Skip to content

Commit

Permalink
Merge branch 'main' of github.com:AMReX-FHD/FHDeX into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jbbel committed Nov 13, 2023
2 parents 8f2d12f + aca47b4 commit fcdbf99
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 12 deletions.
14 changes: 8 additions & 6 deletions exec/hydro/Checkpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ void WriteCheckPoint(int step,
}
}

int comm_rank = 0;
int n_ranks = 1;
#if AMREX_USE_MPI
// C++ random number engine
// have each MPI process write its random number state to a different file
int comm_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank);

int n_ranks;
MPI_Comm_size(MPI_COMM_WORLD, &n_ranks);
#endif

// don't write out all the rng states at once (overload filesystem)
// one at a time write out the rng states to different files, one for each MPI rank
Expand Down Expand Up @@ -195,13 +196,14 @@ void ReadCheckPoint(int& step,
#endif
}

int comm_rank = 0;
int n_ranks = 1;
#if AMREX_USE_MPI
// C++ random number engine
// each MPI process reads in its own file
int comm_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank);

int n_ranks;
MPI_Comm_size(MPI_COMM_WORLD, &n_ranks);
#endif

if (seed < 0) {

Expand Down
2 changes: 0 additions & 2 deletions exec/hydro/inputs_incomp_equil_fluct_2d
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
bc_vel_lo = -1 -1
bc_vel_hi = -1 -1

algorithm_type = 2



mg_verbose = 0 # multigrid verbosity
Expand Down
2 changes: 2 additions & 0 deletions src_analysis/StructFact.H
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
# endif
#else
#include <fftw3.h>
#if AMREX_USE_MPI
#include <fftw3-mpi.h>
#endif
#endif

#include <AMReX_GpuComplex.H>

Expand Down
6 changes: 6 additions & 0 deletions src_compressible/compressible_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ AMREX_GPU_MANAGED int compressible::do_2D;
AMREX_GPU_MANAGED int compressible::all_correl;
AMREX_GPU_MANAGED int compressible::nspec_surfcov = 0;
AMREX_GPU_MANAGED bool compressible::do_reservoir = false;
AMREX_GPU_MANAGED amrex::Real compressible::zeta_ratio = -1.0;

void InitializeCompressibleNamespace()
{
Expand Down Expand Up @@ -70,6 +71,11 @@ void InitializeCompressibleNamespace()
do_reservoir = true;
}

// bulk viscosity ratio
pp.query("zeta_ratio",zeta_ratio);
if ((amrex::Math::abs(visc_type) == 3) and (zeta_ratio < 0.0)) amrex::Abort("need non-negative zeta_ratio (ratio of bulk to shear viscosity) for visc_type = 3 (use bulk viscosity)");
if ((amrex::Math::abs(visc_type) == 3) and (zeta_ratio >= 0.0)) amrex::Print() << "bulk viscosity model selected; bulk viscosity ratio is: " << zeta_ratio << "\n";

return;
}

Expand Down
1 change: 1 addition & 0 deletions src_compressible/compressible_namespace.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace compressible {
extern AMREX_GPU_MANAGED int all_correl;
extern AMREX_GPU_MANAGED int nspec_surfcov;
extern AMREX_GPU_MANAGED bool do_reservoir;
extern AMREX_GPU_MANAGED amrex::Real zeta_ratio;

}

6 changes: 6 additions & 0 deletions src_compressible/transCoeffs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ void calculateTransportCoeffs(const MultiFab& prim_in,
}
}

// set bulk viscosity
if (amrex::Math::abs(visc_type) == 3) {
zeta(i,j,k) = zeta_ratio * eta(i,j,k);
}


});
}
}
3 changes: 2 additions & 1 deletion src_compressible_stag/compressible_functions_stag.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ void WritePlotFileStag(int step,
const MultiFab& surfcovMeans,
const MultiFab& surfcovVars,
const MultiFab& eta,
const MultiFab& kappa);
const MultiFab& kappa,
const MultiFab& zeta);

void WriteSpatialCross3D(const Vector<Real>& spatialCross, int step, const Geometry& geom, const int ncross);

Expand Down
4 changes: 2 additions & 2 deletions src_compressible_stag/main_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ void main_driver(const char* argv)

if (plot_int > 0) {
WritePlotFileStag(0, 0.0, geom, cu, cuMeans, cuVars, cumom, cumomMeans, cumomVars,
prim, primMeans, primVars, vel, velMeans, velVars, coVars, surfcov, surfcovMeans, surfcovVars, eta, kappa);
prim, primMeans, primVars, vel, velMeans, velVars, coVars, surfcov, surfcovMeans, surfcovVars, eta, kappa, zeta);
#if defined(TURB)
if (turbForcing > 0) {
EvaluateWritePlotFileVelGrad(0, 0.0, geom, vel, vel_decomp);
Expand Down Expand Up @@ -1145,7 +1145,7 @@ void main_driver(const char* argv)
//yzAverage(cuMeans, cuVars, primMeans, primVars, spatialCross,
// cuMeansAv, cuVarsAv, primMeansAv, primVarsAv, spatialCrossAv);
WritePlotFileStag(step, time, geom, cu, cuMeans, cuVars, cumom, cumomMeans, cumomVars,
prim, primMeans, primVars, vel, velMeans, velVars, coVars, surfcov, surfcovMeans, surfcovVars, eta, kappa);
prim, primMeans, primVars, vel, velMeans, velVars, coVars, surfcov, surfcovMeans, surfcovVars, eta, kappa, zeta);

#if defined(TURB)
if (turbForcing > 0) {
Expand Down
14 changes: 13 additions & 1 deletion src_compressible_stag/writePlotFileStag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ void WritePlotFileStag(int step,
const amrex::MultiFab& surfcovMeans,
const amrex::MultiFab& surfcovVars,
const amrex::MultiFab& eta,
const amrex::MultiFab& kappa)
const amrex::MultiFab& kappa,
const amrex::MultiFab& zeta)
{
BL_PROFILE_VAR("writePlotFileStag()",writePlotFileStag);

Expand All @@ -38,11 +39,13 @@ void WritePlotFileStag(int step,
// prim: [vx, vy, vz, T, p, Yk, Xk] -- 5 + 2*nspecies
// shifted [vx, vy, vz] -- 3
// eta, kappa -- 2
// zeta -- 1 (only when visc_type = 3)
nplot += nvars;
nplot += 3;
nplot += 5 + 2*nspecies;
nplot += 3;
nplot += 2;
if (amrex::Math::abs(visc_type) == 3) nplot += 1;

if (nspec_surfcov>0) nplot += nspec_surfcov;

Expand Down Expand Up @@ -132,6 +135,14 @@ void WritePlotFileStag(int step,
amrex::MultiFab::Copy(plotfile,kappa,0,cnt,numvars,0);
cnt+=numvars;

// instantaneous
// zeta -- 1
if (amrex::Math::abs(visc_type) == 3) {
numvars = 1;
amrex::MultiFab::Copy(plotfile,zeta,0,cnt,numvars,0);
cnt+=numvars;
}

// instantaneous
// surfcov -- nspec_surfcov
if (nspec_surfcov>0) {
Expand Down Expand Up @@ -277,6 +288,7 @@ void WritePlotFileStag(int step,

varNames[cnt++] = "eta";
varNames[cnt++] = "kappa";
if (amrex::Math::abs(visc_type) == 3) varNames[cnt++] = "zeta";

if (nspec_surfcov>0) {
x = "surfcov_";
Expand Down

0 comments on commit fcdbf99

Please sign in to comment.