Skip to content

Commit

Permalink
Don't extrude sphere mesh on decomposition.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielabdi-noaa committed May 1, 2024
1 parent d3a0931 commit 1879cd8
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/field/field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,11 +1050,7 @@ int Prepare::decomposeMesh(Int step) {
std::cout << "Decomposing grid at step " << step << std::endl;

/*Read mesh*/
LoadMesh(step,false);

/*Read fields*/
createFields(fields,step);
readFields(fields,step);
LoadMesh(step,false,false);

/**********************
* decompose mesh
Expand Down Expand Up @@ -1202,9 +1198,11 @@ int Prepare::decomposeMesh(Int step) {
}
}
}

/**************************************
* Write grid
**************************************/
std::string grid_path;

/* write master grid after reordering cells*/
{
Expand All @@ -1229,13 +1227,17 @@ int Prepare::decomposeMesh(Int step) {
string str = path.str();

if(System::exists(str + ".txt")) {
ofstream os(str + ".txt");
str += ".txt";
ofstream os(str + ".tmp");
os << gMesh;
} else if(System::exists(str + ".bin")) {
Util::ofstream_bin os(str + ".bin");
str += ".bin";
Util::ofstream_bin os(str + ".tmp");
os << gMesh;
}

grid_path = str;

/*rewrite AmrTree*/
{
stringstream path;
Expand Down Expand Up @@ -1281,6 +1283,19 @@ int Prepare::decomposeMesh(Int step) {
}
}

/*Read old mesh again with extrusion on sphere*/
{
if(is_spherical)
LoadMesh(step,false,true);

/*Rename reordered mesh file*/
std::rename((grid_path + ".tmp").c_str(), grid_path.c_str());

/*Read fields*/
createFields(fields,step);
readFields(fields,step);
}

/***************************
* Expand cLoc
***************************/
Expand Down

0 comments on commit 1879cd8

Please sign in to comment.