Set
Set entries in vector field
Calling example:
Interface 1
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set1(obj, globalNode, VALUE, scale, &
& addContribution)
CLASS(STVectorFieldLis_), INTENT(INOUT) :: obj
INTEGER(I4B), INTENT(IN) :: globalNode
REAL(DFP), INTENT(IN) :: VALUE(:, :)
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set1
END INTERFACE
- This routine sets the single entry of the vector field.
- Here,
value
represents the space-time values at a node. - The shape of
value
should be same as (obj%spaceCompo
,obj%timeCompo
).
In this example we test the Set method.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( STVectorFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
INTEGER( I4B ), PARAMETER :: spaceCompo=2_I4B
INTEGER( I4B ), PARAMETER :: timeCompo=2_I4B
REAL( DFP ), allocatable :: value(:,:)
CHARACTER(*), PARAMETER :: engine = "LIS_OMP"
! import domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
CALL meshfile%Deallocate()
! set parameters for VectorField_
CALL FPL_INIT()
CALL param%initiate()
CALL SetSTVectorFieldParam( &
& param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine, &
& spaceCompo=spaceCompo, &
& timeCompo=timeCompo)
CALL obj%initiate( param, dom )
call reallocate(value, spaceCompo, timeCompo)
call random_number(value)
call obj%set(value=value, globalNode=1)
CALL obj%Display("obj = ")
call display(value, "value = ")
CALL obj%Deallocate(); CALL dom%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
END PROGRAM main
Results
# VAR :U
DOF-1 , DOF-2 , DOF-3 , DOF-4 ,
-------, -------, -------, -------,
0.34965, 0.85832, 0.58169, 0.51880,
value =
------------------
0.349652 0.581689
0.858322 0.518797
Interface 2
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set2(obj, VALUE, scale, addContribution)
CLASS(STVectorFieldLis_), TARGET, INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE(:, :)
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set2
END INTERFACE
- This method sets all the nodal values to
value
- Here,
value
represents the space-time values at a node. - The shape of
value
should be same as (obj%spaceCompo
,obj%timeCompo
).
In this example we test the Set method.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( STVectorFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
INTEGER( I4B ), PARAMETER :: spaceCompo=2_I4B
INTEGER( I4B ), PARAMETER :: timeCompo=2_I4B
REAL( DFP ), allocatable :: value(:,:)
CHARACTER(*), PARAMETER :: engine = "LIS_OMP"
! import domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
CALL meshfile%Deallocate()
! set parameters for VectorField_
CALL FPL_INIT()
CALL param%initiate()
CALL SetSTVectorFieldParam( &
& param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine, &
& spaceCompo=spaceCompo, &
& timeCompo=timeCompo)
CALL obj%initiate( param, dom )
call reallocate(value, spaceCompo, timeCompo)
call random_number(value)
call obj%set(value=value)
CALL obj%Display("obj = ")
call display(value, "value = ")
CALL obj%Deallocate(); CALL dom%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
END PROGRAM main
Results
# VAR :U
DOF-1 , DOF-2 , DOF-3 , DOF-4 ,
--------, --------, --------, --------,
0.528645, 0.580276, 0.587390, 0.497406,
0.528645, 0.580276, 0.587390, 0.497406,
0.528645, 0.580276, 0.587390, 0.497406,
# spaceCompo = 2
# timeCompo = 2
value =
------------------
0.528645 0.587390
0.580276 0.497406
Interface 3
INTERFACE
MODULE SUBROUTINE Set3(obj, VALUE, spaceCompo, timeCompo, &
& scale, addContribution)
CLASS(STVectorFieldLis_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE
INTEGER(I4B), INTENT(IN) :: spaceCompo
INTEGER(I4B), INTENT(IN) :: timeCompo
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set3
END INTERFACE
- This method sets all the nodal values to
value
- Here,
value
represents the value of space-time component.
Interface 4
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set4(obj, VALUE, scale, addContribution)
CLASS(STVectorFieldLis_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE(:, :, :)
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set4
END INTERFACE
- This routine set all entries of space-time vector field.
- All spatial values of all space-time components are set.
value
denotes the space-time nodal vector.- shape of
value
is(spaceCompo, timeCompo, tNodes)
.
In this example we test the Set method.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( STVectorFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
INTEGER( I4B ), PARAMETER :: spaceCompo=2_I4B
INTEGER( I4B ), PARAMETER :: timeCompo=2_I4B
REAL( DFP ), allocatable :: value(:,:,:)
CHARACTER(*), PARAMETER :: engine = "LIS_OMP"
INTEGER( I4B ) :: tnodes
! import domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
CALL meshfile%Deallocate()
! set parameters for VectorField_
CALL FPL_INIT()
CALL param%initiate()
CALL SetSTVectorFieldParam( &
& param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine, &
& spaceCompo=spaceCompo, &
& timeCompo=timeCompo)
CALL obj%initiate( param, dom )
tnodes = dom%getTotalNodes()
call reallocate(value, spaceCompo, timeCompo, tnodes)
call random_number(value)
call obj%set(value=value)
CALL obj%Display("obj = ")
call display(value(:,:,1:3), "value = ")
CALL obj%Deallocate(); CALL dom%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
END PROGRAM main
Results
# VAR :U
DOF-1 , DOF-2 , DOF-3 , DOF-4 ,
--------, --------, --------, --------,
0.468014, 0.193133, 0.825314, 0.189746,
0.870013, 0.165566, 0.767453, 0.480631,
0.544904, 0.097415, 0.914453, 0.895436,
# spaceCompo = 2
# timeCompo = 2
value =( :, :, 1 ) =
---------------------
0.468014 0.825314
0.193133 0.189746
value =( :, :, 2 ) =
---------------------
0.870013 0.767453
0.165566 0.480631
value =( :, :, 3 ) =
---------------------
0.544904 0.914453
0.097415 0.895436
Interface 5
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE SUBROUTINE Set5(obj, VALUE, spaceCompo, timeCompo, &
& scale, addContribution)
CLASS(STVectorFieldLis_), INTENT(INOUT) :: obj
REAL(DFP), INTENT(IN) :: VALUE(:)
INTEGER(I4B), INTENT(IN) :: spaceCompo
INTEGER(I4B), INTENT(IN) :: timeCompo
REAL(DFP), OPTIONAL, INTENT(IN) :: scale
LOGICAL(LGT), OPTIONAL, INTENT(IN) :: addContribution
END SUBROUTINE Set5
END INTERFACE
- This routine sets all entries
- The entries are selected by specifying
spaceCompo
andtimeCompo
- Size of value should be equal to the
tNodes
In this example we test the Set method.
PROGRAM main
USE easifemBase
USE easifemClasses
TYPE( Domain_ ) :: dom
TYPE( STVectorFieldLis_ ) :: obj
TYPE( HDF5File_ ) :: meshfile
TYPE( ParameterList_ ) :: param
INTEGER( I4B ) :: ierr
INTEGER( I4B ), PARAMETER :: spaceCompo=2_I4B
INTEGER( I4B ), PARAMETER :: timeCompo=2_I4B
REAL( DFP ), allocatable :: value(:)
CHARACTER(*), PARAMETER :: engine = "LIS_OMP"
INTEGER( I4B ) :: tnodes
! import domain
CALL meshfile%initiate( filename="./mesh.h5", mode="READ" )
CALL meshfile%open()
CALL dom%initiate( hdf5=meshfile, group="" )
CALL meshfile%Deallocate()
! set parameters for VectorField_
CALL FPL_INIT()
CALL param%initiate()
CALL SetSTVectorFieldParam( &
& param=param, &
& fieldType=FIELD_TYPE_NORMAL, &
& name="U", &
& engine=engine, &
& spaceCompo=spaceCompo, &
& timeCompo=timeCompo)
CALL obj%initiate( param, dom )
tnodes = dom%getTotalNodes()
call reallocate(value, tnodes)
call random_number(value)
call obj%set(value=value, spaceCompo=2, timeCompo=2)
CALL obj%Display("obj = ")
call display(value(1:3), "value = ")
CALL obj%Deallocate(); CALL dom%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
END PROGRAM main
Results
# VAR :U
DOF-1 , DOF-2 , DOF-3 , DOF-4 ,
-------, -------, -------, --------,
0.00000, 0.00000, 0.00000, 0.240216,
0.00000, 0.00000, 0.00000, 0.725414,
0.00000, 0.00000, 0.00000, 0.490273,
.
.
.
# spaceCompo = 2
# timeCompo = 2
value =
--------
0.240216
0.725414
0.490273
Interface 6
- ܀ Interface
- ️܀ See example