diff --git a/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.F90 b/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.F90 index 7f3ae717..9209ed7a 100644 --- a/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.F90 +++ b/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.F90 @@ -1,133 +1,59 @@ ---- -title: MassMatrix example 3 -author: Vikas Sharma, Ph.D. -date: 20 Nov 2021 -update: 20 Nov 2021 -tags: - - ReferenceLine - - ReferenceLine/Initiate - - QuadraturePoint/Initiate - - ElemshapeData/Initiate - - MassMatrix ---- - -# MassMatrix example 3 - -!!! note "" - This example shows how to USE the SUBROUTINE called `MassMatrix` to create a mass matrix in space domain. - -Here, we want to DO the following. - -$$ -\int_{\Omega } N^{I}\rho N^{J}d\Omega -$$ - -!!! warning "" - `rho` can be a constant, or a FUNCTION of spatial coordinates, or some nonlinear FUNCTION. - -In this example, following mass matrix is formed for [[ReferenceLine_]] element, [[QuadraturePoint_]] are `GaussLegendre`. - -$$ -\int_{\Omega } N^{I} N^{J}d\Omega -$$ - -This TYPE of mass matrix is useful when $rho$ is a constant. - -## Modules and classes - -## Usage - -```fortran PROGRAM main - USE easifemBase - IMPLICIT NONE - TYPE(Elemshapedata_) :: test, elemsdForsimplex, trial - TYPE(Quadraturepoint_) :: quad - TYPE(Referenceline_) :: simplexElem, refElemFortest, refElemFortrial - REAL(DFP), ALLOCATABLE :: mat(:, :), XiJ(:, :) - INTEGER( I4B ), PARAMETER :: orderFortest = 1, orderForTrial = 2 -``` - -!!! note "" - Let us now create the physical coordinate of the line element. - -```fortran - XiJ = RESHAPE([-1, 1], [1, 2]) -``` - -!!! note "" - Now we create an instance of [[ReferenceLine_]]. - -```fortran - simplexElem = referenceline(nsd=1) +USE easifemBase +IMPLICIT NONE +TYPE(Elemshapedata_) :: test, elemsdForsimplex, trial +TYPE(Quadraturepoint_) :: quad +TYPE(Referenceline_) :: simplexElem, refElemFortest, refElemFortrial +REAL(DFP), ALLOCATABLE :: mat(:, :), XiJ(:, :) +INTEGER(I4B), PARAMETER :: orderFortest = 1, orderForTrial = 2 + +! Let us now create the physical coordinate of the line element. + +XiJ = RESHAPE([-1, 1], [1, 2]) + +! Now we create an instance of [[ReferenceLine_]]. + +simplexElem = referenceline(nsd=1) CALL simplexElem%LagrangeElement(order=orderForTest, highOrderObj=refElemForTest) CALL simplexElem%LagrangeElement(order=orderForTrial, highOrderObj=refElemForTrial) -``` -!!! note "" - Here, we create the quadrature points. - -```fortran +! Here, we create the quadrature points. CALL initiate( obj=quad, refelem=simplexElem, order=orderForTest+orderForTrial, & - & quadratureType='GaussLegendre' ) -``` - -!!! note "" - Initiate an instance of [[ElemshapeData_]]. You can learn more about it from [[ElemshapeData_test]]. - -```fortran - CALL initiate(obj=elemsdForsimplex, & - & quad=quad, & - & refelem=simplexElem, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) -``` - -!!! note "" - Initiate an instance of [[ElemeshapeData_]] for test function. - -```fortran - CALL initiate(obj=test, & - & quad=quad, & - & refelem=refElemForTest, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) - CALL Set(obj=test, val=xij, N=elemsdForSimplex%N, & - & dNdXi=elemsdForSimplex%dNdXi) -``` - -!!! note "" - Initiate an instance of [[ElemeshapeData_]] for trial function. - -```fortran - CALL initiate(obj=trial, & - & quad=quad, & - & refelem=refElemForTrial, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) - CALL Set(obj=trial, val=xij, N=elemsdForSimplex%N, & - & dNdXi=elemsdForSimplex%dNdXi) -``` - -!!! note "" - Let us now create the mass matrix. - -```fortran - mat=MassMatrix(test=test, trial=trial) - CALL Display(mat, "mat:") -``` - -??? example "Results" - - ```bash - mat: - ------------------------- - 0.33333 0.00000 0.66667 - 0.00000 0.33333 0.66667 - ``` - -!!! settings "Cleanup" - -```fortran + quadratureType='GaussLegendre') + +! Initiate an instance of [[ElemshapeData_]]. You can learn more about it from [[ElemshapeData_test]]. + +CALL initiate(obj=elemsdForsimplex, & + quad=quad, & + refelem=simplexElem, & + ContinuityType=typeH1, & + InterpolType=typeLagrangeInterpolation) + +! Initiate an instance of [[ElemeshapeData_]] for test function. + +CALL initiate(obj=test, & + quad=quad, & + refelem=refElemForTest, & + ContinuityType=typeH1, & + InterpolType=typeLagrangeInterpolation) + +CALL Set(obj=test, val=xij, N=elemsdForSimplex%N, & + dNdXi=elemsdForSimplex%dNdXi) + +! Initiate an instance of [[ElemeshapeData_]] for trial function. + +CALL initiate(obj=trial, & + quad=quad, & + refelem=refElemForTrial, & + ContinuityType=typeH1, & + InterpolType=typeLagrangeInterpolation) + +CALL Set(obj=trial, val=xij, N=elemsdForSimplex%N, & + dNdXi=elemsdForSimplex%dNdXi) + +! Let us now create the mass matrix. + +mat = MassMatrix(test=test, trial=trial) +CALL Display(mat, "mat:") + END PROGRAM main -``` diff --git a/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.md b/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.md index 7f3ae717..46292e44 100644 --- a/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.md +++ b/docs/docs-api/MassMatrix/examples/MassMatrix_test_3.md @@ -1,31 +1,14 @@ ---- -title: MassMatrix example 3 -author: Vikas Sharma, Ph.D. -date: 20 Nov 2021 -update: 20 Nov 2021 -tags: - - ReferenceLine - - ReferenceLine/Initiate - - QuadraturePoint/Initiate - - ElemshapeData/Initiate - - MassMatrix ---- +This example shows how to USE the SUBROUTINE called `MassMatrix` to create a mass matrix in space domain. -# MassMatrix example 3 - -!!! note "" - This example shows how to USE the SUBROUTINE called `MassMatrix` to create a mass matrix in space domain. - Here, we want to DO the following. $$ \int_{\Omega } N^{I}\rho N^{J}d\Omega $$ -!!! warning "" - `rho` can be a constant, or a FUNCTION of spatial coordinates, or some nonlinear FUNCTION. - -In this example, following mass matrix is formed for [[ReferenceLine_]] element, [[QuadraturePoint_]] are `GaussLegendre`. +`rho` can be a constant, or a FUNCTION of spatial coordinates, or some nonlinear FUNCTION. + +In this example, following mass matrix is formed for ReferenceLine element, QuadraturePoint are `GaussLegendre`. $$ \int_{\Omega } N^{I} N^{J}d\Omega @@ -33,101 +16,3 @@ $$ This TYPE of mass matrix is useful when $rho$ is a constant. -## Modules and classes - -## Usage - -```fortran -PROGRAM main - USE easifemBase - IMPLICIT NONE - TYPE(Elemshapedata_) :: test, elemsdForsimplex, trial - TYPE(Quadraturepoint_) :: quad - TYPE(Referenceline_) :: simplexElem, refElemFortest, refElemFortrial - REAL(DFP), ALLOCATABLE :: mat(:, :), XiJ(:, :) - INTEGER( I4B ), PARAMETER :: orderFortest = 1, orderForTrial = 2 -``` - -!!! note "" - Let us now create the physical coordinate of the line element. - -```fortran - XiJ = RESHAPE([-1, 1], [1, 2]) -``` - -!!! note "" - Now we create an instance of [[ReferenceLine_]]. - -```fortran - simplexElem = referenceline(nsd=1) - CALL simplexElem%LagrangeElement(order=orderForTest, highOrderObj=refElemForTest) - CALL simplexElem%LagrangeElement(order=orderForTrial, highOrderObj=refElemForTrial) -``` - -!!! note "" - Here, we create the quadrature points. - -```fortran - CALL initiate( obj=quad, refelem=simplexElem, order=orderForTest+orderForTrial, & - & quadratureType='GaussLegendre' ) -``` - -!!! note "" - Initiate an instance of [[ElemshapeData_]]. You can learn more about it from [[ElemshapeData_test]]. - -```fortran - CALL initiate(obj=elemsdForsimplex, & - & quad=quad, & - & refelem=simplexElem, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) -``` - -!!! note "" - Initiate an instance of [[ElemeshapeData_]] for test function. - -```fortran - CALL initiate(obj=test, & - & quad=quad, & - & refelem=refElemForTest, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) - CALL Set(obj=test, val=xij, N=elemsdForSimplex%N, & - & dNdXi=elemsdForSimplex%dNdXi) -``` - -!!! note "" - Initiate an instance of [[ElemeshapeData_]] for trial function. - -```fortran - CALL initiate(obj=trial, & - & quad=quad, & - & refelem=refElemForTrial, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) - CALL Set(obj=trial, val=xij, N=elemsdForSimplex%N, & - & dNdXi=elemsdForSimplex%dNdXi) -``` - -!!! note "" - Let us now create the mass matrix. - -```fortran - mat=MassMatrix(test=test, trial=trial) - CALL Display(mat, "mat:") -``` - -??? example "Results" - - ```bash - mat: - ------------------------- - 0.33333 0.00000 0.66667 - 0.00000 0.33333 0.66667 - ``` - -!!! settings "Cleanup" - -```fortran -END PROGRAM main -``` diff --git a/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.F90 b/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.F90 index dc085db5..cf16c00a 100644 --- a/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.F90 +++ b/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.F90 @@ -1,134 +1,58 @@ ---- -title: MassMatrix example 4 -author: Vikas Sharma, Ph.D. -date: 20 Nov 2021 -update: 20 Nov 2021 -tags: - - ReferenceLine - - ReferenceLine/Initiate - - QuadraturePoint/Initiate - - ElemshapeData/Initiate - - MassMatrix ---- - -# MassMatrix example 4 - -!!! note "" - This example shows how to USE the SUBROUTINE called `MassMatrix` to create a mass matrix in space domain. - -Here, we want to DO the following. - -$$ -\int_{\Omega } N^{I}\rho N^{J}d\Omega -$$ - -!!! warning "" - `rho` can be a constant, or a FUNCTION of spatial coordinates, or some nonlinear FUNCTION. - -In this example, following mass matrix is formed for [[ReferenceLine_]] element, [[QuadraturePoint_]] are `GaussLegendre`. - -$$ -\int_{\Omega } N^{I} N^{J}d\Omega -$$ - -This TYPE of mass matrix is useful when $rho$ is a constant. - -## Modules and classes - -## Usage - -```fortran PROGRAM main - USE easifemBase - IMPLICIT NONE - TYPE(Elemshapedata_) :: test, elemsdForsimplex, trial - TYPE(Quadraturepoint_) :: quad - TYPE(Referenceline_) :: simplexElem, refElemFortest, refElemFortrial - REAL(DFP), ALLOCATABLE :: mat(:, :), XiJ(:, :) - INTEGER( I4B ), PARAMETER :: orderFortest = 1, orderForTrial = 2 -``` +USE easifemBase +IMPLICIT NONE +TYPE(Elemshapedata_) :: test, elemsdForsimplex, trial +TYPE(Quadraturepoint_) :: quad +TYPE(Referenceline_) :: simplexElem, refElemFortest, refElemFortrial +REAL(DFP), ALLOCATABLE :: mat(:, :), XiJ(:, :) +INTEGER(I4B), PARAMETER :: orderFortest = 1, orderForTrial = 2 -!!! note "" - Let us now create the physical coordinate of the line element. +! Let us now create the physical coordinate of the line element. -```fortran - XiJ = RESHAPE([-1, 1], [1, 2]) -``` +XiJ = RESHAPE([-1, 1], [1, 2]) -!!! note "" - Now we create an instance of [[ReferenceLine_]]. +! Now we create an instance of [[ReferenceLine_]]. -```fortran - simplexElem = referenceline(nsd=1) +simplexElem = referenceline(nsd=1) CALL simplexElem%LagrangeElement(order=orderForTest, highOrderObj=refElemForTest) CALL simplexElem%LagrangeElement(order=orderForTrial, highOrderObj=refElemForTrial) -``` -!!! note "" - Here, we create the quadrature points. +! Here, we create the quadrature points. -```fortran CALL initiate( obj=quad, refelem=simplexElem, order=orderForTest+orderForTrial, & - & quadratureType='GaussLegendre' ) -``` - -!!! note "" - Initiate an instance of [[ElemshapeData_]]. You can learn more about it from [[ElemshapeData_test]]. + quadratureType='GaussLegendre') -```fortran - CALL initiate(obj=elemsdForsimplex, & - & quad=quad, & - & refelem=simplexElem, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) -``` +! Initiate an instance of [[ElemshapeData_]]. You can learn more about it from [[ElemshapeData_test]]. -!!! note "" - Initiate an instance of [[ElemeshapeData_]] for test function. - -```fortran - CALL initiate(obj=test, & - & quad=quad, & - & refelem=refElemForTest, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) - CALL Set(obj=test, val=xij, N=elemsdForSimplex%N, & - & dNdXi=elemsdForSimplex%dNdXi) -``` +CALL initiate(obj=elemsdForsimplex, & + & quad=quad, & + & refelem=simplexElem, & + & ContinuityType=typeH1, & + & InterpolType=typeLagrangeInterpolation) -!!! note "" - Initiate an instance of [[ElemeshapeData_]] for trial function. - -```fortran - CALL initiate(obj=trial, & - & quad=quad, & - & refelem=refElemForTrial, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) - CALL Set(obj=trial, val=xij, N=elemsdForSimplex%N, & - & dNdXi=elemsdForSimplex%dNdXi) -``` +! Initiate an instance of [[ElemeshapeData_]] for test function. -!!! note "" - Let us now create the mass matrix. +CALL initiate(obj=test, & + & quad=quad, & + & refelem=refElemForTest, & + & ContinuityType=typeH1, & + & InterpolType=typeLagrangeInterpolation) +CALL Set(obj=test, val=xij, N=elemsdForSimplex%N, & + & dNdXi=elemsdForSimplex%dNdXi) -```fortran - mat=MassMatrix(test=trial, trial=test) - CALL Display(mat, "mat:") -``` +! Initiate an instance of [[ElemeshapeData_]] for trial function. -??? example "Results" +CALL initiate(obj=trial, & + & quad=quad, & + & refelem=refElemForTrial, & + & ContinuityType=typeH1, & + & InterpolType=typeLagrangeInterpolation) +CALL Set(obj=trial, val=xij, N=elemsdForSimplex%N, & + & dNdXi=elemsdForSimplex%dNdXi) - ```bash - mat: - ---------------- - 0.33333 0.00000 - 0.00000 0.33333 - 0.66667 0.66667 - ``` +! Let us now create the mass matrix. -!!! settings "Cleanup" +mat = MassMatrix(test=trial, trial=test) +CALL Display(mat, "mat:") -```fortran END PROGRAM main -``` diff --git a/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.md b/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.md index dc085db5..f9a97f09 100644 --- a/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.md +++ b/docs/docs-api/MassMatrix/examples/MassMatrix_test_4.md @@ -1,31 +1,14 @@ ---- -title: MassMatrix example 4 -author: Vikas Sharma, Ph.D. -date: 20 Nov 2021 -update: 20 Nov 2021 -tags: - - ReferenceLine - - ReferenceLine/Initiate - - QuadraturePoint/Initiate - - ElemshapeData/Initiate - - MassMatrix ---- +This example shows how to USE the SUBROUTINE called `MassMatrix` to create a mass matrix in space domain. -# MassMatrix example 4 - -!!! note "" - This example shows how to USE the SUBROUTINE called `MassMatrix` to create a mass matrix in space domain. - Here, we want to DO the following. $$ \int_{\Omega } N^{I}\rho N^{J}d\Omega $$ -!!! warning "" - `rho` can be a constant, or a FUNCTION of spatial coordinates, or some nonlinear FUNCTION. - -In this example, following mass matrix is formed for [[ReferenceLine_]] element, [[QuadraturePoint_]] are `GaussLegendre`. +`rho` can be a constant, or a FUNCTION of spatial coordinates, or some nonlinear FUNCTION. + +In this example, following mass matrix is formed for ReferenceLine element, QuadraturePoint are `GaussLegendre`. $$ \int_{\Omega } N^{I} N^{J}d\Omega @@ -33,102 +16,3 @@ $$ This TYPE of mass matrix is useful when $rho$ is a constant. -## Modules and classes - -## Usage - -```fortran -PROGRAM main - USE easifemBase - IMPLICIT NONE - TYPE(Elemshapedata_) :: test, elemsdForsimplex, trial - TYPE(Quadraturepoint_) :: quad - TYPE(Referenceline_) :: simplexElem, refElemFortest, refElemFortrial - REAL(DFP), ALLOCATABLE :: mat(:, :), XiJ(:, :) - INTEGER( I4B ), PARAMETER :: orderFortest = 1, orderForTrial = 2 -``` - -!!! note "" - Let us now create the physical coordinate of the line element. - -```fortran - XiJ = RESHAPE([-1, 1], [1, 2]) -``` - -!!! note "" - Now we create an instance of [[ReferenceLine_]]. - -```fortran - simplexElem = referenceline(nsd=1) - CALL simplexElem%LagrangeElement(order=orderForTest, highOrderObj=refElemForTest) - CALL simplexElem%LagrangeElement(order=orderForTrial, highOrderObj=refElemForTrial) -``` - -!!! note "" - Here, we create the quadrature points. - -```fortran - CALL initiate( obj=quad, refelem=simplexElem, order=orderForTest+orderForTrial, & - & quadratureType='GaussLegendre' ) -``` - -!!! note "" - Initiate an instance of [[ElemshapeData_]]. You can learn more about it from [[ElemshapeData_test]]. - -```fortran - CALL initiate(obj=elemsdForsimplex, & - & quad=quad, & - & refelem=simplexElem, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) -``` - -!!! note "" - Initiate an instance of [[ElemeshapeData_]] for test function. - -```fortran - CALL initiate(obj=test, & - & quad=quad, & - & refelem=refElemForTest, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) - CALL Set(obj=test, val=xij, N=elemsdForSimplex%N, & - & dNdXi=elemsdForSimplex%dNdXi) -``` - -!!! note "" - Initiate an instance of [[ElemeshapeData_]] for trial function. - -```fortran - CALL initiate(obj=trial, & - & quad=quad, & - & refelem=refElemForTrial, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) - CALL Set(obj=trial, val=xij, N=elemsdForSimplex%N, & - & dNdXi=elemsdForSimplex%dNdXi) -``` - -!!! note "" - Let us now create the mass matrix. - -```fortran - mat=MassMatrix(test=trial, trial=test) - CALL Display(mat, "mat:") -``` - -??? example "Results" - - ```bash - mat: - ---------------- - 0.33333 0.00000 - 0.00000 0.33333 - 0.66667 0.66667 - ``` - -!!! settings "Cleanup" - -```fortran -END PROGRAM main -``` diff --git a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.F90 b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.F90 index 982754fc..b2987532 100644 --- a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.F90 +++ b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_1.F90 @@ -4,7 +4,7 @@ PROGRAM main elem => TypeElemNameOpt, & quadType => TypeQuadratureOpt, & iptype => TypeInterpolationOpt, & - basisType => TypePolynomialOpt + polyType => TypePolynomialOpt USE GlobalData, ONLY: DFP, I4B @@ -17,28 +17,32 @@ PROGRAM main Elemsd_Allocate => ALLOCATE, & Elemsd_Set => Set, & Elemsd_Display => Display +USE MassMatrix_Method, ONLY: MassMatrix IMPLICIT NONE TYPE(ElemShapeData_) :: elemsd, linelemsd TYPE(QuadraturePoint_) :: quad -REAL(DFP), ALLOCATABLE :: mat(:, :), xij(:, :) -INTEGER(I4B), PARAMETER :: order = 2, one_i = 1 -REAL(DFP), PARAMETER :: refElemCoord(1, 2) = & - RESHAPE([-1.0_DFP, 1.0_DFP], [1, 2]) -INTEGER(I4B) :: nns, nips, tsize, integralOrder -CHARACTER(LEN=*), PARAMETER :: domainName = "B" +REAL(DFP), ALLOCATABLE :: mat(:, :) +INTEGER(I4B) :: nips, tsize -! Let us now create the physical coordinate of the line element. -xij = RESHAPE([-1, 1], [1, 2]) -integralOrder = 2 * order +CHARACTER(LEN=*), PARAMETER :: domainName = "B" +INTEGER(I4B), PARAMETER :: order = 2, & + one_i = 1, & + integralOrder = 2 * order, & + nns = order + 1 +INTEGER(I4B), PARAMETER :: elemType = elem%line +INTEGER(I4B), PARAMETER :: quadratureType = quadType%GaussLegendre +INTEGER( I4B ), PARAMETER :: interpolationType = iptype%GaussLegendreLobatto +INTEGER( I4B ), PARAMETER :: basisType = polyType%Monomial +REAL(DFP), PARAMETER :: refElemCoord(1, 2) = RESHAPE([-1.0_DFP, 1.0_DFP], [1, 2]) +REAL(DFP), PARAMETER :: xij(1, 2) = RESHAPE([-1.0_DFP, 1.0_DFP], [1, 2]) ! Here, we create the quadrature points. -CALL QuadPoint_Initiate(obj=quad, elemType=elem%line, & +CALL QuadPoint_Initiate(obj=quad, elemType=elemType, & domainName=domainName, order=integralOrder, & - quadratureType=quadType%GaussLegendre) + quadratureType=quadratureType) nips = Quad_Size(quad, 2) -nns = order + 1 CALL Display(nips, "number of integration points: ") CALL Display(nns, "number of nodes in space: ") @@ -48,23 +52,23 @@ PROGRAM main ! Initiate an instance of ElemshapeData_ for linear geometry. CALL LagrangeElemShapeData(obj=linelemsd, quad=quad, nsd=elemsd%nsd, & - xidim=elemsd%xidim, elemtype=elem%line, & + xidim=elemsd%xidim, elemType=elemType, & refelemCoord=refelemCoord, domainName=domainName, & order=one_i) CALL LagrangeElemShapeData(obj=elemsd, quad=quad, nsd=elemsd%nsd, xidim=elemsd%xidim, & - elemType=elem%line, refelemCoord=refelemCoord, & + elemType=elemType, refelemCoord=refelemCoord, & domainName=domainName, order=order, & - ipType=iptype%GaussLegendreLobatto, & - basisType=basisType%Monomial) + ipType=interpolationType, & + basisType=polyType%Monomial) CALL Elemsd_Set(obj=elemsd, val=xij, N=linelemsd%N, dNdXi=linelemsd%dNdXi) CALL Elemsd_Display(elemsd, "elemsd:") -! ! Let us now create the mass matrix. -! -! mat = MassMatrix(test=test, trial=test) -! CALL Display(mat, "mat:") +! Let us now create the mass matrix. +mat = MassMatrix(test=elemsd, trial=elemsd) +CALL Display(mat, "mass matrix:") +CALL Display(SUM(mat, dim=2), "row sum of mass matrix:") END PROGRAM main diff --git a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.F90 b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.F90 index cdae59a6..4ad28b2f 100644 --- a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.F90 +++ b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.F90 @@ -1,120 +1,44 @@ ---- -title: MassMatrix example 2 -author: Vikas Sharma, Ph.D. -date: 20 Nov 2021 -update: 20 Nov 2021 -tags: - - ReferenceLine - - ReferenceLine/Initiate - - QuadraturePoint/Initiate - - ElemshapeData/Initiate - - MassMatrix ---- - -# MassMatrix example 2 - -!!! note "" - This example shows how to USE the SUBROUTINE called `MassMatrix` to create a mass matrix in space domain. - -Here, we want to DO the following. - -$$ -\int_{\Omega } N^{I}\rho N^{J}d\Omega -$$ - -!!! warning "" - `rho` can be a constant, or a FUNCTION of spatial coordinates, or some nonlinear FUNCTION. - -In this example, following mass matrix is formed for [[ReferenceLine_]] element, [[QuadraturePoint_]] are `GaussLegendre`. - -$$ -\int_{\Omega } N^{I} N^{J}d\Omega -$$ - -This TYPE of mass matrix is useful in cases WHERE $rho$ is a constant. - -## Modules and classes - -## Usage - -```fortran PROGRAM main - USE easifemBase - IMPLICIT NONE - TYPE(Elemshapedata_) :: test, elemsdForsimplex - TYPE(Quadraturepoint_) :: quad - TYPE(Referenceline_) :: simplexElem, refElem - REAL(DFP), ALLOCATABLE :: mat(:, :), XiJ(:, :) - INTEGER( I4B ), PARAMETER :: order = 2 -``` - -!!! note "" - Let us now create the physical coordinate of the line element. - -```fortran - XiJ = RESHAPE([-1, 1], [1, 2]) -``` - -!!! note "" - Now we create an instance of [[ReferenceLine_]]. - -```fortran - simplexElem = referenceline(nsd=1) - CALL simplexElem%LagrangeElement(order=order, highOrderObj=refelem) -``` - -!!! note "" - Here, we create the quadrature points. +USE easifemBase -```fortran - CALL initiate( obj=quad, refelem=refelem, order=order*2, & - & quadratureType='GaussLegendre' ) -``` +IMPLICIT NONE -!!! note "" - Initiate an instance of [[ElemshapeData_]]. You can learn more about it from [[ElemshapeData_test]]. +TYPE(Elemshapedata_) :: test, elemsdForsimplex +TYPE(Quadraturepoint_) :: quad +TYPE(Referenceline_) :: simplexElem, refElem +REAL(DFP), ALLOCATABLE :: mat(:, :), XiJ(:, :) +INTEGER(I4B), PARAMETER :: order = 2 -```fortran - CALL initiate(obj=elemsdForsimplex, & - & quad=quad, & - & refelem=simplexElem, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) -``` +! Let us now create the physical coordinate of the line element. +XiJ = RESHAPE([-1, 1], [1, 2]) -!!! note "" - Initiate an instance of [[ElemeshapeData_]]. - -```fortran - CALL initiate(obj=test, & - & quad=quad, & - & refelem=refElem, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) - CALL Set(obj=test, val=xij, N=elemsdForSimplex%N, & - & dNdXi=elemsdForSimplex%dNdXi) -``` +! Now we create an instance of [[ReferenceLine_]]. +simplexElem = referenceline(nsd=1) +CALL simplexElem%LagrangeElement(order=order, highOrderObj=refelem) -!!! note "" - Let us now create the mass matrix. +! Here, we create the quadrature points. +CALL initiate(obj=quad, refelem=refelem, order=order * 2, & + quadratureType='GaussLegendre') -```fortran - mat=MassMatrix(test=test, trial=test) - CALL Display(mat, "mat:") -``` +! Initiate an instance of [[ElemshapeData_]]. You can learn more about it from [[ElemshapeData_test]]. +CALL initiate(obj=elemsdForsimplex, & + quad=quad, & + refelem=simplexElem, & + ContinuityType=typeH1, & + InterpolType=typeLagrangeInterpolation) -??? example "Results" +! Initiate an instance of [[ElemeshapeData_]]. +CALL initiate(obj=test, & + quad=quad, & + refelem=refElem, & + ContinuityType=typeH1, & + InterpolType=typeLagrangeInterpolation) - ```bash - mat: - --------------------------- - 0.26667 -0.06667 0.13333 - -0.06667 0.26667 0.13333 - 0.13333 0.13333 1.06667 - ``` +CALL Set(obj=test, val=xij, N=elemsdForSimplex%N, & + dNdXi=elemsdForSimplex%dNdXi) -!!! settings "Cleanup" +! Let us now create the mass matrix. +mat = MassMatrix(test=test, trial=test) +CALL Display(mat, "mat:") -```fortran END PROGRAM main -``` diff --git a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.md b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.md index cdae59a6..46e0d99a 100644 --- a/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.md +++ b/docs/docs-api/MassMatrix/examples/_MassMatrix_test_2.md @@ -1,31 +1,14 @@ ---- -title: MassMatrix example 2 -author: Vikas Sharma, Ph.D. -date: 20 Nov 2021 -update: 20 Nov 2021 -tags: - - ReferenceLine - - ReferenceLine/Initiate - - QuadraturePoint/Initiate - - ElemshapeData/Initiate - - MassMatrix ---- +This example shows how to USE the SUBROUTINE called `MassMatrix` to create a mass matrix in space domain. -# MassMatrix example 2 - -!!! note "" - This example shows how to USE the SUBROUTINE called `MassMatrix` to create a mass matrix in space domain. - -Here, we want to DO the following. +Here, we want to DO the following. $$ \int_{\Omega } N^{I}\rho N^{J}d\Omega $$ -!!! warning "" - `rho` can be a constant, or a FUNCTION of spatial coordinates, or some nonlinear FUNCTION. - -In this example, following mass matrix is formed for [[ReferenceLine_]] element, [[QuadraturePoint_]] are `GaussLegendre`. +`rho` can be a constant, or a FUNCTION of spatial coordinates, or some nonlinear FUNCTION. + +In this example, following mass matrix is formed for ReferenceLine element, QuadraturePoint are `GaussLegendre`. $$ \int_{\Omega } N^{I} N^{J}d\Omega @@ -33,88 +16,3 @@ $$ This TYPE of mass matrix is useful in cases WHERE $rho$ is a constant. -## Modules and classes - -## Usage - -```fortran -PROGRAM main - USE easifemBase - IMPLICIT NONE - TYPE(Elemshapedata_) :: test, elemsdForsimplex - TYPE(Quadraturepoint_) :: quad - TYPE(Referenceline_) :: simplexElem, refElem - REAL(DFP), ALLOCATABLE :: mat(:, :), XiJ(:, :) - INTEGER( I4B ), PARAMETER :: order = 2 -``` - -!!! note "" - Let us now create the physical coordinate of the line element. - -```fortran - XiJ = RESHAPE([-1, 1], [1, 2]) -``` - -!!! note "" - Now we create an instance of [[ReferenceLine_]]. - -```fortran - simplexElem = referenceline(nsd=1) - CALL simplexElem%LagrangeElement(order=order, highOrderObj=refelem) -``` - -!!! note "" - Here, we create the quadrature points. - -```fortran - CALL initiate( obj=quad, refelem=refelem, order=order*2, & - & quadratureType='GaussLegendre' ) -``` - -!!! note "" - Initiate an instance of [[ElemshapeData_]]. You can learn more about it from [[ElemshapeData_test]]. - -```fortran - CALL initiate(obj=elemsdForsimplex, & - & quad=quad, & - & refelem=simplexElem, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) -``` - -!!! note "" - Initiate an instance of [[ElemeshapeData_]]. - -```fortran - CALL initiate(obj=test, & - & quad=quad, & - & refelem=refElem, & - & ContinuityType=typeH1, & - & InterpolType=typeLagrangeInterpolation) - CALL Set(obj=test, val=xij, N=elemsdForSimplex%N, & - & dNdXi=elemsdForSimplex%dNdXi) -``` - -!!! note "" - Let us now create the mass matrix. - -```fortran - mat=MassMatrix(test=test, trial=test) - CALL Display(mat, "mat:") -``` - -??? example "Results" - - ```bash - mat: - --------------------------- - 0.26667 -0.06667 0.13333 - -0.06667 0.26667 0.13333 - 0.13333 0.13333 1.06667 - ``` - -!!! settings "Cleanup" - -```fortran -END PROGRAM main -```