Skip to content

Commit

Permalink
Merge pull request #54 from LLNL/InletOutletRZ
Browse files Browse the repository at this point in the history
added the map from RZ space to 2d into the finalize and initialize me…
  • Loading branch information
jmikeowen authored Feb 26, 2021
2 parents eb21ac2 + 199e87f commit fe747f4
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/Boundary/InflowOutflowBoundary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,25 +277,38 @@ InflowOutflowBoundary<Dimension>::initializeProblemStartup(const bool /*final*/)
CHECK(positr != mBufferedValues.end());
auto& posbuf = positr->second;
auto posvals = extractBufferedValues<Vector>(posbuf);
const GeomPlane<Dimension> exitPlane(mPlane.point(), -nhat);
for (auto k = 0u; k < ni; ++k) {
const auto i = nodeIDs[k];
posvals[k] = mapPositionThroughPlanes(pos[i], mPlane, mPlane);
// cerr << " Ghost position: " << i << " @ " << posvals[k] << endl;
}
posbuf.clear();
for (const auto& p: posvals) packElement(p, posbuf);

// IF RZ adjust ghost masses
if (mDataBase.isRZ){
auto& mass = nodeList.mass();
const auto masskey = StateBase<Dimension>::key(mass);
auto massitr = mBufferedValues.find(masskey);
auto& massbuf = massitr->second;
auto massvals = extractBufferedValues<Scalar>(massbuf);

for (auto k = 0u; k < ni; ++k) {
const auto circi = 2.0*M_PI*abs(posvals[k].y());
CHECK(circi > 0.0);
massvals[k]/=circi;
}
massbuf.clear();
for (const auto& m: massvals) packElement(m, massbuf);
}

// Determine the in/outflow velocity.
const auto& vel = nodeList.velocity();
Scalar vinflow = 0.0;
for (const auto i: nodeIDs) {
// CHECK(std::abs(vel[i].dot(nhat)/vel[i].magnitude() - 1.0) < 1.0e-5);
vinflow += vel[i].dot(nhat);
}
vinflow = (allReduce(vinflow, MPI_SUM, Communicator::communicator())/
std::max(1.0e-30, allReduce(double(nodeIDs.size()), MPI_SUM, Communicator::communicator()))); // Negative implies outflow
// cerr << "Computed inflow velocity: " << vinflow << endl;

// Figure out a timestep limit such that we don't move more than the ghost
// node thickness.
Expand Down

0 comments on commit fe747f4

Please sign in to comment.