diff --git a/src_compressible_stag/main_driver.cpp b/src_compressible_stag/main_driver.cpp index d9f4d701..dad19c8d 100644 --- a/src_compressible_stag/main_driver.cpp +++ b/src_compressible_stag/main_driver.cpp @@ -248,12 +248,12 @@ void main_driver(const char* argv) std::string filename = "crossMeans"; std::ofstream outfile; - std::string filenamereslo = "consResLo"; - std::ofstream outfilereslo; - if (ParallelDescriptor::IOProcessor()) outfilereslo.open(filenamereslo); - std::string filenamereshi = "consResHi"; - std::ofstream outfilereshi; - if (ParallelDescriptor::IOProcessor()) outfilereshi.open(filenamereshi); +// std::string filenamereslo = "consResLo"; +// std::ofstream outfilereslo; +// if (ParallelDescriptor::IOProcessor()) outfilereslo.open(filenamereslo); +// std::string filenamereshi = "consResHi"; +// std::ofstream outfilereshi; +// if (ParallelDescriptor::IOProcessor()) outfilereshi.open(filenamereshi); ///////////////////////////////////////////// // Setup Structure factor variables & scaling ///////////////////////////////////////////// @@ -920,7 +920,7 @@ void main_driver(const char* argv) // timer Real ts2 = ParallelDescriptor::second() - ts1; ParallelDescriptor::ReduceRealMax(ts2, ParallelDescriptor::IOProcessorNumber()); - if (step%1 == 0) { + if (step%100 == 0) { amrex::Print() << "Advanced step " << step << " in " << ts2 << " seconds\n"; } @@ -988,7 +988,7 @@ void main_driver(const char* argv) statsCount, geom); } statsCount++; - if (step%1 == 0) { + if (step%100 == 0) { amrex::Print() << "Mean Density: " << ComputeSpatialMean(cu, 0) << " Mean Momentum (x):" << ComputeSpatialMean(cumom[0], 0) << " Mean Energy:" << ComputeSpatialMean(cu, 4) << "\n"; } @@ -1249,72 +1249,72 @@ void main_driver(const char* argv) } } - // reservoir debug output - Box dom(geom.Domain()); - - for ( MFIter mfi(cu); mfi.isValid(); ++mfi) { - - const Box& bx = mfi.validbox(); - const auto lo = amrex::lbound(bx); - const auto hi = amrex::ubound(bx); - - AMREX_D_TERM(Array4 const& xmom = cumom[0].array(mfi);, - Array4 const& ymom = cumom[1].array(mfi);, - Array4 const& zmom = cumom[2].array(mfi);); - - const Array4& cufab = cu.array(mfi); - const Array4& primfab = prim.array(mfi); - - // Reservoir in LO X - if ((bc_mass_lo[0] == 4) and (bx.smallEnd(0) <= dom.smallEnd(0))) { - for (auto k = lo.z; k <= hi.z; ++k) { - for (auto j = lo.y; j <= hi.y; ++j) { - for (auto i = lo.x; i <= hi.x; ++i) { - if (i == dom.smallEnd(0) and (j==0) and (k==0)) { - Real dens = cufab(i,j,k,0); - Real en = cufab(i,j,k,4); - Real rho1 = cufab(i,j,k,5); - Real rho2 = cufab(i,j,k,6); - Real temp = primfab(i,j,k,4); - Real press = primfab(i,j,k,5); - Real moment = xmom(i,j,k); - if (ParallelDescriptor::IOProcessor()) { - outfilereslo << dens << " " << en << " " << rho1 << " " << rho2 << " " << temp << " " << press << " " << moment << std::endl; - } - } - } - } - } - } - - // Reservoir in HI X - if ((bc_mass_hi[0] == 4) and (bx.bigEnd(0) >= dom.bigEnd(0))) { - for (auto k = lo.z; k <= hi.z; ++k) { - for (auto j = lo.y; j <= hi.y; ++j) { - for (auto i = lo.x; i <= hi.x; ++i) { - if (i == dom.bigEnd(0) and (j==0) and (k==0)) { - Real dens = cufab(i,j,k,0); - Real en = cufab(i,j,k,4); - Real rho1 = cufab(i,j,k,5); - Real rho2 = cufab(i,j,k,6); - Real temp = primfab(i,j,k,4); - Real press = primfab(i,j,k,5); - Real moment = xmom(i+1,j,k); - if (ParallelDescriptor::IOProcessor()) { - outfilereshi << dens << " " << en << " " << rho1 << " " << rho2 << " " << temp << " " << press << " " << moment << std::endl; - } - } - } - } - } - } - } +// // reservoir debug output +// Box dom(geom.Domain()); +// +// for ( MFIter mfi(cu); mfi.isValid(); ++mfi) { +// +// const Box& bx = mfi.validbox(); +// const auto lo = amrex::lbound(bx); +// const auto hi = amrex::ubound(bx); +// +// AMREX_D_TERM(Array4 const& xmom = cumom[0].array(mfi);, +// Array4 const& ymom = cumom[1].array(mfi);, +// Array4 const& zmom = cumom[2].array(mfi);); +// +// const Array4& cufab = cu.array(mfi); +// const Array4& primfab = prim.array(mfi); +// +// // Reservoir in LO X +// if ((bc_mass_lo[0] == 4) and (bx.smallEnd(0) <= dom.smallEnd(0))) { +// for (auto k = lo.z; k <= hi.z; ++k) { +// for (auto j = lo.y; j <= hi.y; ++j) { +// for (auto i = lo.x; i <= hi.x; ++i) { +// if (i == dom.smallEnd(0) and (j==0) and (k==0)) { +// Real dens = cufab(i,j,k,0); +// Real en = cufab(i,j,k,4); +// Real rho1 = cufab(i,j,k,5); +// Real rho2 = cufab(i,j,k,6); +// Real temp = primfab(i,j,k,4); +// Real press = primfab(i,j,k,5); +// Real moment = xmom(i,j,k); +// if (ParallelDescriptor::IOProcessor()) { +// outfilereslo << dens << " " << en << " " << rho1 << " " << rho2 << " " << temp << " " << press << " " << moment << std::endl; +// } +// } +// } +// } +// } +// } +// +// // Reservoir in HI X +// if ((bc_mass_hi[0] == 4) and (bx.bigEnd(0) >= dom.bigEnd(0))) { +// for (auto k = lo.z; k <= hi.z; ++k) { +// for (auto j = lo.y; j <= hi.y; ++j) { +// for (auto i = lo.x; i <= hi.x; ++i) { +// if (i == dom.bigEnd(0) and (j==0) and (k==0)) { +// Real dens = cufab(i,j,k,0); +// Real en = cufab(i,j,k,4); +// Real rho1 = cufab(i,j,k,5); +// Real rho2 = cufab(i,j,k,6); +// Real temp = primfab(i,j,k,4); +// Real press = primfab(i,j,k,5); +// Real moment = xmom(i+1,j,k); +// if (ParallelDescriptor::IOProcessor()) { +// outfilereshi << dens << " " << en << " " << rho1 << " " << rho2 << " " << temp << " " << press << " " << moment << std::endl; +// } +// } +// } +// } +// } +// } +// } // timer Real aux2 = ParallelDescriptor::second() - aux1; ParallelDescriptor::ReduceRealMax(aux2, ParallelDescriptor::IOProcessorNumber()); - if (step%1 == 0) { + if (step%100 == 0) { amrex::Print() << "Aux time (stats, struct fac, plotfiles) " << aux2 << " seconds\n"; } @@ -1329,7 +1329,7 @@ void main_driver(const char* argv) ParallelDescriptor::ReduceLongMin(min_fab_megabytes, IOProc); ParallelDescriptor::ReduceLongMax(max_fab_megabytes, IOProc); - if (step%1 == 0) { + if (step%100 == 0) { amrex::Print() << "High-water FAB megabyte spread across MPI nodes: [" << min_fab_megabytes << " ... " << max_fab_megabytes << "]\n"; } @@ -1340,15 +1340,15 @@ void main_driver(const char* argv) ParallelDescriptor::ReduceLongMin(min_fab_megabytes, IOProc); ParallelDescriptor::ReduceLongMax(max_fab_megabytes, IOProc); - if (step%1 == 0) { + if (step%100 == 0) { amrex::Print() << "Curent FAB megabyte spread across MPI nodes: [" << min_fab_megabytes << " ... " << max_fab_megabytes << "]\n"; } } if (ParallelDescriptor::IOProcessor()) outfile.close(); - if (ParallelDescriptor::IOProcessor()) outfilereslo.close(); - if (ParallelDescriptor::IOProcessor()) outfilereshi.close(); +// if (ParallelDescriptor::IOProcessor()) outfilereslo.close(); +// if (ParallelDescriptor::IOProcessor()) outfilereshi.close(); // timer Real stop_time = ParallelDescriptor::second() - strt_time; diff --git a/src_compressible_stag/timeStepStag.cpp b/src_compressible_stag/timeStepStag.cpp index f90f68f4..68ae65a6 100644 --- a/src_compressible_stag/timeStepStag.cpp +++ b/src_compressible_stag/timeStepStag.cpp @@ -311,11 +311,13 @@ void RK3stepStag(MultiFab& cu, geom, stoch_weights,dt); // add to the total continuum fluxes based on RK3 weight + Real aux1 = ParallelDescriptor::second(); if (do_reservoir) { - for (int d=0;d0) { MultiFab::LinComb(ranchem, @@ -409,6 +411,10 @@ void RK3stepStag(MultiFab& cu, BCMomTrans(cupmom[i], vel[i], geom, i); } + if (do_reservoir) { + ResetReservoirMom(cupmom, cumom_res, geom); // set momentum at the reservoir interface to its value from particle update + } + // Fill boundaries for conserved variables for (int d=0; d0) { MultiFab::LinComb(ranchem, @@ -588,6 +596,10 @@ void RK3stepStag(MultiFab& cu, BCMomTrans(cup2mom[i], vel[i], geom, i); } + if (do_reservoir) { + ResetReservoirMom(cup2mom, cumom_res, geom); // set momentum at the reservoir interface to its value from particle update + } + // Fill boundaries for conserved variables for (int d=0; d0) { MultiFab::LinComb(ranchem, @@ -762,23 +776,27 @@ void RK3stepStag(MultiFab& cu, BCMomNormal(cumom[i], vel[i], cu, geom, i); BCMomTrans(cumom[i], vel[i], geom, i); } - - ///////////////////////////////////////////////////// - // compute fluxes and momentum at the reservoir ///// - // over an intergration step dt ///////////////////// - // timer - Real aux1 = ParallelDescriptor::second(); + if (do_reservoir) { - ComputeFluxMomReservoir(cu0,prim0,vel0,cumom_res,faceflux_res,geom,dt); // compute fluxes and momentum from reservoir particle update ResetReservoirMom(cumom, cumom_res, geom); // set momentum at the reservoir interface to its value from particle update - ReFluxCons(cu, cu0, faceflux_res, faceflux_cont, geom, dt); // reflux the conservative qtys in the adjacent cell from reservoir flux - } - Real aux2 = ParallelDescriptor::second() - aux1; - ParallelDescriptor::ReduceRealMax(aux2, ParallelDescriptor::IOProcessorNumber()); - if (step%1 == 0) { - amrex::Print() << "Step: " << step << " Reservoir generator time: " << aux2 << " seconds\n"; } - ///////////////////////////////////////////////////// + +// ///////////////////////////////////////////////////// +// // compute fluxes and momentum at the reservoir ///// +// // over an intergration step dt ///////////////////// +// // timer +// Real aux1 = ParallelDescriptor::second(); +// if (do_reservoir) { +// ComputeFluxMomReservoir(cu0,prim0,vel0,cumom_res,faceflux_res,geom,dt); // compute fluxes and momentum from reservoir particle update +// ResetReservoirMom(cumom, cumom_res, geom); // set momentum at the reservoir interface to its value from particle update +// ReFluxCons(cu, cu0, faceflux_res, faceflux_cont, geom, dt); // reflux the conservative qtys in the adjacent cell from reservoir flux +// } +// Real aux2 = ParallelDescriptor::second() - aux1; +// ParallelDescriptor::ReduceRealMax(aux2, ParallelDescriptor::IOProcessorNumber()); +// if (step%1 == 0) { +// amrex::Print() << "Step: " << step << " Reservoir generator time: " << aux2 << " seconds\n"; +// } +// ///////////////////////////////////////////////////// // Fill boundaries for conserved variables for (int d=0; d