Skip to content

Commit

Permalink
WIP debugging initialization and forcing from met_em files.
Browse files Browse the repository at this point in the history
  • Loading branch information
wiersema1 committed Oct 12, 2023
1 parent 3a745c6 commit c87d821
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 136 deletions.
6 changes: 4 additions & 2 deletions Exec/DevTests/MetGrid/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ USE_ASSERTION = TRUE

USE_NETCDF = TRUE

#USE_MOISTURE = FALSE
USE_MOISTURE = TRUE
USE_MOISTURE = FALSE
#USE_MOISTURE = TRUE

USE_WARM_NO_PRECIP = TRUE

# GNU Make
Bpack := ./Make.package
Expand Down
2 changes: 1 addition & 1 deletion Exec/DevTests/MetGrid/inputs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ erf.check_int = 100 # number of timesteps between checkpoints
# PLOTFILES
erf.plot_file_1 = plt # prefix of plotfile name
erf.plot_int_1 = 1 # number of timesteps between plotfiles
erf.plot_vars_1 = density dens_hse rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta z_phys mapfac pres_hse pert_pres KE QKE
erf.plot_vars_1 = RhoQv density dens_hse rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta z_phys mapfac pres_hse pert_pres KE QKE

# SOLVER CHOICE
erf.alpha_T = 1.0
Expand Down
27 changes: 24 additions & 3 deletions Source/BoundaryConditions/BoundaryConditions_metgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ ERF::fill_from_metgrid (const Vector<MultiFab*>& mfs, const Real time)
amrex::Real oma = 1.0 - alpha;

// Flags for read vars and index mapping
#if defined(ERF_USE_MOISTURE) || defined(ERF_USE_WARM_NO_PRECIP)
// See IndexDefines.H
#if defined(ERF_USE_MOISTURE)
// Cons includes [Rho RhoTheta RhoKE RhoQKE RhoScalar RhoQt RhoQp NumVars]
Vector<int> cons_read = {1, 1, 0, 0, 0, 1, 0};
Vector<int> cons_map = {MetGridBdyVars::R, MetGridBdyVars::T, 0, 0, 0, MetGridBdyVars::QV, 0};
#elif defined(ERF_USE_WARM_NO_PRECIP)
// Cons includes [Rho RhoTheta RhoKE RhoQKE RhoScalar RhoQv RhoQc NumVars]
Vector<int> cons_read = {1, 1, 0, 0, 0, 1, 0};
Vector<int> cons_map = {MetGridBdyVars::R, MetGridBdyVars::T, 0, 0, 0, MetGridBdyVars::QV, 0};
# else
Vector<int> cons_read = {1, 1, 0, 0, 0}; // R, RT, RKE, RQKE, RS
Vector<int> cons_map = {MetGridBdyVars::R, MetGridBdyVars::T, 0, 0, 0}; // R, RT, RKE, RQKE, RS
// Cons includes [Rho RhoTheta RhoKE RhoQKE RhoScalar NumVars]
Vector<int> cons_read = {1, 1, 0, 0, 0};
Vector<int> cons_map = {MetGridBdyVars::R, MetGridBdyVars::T, 0, 0, 0};
#endif

Vector<Vector<int>> is_read;
Expand Down Expand Up @@ -75,6 +82,20 @@ ERF::fill_from_metgrid (const Vector<MultiFab*>& mfs, const Real time)
int ivar = ind_map[var_idx][comp_idx];
IntVect ng_vect = mf.nGrowVect(); ng_vect[2] = 0;

if (ivar == MetGridBdyVars::U) {
amrex::Print() << "fill_from_metgrid U var_idx=" << var_idx << " comp_idx=" << comp_idx << " ivar=" << ivar << std::endl;
} else if (ivar == MetGridBdyVars::V) {
amrex::Print() << "fill_from_metgrid V var_idx=" << var_idx << " comp_idx=" << comp_idx << " ivar=" << ivar << std::endl;
} else if (ivar == MetGridBdyVars::R) {
amrex::Print() << "fill_from_metgrid R var_idx=" << var_idx << " comp_idx=" << comp_idx << " ivar=" << ivar << std::endl;
} else if (ivar == MetGridBdyVars::T) {
amrex::Print() << "fill_from_metgrid T var_idx=" << var_idx << " comp_idx=" << comp_idx << " ivar=" << ivar << std::endl;
} else if (ivar == MetGridBdyVars::QV) {
amrex::Print() << "fill_from_metgrid QV var_idx=" << var_idx << " comp_idx=" << comp_idx << " ivar=" << ivar << std::endl;
} else {
amrex::Print() << "fill_from_metgrid UNKNOWN" << std::endl;
}

// We have data at fixed time intervals we will call dT
// Then to interpolate, given time, we can define n = (time/dT)
// and alpha = (time - n*dT) / dT, then we define the data at time
Expand Down
Loading

0 comments on commit c87d821

Please sign in to comment.