Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
f7a2b60
refinement wip: inherit from sgs_fra, disable 2d, bulk and piggybacki…
pdziekan Sep 27, 2022
2cd1c50
ref: calculate and output refined th and rv
pdziekan Sep 28, 2022
1d85520
allocate vector arrays of size grid ref (for refined courants
pdziekan Sep 30, 2022
08fbd73
comment about TODO
pdziekan Sep 30, 2022
923262b
nx,dx,x0,x1 (and y and z) based on grid_ref
pdziekan Sep 30, 2022
0cbe6eb
courant refined wip
pdziekan Sep 30, 2022
bb4535e
courant refined wip
pdziekan Sep 30, 2022
95c4a8a
th_ref -> th_reference
pdziekan Sep 30, 2022
76fbfc4
rt params: contain profs, not pointers
pdziekan Sep 30, 2022
9b5827a
profs as part of rt_params
pdziekan Sep 30, 2022
27325d6
profiles: default ctor
pdziekan Sep 30, 2022
9ee0fd8
profiles as part of params WIP
pdziekan Oct 3, 2022
cc5dd1b
profiles as part of params
pdziekan Oct 3, 2022
eb5025c
refinement wip
pdziekan Oct 3, 2022
783d640
profiles ref output
pdziekan Oct 3, 2022
d57f162
anelastic env profiles: more accurate algorithm to have agreement bet…
pdziekan Oct 4, 2022
fda204b
comment abut differences in normal and refined ref prof
pdziekan Oct 4, 2022
a69bd8c
fix refined x1
pdziekan Oct 4, 2022
4f07860
fix update th and rv after cond
pdziekan Oct 18, 2022
1195217
microphysics output: record_aux_refined
pdziekan Oct 19, 2022
9fc55f2
interpolate refined courants
pdziekan Oct 24, 2022
a9cfcf0
uvw push back fix
pdziekan Oct 24, 2022
08fdd59
output refined th and rv
pdziekan Oct 25, 2022
7c94a39
th rv precond typo fix + barrier before cour interpolation
pdziekan Oct 25, 2022
70d309e
negtozer of refined rv...
pdziekan Oct 25, 2022
3f3b829
grid refinement in diag_rc and rl
pdziekan Oct 27, 2022
0c282bc
diag_rx add halo
pdziekan Oct 28, 2022
d396361
comment debug output
pdziekan Oct 28, 2022
7a8bd86
same stretching parameters for th and rv
pdziekan Nov 24, 2022
9e4c05e
decrease amount of output
Nov 30, 2022
74c76fb
TEMP: courant and Cx output for comparison
pdziekan Jan 20, 2023
264a6a2
Merge branch 'fractal_refinement' into rico_mean_vel_plus_fractal
Jan 23, 2023
9b142de
Revert "TEMP: courant and Cx output for comparison"
pdziekan Jan 26, 2023
198c5c6
always reconstruct just before output
pdziekan Jan 26, 2023
776f7b9
bring back reconstruction in ante_loop, just in case
pdziekan Jan 26, 2023
5f09778
Merge branch 'rng_seed_init_switch_merge_master_rd_min_max' into frac…
pdziekan Feb 14, 2023
88e31c7
Merge branch 'fractal_refinement' into rico_mean_vel_plus_fractal
Feb 28, 2023
26e2d94
Merge branch 'rico_mean_vel' into rico_mean_vel_plus_fractal
Feb 28, 2023
0f7f4a1
more verbose checknan
Mar 2, 2023
f46651b
negtozero rv after rv reconstruction in ante loop and in ante record all
Mar 2, 2023
d042d0a
checknan fix
Mar 2, 2023
35c5714
record refined courants (not all of them...)
pdziekan Mar 7, 2023
bc47f46
record courants ref fix
Mar 7, 2023
9a9327a
record refined u v w
Mar 7, 2023
8831367
record courant: fix for storage order
Mar 7, 2023
46e6f3f
fix coourant record ranges
Mar 7, 2023
7d4802d
comment some courant debugging output
Mar 7, 2023
b8291b2
Merge branch 'fractal_refinement' into rico_mean_vel_plus_fractal
Mar 8, 2023
363adaf
negcheck with additional arrays output
Mar 8, 2023
82c9872
refined rv negative: output more arrs
Mar 8, 2023
a433e71
update dbg neg res output
Mar 9, 2023
a3e8a58
Merge branch 'master' into fractal_refinement
pdziekan Mar 9, 2023
4fd4d65
fix rv/th_LS profiles: profiles moved from params to params.profs
pdziekan Mar 10, 2023
0825a90
Merge branch 'fractal_refinement' into rico_mean_vel_plus_fractal
pdziekan Mar 10, 2023
6e46fb0
Merge branch 'rico_mean_vel' into rico_mean_vel_plus_fractal
pdziekan Mar 10, 2023
2b23df2
dont save prs_tol to const in piggy
pdziekan Mar 10, 2023
11f3f0f
move headers common to uwlcm and run_hlpr to a separate file
pdziekan Mar 10, 2023
95034e1
typo fix for the win!
pdziekan Mar 10, 2023
0a74ffd
update LS profiles: done by one thread, pass reference to array
Mar 16, 2023
458c705
update forces: pass by reference, bind constatnts
Mar 16, 2023
efc0ae8
comment about initial large-scale forcing prfiles
Mar 16, 2023
003202d
Merge branch 'rico_mean_vel' into rico_mean_vel_plus_fractal
Mar 21, 2023
a998835
remove tabs
Mar 21, 2023
8127ed0
update to new mpdata ref hdf5
pdziekan Mar 27, 2023
4550f76
xmf writeup fix
pdziekan Mar 27, 2023
eac3267
Merge branch 'fractal_refinement' into rico_mean_vel_plus_fractal
pdziekan Mar 28, 2023
f76be23
Merge branch 'rico_mean_vel_plus_fractal' of github.com:pdziekan/UWLC…
pdziekan Mar 28, 2023
bd86dec
Merge branch 'master' into rico_mean_vel_plus_fractal
pdziekan Mar 28, 2023
0312606
DEBUGGING: no effect of micro on dynamics
Mar 31, 2023
d0beec6
DBG: no interpolation refinement xchng of refiness
Mar 31, 2023
d490899
bring back reconstruct_refinee
Apr 1, 2023
e9e6e0f
dont reconstuct refinee in ante record all
Apr 3, 2023
645d24e
remove uvw from ct_params fractal_recon
Apr 3, 2023
147aad0
dont init uvw ref
pdziekan Apr 3, 2023
9535866
Revert "dont init uvw ref"
pdziekan Apr 3, 2023
0b53082
Revert "remove uvw from ct_params fractal_recon"
pdziekan Apr 3, 2023
a0af600
dont call diag_rx
pdziekan Apr 3, 2023
4937dc5
dont call diag_rx
pdziekan Apr 3, 2023
eea721b
Revert "dont call diag_rx"
Apr 3, 2023
ec0dc50
bring back full diag_rx
Apr 4, 2023
578ec61
negtozero: bump set value to 1e-6
Apr 4, 2023
d5682d2
Merge branch 'fractal_refinement' of github.com:pdziekan/UWLCM into f…
Apr 5, 2023
5bd785e
diag_rx: no spatial averaging
Apr 5, 2023
f5517d3
Revert "diag_rx: no spatial averaging"
Apr 5, 2023
25bc516
record r_l
Apr 6, 2023
77431ef
remove dbg changes
Apr 6, 2023
2122589
replace direct calls to spatial_average_ref2reg with this->spatial_av…
Apr 7, 2023
65625ce
nancheck after spatial ref_2_reg
Apr 7, 2023
6cccd1c
negtozero set var = 1e-4
Apr 7, 2023
be3a501
RICO with window: mean v velocity of 0.1 m/s
Apr 7, 2023
9c2cd02
RICO window v_mean=-1
Apr 11, 2023
2529874
rico: window mean_v=0, buoyancy_wet=0
Apr 11, 2023
645265c
fix dth drv nanchecks + recrod dth
Apr 11, 2023
1baa587
move dth storing to diag_lgrngn
Apr 11, 2023
0953c12
interpolate insated of reconsteuct th and rv
Apr 14, 2023
dec4483
dont add dth
Apr 17, 2023
da0a5b7
Revert "dont add dth"
Apr 17, 2023
7ab9c61
Revert "interpolate insated of reconsteuct th and rv"
Apr 18, 2023
8b3a1b0
bring back to pre-debug state
Apr 18, 2023
e82077f
new stretching parameters from LES, different for th and rv
Apr 26, 2023
ca14f37
LES stretch params but halved
May 17, 2023
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
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ if(UWLCM_TIMING)
target_compile_options(uwlcm PRIVATE "-DUWLCM_TIMING")
endif()

# by default, don't compile 2D and blk, because they dont use refinement and libmpdata++ doesnt compile without refinement
# also dont compile piggy as it is not compatible with refinement too
if(NOT UWLCM_DISABLE)
set(UWLCM_DISABLE "2D_BLK_1M;3D_BLK_1M;2D_BLK_2M;3D_BLK_2M;2D_LGRNGN;2D_NONE;3D_NONE;PIGGYBACKER")
endif()

# handle the disable compilation options
if(UWLCM_DISABLE)
set(UWLCM_DISABLE_PREFIX "UWLCM_DISABLE_")
Expand Down
78 changes: 51 additions & 27 deletions src/cases/Anelastic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace cases
virtual quantity<si::dimensionless, real_t> r_t(const real_t &z) {throw std::runtime_error("base Anelastic class r_t called");}

// calculate the initial environmental theta and rv profiles
// like in Wojtek's BabyEulag
// adapted from Wojtek Grabowski's BabyEulag
void env_prof(detail::profiles_t &profs, int nz)
{
using libcloudphxx::common::moist_air::R_d_over_c_pd;
Expand Down Expand Up @@ -52,33 +52,57 @@ namespace cases
real_t d = l_tri<real_t>() / si::joules * si::kilograms / rv;
real_t f = R_d_over_c_pd<real_t>();

real_t lwp_env = 0;

// real_t lwp_env = 0;
//
for(int k=1; k<nz; ++k)
{
real_t bottom = R_d<real_t>() / si::joules * si::kelvins * si::kilograms * T(k-1) * (1 + 0.61 * profs.rv_e(k-1)); // (p / rho) of moist air at k-1
real_t rho1 = profs.p_e(k-1) / bottom; // rho at k-1
profs.p_e(k) = profs.p_e(k-1) - rho1 * 9.81 * dz; // estimate of pre at k (dp = -g * rho * dz)
real_t thetme = pow(p_1000<real_t>() / si::pascals / profs.p_e(k), f); // 1/Exner
real_t thi = 1. / (th_l(k * dz) / si::kelvins); // 1/theta_std
real_t y = b * thetme * tt0 * thi;
real_t ees = ee0 * exp(b-y); // saturation vapor pressure (Tetens equation or what?)
real_t qvs = a * ees / (profs.p_e(k) - ees); // saturation vapor mixing ratio = R_d / R_v * ees / p_d
// calculate linearized condensation rate
real_t cf1 = thetme*thetme*thi*thi; // T^{-2}
cf1 *= c * d * profs.p_e(k) / (profs.p_e(k) - ees); // = l_tri^2 / (C_pd * R_v * T^2) * p/p_d
real_t delta = (r_t(k*dz) - qvs) / (1 + qvs * cf1); // how much supersaturated is the air (divided by sth)
if(delta < 0.) delta = 0.;
profs.rv_e(k) = r_t(k*dz) - delta;
profs.rl_e(k) = delta;
profs.th_e(k) = th_l(k*dz) / si::kelvins + c * thetme * delta;
T(k) = profs.th_e(k) * pow(profs.p_e(k) / (p_1000<real_t>() / si::pascals), f);

bottom = R_d<real_t>() / si::joules * si::kelvins * si::kilograms * T(k) * (1 + 0.61 * profs.rv_e(k)); // (p / rho) of moist air at k-1
rho1 = profs.p_e(k) / bottom; // rho at k-1
lwp_env += delta * rho1;
/// estimate of pressure at k assuming constant pressure (dp = -g * rho * dz) (like in babyEulag)
/*
real_t Rd_Tv_m1 = R_d<real_t>() / si::joules * si::kelvins * si::kilograms * T(k-1) * (1 + 0.61 * profs.rv(k-1));
real_t rho_m1 = profs.p_e(k-1) / Rd_Tv_m1; // rho at k-1
profs.p_e(k) = profs.p_e(k-1) - rho1 * 9.81 * dz;
*/

real_t T_midlvl = T(k-1); // pressure calculating assuming constant temperature between levels, this is the first estimate of this constant temp
real_t rv_midlvl = profs.rv_e(k-1); // same for water vapor
real_t rl_midlvl = 0; // same for liquid water

for(int i=0; i<100; ++i) // TODO: why 100 iterations?
{
// pressure profile assuming constant temperature between levels
real_t Rd_Tv = R_d<real_t>() / si::joules * si::kelvins * si::kilograms * T_midlvl * (1 + 0.61 * rv_midlvl - rl_midlvl);
profs.p_e(k) = profs.p_e(k-1) * exp(-9.81 * dz / Rd_Tv ); // estimate of pre at k assuming constant temperature

// adjust for supersaturation
real_t thetme = pow(p_1000<real_t>() / si::pascals / profs.p_e(k), f); // 1/Exner
real_t thi = 1. / (th_l(k * dz) / si::kelvins); // 1/theta_std
real_t y = b * thetme * tt0 * thi;
real_t ees = ee0 * exp(b-y); // saturation vapor pressure (Tetens equation or what?)
real_t qvs = a * ees / (profs.p_e(k) - ees); // saturation vapor mixing ratio = R_d / R_v * ees / p_d
// calculate linearized condensation rate
real_t cf1 = thetme*thetme*thi*thi; // T^{-2}
cf1 *= c * d * profs.p_e(k) / (profs.p_e(k) - ees); // = l_tri^2 / (C_pd * R_v * T^2) * p/p_d
real_t delta = (r_t(k*dz) - qvs) / (1 + qvs * cf1); // how much supersaturated is the air (divided by sth)
if(delta < 0.) delta = 0.;
profs.rv_e(k) = r_t(k*dz) - delta;
profs.rl_e(k) = delta;
profs.th_e(k) = th_l(k*dz) / si::kelvins + c * thetme * delta;
T(k) = profs.th_e(k) * pow(profs.p_e(k) / (p_1000<real_t>() / si::pascals), f);

// linear interpolation between levels for the next iteration
T_midlvl = (T(k) + T(k-1)) / 2.;
rv_midlvl = (profs.rv_e(k) + profs.rv_e(k-1)) / 2.;
rl_midlvl = (profs.rl_e(k) + profs.rl_e(k-1)) / 2.;
}

/*
Rd_Tv = R_d<real_t>() / si::joules * si::kelvins * si::kilograms * T(k) * (1 + 0.61 * profs.rv_e(k)); // (p / rho) of moist air at k
rho_m1 = profs.p_e(k) / Rd_Tv; // rho at k
lwp_env += delta * rho_m1;
*/
}
lwp_env = lwp_env * 5 * 1e3;
// lwp_env = lwp_env * 5 * 1e3;
//
}

// calculate the initial reference theta and rv profiles
Expand All @@ -101,8 +125,8 @@ namespace cases
st(notopbot) = (profs.th_e(notopbot+1) - profs.th_e(notopbot-1)) / profs.th_e(notopbot);
real_t st_avg = blitz::sum(st) / (nz-2) / (2.*dz);
// reference theta
profs.th_ref = profs.th_e(0) * (1. + 0.608 * profs.rv_e(0)) * exp(st_avg * k * dz);
// th_ref = th_e(0) * pow(1 + rv_e(0) / a, f) // calc dry theta at z=0
profs.th_reference = profs.th_e(0) * (1. + 0.608 * profs.rv_e(0)) * exp(st_avg * k * dz);
// th_reference = th_e(0) * pow(1 + rv_e(0) / a, f) // calc dry theta at z=0
// * exp(st_avg * k * dz);
// virtual temp at surface

Expand Down
40 changes: 21 additions & 19 deletions src/cases/CasesCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace cases
return f_vel_prof(z) * si::seconds / si::meters - mean_vel;
}

void init(bool window, quantity<si::length, real_t> Z)
void init(bool window, quantity<si::length, real_t> Z, real_t target_mean_vel = 0) // target_mean_vel is the mean velocity we want to have within the window
{
initialized=true;
mean_vel = 0;
Expand All @@ -48,6 +48,7 @@ namespace cases
for(int i=0; i < setup::mean_horvel_npts; ++i)
mean_vel += f_vel_prof(i * (Z / si::meters) / (setup::mean_horvel_npts-1)) * si::seconds / si::meters;
mean_vel /= setup::mean_horvel_npts;
mean_vel -= target_mean_vel;
}
}

Expand Down Expand Up @@ -158,32 +159,33 @@ namespace cases
}

virtual void update_surf_flux_sens(blitz::Array<real_t, n_dims> surf_flux_sens,
blitz::Array<real_t, n_dims> th_ground,
blitz::Array<real_t, n_dims> U_ground,
const real_t &U_ground_z,
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy = 0)
const blitz::Array<real_t, n_dims> &th_ground,
const blitz::Array<real_t, n_dims> &U_ground,
const int timestep, const real_t dt,
const real_t dx, const real_t dy, const real_t U_ground_z)
{if(timestep==0) surf_flux_sens = 0.;};

virtual void update_surf_flux_lat(blitz::Array<real_t, n_dims> surf_flux_lat,
blitz::Array<real_t, n_dims> rt_ground,
blitz::Array<real_t, n_dims> U_ground,
const real_t &U_ground_z,
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy = 0)
virtual void update_surf_flux_lat (blitz::Array<real_t, n_dims> surf_flux_lat,
const blitz::Array<real_t, n_dims> &rt_ground,
const blitz::Array<real_t, n_dims> &U_ground,
const int timestep, const real_t dt,
const real_t dx, const real_t dy, const real_t U_ground_z)
{if(timestep==0) surf_flux_lat = 0.;};

virtual void update_surf_flux_uv(blitz::Array<real_t, n_dims> surf_flux_uv,
blitz::Array<real_t, n_dims> uv_ground,
blitz::Array<real_t, n_dims> U_ground,
const real_t &U_ground_z,
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy = 0, const real_t &uv_mean = 0)
virtual void update_surf_flux_uv (blitz::Array<real_t, n_dims> surf_flux_uv,
const blitz::Array<real_t, n_dims> &uv_ground,
const blitz::Array<real_t, n_dims> &U_ground,
const int timestep, const real_t dt,
const real_t dx, const real_t dy, const real_t U_ground_z,
const real_t uv_mean = 0)
{if(timestep==0) surf_flux_uv = 0.;};

virtual void update_rv_LS(blitz::Array<real_t, 1> rv_LS,
int timestep, real_t dt, real_t dz)
virtual void update_rv_LS(blitz::Array<real_t, 1> &rv_LS,
const int timestep, const real_t dt, const real_t dz)
{};

virtual void update_th_LS(blitz::Array<real_t, 1> th_LS,
int timestep, real_t dt, real_t dz)
virtual void update_th_LS(blitz::Array<real_t, 1> &th_LS,
const int timestep, const real_t dt, const real_t dz)
{};

// ctor
Expand Down
28 changes: 13 additions & 15 deletions src/cases/CumulusCongestus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,12 @@ namespace cases
profs.th_LS = 0.; // no large-scale horizontal advection
profs.rv_LS = 0.;
}

// functions that set surface fluxes per timestep
void update_surf_flux_sens(blitz::Array<real_t, n_dims> surf_flux_sens,
blitz::Array<real_t, n_dims> th_ground,
blitz::Array<real_t, n_dims> U_ground,
const real_t &U_ground_z,
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy) override
const blitz::Array<real_t, n_dims> &th_ground,
const blitz::Array<real_t, n_dims> &U_ground,
const int timestep, const real_t dt,
const real_t dx, const real_t dy, const real_t U_ground_z) override
{
if(timestep == 0)
surf_flux_sens = .1 * -1 * (this->rhod_0 / si::kilograms * si::cubic_meters) * theta_std::exner(p_0); // [K kg / (m^2 s)]; -1 because negative gradient of upward flux means inflow
Expand All @@ -238,12 +237,11 @@ namespace cases
}
}


void update_surf_flux_lat(blitz::Array<real_t, n_dims> surf_flux_lat,
blitz::Array<real_t, n_dims> rt_ground,
blitz::Array<real_t, n_dims> U_ground,
const real_t &U_ground_z,
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy) override
const blitz::Array<real_t, n_dims> &rt_ground,
const blitz::Array<real_t, n_dims> &U_ground,
const int timestep, const real_t dt,
const real_t dx, const real_t dy, const real_t U_ground_z) override
{
if(timestep == 0)
surf_flux_lat = .4e-4 * -1 * (this->rhod_0 / si::kilograms * si::cubic_meters); // [m/s]
Expand All @@ -259,18 +257,18 @@ namespace cases
// one function for updating u or v
// the n_dims arrays have vertical extent of 1 - ground calculations only in here
void update_surf_flux_uv(blitz::Array<real_t, n_dims> surf_flux_uv, // output array
blitz::Array<real_t, n_dims> uv_ground, // value of u or v on the ground
blitz::Array<real_t, n_dims> U_ground, // magnitude of horizontal ground wind
const real_t &U_ground_z,
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy, const real_t &uv_mean)
const blitz::Array<real_t, n_dims> &uv_ground, // value of u or v on the ground
const blitz::Array<real_t, n_dims> &U_ground, // magnitude of horizontal ground wind
const int timestep, const real_t dt,
const real_t dx, const real_t dy, const real_t U_ground_z,
const real_t uv_mean = 0)
{
surf_flux_uv = where(U_ground < 1e-4,
- 0.0784 * (uv_ground + uv_mean) / real_t(1e-4) * -1 * (this->rhod_0 / si::kilograms * si::cubic_meters), // 0.0784 m^2 / s^2 is the square of friction velocity = 0.28 m / s
- 0.0784 * (uv_ground + uv_mean) / U_ground * -1 * (this->rhod_0 / si::kilograms * si::cubic_meters)
);
}


// ctor
CumulusCongestusCommon()
{
Expand Down
27 changes: 14 additions & 13 deletions src/cases/DYCOMS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ namespace cases
}

void update_surf_flux_sens(blitz::Array<real_t, n_dims> surf_flux_sens,
blitz::Array<real_t, n_dims> th_ground,
blitz::Array<real_t, n_dims> U_ground,
const real_t &U_ground_z,
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy) override
const blitz::Array<real_t, n_dims> &th_ground,
const blitz::Array<real_t, n_dims> &U_ground,
const int timestep, const real_t dt,
const real_t dx, const real_t dy, const real_t U_ground_z) override
{
if(timestep == 0) // TODO: what if this function is not called at t=0? force such call
{
Expand All @@ -272,10 +272,10 @@ namespace cases
}

void update_surf_flux_lat(blitz::Array<real_t, n_dims> surf_flux_lat,
blitz::Array<real_t, n_dims> rt_ground,
blitz::Array<real_t, n_dims> U_ground,
const real_t &U_ground_z,
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy) override
const blitz::Array<real_t, n_dims> &rt_ground,
const blitz::Array<real_t, n_dims> &U_ground,
const int timestep, const real_t dt,
const real_t dx, const real_t dy, const real_t U_ground_z) override
{
if(timestep == 0) // TODO: what if this function is not called at t=0? force such call
{
Expand All @@ -287,11 +287,12 @@ namespace cases

// one function for updating u or v
// the n_dims arrays have vertical extent of 1 - ground calculations only in here
void update_surf_flux_uv(blitz::Array<real_t, n_dims> surf_flux_uv, // output array
blitz::Array<real_t, n_dims> uv_ground, // value of u or v on the ground
blitz::Array<real_t, n_dims> U_ground, // magnitude of horizontal ground wind
const real_t &U_ground_z,
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy, const real_t &uv_mean)
void update_surf_flux_uv (blitz::Array<real_t, n_dims> surf_flux_uv,
const blitz::Array<real_t, n_dims> &uv_ground,
const blitz::Array<real_t, n_dims> &U_ground,
const int timestep, const real_t dt,
const real_t dx, const real_t dy, const real_t U_ground_z,
const real_t uv_mean = 0) override
{
surf_flux_uv = where(U_ground == 0., 0.,
- 0.0625 * (uv_ground + uv_mean) / U_ground * -1 * (this->rhod_0 / si::kilograms * si::cubic_meters)// 0.0625 m^2 / s^2 is the square of friction velocity = 0.25 m / s; * -1 because negative gradient of upward flux means inflow
Expand Down
28 changes: 10 additions & 18 deletions src/cases/DryPBL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,31 +244,23 @@ namespace cases
}

void update_surf_flux_sens(blitz::Array<real_t, n_dims> surf_flux_sens,
blitz::Array<real_t, n_dims> th_ground, // value of th on the ground
blitz::Array<real_t, n_dims> U_ground, // magnitude of horizontal ground wind
const real_t &U_ground_z, // altituted at which U_ground is diagnosed
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy) override
const blitz::Array<real_t, n_dims> &th_ground,
const blitz::Array<real_t, n_dims> &U_ground,
const int timestep, const real_t dt,
const real_t dx, const real_t dy, const real_t U_ground_z) override
{
surf_flux_sens = .01 * -1 * (this->rhod_0 / si::kilograms * si::cubic_meters) * theta_std::exner(p_0); // [K kg / (m^2 s)]; -1 because negative gradient of upward flux means inflow

}

void update_surf_flux_lat(blitz::Array<real_t, n_dims> surf_flux_lat,
blitz::Array<real_t, n_dims> rt_ground,
blitz::Array<real_t, n_dims> U_ground,
const real_t &U_ground_z,
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy) override
{
surf_flux_lat = 0;
}

// one function for updating u or v
// the n_dims arrays have vertical extent of 1 - ground calculations only in here
void update_surf_flux_uv(blitz::Array<real_t, n_dims> surf_flux_uv, // output array
blitz::Array<real_t, n_dims> uv_ground, // value of u or v on the ground
blitz::Array<real_t, n_dims> U_ground, // magnitude of horizontal ground wind
const real_t &U_ground_z, // altituted at which U_ground is diagnosed
const int &timestep, const real_t &dt, const real_t &dx, const real_t &dy, const real_t &uv_mean) override
void update_surf_flux_uv (blitz::Array<real_t, n_dims> surf_flux_uv,
const blitz::Array<real_t, n_dims> &uv_ground,
const blitz::Array<real_t, n_dims> &U_ground,
const int timestep, const real_t dt,
const real_t dx, const real_t dy, const real_t U_ground_z,
const real_t uv_mean = 0) override
{
surf_flux_uv = - real_t(0.1) * U_ground * (uv_ground + uv_mean) * -1 * (this->rhod_0 / si::kilograms * si::cubic_meters); // [ kg m/s / (m^2 s) ]
}
Expand Down
Loading