Skip to content

Commit a5ea31a

Browse files
committed
Removed old routines that does reconstruction assembly in MPAS
1 parent da48034 commit a5ea31a

File tree

8 files changed

+53
-475
lines changed

8 files changed

+53
-475
lines changed

src/pmpo_MPMesh.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ void MPMesh::calcBasis(bool use3DArea) {
1818
//For Gnomonic Projection
1919
auto gnomProjVtx = p_mesh->getMeshField<polyMPO::MeshF_VtxGnomProj>();
2020
auto gnomProjElmCenter = p_mesh->getMeshField<polyMPO::MeshF_ElmCenterGnomProj>();
21-
21+
22+
bool isRotated = true;
2223
auto calcbasis = PS_LAMBDA(const int& elm, const int& mp, const int& mask) {
2324
if(mask) { //if material point is 'active'/'enabled'
2425
Vec3d position3d(MPsPosition(mp,0),MPsPosition(mp,1),MPsPosition(mp,2));
@@ -40,6 +41,10 @@ void MPMesh::calcBasis(bool use3DArea) {
4041
if(!use3DArea){
4142
double mpProjX, mpProjY;
4243
auto gnomProjElmCenter_sub = Kokkos::subview(gnomProjElmCenter, elm, Kokkos::ALL);
44+
if(isRotated){
45+
position3d[0] = -MPsPosition(mp, 2);
46+
position3d[2] = MPsPosition(mp, 0);
47+
}
4348
computeGnomonicProjectionAtPoint(position3d, gnomProjElmCenter_sub, mpProjX, mpProjY);
4449
auto gnom_vtx_subview = Kokkos::subview(gnomProjVtx, elm, Kokkos::ALL, Kokkos::ALL);
4550
compute2DplanarTriangleArea(numVtx, gnom_vtx_subview, mpProjX, mpProjY, basisByArea);

src/pmpo_MPMesh_assembly.hpp

Lines changed: 16 additions & 466 deletions
Large diffs are not rendered by default.

src/pmpo_c.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,7 @@ void polympo_setReconstructionOfStress_f(MPMesh_ptr p_mpmesh, const int order, c
12491249
(void)meshEntType;
12501250
}
12511251

1252+
//TO DO DELETE
12521253
//With MPI communication done via MPAS
12531254
void polympo_vtxSubAssemblyIceArea_f(MPMesh_ptr p_mpmesh, int vtxPerElm, int nCells, int comp, double* array){
12541255
checkMPMeshValid(p_mpmesh);
@@ -1299,7 +1300,6 @@ void polympo_applyReconstruction_f(MPMesh_ptr p_mpmesh){
12991300
mpmesh->reconstructSlices();
13001301
}
13011302

1302-
//Method 1
13031303
void polympo_fullAssemblyIceArea_f(MPMesh_ptr p_mpmesh, int vtxPerElm, int nCells, int nVerticesSolve, int nVertices,
13041304
double* array_sub, double* array_full){
13051305
checkMPMeshValid(p_mpmesh);
@@ -1308,18 +1308,27 @@ void polympo_fullAssemblyIceArea_f(MPMesh_ptr p_mpmesh, int vtxPerElm, int nCell
13081308
PMT_ALWAYS_ASSERT(nVertices == p_mesh->getNumVertices());
13091309
mpmesh->assembleField(vtxPerElm, nCells, nVerticesSolve, nVertices, array_sub, array_full);
13101310
}
1311+
//
13111312

1313+
//Only these are needed
13121314
void polympo_reconstruct_iceArea_with_MPI_f(MPMesh_ptr p_mpmesh){
13131315
checkMPMeshValid(p_mpmesh);
13141316
auto mpmesh = ((polyMPO::MPMesh*)p_mpmesh);
13151317
mpmesh->reconstruct_full<polyMPO::MeshF_VtxMass>();
13161318
}
13171319

1320+
void polympo_reconstruct_velocity_with_MPI_f(MPMesh_ptr p_mpmesh){
1321+
checkMPMeshValid(p_mpmesh);
1322+
auto mpmesh = ((polyMPO::MPMesh*)p_mpmesh);
1323+
mpmesh->reconstruct_full<polyMPO::MeshF_Vel>();
1324+
}
1325+
13181326
void polympo_reconstruct_coeff_with_MPI_f(MPMesh_ptr p_mpmesh){
13191327
checkMPMeshValid(p_mpmesh);
13201328
auto mpmesh = ((polyMPO::MPMesh*)p_mpmesh);
13211329
mpmesh->reconstruct_coeff_full();
13221330
}
1331+
//Till here
13231332

13241333
void polympo_setOwningProc_f(MPMesh_ptr p_mpmesh, const int nCells, const int* array){
13251334
checkMPMeshValid(p_mpmesh);

src/pmpo_c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ void polympo_fullAssemblyIceArea_f(MPMesh_ptr p_mpmesh, int vtxPerElm, int nCell
130130
double* array_sub, double* array_full);
131131

132132
void polympo_reconstruct_coeff_with_MPI_f(MPMesh_ptr p_mpmesh);
133-
134133
void polympo_reconstruct_iceArea_with_MPI_f(MPMesh_ptr p_mpmesh);
134+
void polympo_reconstruct_velocity_with_MPI_f(MPMesh_ptr p_mpmesh);
135135

136136
// Timing
137137
void polympo_enableTiming_f();

src/pmpo_fortran.f90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,14 @@ subroutine polympo_reconstruct_iceArea_with_MPI(mpMesh) &
977977
use :: iso_c_binding
978978
type(c_ptr), value :: mpMesh
979979
end subroutine
980+
981+
subroutine polympo_reconstruct_velocity_with_MPI(mpMesh) &
982+
bind(C, NAME='polympo_reconstruct_velocity_with_MPI_f')
983+
use :: iso_c_binding
984+
type(c_ptr), value :: mpMesh
985+
end subroutine
980986

987+
981988
!---------------------------------------------------------------------------
982989
!> @brief directly call the reconstruct of the MP fields to mesh fields
983990
!> @param mpmesh(in/out) MPMesh object

src/pmpo_mesh.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ namespace polyMPO{
7979
pumipic::RecordTime("PolyMPO_computeRotLatLonIncr", timer.seconds());
8080
}
8181

82-
void Mesh::setGnomonicProjection(bool isRotated, double radius){
82+
void Mesh::setGnomonicProjection(bool isRotated){
8383
std::cout<<__FUNCTION__<<std::endl;
8484
auto gnomProjVtx = getMeshField<MeshF_VtxGnomProj>();
8585
auto gnomProjElmCenter = getMeshField<MeshF_ElmCenterGnomProj>();
@@ -93,7 +93,8 @@ namespace polyMPO{
9393

9494
Vec3d elmCenter(elmCenters(iElm, 0), elmCenters(iElm, 1), elmCenters(iElm, 2));
9595
if(isRotated){
96-
96+
elmCenter[0] = - elmCenters(iElm, 2);
97+
elmCenter[2] = elmCenters(iElm, 0);
9798
}
9899
auto cos2LatR = elmCenter[0]*elmCenter[0] + elmCenter[1]*elmCenter[1];
99100
auto invR = 1.0/ sqrt(cos2LatR + elmCenter[2]*elmCenter[2]);
@@ -108,8 +109,9 @@ namespace polyMPO{
108109
for(int i=0; i<nVtxE; i++){
109110
int vID = elm2VtxConn(iElm, i+1) - 1;
110111
Vec3d vtxCord(vtxCoords(vID, 0), vtxCoords(vID, 1), vtxCoords(vID, 2));
111-
if (isRotated){
112-
112+
if(isRotated){
113+
vtxCord[0] = - vtxCoords(vID, 2);
114+
vtxCord[2] = vtxCoords(vID, 0);
113115
}
114116

115117
double outX, outY;

src/pmpo_mesh.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class Mesh {
186186
IntView getElmGlobal() {return globalElm_;}
187187
IntView getVtxGlobal() {return globalVtx_;}
188188

189-
void setGnomonicProjection(bool isRotated, double radius);
189+
void setGnomonicProjection(bool isRotated);
190190

191191
void computeRotLatLonIncr();
192192
};

src/pmpo_wachspressBasis.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,8 @@ inline void sphericalInterpolationDispVelIncr(MPMesh& mpMesh){
450450
auto mpField2 = p_MPs->getData<mpfIndex2>();
451451

452452
// Field required for calculting gnomonic projection of MPs
453-
bool use3DArea=false;
453+
bool use3DArea = false;
454+
bool isRotated = true;
454455
auto gnomProjVtx = p_mesh->getMeshField<polyMPO::MeshF_VtxGnomProj>();
455456
auto gnomProjElmCenter = p_mesh->getMeshField<polyMPO::MeshF_ElmCenterGnomProj>();
456457

@@ -477,6 +478,10 @@ inline void sphericalInterpolationDispVelIncr(MPMesh& mpMesh){
477478
else{ //if using gnomonic Projection for weights
478479
double mpProjX, mpProjY;
479480
auto gnomProjElmCenter_sub = Kokkos::subview(gnomProjElmCenter, elm, Kokkos::ALL);
481+
if(isRotated){
482+
position3d[0] = -MPsPosition(mp, 2);
483+
position3d[2] = MPsPosition(mp, 0);
484+
}
480485
computeGnomonicProjectionAtPoint(position3d, gnomProjElmCenter_sub, mpProjX, mpProjY);
481486
auto gnom_vtx_subview = Kokkos::subview(gnomProjVtx, elm, Kokkos::ALL, Kokkos::ALL);
482487
compute2DplanarTriangleArea(numVtx, gnom_vtx_subview, mpProjX, mpProjY, basisByArea);

0 commit comments

Comments
 (0)