Skip to main content

Initiate

Inherited from AbstractMeshField

Initiate

Initiate an instance of AbstractMeshField_.

@ConstructorMethods

Interface 1 (Initiate by using param)

INTERFACE AbstractMeshFieldInitiate
MODULE SUBROUTINE Initiate1(obj, param, mesh)
CLASS(AbstractMeshField_), INTENT(INOUT) :: obj
TYPE(ParameterList_), INTENT(IN) :: param
TYPE(Mesh_), TARGET, INTENT(IN) :: mesh
END SUBROUTINE Initiate1
END INTERFACE AbstractMeshFieldInitiate

Interface 2 (Initiate by copying)

INTERFACE
MODULE SUBROUTINE Initiate2(obj, obj2, copyFull, copyStructure, &
& usePointer)
CLASS(AbstractMeshField_), INTENT(INOUT) :: obj
CLASS(AbstractMeshField_), INTENT(INOUT) :: obj2
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: copyFull
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: copyStructure
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: usePointer
END SUBROUTINE Initiate2
END INTERFACE

Interface 3 (Initiate by AbstractMaterial)

INTERFACE
MODULE SUBROUTINE Initiate3(obj, mesh, material, name, engine)
CLASS(AbstractMeshField_), INTENT(INOUT) :: obj
!! AbstractMeshField
TYPE(Mesh_), TARGET, INTENT(IN) :: mesh
!! mesh
CLASS(AbstractMaterial_), INTENT(INOUT) :: material
!! Abstract material
CHARACTER(*), INTENT(IN) :: name
!! name of the AbstractMeshField
CHARACTER(*), INTENT(IN) :: engine
!! engine of the AbstractMeshField
END SUBROUTINE Initiate3
END INTERFACE

Interface 4 (Initiate by UserFunction)

INTERFACE
MODULE SUBROUTINE Initiate4(obj, mesh, func, name, engine, nnt)
CLASS(AbstractMeshField_), INTENT(INOUT) :: obj
!! AbstractMeshField
TYPE(Mesh_), TARGET, INTENT(IN) :: mesh
!! mesh
CLASS(UserFunction_), INTENT(INOUT) :: func
!! Abstract material
CHARACTER(*), INTENT(IN) :: name
!! name of the AbstractMeshField
CHARACTER(*), INTENT(IN) :: engine
!! engine of the AbstractMeshField
INTEGER(I4B), OPTIONAL, INTENT(IN) :: nnt
!! number of nodes in time
END SUBROUTINE Initiate4
END INTERFACE

Example 1

Click here to see the example

Example 1

info

This example shows how to initiate an instance of Mesh by reading data from mesh file, which is in HDF5File_ format. We will also construct an instance of VectorMeshField_.

PROGRAM main
USE easifemBase
USE easifemClasses
IMPLICIT NONE
TYPE( HDF5File_ ) :: meshfile
TYPE( Mesh_ ) :: amesh
TYPE( VectorMeshField_ ) :: obj
TYPE( ParameterList_ ) :: param

Step 1:

Initiate and open the mesh file which is in HDF5File_ format.

CALL meshfile%Initiate( FileName="./mesh.h5", MODE="READ" )
CALL meshfile%Open()
CALL amesh%Initiate(hdf5=meshfile, group="/surfaceEntities_1" )

Step 2:

Initiate an instance of VectorMeshField_.

CALL FPL_INIT(); CALL param%initiate()
CALL SetVectorMeshFieldParam( &
& param=param, &
& name='aVector', &
& varType = Constant, &
& fieldType=TypeField%normal, &
& engine='NATIVE_SERIAL', &
& defineOn=Nodal, &
& nns=6, &
& spaceCompo=amesh%GetNSD() )
CALL obj%Initiate( param=param, mesh=amesh )
CALL obj%Display( 'obj: ' )

The above code will initiate an instance of VectorMeshField_, which will contain following data.

Object INITIATED: TRUE
name: aVector
prefix: VectorMeshField
fieldType: NORMAL
engine: NATIVE_SERIAL
tSize: 484
defineOn: Nodal
rank: Vector
varType: Constant
shape:
-------
2
val ALLOCATED: TRUE
mesh ASSOCIATED: TRUE

Let's try to understand the following situation:

  • We save data in a two dimensional array val.
  • The number of rows in val in this example is 1. Because, we have set varType=Constant, all nodes (we have specified 6 nodes) in an element have constant vector valued. Read more about the Shape method.
  • The number of columns in val is 484 elements in the mesh.

Step 3:

  CALL obj%Deallocate()
CALL amesh%Deallocate()
CALL meshfile%Close()
CALL meshfile%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
END PROGRAM main

Example 2

Click here to see the example

Example 2

info

This example shows how to initiate an instance of Mesh by reading data from mesh file, which is in HDF5File_ format. We will also construct an instance of VectorMeshField_.

PROGRAM main
USE easifemBase
USE easifemClasses
IMPLICIT NONE
TYPE( HDF5File_ ) :: meshfile
TYPE( Mesh_ ) :: amesh
TYPE( VectorMeshField_ ) :: obj
TYPE( ParameterList_ ) :: param

Step 1:

Initiate and open the mesh file which is in HDF5File_ format.

CALL meshfile%Initiate( FileName="./mesh.h5", MODE="READ" )
CALL meshfile%Open()
CALL amesh%Initiate(hdf5=meshfile, group="/surfaceEntities_1" )

Step 2:

Initiate an instance of VectorMeshField_.

CALL FPL_INIT(); CALL param%initiate()
CALL SetVectorMeshFieldParam( &
& param=param, &
& name='aVector', &
& varType = Constant, &
& fieldType=TypeField%Constant, &
& engine='NATIVE_SERIAL', &
& defineOn=Nodal, &
& nns=6, &
& spaceCompo=amesh%GetNSD() )
CALL obj%Initiate( param=param, mesh=amesh )
CALL obj%Display( 'obj: ' )

The above code will initiate an instance of VectorMeshField_, which will contain following data.

Object INITIATED: TRUE
name: aVector
prefix: VectorMeshField
fieldType: CONSTANT
engine: NATIVE_SERIAL
tSize: 1
defineOn: Nodal
rank: Vector
varType: Constant
shape:
-------
2
val ALLOCATED: TRUE
mesh ASSOCIATED: TRUE

Let's try to understand the above code:

  • We save data in a two dimensional array val.
  • The number of rows in val for above example is 1 (this is because the vector data is constant inside the element).
  • Because, we have set varType=Constant, all nodes (we have specified 6 nodes) in an element have same vector value. Read more about the Shape method.
  • The number of columns in val is 1, this is because the fieldType=Constant (i.e., constant across all the elements).

Step 3:

  CALL obj%Deallocate()
CALL amesh%Deallocate()
CALL meshfile%Close()
CALL meshfile%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
END PROGRAM main

Example 3

Click here to see the example

Example 3

info

This example shows how to initiate an instance of Mesh by reading data from mesh file, which is in HDF5File_ format. We will also construct an instance of VectorMeshField_.

PROGRAM main
USE easifemBase
USE easifemClasses
IMPLICIT NONE
TYPE( HDF5File_ ) :: meshfile
TYPE( Mesh_ ) :: amesh
TYPE( VectorMeshField_ ) :: obj
TYPE( ParameterList_ ) :: param

Step 1:

Initiate and open the mesh file which is in HDF5File_ format.

CALL meshfile%Initiate( FileName="./mesh.h5", MODE="READ" )
CALL meshfile%Open()
CALL amesh%Initiate(hdf5=meshfile, group="/surfaceEntities_1" )

Step 2:

Initiate an instance of VectorMeshField_.

CALL FPL_INIT(); CALL param%initiate()
CALL SetVectorMeshFieldParam( &
& param=param, &
& name='aVector', &
& varType = Space, &
& fieldType=TypeField%Normal, &
& engine='NATIVE_SERIAL', &
& defineOn=Nodal, &
& nns=6, &
& spaceCompo=amesh%GetNSD() )
CALL obj%Initiate( param=param, mesh=amesh )
CALL obj%Display( 'obj: ' )
call display(amesh%GetTotalElements(), "total elements: " )

The above code will initiate an instance of VectorMeshField_, which will contain following data.

Object INITIATED: TRUE
name: aVector
prefix: VectorMeshField
fieldType: NORMAL
engine: NATIVE_SERIAL
tSize: 484
defineOn: Nodal
rank: Vector
varType: Space
shape:
-------
2
6
val ALLOCATED: TRUE
mesh ASSOCIATED: TRUE
total elements: 484

Let's try to understand the above code:

  • We save data in a two dimensional array val.
  • The number of rows in val for above example is 2. This is because we have set varType=Space, which means the vector data changes in Space inside the element.
  • Because, we have set varType=Space, therefore val(1:12) denotes the value of vector field at 6 nodes of element. Read more about the Shape method.
  • The number of columns in val is 484 (which is the total number of elements in the mesh), this is because the fieldType=Regular (i.e., changes across all the elements).

Step 3:

  CALL obj%Deallocate()
CALL amesh%Deallocate()
CALL meshfile%Close()
CALL meshfile%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
END PROGRAM main