Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Brunt-Vaisala freq into Smag model #1625

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
73d7f9e
Add Brunt-Vaisala freq into Smag.
AMLattanzi May 17, 2024
8ff89a4
This is a mess of everything.
AMLattanzi May 20, 2024
0484394
Unused var and GPU funs.
AMLattanzi May 21, 2024
1770f3c
Fix GPU copy oops.
AMLattanzi May 21, 2024
67dc7a6
Add Deardorff and clean up unused.
AMLattanzi May 21, 2024
498deef
Clean up MOST.
May 22, 2024
1abacd1
Merge branch 'development' into SmagBF
AMLattanzi May 28, 2024
b4fd1f0
Merge branch 'development' into SmagBF
AMLattanzi May 28, 2024
26cf134
Follow WRF document more precisely.
AMLattanzi May 28, 2024
fbb6318
Merge branch 'development' into SmagBF
AMLattanzi Jun 3, 2024
82cb3da
Merge branch 'development' into SmagBF
AMLattanzi Jun 7, 2024
973f4f2
Merge branch 'development' into SmagBF
AMLattanzi Jun 10, 2024
c41afbb
Merge branch 'development' into SmagBF
AMLattanzi Jun 10, 2024
f7185a9
Debug compile clean up.
AMLattanzi Jun 10, 2024
4cd1f53
Merge branch 'development' into SmagBF
AMLattanzi Jun 12, 2024
a2e70e2
clean up botched merge.
AMLattanzi Jun 12, 2024
e7dacb6
Merge branch 'development' into SmagBF
AMLattanzi Jun 12, 2024
396472b
Remove BV frequency call but leave code in place.
AMLattanzi Jun 13, 2024
c4da542
Merge branch 'development' into SmagBF
AMLattanzi Jun 17, 2024
e6fe038
Merge branch 'development' into SmagBF
AMLattanzi Jun 18, 2024
91827f9
Merge branch 'development' into SmagBF
AMLattanzi Jun 20, 2024
3bbd357
Merge branch 'development' into SmagBF
AMLattanzi Jun 21, 2024
bef722f
Correct eddy viscosity near MOST wall.
AMLattanzi Jun 21, 2024
1c1cb2b
Merge branch 'development' into SmagBF
AMLattanzi Jun 21, 2024
49ff376
Merge branch 'development' into SmagBF
AMLattanzi Jun 24, 2024
11e39d5
Merge branch 'development' into SmagBF
AMLattanzi Jun 25, 2024
ce006a0
Merge branch 'development' into SmagBF
AMLattanzi Jun 25, 2024
fe5d435
Merge branch 'development' into SmagBF
AMLattanzi Jun 26, 2024
fe5a9d7
Merge branch 'development' into SmagBF
AMLattanzi Jul 9, 2024
a10f8b2
Merge branch 'development' into SmagBF
AMLattanzi Jul 11, 2024
aa12cf6
Clean up for workflow.
AMLattanzi Jul 11, 2024
003c95f
Merge branch 'development' into SmagBF
AMLattanzi Jul 18, 2024
4086cb9
Merge branch 'development' into SmagBF
AMLattanzi Jul 22, 2024
b951582
Merge branch 'development' into SmagBF
AMLattanzi Jul 22, 2024
4c4cd2a
Merge branch 'development' into SmagBF
AMLattanzi Jul 23, 2024
59f60ae
Merge branch 'development' into SmagBF
AMLattanzi Jul 24, 2024
96f7e20
Merge branch 'development' into SmagBF
AMLattanzi Jul 25, 2024
3c80aec
Merge branch 'development' into SmagBF
AMLattanzi Jul 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Docs/sphinx_doc/MOST.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ In ERF, when the MOST boundary condition is applied, velocity and temperature in
.. math::

(\rho \theta)_{z} = \frac{(\rho \theta)_{i,j,1} - (\rho \theta)_{i,j,0}}{\Delta z}

(\rho \theta)_{i,j,-n} = (\rho \theta)_{i,j,0} - (\rho \theta)_{z} n \Delta z .

Finally, it must be noted that complex terrain will modify the surface normal and tangent vectors. Consequently, the MOST implementation with terrain will require local vector rotations. While the ERF dycore accounts for
Expand Down
3 changes: 2 additions & 1 deletion Exec/DevTests/Bomex/input_SAM
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ erf.most.tstar = 8.0e-3 # theta flux
erf.most.qstar = 5.2e-5 # qv flux
erf.most.z0 = 0.1
erf.most.zref = 20.0
erf.use_explicit_most = true

# NOTE: This should have a qv grad too (use hoextrapcc?!)
zhi.type = "SlipWall"
Expand Down Expand Up @@ -58,7 +59,7 @@ erf.dryscal_vert_adv_type = WENOZ5
erf.moistscal_horiz_adv_type = WENOZ5
erf.moistscal_vert_adv_type = WENOZ5

erf.moisture_model = "SAM"
erf.moisture_model = "Kessler"

erf.molec_diff_type = "None"

Expand Down
2 changes: 2 additions & 0 deletions Source/BoundaryConditions/ABLMost.H
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ public:
amrex::MultiFab* xzmom_flux, amrex::MultiFab* zxmom_flux,
amrex::MultiFab* yzmom_flux, amrex::MultiFab* zymom_flux,
amrex::MultiFab* heat_flux,
amrex::MultiFab* qv_flux,
amrex::MultiFab* z_phys);

template<typename FluxCalc>
Expand All @@ -261,6 +262,7 @@ public:
amrex::MultiFab* xzmom_flux, amrex::MultiFab* zxmom_flux,
amrex::MultiFab* yzmom_flux, amrex::MultiFab* zymom_flux,
amrex::MultiFab* heat_flux,
amrex::MultiFab* qv_flux,
amrex::MultiFab* z_phys,
const amrex::Real& dz_no_terrain,
const FluxCalc& flux_comp);
Expand Down
35 changes: 23 additions & 12 deletions Source/BoundaryConditions/ABLMost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ ABLMost::impose_most_bcs (const int& lev,
MultiFab* xzmom_flux, MultiFab* zxmom_flux,
MultiFab* yzmom_flux, MultiFab* zymom_flux,
MultiFab* heat_flux,
MultiFab* qv_flux,
MultiFab* z_phys)
{
const int klo = 0;
Expand All @@ -200,20 +201,23 @@ ABLMost::impose_most_bcs (const int& lev,
xzmom_flux, zxmom_flux,
yzmom_flux, zymom_flux,
heat_flux,
qv_flux,
z_phys, m_geom[lev].CellSize(2), flux_comp);
} else if (flux_type == FluxCalcType::DONELAN) {
donelan_flux flux_comp(klo);
compute_most_bcs(lev, mfs,
xzmom_flux, zxmom_flux,
yzmom_flux, zymom_flux,
heat_flux,
qv_flux,
z_phys, m_geom[lev].CellSize(2), flux_comp);
} else {
custom_flux flux_comp(klo);
compute_most_bcs(lev, mfs,
xzmom_flux, zxmom_flux,
yzmom_flux, zymom_flux,
heat_flux,
qv_flux,
z_phys, m_geom[lev].CellSize(2), flux_comp);
}
}
Expand All @@ -234,6 +238,7 @@ ABLMost::compute_most_bcs (const int& lev,
MultiFab* xzmom_flux, MultiFab* zxmom_flux,
MultiFab* yzmom_flux, MultiFab* zymom_flux,
MultiFab* heat_flux,
MultiFab* qv_flux,
MultiFab* z_phys,
const Real& dz_no_terrain,
const FluxCalc& flux_comp)
Expand All @@ -242,7 +247,6 @@ ABLMost::compute_most_bcs (const int& lev,
const int icomp = 0;
for (MFIter mfi(*mfs[0]); mfi.isValid(); ++mfi)
{
// TODO: No LSM lateral ghost cells, should this change?
// Valid CC box
Box vbx = mfi.validbox(); vbx.makeSlab(2,klo-1);

Expand All @@ -262,6 +266,7 @@ ABLMost::compute_most_bcs (const int& lev,
auto t31_arr = (zxmom_flux && m_exp_most) ? zxmom_flux->array(mfi) : Array4<Real>{};
auto t32_arr = (zymom_flux && m_exp_most) ? zymom_flux->array(mfi) : Array4<Real>{};
auto hfx_arr = (m_exp_most) ? heat_flux->array(mfi) : Array4<Real>{};
auto qfx_arr = (m_exp_most && use_moisture ) ? qv_flux->array(mfi) : Array4<Real>{};

const auto eta_arr = m_eddyDiffs_lev[lev]->array(mfi);

Expand Down Expand Up @@ -292,6 +297,11 @@ ABLMost::compute_most_bcs (const int& lev,
auto lsm_flux_arr = (m_lsm_flux_lev[lev][0]) ? m_lsm_flux_lev[lev][0]->array(mfi) :
Array4<Real> {};

// NOTE: The returned fluxes (tflux/qflux/stressx/stressy) are the diffusive fluxes
// defined as F_d = -K \partial \phi / \partial z. This is consistent with the
// computation of the diffusion source term as well as the buoyancy source for
// turbulence modeling (e.g. Deardorff)

for (int var_idx = 0; var_idx < Vars::NumTypes; ++var_idx)
{
const Box& bx = (*mfs[var_idx])[mfi].box();
Expand All @@ -305,7 +315,7 @@ ABLMost::compute_most_bcs (const int& lev,
{
Real dz = (zphys_arr) ? ( zphys_arr(i,j,klo ) - zphys_arr(i,j,klo-1) ) : dz_no_terrain;
Real dz1 = (zphys_arr) ? ( zphys_arr(i,j,klo+1) - zphys_arr(i,j,klo ) ) : dz_no_terrain;
Real Tflux = flux_comp.compute_t_flux(i, j, k, n, icomp, dz, dz1, exp_most, eta_arr,
Real tflux = flux_comp.compute_t_flux(i, j, k, n, icomp, dz, dz1, exp_most, eta_arr,
cons_arr, velx_arr, vely_arr,
umm_arr, tm_arr, u_star_arr, t_star_arr, t_surf_arr,
dest_arr);
Expand All @@ -314,10 +324,10 @@ ABLMost::compute_most_bcs (const int& lev,
// TODO: make sure not to double-count surface heat flux if using a LSM
int is_land = (lmask_arr) ? lmask_arr(i,j,klo) : 1;
if (is_land && lsm_flux_arr && vbx.contains(i,j,k)) {
lsm_flux_arr(i,j,klo) = Tflux;
lsm_flux_arr(i,j,klo) = tflux;
}
else if ((k == klo-1) && vbx.contains(i,j,k) && exp_most) {
hfx_arr(i,j,klo-1) = Tflux;
hfx_arr(i,j,klo) = tflux;
}
});

Expand All @@ -328,11 +338,14 @@ ABLMost::compute_most_bcs (const int& lev,
{
Real dz = (zphys_arr) ? ( zphys_arr(i,j,klo ) - zphys_arr(i,j,klo-1) ) : dz_no_terrain;
Real dz1 = (zphys_arr) ? ( zphys_arr(i,j,klo+1) - zphys_arr(i,j,klo ) ) : dz_no_terrain;
Real Qflux = flux_comp.compute_q_flux(i, j, k, n, icomp, dz, dz1, exp_most, eta_arr,
Real qflux = flux_comp.compute_q_flux(i, j, k, n, icomp, dz, dz1, exp_most, eta_arr,
cons_arr, velx_arr, vely_arr,
umm_arr, qm_arr, u_star_arr, q_star_arr, t_surf_arr,
dest_arr);
amrex::ignore_unused(Qflux);

if ((k == klo-1) && vbx.contains(i,j,k) && exp_most) {
qfx_arr(i,j,klo) = qflux;
}
});
}

Expand All @@ -350,10 +363,9 @@ ABLMost::compute_most_bcs (const int& lev,
umm_arr, um_arr, u_star_arr,
dest_arr);
if ((k == klo-1) && vbxx.contains(i,j,k) && exp_most) {
t13_arr(i,j,klo) = -stressx;
if (t31_arr) t31_arr(i,j,klo) = -stressx;
t13_arr(i,j,klo) = stressx;
if (t31_arr) t31_arr(i,j,klo) = stressx;
}
amrex::ignore_unused(stressx);
});

} else if (var_idx == Vars::yvel) {
Expand All @@ -370,10 +382,9 @@ ABLMost::compute_most_bcs (const int& lev,
umm_arr, vm_arr, u_star_arr,
dest_arr);
if ((k == klo-1) && vbxy.contains(i,j,k) && exp_most) {
t23_arr(i,j,klo) = -stressy;
if (t32_arr) t32_arr(i,j,klo) = -stressy;
t23_arr(i,j,klo) = stressy;
if (t32_arr) t32_arr(i,j,klo) = stressy;
}
amrex::ignore_unused(stressy);
});
}
} // var_idx
Expand Down
1 change: 1 addition & 0 deletions Source/BoundaryConditions/ERF_FillPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ ERF::FillIntermediatePatch (int lev, Real time,
Tau13_lev[lev].get(), Tau31_lev[lev].get(),
Tau23_lev[lev].get(), Tau32_lev[lev].get(),
SFS_hfx3_lev[lev].get(),
SFS_qfx3_lev[lev].get(),
z_phys_nd[lev].get());
}

Expand Down
Loading
Loading