Initiate
This method constructs an instance of BlockMatrixField.
Calling examples:
CALL Initiate( BlockMatrixField_ :: obj, ParameterList_ :: param, Domain_ :: dom )
CALL Initiate( &
& BlockMatrixField_ :: obj, &
& BlockMatrixField_ :: obj2 &
<& , Bool::copyFull> &
<& , Bool::copyStructure> &
<& , Bool :: usePointer> )
CALL Initiate( &
& BlockMatrixField_ :: obj, &
& ParameterList_ :: param, &
& DomainPointer_ :: dom)
Interface 1
- Interface 1
- ܀ Examples
INTERFACE
SUBROUTINE Initiate( obj, param, dom )
CLASS( BlockMatrixField_ ), INTENT( INOUT ) :: obj
TYPE( ParameterList_), INTENT( IN ) :: param
TYPE( Domain_ ), TARGET, INTENT( IN ) :: dom
END SUBROUTINE Initiate
END INTERFACE
This routine creates a square sparse matrix.
This routine initiates an instance of BlockMatrixField_.
The options/arguments to initiate the matrix field are
contained inside param, which is an instance of ParameterList_.
In addition, Domain_ dom is target to the pointer obj%domain.
- Param contains both essential and optional parameters which are used in constructing the matrix field
- dom is a pointer to a domain, where we are interested in constructing the matrix
ESSENTIAL PARAMETERS are
nameThis is name of field (char)matrixProp, UNSYM, SYM (char)engine
OPTIONAL PARAMETERS
spaceCompo, INT, default is 1timeCompo, INT, default is 1fieldType, INT, default is FIELD_TYPE_NORMAL
PROGRAM main
USE easifemBase
USE easifemClasses
IMPLICIT NONE
TYPE( BlockMatrixField_ ) :: obj
TYPE( ParameterList_ ) :: param
TYPE( Domain_ ) :: dom
TYPE( HDF5File_ ) :: meshfile
CHARACTER( LEN = * ), PARAMETER :: meshFilename="./mesh_tri3.h5"
CALL FPL_INIT(); CALL param%Initiate()
CALL SetBlockMatrixFieldParam(param=param, name="K", &
& physicalVarNames=["V", "P"], spaceCompo=[2, 1], &
& timeCompo=[1,1], fieldType=FIELD_TYPE_NORMAL, &
& matrixProp="UNSYM" )
CALL meshfile%Initiate( FileName=meshFilename, MODE="READ" )
CALL meshfile%Open()
CALL dom%Initiate( meshfile, "")
CALL obj%Initiate(param=param, dom=dom)
CALL obj%Display("")
CALL obj%Deallocate( )
!> cleanup
CALL param%Deallocate(); CALL FPL_FINALIZE()
CALL meshfile%Deallocate()
CALL dom%Deallocate()
CALL obj%Deallocate()
END PROGRAM main
Interface 2
- Interface 2
- ܀ Examples
INTERFACE
SUBROUTINE Initiate( obj, obj2, copyFull, copyStructure, &
& usePointer )
CLASS( BlockMatrixField_ ), INTENT( INOUT ) :: obj
CLASS( BlockMatrixField_ ), INTENT( INOUT ) :: obj2
LOGICAL( LGT ), OPTIONAL, INTENT( IN ) :: copyFull
LOGICAL( LGT ), OPTIONAL, INTENT( IN ) :: copyStructure
LOGICAL( LGT ), OPTIONAL, INTENT( IN ) :: usePointer
END SUBROUTINE Initiate
END INTERFACE
This method is inherited from MatrixField
Initiate by copying from other fields. This routine initiates the obj MatrixField_ by copying contents from obj2, an instance of child class of AbstractField_.
If copyFull, copyStructure, usePointer are absent then this subroutine,
copies the value of the matrix from obj2 to obj.
At present, the routine works for copyFull=.TRUE., copyStructure=.TRUE., usePointer=.TRUE., which equivalent to the default behavior.
- TODO Add functionality for other options too.
obj2 should be an instance of MatrixField_
BlockMatrixField example 3
This example shows the use of SetBlockMatrixFieldParam, BlockMatrixField
Usage
PROGRAM main
USE easifemBase
USE easifemClasses
IMPLICIT NONE
TYPE( BlockMatrixField_) :: obj
TYPE( ParameterList_ ) :: param
TYPE( Domain_), TARGET :: pressureDomain
TYPE( Domain_ ), TARGET :: velocityDomain
TYPE( DomainPointer_) :: domains( 2 )
TYPE( HDF5File_ ) :: pressureMeshFile
TYPE( HDF5File_ ) :: velocityMeshFile
CHARACTER( LEN = * ), PARAMETER :: pressureMeshFilename="./mesh_tri3.h5"
CHARACTER( LEN = * ), PARAMETER :: velocityMeshFilename="./mesh_tri6.h5"
CALL FPL_INIT(); CALL param%Initiate()
CALL SetBlockMatrixFieldParam(param=param, name="K", &
& physicalVarNames=["V", "P"], spaceCompo=[2, 1], &
& timeCompo=[1,1], fieldType=FIELD_TYPE_NORMAL, &
& matrixProp="UNSYM" )
CALL pressureMeshfile%Initiate( FileName=pressureMeshFilename, MODE="READ" )
CALL velocityMeshfile%Initiate( FileName=velocityMeshFilename, MODE="READ" )
CALL pressureMeshfile%Open()
CALL velocityMeshfile%Open()
CALL pressureDomain%Initiate( pressureMeshfile, "")
CALL velocityDomain%Initiate( velocityMeshfile, "")
CALL pressureMeshfile%Deallocate()
CALL velocityMeshfile%Deallocate()
domains(1)%ptr => velocityDomain
domains(2)%ptr => pressureDomain
CALL obj%Initiate(param=param, dom=domains)
CALL obj%Display("")
Cleanup
CALL obj%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
NULLIFY(domains(1)%ptr, domains(2)%ptr)
CALL pressureDomain%Deallocate()
CALL velocityDomain%Deallocate()
CALL obj%Deallocate()
END PROGRAM main
Interface 3
- Interface 3
- ܀ Examples
INTERFACE
SUBROUTINE Initiate(obj, param, dom)
CLASS(BlockMatrixField_), INTENT(INOUT) :: obj
TYPE(ParameterList_), INTENT(IN) :: param
TYPE(DomainPointer_), TARGET, INTENT(IN) :: dom(:)
END SUBROUTINE Initiate
END INTERFACE
- The matrix has a block struture, wherein, col and rows corresponds to the different physical variables.
The rectan