Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Reduce the number of fillPatch operations (#191)
Browse files Browse the repository at this point in the history
* Change signature of transport kernels to use Array4<const Real> on T.

* Start reducing the number of FillPatch operation. Transport calc*
now uses class state since only 1 ghost cell is needed.

* Remove part of the FPI in compute_diffdiff_term.

* Comb. through the code to remove some more FillPatch operations.
Change _OPENMP to AMREX_USE_OMP.
Use const_array as much as possible.

* Forgot a couple of VisMF.

* A couple more const Refs of state data.

* Slight re-order of advance_setup operations.
esclapez authored Aug 23, 2021
1 parent 4ba1044 commit a6a8692
Showing 3 changed files with 936 additions and 979 deletions.
10 changes: 6 additions & 4 deletions Source/PeleLM.H
Original file line number Diff line number Diff line change
@@ -340,16 +340,17 @@ public:

void adjust_spec_diffusion_fluxes (amrex::MultiFab* const * flux,
const amrex::MultiFab& S,
const amrex::BCRec& bc,
amrex::Real time);
const amrex::BCRec& bc);


void calcDiffusivity_Wbar (const amrex::Real time);

void calc_dpdt (amrex::Real time,
amrex::Real dt,
amrex::MultiFab& dpdt);

void checkTimeStep (amrex::Real dt);
void checkTimeStep (amrex::Real a_time,
amrex::Real a_dt);

void compute_differential_diffusion_fluxes (const amrex::MultiFab& S,
const amrex::MultiFab* Scrse,
@@ -387,7 +388,8 @@ public:
amrex::MultiFab& P,
int pComp);

void compute_Wbar_fluxes(amrex::Real time,
void compute_Wbar_fluxes(const amrex::MultiFab &a_scalars,
amrex::Real time,
int inc_flag,
amrex::Real inc_coeff);

1,878 changes: 915 additions & 963 deletions Source/PeleLM.cpp

Large diffs are not rendered by default.

27 changes: 15 additions & 12 deletions Source/PeleLM_K.H
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ reactionRateRhoY(int i, int j, int k,
amrex::Array4<const amrex::Real> const& rhoY,
amrex::Array4<const amrex::Real> const& rhoH,
amrex::Array4<const amrex::Real> const& T,
amrex::Array4<int> const& mask,
amrex::Array4<const int> const& mask,
amrex::Array4< amrex::Real> const& rhoYdot) noexcept
{
using namespace amrex::literals;
@@ -425,16 +425,16 @@ getTransportCoeff(int i, int j, int k,
for (int n = 0; n < NUM_SPECIES; n++) {
y[n] = rhoY(i,j,k,n) * rhoinv;
}
rho *= 1.0e-3_rt; // MKS -> CGS conversion
amrex::Real Tloc = T(i,j,k); // So that we can use const_array

amrex::Real Wbar = 0.0_rt;
eos.Y2WBAR(y, Wbar);

rho *= 1.0e-3_rt; // MKS -> CGS conversion
amrex::Real rhoDi_cgs[NUM_SPECIES] = {0.0};
amrex::Real lambda_cgs = 0.0_rt;
amrex::Real mu_cgs = 0.0_rt;
amrex::Real dummy_xi = 0.0_rt;
amrex::Real Tloc = T(i,j,k);

bool get_xi = false;
bool get_mu = true;
@@ -459,7 +459,7 @@ getTransportCoeffUnityLe(int i, int j, int k,
amrex::Real const& ScInv,
amrex::Real const& PrInv,
amrex::Array4<const amrex::Real> const& rhoY,
amrex::Array4< amrex::Real> const& T,
amrex::Array4<const amrex::Real> const& T,
amrex::Array4< amrex::Real> const& rhoDi,
amrex::Array4< amrex::Real> const& lambda,
amrex::Array4< amrex::Real> const& mu,
@@ -479,8 +479,9 @@ getTransportCoeffUnityLe(int i, int j, int k,
for (int n = 0; n < NUM_SPECIES; n++) {
y[n] = rhoY(i,j,k,n) * rhoinv;
}
rho *= 1.0e-3_rt; // MKS -> CGS conversion
amrex::Real Tloc = T(i,j,k); // So that we can use const_array

rho *= 1.0e-3_rt; // MKS -> CGS conversion
amrex::Real rhoDi_cgs[NUM_SPECIES] = {0.0};
amrex::Real lambda_cgs = 0.0_rt;
amrex::Real mu_cgs = 0.0_rt;
@@ -491,7 +492,7 @@ getTransportCoeffUnityLe(int i, int j, int k,
bool get_lam = false;
bool get_Ddiag = false;
auto trans = pele::physics::PhysicsType::transport();
trans.transport(get_xi, get_mu, get_lam, get_Ddiag, T(i,j,k),
trans.transport(get_xi, get_mu, get_lam, get_Ddiag, Tloc,
rho, y, rhoDi_cgs, mu_cgs, dummy_xi, lambda_cgs, trans_parm);

mu(i,j,k) = mu_cgs * 1.0e-1_rt; // CGS -> MKS conversions
@@ -532,7 +533,7 @@ AMREX_FORCE_INLINE
void
getVelViscosity(int i, int j, int k,
amrex::Array4<const amrex::Real> const& rhoY,
amrex::Array4< amrex::Real> const& T,
amrex::Array4<const amrex::Real> const& T,
amrex::Array4< amrex::Real> const& mu,
pele::physics::transport::TransParm<pele::physics::PhysicsType::eos_type,
pele::physics::PhysicsType::transport_type> const* trans_parm) noexcept
@@ -549,8 +550,9 @@ getVelViscosity(int i, int j, int k,
for (int n = 0; n < NUM_SPECIES; n++) {
y[n] = rhoY(i,j,k,n) * rhoinv;
}

rho *= 1.0e-3_rt; // MKS -> CGS conversion
amrex::Real Tloc = T(i,j,k); // So that we can use const_array

amrex::Real dummy_rhoDi[NUM_SPECIES] = {0.0};
amrex::Real dummy_lambda = 0.0_rt;
amrex::Real mu_cgs = 0.0_rt;
@@ -561,7 +563,7 @@ getVelViscosity(int i, int j, int k,
bool get_lam = false;
bool get_Ddiag = false;
auto trans = pele::physics::PhysicsType::transport();
trans.transport(get_xi, get_mu, get_lam, get_Ddiag, T(i,j,k),
trans.transport(get_xi, get_mu, get_lam, get_Ddiag, Tloc,
rho, y, dummy_rhoDi, mu_cgs, dummy_xi, dummy_lambda, trans_parm);

// Do CGS -> MKS conversions
@@ -573,7 +575,7 @@ AMREX_FORCE_INLINE
void
getConductivity(int i, int j, int k,
amrex::Array4<const amrex::Real> const& rhoY,
amrex::Array4< amrex::Real> const& T,
amrex::Array4<const amrex::Real> const& T,
amrex::Array4< amrex::Real> const& lambda,
pele::physics::transport::TransParm<pele::physics::PhysicsType::eos_type,
pele::physics::PhysicsType::transport_type> const* trans_parm) noexcept
@@ -590,8 +592,9 @@ getConductivity(int i, int j, int k,
for (int n = 0; n < NUM_SPECIES; n++) {
y[n] = rhoY(i,j,k,n) * rhoinv;
}

rho *= 1.0e-3_rt; // MKS -> CGS conversion
amrex::Real Tloc = T(i,j,k); // So that we can use const_array

amrex::Real dummy_rhoDi[NUM_SPECIES] = {0.0};
amrex::Real lambda_cgs = 0.0_rt;
amrex::Real dummy_mu = 0.0_rt;
@@ -602,7 +605,7 @@ getConductivity(int i, int j, int k,
bool get_lam = true;
bool get_Ddiag = false;
auto trans = pele::physics::PhysicsType::transport();
trans.transport(get_xi, get_mu, get_lam, get_Ddiag, T(i,j,k),
trans.transport(get_xi, get_mu, get_lam, get_Ddiag, Tloc,
rho, y, dummy_rhoDi, dummy_mu, dummy_xi, lambda_cgs, trans_parm);

// Do CGS -> MKS conversions

0 comments on commit a6a8692

Please sign in to comment.