Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get1 Method in STVectorField #346

Closed
vickysharma0812 opened this issue Dec 23, 2023 · 1 comment
Closed

Get1 Method in STVectorField #346

vickysharma0812 opened this issue Dec 23, 2023 · 1 comment

Comments

@vickysharma0812
Copy link
Member

Feature 1

We want to get x, y, z coordinate of a STVector field at a given time step by calling following method.

CALL Obj%Get(value(:), globalNode, timeCompo) 

Feature 2

Get time component of a given space component at a given node.

CALL Obj%Get(value(:), globalNode, spaceCompo) 

Feature 3

Get space-time component a t given node.

CALL obj%Get(value(:), globalNode, spaceCompo, timeCompo)
@vickysharma0812
Copy link
Member Author

PROGRAM main
USE easifemBase
USE easifemClasses
TYPE(Domain_) :: dom
TYPE(STVectorField_) :: 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 :: svalue(:, :, :)
REAL(DFP), ALLOCATABLE :: VALUE(:)
CHARACTER(*), PARAMETER :: engine = "NATIVE_SERIAL"
INTEGER(I4B) :: tnodes
LOGICAL(LGT) :: isok

! 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(svalue, spaceCompo, timeCompo, tnodes)
CALL RANDOM_NUMBER(svalue)
CALL obj%set(VALUE=svalue)

CALL obj%Get(VALUE=VALUE, spaceCompo=1, globalNode=3)
isok = ALL(svalue(1, :, 3) .approxeq.VALUE)
CALL ok(isok, "Get(1) ")

CALL obj%Get(VALUE=VALUE, timeCompo=2, globalNode=3)
isok = ALL(svalue(:, 2, 3) .approxeq.VALUE)
CALL ok(isok, "Get(2) ")

CALL obj%Get(VALUE=VALUE, timeCompo=2, spaceCompo=1, globalNode=3)
isok = ALL(svalue(1, 2, 3) .approxeq.VALUE)
CALL ok(isok, "Get(3) ")

CALL obj%DEALLOCATE(); CALL dom%DEALLOCATE()
CALL param%DEALLOCATE(); CALL FPL_FINALIZE()
END PROGRAM main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant