Skip to content

Commit

Permalink
Update PelePhysics and add path to new utility (#435)
Browse files Browse the repository at this point in the history
* Update PelePhysics and add new utility to Make.PeleLMeX

* Add PelePhysics utilities to CMake

* Test PelePhysics:tidy against clang-tidy.

* Update PelePhysics submodule
  • Loading branch information
dmontgomeryNREL authored Nov 8, 2024
1 parent 86c4721 commit da52f28
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CMake/BuildPelePhysicsLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ function(build_pele_physics_lib pele_physics_lib_name)
)
target_include_directories(${pele_physics_lib_name} PUBLIC ${PELE_PHYSICS_UTILITY_DIR}/PMF)

target_sources(${pele_physics_lib_name}
PRIVATE
${PELE_PHYSICS_UTILITY_DIR}/Utilities/Utilities.H
${PELE_PHYSICS_UTILITY_DIR}/Utilities/UnitConversions.H
)
target_include_directories(${pele_physics_lib_name} PUBLIC ${PELE_PHYSICS_UTILITY_DIR}/Utilities)

target_sources(${pele_physics_lib_name}
PRIVATE
${AMREX_SUNDIALS_DIR}/AMReX_Sundials.H
Expand Down
1 change: 1 addition & 0 deletions Exec/Make.PeleLMeX
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ ChemDir = Mechanisms/$(Chemistry_Model)

PPdirs := Source/Utility/PMF Source/Utility/TurbInflow Source/Utility/PltFileManager
PPdirs += Source/Utility/Diagnostics Source/Utility/BlackBoxFunction
PPdirs += Source/Utility/Utilities
PPdirs += Source $(ChemDir) Source/Reactions Source/Eos Source/Transport
Bpack += $(foreach dir, $(PPdirs), $(PELE_PHYSICS_HOME)/$(dir)/Make.package)
Blocs += $(foreach dir, $(PPdirs), $(PELE_PHYSICS_HOME)/$(dir))
Expand Down
1 change: 1 addition & 0 deletions Source/PeleLMeX.H
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <PMFData.H>
#include <turbinflow.H>
#include <ReactorBase.H>
#include <Utilities.H>

// AMReX-Hydro lib
#include <hydro_MacProjector.H>
Expand Down
17 changes: 10 additions & 7 deletions Source/PeleLMeX_K.H
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include <mechanism.H>
#include <PelePhysics.H>

namespace m2c = pele::physics::utilities::mks2cgs;
namespace c2m = pele::physics::utilities::cgs2mks;

template <typename EOSType>
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void
getTransportCoeff(
Expand Down Expand Up @@ -47,7 +50,7 @@ getTransportCoeff(
amrex::Real Wbar = 0.0_rt;
eos.Y2WBAR(y, Wbar);

rho *= 1.0e-3_rt; // MKS -> CGS conversion
rho = m2c::Rho(rho); // 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;
Expand All @@ -66,32 +69,32 @@ getTransportCoeff(
chi_loc, mu_cgs, dummy_xi, lambda_cgs, trans_parm);

// Do CGS -> MKS conversions
mu(i, j, k) = mu_cgs * 1.0e-1_rt;
mu(i, j, k) = c2m::Mu(mu_cgs);
if (do_fixed_Pr && do_fixed_Le) { // fixed Pr and Le, transport all dependent
// on visc
amrex::Real cpmix = 0.0_rt;
eos.TY2Cp(T(i, j, k), y, cpmix);
lambda(i, j, k) = PrInv * cpmix * mu_cgs * 1.0e-5_rt;
lambda(i, j, k) = PrInv * c2m::Cp(cpmix) * c2m::Mu(mu_cgs);
amrex::Real ScInv = PrInv * LeInv;
for (int n = 0; n < NUM_SPECIES; n++) {
rhoDi(i, j, k, n) = ScInv * mu_cgs * 1.0e-1_rt;
rhoDi(i, j, k, n) = ScInv * c2m::Mu(mu_cgs);
}
} else if (do_fixed_Pr) { // fixed Pr, still use species diffs
amrex::Real cpmix = 0.0_rt;
eos.TY2Cp(T(i, j, k), y, cpmix);
lambda(i, j, k) = PrInv * cpmix * mu_cgs * 1.0e-5_rt;
lambda(i, j, k) = PrInv * c2m::Cp(cpmix) * c2m::Mu(mu_cgs);
for (int n = 0; n < NUM_SPECIES; n++) {
rhoDi(i, j, k, n) = rhoDi_cgs[n] * Wbar * mwtinv[n] * 1.0e-1_rt;
}
} else if (do_fixed_Le) { // fixed Le, still use thermal cond
lambda(i, j, k) = lambda_cgs * 1.0e-5_rt;
lambda(i, j, k) = c2m::Lambda(lambda_cgs);
amrex::Real cpmix = 0.0_rt;
eos.TY2Cp(T(i, j, k), y, cpmix);
for (int n = 0; n < NUM_SPECIES; n++) {
rhoDi(i, j, k, n) = lambda_cgs * 1.0e-1_rt * LeInv / cpmix;
}
} else { // full MA model, with Soret if needed
lambda(i, j, k) = lambda_cgs * 1.0e-5_rt;
lambda(i, j, k) = c2m::Lambda(lambda_cgs);
for (int n = 0; n < NUM_SPECIES; n++) {
rhoDi(i, j, k, n) = rhoDi_cgs[n] * Wbar * mwtinv[n] * 1.0e-1_rt;
if (do_soret) {
Expand Down

0 comments on commit da52f28

Please sign in to comment.