-
Notifications
You must be signed in to change notification settings - Fork 1
Eg/add mesh vtx strain rate #62
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
base: cws/pumipicDps
Are you sure you want to change the base?
Changes from 7 commits
5de5e5e
a756fe0
cf6783e
3b81cd4
3f4c3b4
efb2d77
4b2f050
3dfd842
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -699,6 +699,48 @@ void polympo_getMeshOnSurfDispIncr_f(MPMesh_ptr p_mpmesh, const int nComps, cons | |
| Kokkos::deep_copy(arrayHost, array_d); | ||
| } | ||
|
|
||
| void polympo_setMeshVtxStrainRate_f(MPMesh_ptr p_mpmesh, const int nVertices, const double *xNormal, const double *yNormal, const double *zNormal, const double *xyShear, const double *xzShear, const double *yzShear){ | ||
| //check mpMesh is valid | ||
| checkMPMeshValid(p_mpmesh); | ||
| auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh; | ||
|
|
||
| //check the size | ||
| PMT_ALWAYS_ASSERT(p_mesh->getNumVertices()==nVertices); | ||
|
|
||
| auto strainRate = p_mesh->getMeshField<polyMPO::MeshF_VtxStrainRate>(); | ||
| auto h_strainRate = Kokkos::create_mirror_view(strainRate); | ||
| for(int i = 0; i < nVertices; i++){ | ||
| h_strainRate(i,0) = xNormal[i]; | ||
| h_strainRate(i,1) = yNormal[i]; | ||
| h_strainRate(i,2) = zNormal[i]; | ||
| h_strainRate(i,3) = xyShear[i]; | ||
| h_strainRate(i,4) = xzShear[i]; | ||
| h_strainRate(i,5) = yzShear[i]; | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to discuss this numbering, i.e., for 6 components of symmetric tensor per vertex (i.e., 0 through 5).
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. function now uses one 2d array instead of six 1d arrays. |
||
| Kokkos::deep_copy(strainRate, h_strainRate); | ||
| } | ||
|
|
||
| void polympo_getMeshVtxStrainRate_f(MPMesh_ptr p_mpmesh, const int nVertices, double *xNormal, double *yNormal, double *zNormal, double *xyShear, double *xzShear, double *yzShear){ | ||
| //check mpMesh is valid | ||
| checkMPMeshValid(p_mpmesh); | ||
| auto p_mesh = ((polyMPO::MPMesh*)p_mpmesh)->p_mesh; | ||
|
|
||
| //check the size | ||
| PMT_ALWAYS_ASSERT(p_mesh->getNumVertices()==nVertices); | ||
|
|
||
| auto strainRate = p_mesh->getMeshField<polyMPO::MeshF_VtxStrainRate>(); | ||
| auto h_strainRate = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), strainRate); | ||
| for(int i = 0; i < nVertices; i++){ | ||
| xNormal[i] = h_strainRate(i,0); | ||
| yNormal[i] = h_strainRate(i,1); | ||
| zNormal[i] = h_strainRate(i,2); | ||
| xyShear[i] = h_strainRate(i,3); | ||
| xzShear[i] = h_strainRate(i,4); | ||
| yzShear[i] = h_strainRate(i,5); | ||
EamonnGlynn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
|
|
||
| void polympo_push_f(MPMesh_ptr p_mpmesh){ | ||
| checkMPMeshValid(p_mpmesh); | ||
| ((polyMPO::MPMesh*)p_mpmesh) ->push(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,6 +139,28 @@ program main | |
| call assert((xArray(i) .eq. i+value1), "Assert MeshVel u-component Velocity Fail") | ||
| call assert((yArray(i) .eq. value2-i), "Assert MeshVel v-component Velocity Fail") | ||
| end do | ||
|
|
||
| !VtxStrainRate needs 6 arrays, using x,y,zArrays for all 6 | ||
|
||
| do i = 1, nverts | ||
| xArray(i) = i + value1 | ||
| yArray(i) = value2 - i | ||
| zArray(i) = i + (value1 * value2) | ||
| end do | ||
| call polympo_setMeshVtxStrainRate(mpMesh, nverts, c_loc(xArray),c_loc(yArray), & | ||
| c_loc(zArray),c_loc(xArray),c_loc(yArray),c_loc(zArray)) | ||
| xArray = -1 | ||
| yArray = -1 | ||
| zArray = -1 | ||
| call polympo_getMeshVtxStrainRate(mpMesh, nverts, c_loc(xArray),c_loc(yArray), & | ||
| c_loc(zArray),c_loc(xArray),c_loc(yArray),c_loc(zArray)) | ||
| do i = 1, nverts | ||
| call assert((xArray(i) .eq. i+value1), & | ||
| "Assert MeshVtxStrainRate xx-component Velocity Fail") | ||
| call assert((yArray(i) .eq. value2-i), & | ||
| "Assert MeshVtxStrainRate yy-component Velocity Fail") | ||
| call assert((zArray(i) .eq. i+(value1*value2)), & | ||
| "Assert MeshVtxStrainRate zz-component Velocity Fail") | ||
| end do | ||
|
|
||
| deallocate(MParray) | ||
| deallocate(Mesharray) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to discuss if each component (of the 6 components of symmetric tensor) will be given as a separate array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has been converted to take one 2d array instead