Initiate
This method initiates an instance of OneDimFEDOF. There are several ways to initiate an instance of OneDimFEDOF.
The Initiate method has four different implementations:
Initiate1- Initializes with homogeneous order for all elementsInitiate2- Initializes with inhomogeneous orders specified per elementInitiate3- Initializes from a parameter listInitiate4- Initializes from an order vector defined for global elements
Interface 1
This method is for Homogeneous order, that is, all elements in the mesh have the same order.
INTERFACE
MODULE SUBROUTINE Initiate(obj, order, mesh, baseContinuity, &
baseInterpolation, fetype, ipType, basisType, alpha, beta, lambda, &
quadratureType, quadratureOrder, quadratureNips, &
quadratureAlpha, quadratureBeta, quadratureLambda)
CLASS(OneDimFEDOF_), INTENT(INOUT) :: obj
INTEGER(I4B), INTENT(IN) :: order
!! homogeneous value of order
CLASS(OneDimDomain_), TARGET, INTENT(IN) :: mesh
!! cell mesh
CHARACTER(*), INTENT(IN) :: baseContinuity
!! continuity of basis (regularity)
CHARACTER(*), INTENT(IN) :: baseInterpolation
!! basis function used for interpolation
INTEGER(I4B), OPTIONAL, INTENT(IN) :: fetype
!! Finite element type
!! Default is Scalar, (Vector)
!! Read docs of AbstractOneDimFE
INTEGER(I4B), OPTIONAL, INTENT(IN) :: ipType
!! interpolation type
!! Read docs of AbstractOneDimFE
INTEGER(I4B), OPTIONAL, INTENT(IN) :: basisType
!! type of basis function used for constructing the Lagrange polynomial
!! Used when baseInterpolation is Lagrange
!! Read docs of AbstractOneDimFE
REAL(DFP), OPTIONAL, INTENT(IN) :: alpha
!! alpha parameter for jacobian polynomial
!! Read docs of AbstractOneDimFE
REAL(DFP), OPTIONAL, INTENT(IN) :: beta
!! beta parameter for jacobian polynomial
!! Read docs of AbstractOneDimFE
REAL(DFP), OPTIONAL, INTENT(IN) :: lambda
!! lambda parameter for Ultraspherical parameter
!! used when baseInterpolation is Lagrange
!! used when basistype is Ultraspherical
INTEGER(I4B), OPTIONAL, INTENT(IN) :: quadratureType
!! Quadrature type
INTEGER(I4B), OPTIONAL, INTENT(IN) :: quadratureOrder
!! Accuracy of quadrature rule
INTEGER(I4B), OPTIONAL, INTENT(IN) :: quadratureNips(1)
!! Number of integration points
REAL(DFP), OPTIONAL, INTENT(IN) :: quadratureAlpha
!! Jacobi parameter for quadrature
REAL(DFP), OPTIONAL, INTENT(IN) :: quadratureBeta
!! Jacobi parameter for quadrature
REAL(DFP), OPTIONAL, INTENT(IN) :: quadratureLambda
!! Ultraspherical parameter for quadrature
END SUBROUTINE Initiate
END INTERFACE
Description
This subroutine configures a OneDimFEDOF object by setting up the basis functions, continuity, and interpolation properties based on a given mesh and order.
Parameters
| Parameter | Type | Intent | Description |
|---|---|---|---|
obj | CLASS(OneDimFEDOF_) | INOUT | The OneDimFEDOF object to be initialized. |
order | INTEGER(I4B) | IN | Homogeneous polynomial order for the basis functions. |
mesh | CLASS(AbstractMesh_), TARGET | IN | The computational mesh defining the spatial discretization. |
baseContinuity | CHARACTER(*) | IN | Specifies the continuity of basis functions (regularity or conformity). |
baseInterpolation | CHARACTER(*) | IN | Type of basis function used for interpolation. |
Optional Parameters
| Parameter | Type | Intent | Optional | Description |
|---|---|---|---|---|
ipType | INTEGER(I4B) | IN | Yes | Interpolation point type. Used when baseInterpolation is set to Lagrange. |
basisType | INTEGER(I4B) | IN | Yes | Array specifying types of basis functions used for constructing Lagrange polynomials. Used when baseInterpolation is Lagrange. |
alpha | REAL(DFP) | IN | Yes | Alpha parameters for Jacobi polynomials. Required when baseInterpolation is Lagrange and basisType is Jacobi. |
beta | REAL(DFP) | IN | Yes | Beta parameters for Jacobi polynomials. Required when baseInterpolation is Lagrange and basisType is Jacobi. |
lambda | REAL(DFP) | IN | Yes | Lambda parameters for Ultraspherical polynomials. Required when baseInterpolation is Lagrange and basisType is Ultraspherical. |
Usage Example
CALL myOneDimFEDOF%Initiate(order=2, mesh=myMesh, baseContinuity="H1", &
baseInterpolation="Lagrange", ipType=GAUSS_LOBATTO)
Interface 2
- Here order represents the order of each cell element.
orderis a vector of integers, the length ofordermust be equal to the number of elements in the mesh.order(i)is the order of local elementi.
INTERFACE
MODULE SUBROUTINE obj_Initiate2(obj, order, mesh, baseContinuity, &
baseInterpolation, fetype, ipType, basisType, alpha, beta, lambda, &
islocal, quadratureType, quadratureOrder, quadratureNips, quadratureAlpha, &
quadratureBeta, quadratureLambda)
CLASS(OneDimFEDOF_), INTENT(INOUT) :: obj
!! Finite degree of freedom object
INTEGER(I4B), INTENT(IN) :: order(:)
!! Inhomogeneous value of order
!! This is order of each cell element
!! see the note on islocal
CLASS(OneDimDomain_), TARGET, INTENT(IN) :: mesh
!! cell mesh
CHARACTER(*), INTENT(IN) :: baseContinuity
!! continuity of basis (regularity)
!! Read the docs of AbstractOneDimFE
CHARACTER(*), INTENT(IN) :: baseInterpolation
!! basis function used for interpolation
!! Read the docs of AbstractOneDimFE
INTEGER(I4B), OPTIONAL, INTENT(IN) :: fetype
!! Finite element type
!! Default is Scalar (Vector)
!! Read docs of AbstractOneDimFE
INTEGER(I4B), OPTIONAL, INTENT(IN) :: ipType
!! interpolation type
!! used when baseInterpolation is Lagrange
INTEGER(I4B), OPTIONAL, INTENT(IN) :: basisType
!! type of basis function used for
!! constructing the Lagrange polynomial
!! Used when baseInterpolation is Lagrange
REAL(DFP), OPTIONAL, INTENT(IN) :: alpha
!! alpha parameter for jacobian parameter
!! used when baseInterpolation is Lagrange
!! used when basistype is Jacobi
REAL(DFP), OPTIONAL, INTENT(IN) :: beta
!! beta parameter for jacobian parameter
!! used when baseInterpolation is Lagrange
!! used when basistype is Jacobi
REAL(DFP), OPTIONAL, INTENT(IN) :: lambda
!! lambda parameter for Ultraspherical parameter
!! used when baseInterpolation is Lagrange
!! used when basistype is Ultraspherical
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: islocal
!! islocal denotes whether the order(:) is based on
!! local element or global element number.
!! local element means in order(ii) ii is the local
!! element number, global element means in order(ii) ii is the
!! global element number. Note that getting local element
!! number is difficult for user, so it is better to use
!! global element number.
INTEGER(I4B), OPTIONAL, INTENT(IN) :: quadratureType
!! Quadrature type
INTEGER(I4B), OPTIONAL, INTENT(IN) :: quadratureOrder
!! Accuracy of quadrature rule
INTEGER(I4B), OPTIONAL, INTENT(IN) :: quadratureNips(1)
!! Number of integration points
REAL(DFP), OPTIONAL, INTENT(IN) :: quadratureAlpha
!! Jacobi parameter for quadrature
REAL(DFP), OPTIONAL, INTENT(IN) :: quadratureBeta
!! Jacobi parameter for quadrature
REAL(DFP), OPTIONAL, INTENT(IN) :: quadratureLambda
!! Ultraspherical parameter for quadrature
END SUBROUTINE obj_Initiate2
END INTERFACE
Description
This subroutine configures a OneDimFEDOF object using inhomogeneous orders across mesh elements, allowing different polynomial orders for different parts of the domain.
Parameters
| Parameter | Type | Intent | Description |
|---|---|---|---|
obj | CLASS(OneDimFEDOF_) | INOUT | The Finite Element Degree of Freedom object to be initialized. |
order | INTEGER(I4B)(:) | IN | Array of polynomial orders for each cell element. |
mesh | CLASS(AbstractMesh_), TARGET | IN | The computational mesh defining the spatial discretization. |
baseContinuity | CHARACTER(*) | IN | Specifies the continuity of basis functions (regularity). |
baseInterpolation | CHARACTER(*) | IN | Type of basis function used for interpolation. |
Optional Parameters
| Parameter | Type | Intent | Description |
|---|---|---|---|
ipType | INTEGER(I4B) | IN | Interpolation point type. Used when baseInterpolation is set to Lagrange. |
basisType | INTEGER(I4B)(:) | IN | Array specifying types of basis functions used for constructing Lagrange polynomials. Used when baseInterpolation is Lagrange. |
alpha | REAL(DFP)(:) | IN | Alpha parameters for Jacobi polynomials. Required when baseInterpolation is Lagrange and basisType is Jacobi. |
beta | REAL(DFP)(:) | IN | Beta parameters for Jacobi polynomials. Required when baseInterpolation is Lagrange and basisType is Jacobi. |
lambda | REAL(DFP)(:) | IN | Lambda parameters for Ultraspherical polynomials. Required when baseInterpolation is Lagrange and basisType is Ultraspherical. |
islocal | LOGICAL(LGT) | IN | Specifies whether order array references local element numbers (TRUE) or global element numbers (FALSE, default). |
Usage Example
! Create an array with different orders for different elements
INTEGER(I4B) :: elementOrders(mesh%getTotalElements())
elementOrders = [1, 2, 2, 3, 2, 1] ! Example orders
CALL myOneDimFEDOF%Initiate(order=elementOrders, mesh=myMesh, &
baseContinuity="H1", baseInterpolation="Lagrange", &
ipType=GAUSS_LOBATTO, islocal=.FALSE.)
Notes
- The length of the
orderarray must match the number of elements in the mesh. - When
islocalis not provided or is FALSE, the indices inordercorrespond to global element numbers. - When
islocalis TRUE, the indices inordercorrespond to local element numbers, which may be different from global numbering. - Using global element numbering is generally easier for users to work with.
Interface 3
- This method is used to initiate
OneDimFEDOFby usingParameterList.
INTERFACE
MODULE SUBROUTINE Initiate(obj, param, mesh)
CLASS(OneDimFEDOF_), INTENT(INOUT) :: obj
!! Fintie degree of freedom object
TYPE(ParameterList_), INTENT(IN) :: param
!! parameter list
CLASS(OneDimDomain_), TARGET, INTENT(IN) :: mesh
!! mesh
END SUBROUTINE Initiate
END INTERFACE
This interface is still under development and may not be fully functional yet.
Interface 4
- This routine is similar to the Interface 2, but the order of the element is defined for global element numbers.
- This method is more useful for the user who have no idea about the local element number.
orderis a two-dimensional array.- The number of rows in order is equal to 2
- The first row contains the global element number
- The second row contains the order.
This routine will make order0(:) from order(:,:) and call Initiate2 method internally.
INTERFACE
MODULE SUBROUTINE Initiate(obj, order, mesh, baseContinuity, &
baseInterpolation, fetype, ipType, basisType, alpha, beta, lambda, &
quadratureType, quadratureOrder, quadratureNips, quadratureAlpha, &
quadratureBeta, quadratureLambda)
CLASS(OneDimFEDOF_), INTENT(INOUT) :: obj
INTEGER(I4B), INTENT(IN) :: order(:, :)
!! The number of columns in order is equal to total number of elements
!! The number of rows in order is equal to 2
!! The first row contains the global element number
!! the second rows contains the order of that element
CLASS(OneDimDomain_), TARGET, INTENT(IN) :: mesh
!! mesh
CHARACTER(*), INTENT(IN) :: baseContinuity
!! continuity of basis function
!! Read the docs of AbstractOneDimFE
CHARACTER(*), INTENT(IN) :: baseInterpolation
!! interpolation of basis
!! Read the docs of AbstractOneDimFE
INTEGER(I4B), OPTIONAL, INTENT(IN) :: fetype
!! Finite element type
!! Default is Scalar (Vector)
!! Read docs of AbstractOneDimFE
INTEGER(I4B), OPTIONAL, INTENT(IN) :: ipType
!! Interpolation type
!! used when baseInterpolation is Lagrange
!! Read the docs of AbstractOneDimFE
INTEGER(I4B), OPTIONAL, INTENT(IN) :: basisType
!! type of basis function used for
!! constructing the Lagrange polynomial
!! Used when baseInterpolation is Lagrange
REAL(DFP), OPTIONAL, INTENT(IN) :: alpha
!! alpha parameter for jacobian parameter
!! used when baseInterpolation is Lagrange
!! used when basistype is Jacobi
REAL(DFP), OPTIONAL, INTENT(IN) :: beta
!! beta parameter for jacobian parameter
!! used when baseInterpolation is Lagrange
!! used when basistype is Jacobi
REAL(DFP), OPTIONAL, INTENT(IN) :: lambda
!! lambda parameter for Ultraspherical parameter
!! used when baseInterpolation is Lagrange
!! used when basistype is Ultraspherical
INTEGER(I4B), OPTIONAL, INTENT(IN) :: quadratureType
!! Quadrature type
INTEGER(I4B), OPTIONAL, INTENT(IN) :: quadratureOrder
!! Accuracy of quadrature rule
INTEGER(I4B), OPTIONAL, INTENT(IN) :: quadratureNips(1)
!! Number of integration points
REAL(DFP), OPTIONAL, INTENT(IN) :: quadratureAlpha
!! Jacobi parameter for quadrature
REAL(DFP), OPTIONAL, INTENT(IN) :: quadratureBeta
!! Jacobi parameter for quadrature
REAL(DFP), OPTIONAL, INTENT(IN) :: quadratureLambda
!! Ultraspherical parameter for quadrature
END SUBROUTINE Initiate
END INTERFACE
Parameters
| Parameter | Type | Intent | Description |
|---|---|---|---|
obj | CLASS(OneDimFEDOF_) | INOUT | The OneDimFEDOF object to be initialized. |
order | INTEGER(I4B)(:,:) | IN | 2×N array where N is the number of elements to be configured. |
mesh | CLASS(AbstractMesh_), TARGET | IN | The computational mesh defining the spatial discretization. |
baseContinuity | CHARACTER(*) | IN | Specifies the continuity of basis functions (regularity). |
baseInterpolation | CHARACTER(*) | IN | Type of basis function used for interpolation. |
Optional Parameters
| Parameter | Type | Intent | Description |
|---|---|---|---|
ipType | INTEGER(I4B) | IN | Interpolation point type. Used when baseInterpolation is set to Lagrange. |
basisType | INTEGER(I4B)(:) | IN | Array specifying types of basis functions used for constructing Lagrange polynomials. Used when baseInterpolation is Lagrange. |
alpha | REAL(DFP)(:) | IN | Alpha parameters for Jacobi polynomials. Required when baseInterpolation is Lagrange and basisType is Jacobi. |
beta | REAL(DFP)(:) | IN | Beta parameters for Jacobi polynomials. Required when baseInterpolation is Lagrange and basisType is Jacobi. |
lambda | REAL(DFP)(:) | IN | Lambda parameters for Ultraspherical polynomials. Required when baseInterpolation is Lagrange and basisType is Ultraspherical. |
Usage Example
! Create a 2×3 array to specify orders for three specific elements
INTEGER(I4B) :: elementOrders(2, 3)
! First row: global element numbers
elementOrders(1, :) = [1, 5, 10]
! Second row: corresponding polynomial orders
elementOrders(2, :) = [2, 3, 1]
CALL myOneDimFEDOF%Initiate(order=elementOrders, mesh=myMesh, &
baseContinuity="H1", baseInterpolation="Lagrange", &
ipType=GAUSS_LOBATTO)
Notes
- This interface is more user-friendly as it allows specifying orders only for elements of interest using their global numbers.
- Internally, this method constructs a complete order array and calls Interface 2.
- The number of columns in the
orderarray can be less than the total number of elements in the mesh - only specified elements will receive custom orders.
Example (H1, Lagrange, Uniform Order)
This example shows how to initiate FEDOF with H1 and Hierarchy interpolation.
!> author: Vikas Sharma, Ph. D.
! date: 2025-06-06
! summary: Test the intitiate method for H1, Heirarchical basis,
! for different orders.
PROGRAM main
USE OneDimFEDOF_Class, ONLY: OneDimFEDOF_
USE OneDimDomain_Class, ONLY: OneDimDomain_
USE AbstractMesh_Class
USE HDF5File_Class
USE Display_Method
USE GlobalData
USE Test_Method
USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION
USE BaseType, ONLY: TypeFEVariableOpt, TypeQuadratureOpt, &
TypePolynomialOpt
IMPLICIT NONE
TYPE(OneDimFEDOF_) :: obj
TYPE(OneDimDomain_) :: dom
INTEGER(I4B) :: found, want, order
REAL(DFP), PARAMETER :: domain(2) = [0.0_DFP, 1.0_DFP]
CHARACTER(*), PARAMETER :: baseContinuity="H1" , baseInterpolation="Lagrange"
INTEGER(I4B), PARAMETER :: feType = TypeFEVariableOpt%scalar, &
ipType = TypeQuadratureOpt%equidistance, &
basisType = TypePolynomialOpt%monomial, &
quadratureType = TypeQuadratureOpt%gaussLegendre
CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.)
CALL dom%Initiate(domain=domain, totalElements=2)
! CALL dom%Display("domain: ")
CALL test1
CALL test2
CALL dom%DEALLOCATE()
CONTAINS
SUBROUTINE test1
order = 1
CALL obj%Initiate(order=order, mesh=dom, baseContinuity=baseContinuity, &
baseInterpolation=baseInterpolation, fetype=feType, ipType=ipType, &
basisType=basisType, quadratureType=quadratureType, quadratureOrder=order)
CALL obj%Display("FEDOF:")
found = obj%GetTotalDOF()
want = dom%GetTotalNodes()
CALL IS(found, want, "Total DOF (order=1): ")
END SUBROUTINE test1
SUBROUTINE test2
order = 2
CALL obj%Initiate(order=order, mesh=dom, baseContinuity=baseContinuity, &
baseInterpolation=baseInterpolation, fetype=feType, ipType=ipType, &
basisType=basisType, quadratureType=quadratureType, quadratureOrder=order)
CALL obj%Display("FEDOF:")
found = obj%GetTotalDOF()
want = dom%GetTotalVertexNodes() + (order - 1) * dom%GetTotalElements()
CALL IS(found, want, "Total DOF ( order : "//Tostring(order)//"): ")
END SUBROUTINE test2
END PROGRAM main
Example (H1, Hierarchical, Uniform Order)
This example shows how to initiate FEDOF with H1 and Hierarchy interpolation. Interface 2 of initiate method is used wherein order is a vector of integers representing the order of basis functions for each cell.
!> author: Vikas Sharma, Ph. D.
! date: 2025-06-01
! summary: Initiate fedof for H1 and Heirarchical bases, order is a vector.
PROGRAM main
USE OneDimFEDOF_Class, ONLY: OneDimFEDOF_
USE OneDimDomain_Class, ONLY: OneDimDomain_
USE AbstractMesh_Class
USE HDF5File_Class
USE Display_Method
USE GlobalData
USE Test_Method
USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION
USE BaseType, ONLY: TypeFEVariableOpt, TypeQuadratureOpt, &
TypePolynomialOpt
IMPLICIT NONE
TYPE(OneDimFEDOF_) :: obj
TYPE(OneDimDomain_) :: dom
INTEGER(I4B) :: found, want, order
REAL(DFP), PARAMETER :: domain(2) = [0.0_DFP, 1.0_DFP]
CHARACTER(*), PARAMETER :: baseContinuity="H1" , baseInterpolation="Hierarchical", &
testname = baseContinuity//"_"//baseInterpolation
INTEGER(I4B), PARAMETER :: feType = TypeFEVariableOpt%scalar, &
ipType = TypeQuadratureOpt%equidistance, &
basisType = TypePolynomialOpt%monomial, &
quadratureType = TypeQuadratureOpt%gaussLegendre
CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.)
CALL dom%Initiate(domain=domain, totalElements=2)
! CALL dom%Display("domain: ")
CALL test1
CALL test2
CALL dom%DEALLOCATE()
CONTAINS
SUBROUTINE test1
order = 1
CALL obj%Initiate(order=order, mesh=dom, baseContinuity=baseContinuity, &
baseInterpolation=baseInterpolation, fetype=feType, ipType=ipType, &
basisType=basisType, quadratureType=quadratureType, quadratureOrder=order)
! CALL obj%Display("FEDOF:")
found = obj%GetTotalDOF()
want = dom%GetTotalNodes()
CALL IS(found, want, "Total DOF (order=1): ")
END SUBROUTINE test1
SUBROUTINE test2
order = 2
CALL obj%Initiate(order=order, mesh=dom, baseContinuity=baseContinuity, &
baseInterpolation=baseInterpolation, fetype=feType, ipType=ipType, &
basisType=basisType, quadratureType=quadratureType, quadratureOrder=order)
! CALL obj%Display("FEDOF:")
found = obj%GetTotalDOF()
want = dom%GetTotalVertexNodes() + (order - 1) * dom%GetTotalElements()
CALL IS(found, want, "Total DOF ( order : "//Tostring(order)//"): ")
END SUBROUTINE test2
END PROGRAM main
Example (H1, Hierarchical, Inhomogeneous Order with Local Element Number)
!> author: Vikas Sharma, Ph. D.
! date: 2025-06-01
! summary: Initiate fedof for H1 and Heirarchical bases, order is a vector.
PROGRAM main
USE OneDimFEDOF_Class, ONLY: OneDimFEDOF_
USE OneDimDomain_Class, ONLY: OneDimDomain_
USE AbstractMesh_Class
USE HDF5File_Class
USE Display_Method
USE GlobalData
USE Test_Method
USE ReallocateUtility, ONLY: Reallocate
USE ExceptionHandler_Class, ONLY: e, EXCEPTION_INFORMATION
USE BaseType, ONLY: TypeFEVariableOpt, TypeQuadratureOpt, &
TypePolynomialOpt
IMPLICIT NONE
TYPE(OneDimFEDOF_) :: obj
TYPE(OneDimDomain_) :: dom
INTEGER(I4B) :: found, want, quadratureOrder
REAL(DFP), PARAMETER :: domain(2) = [0.0_DFP, 1.0_DFP]
CHARACTER(*), PARAMETER :: baseContinuity="H1" , baseInterpolation="Hierarchical", &
testname = baseContinuity//"_"//baseInterpolation
INTEGER(I4B), PARAMETER :: feType = TypeFEVariableOpt%scalar, &
ipType = TypeQuadratureOpt%equidistance, &
basisType = TypePolynomialOpt%monomial, &
quadratureType = TypeQuadratureOpt%gaussLegendre
INTEGER(I4B), ALLOCATABLE :: order(:)
CALL e%setQuietMode(EXCEPTION_INFORMATION, .TRUE.)
CALL dom%Initiate(domain=domain, totalElements=2)
! CALL dom%Display("domain: ")
CALL test1
CALL dom%DEALLOCATE()
CONTAINS
SUBROUTINE test1
CALL Reallocate(order, 2)
order(1) = 1
order(2) = 2
quadratureOrder = 2
CALL obj%Initiate(order=order, mesh=dom, baseContinuity=baseContinuity, &
baseInterpolation=baseInterpolation, fetype=feType, ipType=ipType, &
basisType=basisType, quadratureType=quadratureType, quadratureOrder=quadratureOrder)
! CALL obj%Display("FEDOF:")
found = obj%GetTotalDOF()
want = dom%GetTotalVertexNodes() + SUM(order - 1)
CALL IS(found, want, testname//" test 1: ")
END SUBROUTINE test1
END PROGRAM main