Skip to content

Commit

Permalink
framework for entrainment factors for unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
baperry2 committed Oct 15, 2024
1 parent ae2375d commit be7e1f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Source/PBL/ERF_ComputeDiffusionSrcYSU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ DiffusionSrcForStateYSU (const Box& bx, const Box& domain,

// For now, only theta is diffused. TODO: Moisture
int eddy_diff_idz[1] {EddyDiff::Theta_v};
int entrainment_idz[1] {EddyDiff::Theta_ent_YSU};
if (num_comp != 1 ) {
Abort("DiffusionSrcForStateYSU(): num_comp must be 1");
} else if ( start_comp != RhoTheta_comp) {
Expand All @@ -69,10 +70,14 @@ DiffusionSrcForStateYSU (const Box& bx, const Box& domain,
const int qty_index = start_comp + n;
const int prim_index = qty_index - 1;
const int diff_idx = eddy_diff_idz[prim_index];
const int entrainment_idx = eddy_diff_idz[prim_index];

const amrex::Real rhoAlpha = 0.5 * ( mu_turb(i, j, k , diff_idx)
+ mu_turb(i, j, k-1, diff_idx) );

const amrex::Real entrainment = 0.5 * ( mu_turb(i, j, k , entrainment_idx)
+ mu_turb(i, j, k-1, entrainment_idx) );

Real met_h_zeta = az(i,j,k);

Real GradCz;
Expand Down Expand Up @@ -103,7 +108,7 @@ DiffusionSrcForStateYSU (const Box& bx, const Box& domain,
// Always True for now
if (qty_index == RhoTheta_comp) {
if (!most_on_zlo) {
zflux(i,j,k,qty_index) = -rhoAlpha * GradCz / met_h_zeta;
zflux(i,j,k,qty_index) = -rhoAlpha * GradCz / met_h_zeta - entrainment;
hfx_z(i,j,k) = zflux(i,j,k,qty_index);
} else {
zflux(i,j,k,qty_index) = hfx_z(i,j,0);
Expand Down
4 changes: 4 additions & 0 deletions Source/PBL/ERF_ComputeDiffusivityYSU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ ComputeDiffusivityYSU (const MultiFab& xvel,
K_turb(i,j,k,EddyDiff::Theta_v) = std::max(std::min(K_turb(i,j,k,EddyDiff::Theta_v) ,rhoKmax), rhoKmin);
K_turb(i,j,k,EddyDiff::PBL_lengthscale) = pblh_arr(i,j,0);

// Entrainment factors: placeholder for now
K_turb(i,j,k,EddyDiff::Mom_ent_YSU) = 0.0;
K_turb(i,j,k,EddyDiff::Theta_ent_YSU) = 0.0;

});

// HACK set bottom ghost cell to 1st cell
Expand Down

0 comments on commit be7e1f2

Please sign in to comment.