Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
237 commits
Select commit Hold shift + click to select a range
cc47f63
update setup.py to Kyle's latest version
Aug 27, 2015
c0f05d2
Merge remote branch 'upstream/master'
Aug 27, 2015
4097642
start adding Mpace in initilization
Aug 31, 2015
5c1ca0c
add three Arctic cases to namelist generator
Aug 31, 2015
41edebd
adding Mpace in progress
Sep 1, 2015
74d0edb
Merge branch 'initial' into arctic
Sep 1, 2015
b928db4
Adding Arctic cases M-PACE and ISDAC, focus on ISDAC. The code compil…
Sep 4, 2015
8f62e6a
Merge branch 'master' into arctic
Sep 5, 2015
83ae867
Added radiation for ISDAC case
Sep 5, 2015
edb7967
Added SurfaceIsdac to Surface.pyx
Sep 8, 2015
c0609de
Merge branch 'master' into arctic
Sep 8, 2015
8aa3352
Fixed various bugs, and now ISDAC runs
Sep 8, 2015
6f4af0d
Fixed a bug in ForcingIsdac and added forcing outputs
Sep 8, 2015
ff2901b
Fixed bugs in ForcingIsdac for nudging
Sep 10, 2015
308e512
Add output of surface windspeed in SurfaceIsdac
Sep 10, 2015
0a15406
Added output of radiative heating rate to RadiationIsdac
Sep 10, 2015
766040b
turned on boundscheck for debugging
Sep 10, 2015
6d4f4b1
removed redundant @cython apart from the headers
Sep 10, 2015
652725b
turned off boundscheck
Sep 10, 2015
72641ed
Merge remote-tracking branch 'upstream/master' into arctic
Sep 10, 2015
d211fad
Modified SurfaceIsdac according to the latest update by Colleen
Sep 10, 2015
577ec9a
Fixed bugs to run Bomex in ForcingBomex initialization call
Sep 10, 2015
0f91c13
keep fixing bugs in ForcingBomex initialization
Sep 10, 2015
373b69a
Added cpd term in heating rate in RadiationIsdac
Sep 10, 2015
c35e1d9
Added output call for Radiation in Simulation3d.pyx and fixed the err…
Sep 11, 2015
ecf53fd
fixed a bug in Radiation stats_io
Sep 11, 2015
56bf567
added radiative flux output in RadiationIsdac
Sep 14, 2015
8028f3d
fixed a bug in RadiationIsdac
Sep 14, 2015
8677a93
fixed the ISDAC initialization theta_l definition, and fixed a bug as…
Sep 15, 2015
177f865
fixed an error in thetal definition for output
Sep 15, 2015
5c1315d
fixed an error in thetal definition for output
Sep 15, 2015
ac1b604
fixed a bug in InitializationIsdac
Sep 15, 2015
ff1b25f
Merge with master branch
Sep 18, 2015
cb3d903
Merge remote-tracking branch 'upstream/master' into arctic
Sep 18, 2015
c937d20
Changed the latent heat value in Initialization to be consistent
Sep 18, 2015
12f02b5
Merge remote-tracking branch 'upstream/master' into arctic
Sep 18, 2015
c50c879
Merge remote-tracking branch 'upstream/master' into arctic
Sep 22, 2015
587ab84
Initial commit to add mixed-phase microphysics. Currently only implem…
Sep 25, 2015
29f4359
fixed a typo for calling parameters.pxi
Sep 25, 2015
183a3ec
fixed a typo in micro output
Sep 25, 2015
3568283
fixed a bug in liquid fraction calculation
Sep 28, 2015
2975db0
add more water paths for IO
Sep 28, 2015
3f21fd8
Add substepping to source terms (only iterate once)
Sep 29, 2015
11c5982
adding sedimentation (upwind scheme)
Sep 30, 2015
62c5b2f
change np.empty to np.zeros
Sep 30, 2015
7fcd9c8
with upwind scheme, use a instead of a_bar_i
Sep 30, 2015
7c61019
fix n0snow to be 1e6
Oct 1, 2015
b65ebc2
add alternative lambda function for snow
Oct 1, 2015
8b7f2f1
fixed a bug in calculating snow/rain tendency
Oct 1, 2015
7179429
added number density outputs and now use reference alpha0 for microph…
Oct 1, 2015
fcd062f
change a print statement in micro
Oct 1, 2015
0861e5b
update ice microphysics
Oct 1, 2015
b0a3906
update microphysics to follow changes made by Zhihong
Oct 2, 2015
394a1f7
fixed a bug in ghost point filling indexing in sedimentation (thanks …
Oct 2, 2015
17481c5
update the upwind scheme in microphysics precipitation
Oct 5, 2015
dde07de
adding entropy source terms
Oct 5, 2015
759dad9
fixed a bug in rain autoconversion, also redo changes in sedimentatio…
Oct 5, 2015
5894a8f
updated the calculation of qv_star in thermodynamics
Oct 5, 2015
9959b95
adding entropy source terms
Oct 5, 2015
8616d05
update corresponding Simulation3d.pyx
Oct 5, 2015
8b7eed8
update microphysics entropy source term calculation
Oct 6, 2015
f8b4aed
added output of entropy source due to microphysics
Oct 6, 2015
9023074
testing entropy source terms
Oct 6, 2015
46231c4
Merge remote-tracking branch 'upstream/master' into ice_micro
Oct 8, 2015
ce0271d
Updated a bug associated with the merge
Oct 8, 2015
0456f9c
update the No_Microphysics_SA class
Oct 8, 2015
3fadbd2
allow N0_snow to change
Oct 9, 2015
e448bc2
moved water paths stats to microphysics and added number density output
Oct 13, 2015
a6e0cca
add full formulation of G in snow autoconversion
Oct 13, 2015
5b411d9
add qi to autoconversion calculation
Oct 13, 2015
b019107
updated microphysics source terms involving vapor diffusion
Oct 16, 2015
9e6f145
update minor format in aux stats
Oct 20, 2015
1fa3b15
Merge remote-tracking branch 'upstream/master' into ice_micro
Oct 20, 2015
8eba041
add saturation vapor pressure wrt ice and test the sensitivity to sno…
Oct 23, 2015
7adcbcb
added output for ice microphysics
Oct 26, 2015
439d23a
fixed a bug in restart initiation print statement
Oct 26, 2015
7fac6fd
added n0_ice output, and compute lambda for output using cython funct…
Oct 27, 2015
e65bbb3
fixed some microphysics number density output problem
Oct 27, 2015
70f7bc6
use effective saturation vapor pressure
Oct 28, 2015
4d8b634
clean up InitIsdac
Nov 2, 2015
33ba1d7
add large-scale advection in ISDAC case forcing
Nov 4, 2015
0e01985
fixed bugs in forcing
Nov 4, 2015
0f8806b
fixed a bug in large-scale advection forcing of ISDAC
Nov 5, 2015
602ace9
Merge remote-tracking branch 'upstream/master' into ice_micro
Nov 17, 2015
22b3b74
Changed mixed phase microphysics scheme name to Arctic_1M. Now using …
Nov 18, 2015
4ed72ff
removed print statements in simulation3d
Nov 18, 2015
07d67a8
print self.path_plot_file
Nov 18, 2015
1119bd9
changed Isdac forcing to nudging (default), and removed print stateme…
Nov 18, 2015
f66adb3
changed sedimenation to be part of the scalar advection
Nov 19, 2015
f50a00a
fixed a bug in Arctic1M microphysics
Nov 19, 2015
d99595a
major update of Arctic 1M microphysics
Nov 25, 2015
3ccc412
update micro A1M
Nov 25, 2015
67d1bda
update micro A1M
Nov 25, 2015
b2e91dd
update micro A1M
Nov 25, 2015
4a70a36
added thetav output
Nov 25, 2015
4b9a8fb
added thetav output
Nov 25, 2015
e7b2da3
added thetav output
Nov 25, 2015
02340ac
moving microphysics source calculation to C
Nov 30, 2015
0212bb5
updated microphysics so that sedimenation velocity calculations are b…
Nov 30, 2015
be2b003
added output for snow microphysical source terms
Nov 30, 2015
1d7d9f7
Added IsdacCC case
Dec 1, 2015
777dfa5
testing dmean formulation
Dec 1, 2015
5e01c7d
moved N0 calculation out of sedimentation velocities, and try to run …
Dec 1, 2015
b3a9885
turned off microphysics source terms
Dec 1, 2015
e0d6da7
added back snow autoconversion
Dec 2, 2015
663cd29
Changed the call of latent heat and lambda in A1M
Dec 2, 2015
7dd49c5
matched the substep to the old setup
Dec 2, 2015
84858aa
added back micro source terms
Dec 2, 2015
7dfeb75
Updated source terms calculation
Dec 2, 2015
85aea85
clean up A1M microphysics
Dec 2, 2015
efc81b1
Merge branch 'ice_micro' into IsdacCC
Dec 2, 2015
90ff602
cleanup A1M microphysics
Dec 2, 2015
6d0398f
updated A1M microphysics
Dec 3, 2015
554c6a6
updated A1M microphysics
Dec 3, 2015
c4fe6c5
added rain src terms output
Dec 10, 2015
88a1f07
Merge remote-tracking branch 'origin/ice_micro' into IsdacCC
Jan 8, 2016
6de87da
added surface sensible heat flux for IsdacCC
Jan 8, 2016
a9e5d98
Updated surface temperature initialization
Mar 31, 2016
56a437b
Merge branch 'master' of github.com:sally-xiyue/pycles
Mar 31, 2016
1133294
Merge remote-tracking branch 'upstream/rrtm_from_master' into ice_rrtm
Mar 31, 2016
e78c33c
fixed some issues associated with the mixed-phase microphysics compat…
Apr 11, 2016
84ecdf4
added radiation option in DYCOMS_RF01 namelist
Apr 11, 2016
6154732
added RRTMG related files
Apr 11, 2016
c7c1ea6
Merge remote-tracking branch 'upstream/rrtm_from_master' into ice_rrtm
Apr 11, 2016
3fde7a4
updated Isdac radiation
Apr 11, 2016
3013492
more fix on Isdac radiation
Apr 11, 2016
91ef042
add radiation namelist options
Apr 11, 2016
7cdacca
add radiation namelist options
Apr 11, 2016
a8d07af
adding rrtmg to Isdac default case
Apr 12, 2016
37520f3
remove print statements in rrtmg
Apr 12, 2016
8b08de8
adding rrtm namelist options for Isdac
Apr 13, 2016
8730db4
Merge branch 'ice_rrtm' into IsdacCC_rrtm
Apr 14, 2016
2d68b90
Merge remote-tracking branch 'upstream/rrtm_from_master' into ice_rrtm
Apr 14, 2016
6f0e08e
Merge branch 'ice_rrtm' into IsdacCC_rrtm
Apr 14, 2016
027850f
Change IsdacCC initial Ts
Apr 14, 2016
e727a25
update latent heat variable Arctic definition
Apr 20, 2016
f8672bc
update rrtm effective radius of ice (Boudala et al. 2002)
Apr 20, 2016
cb3da5b
update rrtmg effective radius of ice threshold to be consistent
Apr 21, 2016
7c2a494
update reice threshold
Apr 22, 2016
7aec44b
Merge remote-tracking branch 'upstream/master'
May 23, 2016
c5cdd0a
Merge branch 'master' into ice_rrtm
May 23, 2016
3b355b9
Merge branch 'master' into IsdacCC_rrtm
May 23, 2016
cd9755e
fixed a bug in Surface
May 23, 2016
dbdb221
fixed a bug in Surface
May 23, 2016
211c92d
fixed a bug in Isdac initialization
May 23, 2016
6816ba8
fixed a bug in Isdac forcing
May 23, 2016
7b99273
debugging radiation output
May 23, 2016
f71da59
debugging radiation output
May 23, 2016
8950bf6
fixed a bug in Surface IsdacCC
May 24, 2016
e17c47f
added the option to have liquid only Arctic_1M microphysics
May 25, 2016
fa0c5da
fixed a bug in liquid Arctic_1m microphysics
May 26, 2016
67bf0e6
fixed a bug in liquid Arctic_1m microphysics
May 26, 2016
a6b1674
Fixed a bug in effective radius of ice in RRTM
Sep 19, 2016
3b60e52
Fixed a bug in microphysical entropy source term for snow
Dec 5, 2016
3ab0433
Added Mpace initialization
Jan 9, 2017
8c3ca9c
Fixed a bug in Isdac and IsdacCC initialization horizontal wind u
Jan 9, 2017
fc1bf80
Added namelist option for Mpace
Jan 9, 2017
691db8e
Added Mpace initialization call
Jan 9, 2017
1fe2fb8
Added Mpace forcing case
Jan 9, 2017
3763bfa
Fixed a bug in Mpace Init
Jan 10, 2017
8e8a7e9
Added Mpace radiation profile call
Jan 10, 2017
9b410d1
Added subsidence forcing outputs for Mpace
Jan 10, 2017
a4ff4e6
Added Mpace surface case
Jan 10, 2017
7b39b52
Added RRTM namelist option for Mpace
Jan 10, 2017
b822458
Edited Mpace namelist RRTM option
Jan 10, 2017
d9cb8fe
Edited Mpace namelist RRTM option
Jan 10, 2017
7e47747
Fixed a bug in Mpace init
Jan 11, 2017
ff9d112
Added RRTM SW options for Mpace
Jan 11, 2017
5ae89c8
Added RRTM timevarying SW options for Mpace
Jan 11, 2017
b889308
Edited RRTM input option for coszen
Jan 12, 2017
31139df
Changed Mpace surface cm calculation
Jan 13, 2017
01baa55
Set Mpace surface gustiness to be non-zero
Jan 16, 2017
1252939
Fixed bugs in wind profiles initializations
Jan 17, 2017
8121dd5
Fixed Mpace forcing wind bugs
Jan 17, 2017
780cba0
Clean up Mpace surface
Jan 17, 2017
dd7d620
Fixed bugs in Arctic microphysics
Jun 12, 2017
432f7ce
Added liquid fraction function by Hu et al. (2010) as default option
Jul 6, 2017
55fde29
Added logistic function as an option for liquid fraction
Jul 13, 2017
195f61e
Updated liquid fraction function
Jul 14, 2017
a75dea1
Modified liquid fraction function
Jul 21, 2017
8632907
Added ISDAC option of applying large-scale forcing from MERRA-2
Oct 10, 2017
a8e5a71
Added Greg Cesana's liquid fraction formulation
Oct 11, 2017
dc5c1ae
Fixed a bug in accretion coefficient
Oct 19, 2017
fcd52fb
Fixed the index bound error in microphysics_arctic
Oct 19, 2017
6f35605
Added clear sky fluxes and cleaned up radiation
Oct 21, 2017
2fa9196
Updated phase partitioning name and Isdac namelist
Oct 25, 2017
3b9e154
Merge branch 'isdac_forcing'
Oct 25, 2017
e3a36a6
Added RRTM radiation extension profile adjustment for IsdacCC simulat…
Oct 26, 2017
4ee8adb
Use Morrison 2011 formula for snow_lambda
Dec 13, 2017
3be1bf1
Update Arctic microphysics to have the correct precip and evap source…
Dec 13, 2017
7c6fea9
Edited Mpace namelist
Jan 16, 2018
3f7ea6e
Fixed a bug in M-PACE forcing of qt
Jan 30, 2018
5aeab40
Added SHEBA namelist
Jan 30, 2018
9221587
Added SHEBA initial conditions
Jan 30, 2018
21dc138
In the process of adding SHEBA
Feb 1, 2018
40f456b
Updated without having wind nudging
Feb 1, 2018
a420b32
Made minor changes in SHEBA forcing
Feb 1, 2018
30dd999
Updated SHEBA time info for radiation
Feb 1, 2018
f138bf5
Minor changes in SHEBA
Feb 1, 2018
63180f4
Fixed a bug in SHEBA initialization
Feb 2, 2018
bed967e
Updated SHEBA initial profile interpolation to loops
Feb 2, 2018
bb3ebf5
Added patching in SHEBA Forcing profiles initialization
Feb 3, 2018
b12f264
Removed old code
Feb 3, 2018
c93b312
Modified SHEBA initialization surface qt value
Feb 7, 2018
f569c28
Changed the initial profiles of SHEBA to match intercomparison
Feb 17, 2018
84f73f2
Updated Arctic microphysics on master branch to the latest version
Feb 28, 2018
6230ec1
Additional outputs of advection and SHEBA large-scale forcings of ent…
Mar 14, 2018
92705b3
Added M-PACE large-scale forcing outputs
Mar 15, 2018
5789602
Clean up for merging
Mar 22, 2018
aaa526d
Merge with upstream master
Mar 22, 2018
ed21829
Added SHEBA forcing file
Mar 22, 2018
a4c8447
Updated SHEBA forcing intialization
Mar 22, 2018
17bc045
Removed tracking RRTM object files
Mar 22, 2018
5710dd0
Comment cleanup
Mar 22, 2018
1d3e1e5
Updated SHEBA forcing file
Mar 28, 2018
c1b073c
Fixed errors associated with the merge
Mar 29, 2018
8c84d53
Merge remote-tracking branch 'upstream/master' into merge_upstream
Mar 29, 2018
9ef5dff
Removed used micro parameter file
Mar 29, 2018
fc4c86e
Updated SHEBA initialization to use provided profiles
Apr 23, 2018
4b44c3f
Added number concentration outputs
Apr 23, 2018
f3d7498
Updated the calculation of total number concentration for output
Apr 24, 2018
5040280
Removed unnecessary T variables in micro n outputs
Aug 3, 2018
a6b45b8
Adding temporary 3D field of snow_depo as DV
Aug 3, 2018
1c06fd7
Added changes in qv above the domain for RRTM to take into account fo…
Aug 6, 2018
abdc573
Added vertical fluxes of some scalars
Aug 15, 2018
3659961
Updated Surface restart
Aug 15, 2018
0882262
Updated IsdacCC namelist to include SW
Dec 10, 2018
3037889
Added prescribed cos(sza)
Dec 16, 2018
787eb56
Updated wind nudging in IsdacCC to mean wind instead of point wind
Apr 15, 2019
eca1d74
Updated wind nudging in IsdacCC
Apr 16, 2019
d8f2474
Updated wind nudging in IsdacCC
Apr 16, 2019
348151f
Updated s and qt nudging in IsdacCC to be towards the mean fields as …
Apr 18, 2019
887fff3
Added adif to IsdacCC namelist
Apr 18, 2019
fa110fa
Added namelist for solar constant adjustment in IsdacCC
Apr 26, 2019
173661f
Fixed namelist error in IsdacCC RRTM
Apr 29, 2019
e72219d
Reformulated microphysics_arctic_1m accretion to correct errors
Oct 7, 2019
c914f09
Bug fix in kinematics.h
Oct 8, 2019
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
2 changes: 1 addition & 1 deletion Csrc/kinematics.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void compute_strain_rate_mag(const struct DimStruct *dims, double* restrict stra
//Off-diagonal components
//Here factor of 2 arises because we invoke symmetry of tensor
for(ssize_t vi1=0;vi1<dims->dims-1;vi1++){
for (ssize_t d=vi1;d<dims->dims;d++){
for (ssize_t d=vi1+1;d<dims->dims;d++){
const ssize_t shift_s = 3 * dims->npg * vi1 + dims->npg * d ;
for(ssize_t i=imin+1;i<imax;i++){
const ssize_t ishift = i*istride;
Expand Down
116 changes: 105 additions & 11 deletions Csrc/microphysics_arctic_1m.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,20 +341,27 @@ void accretion_all(double density, double p0, double temperature, double ccn, do
factor_s = density*GD3_SNOW*nsnow*pi*ALPHA_ACC_SNOW*C_SNOW*0.25*pow(snow_lam, (-D_SNOW-3.0));
}

double src_ri = -piacr/density;
double src_rl = factor_r*e_rl*ql/density;
double src_si = factor_s*e_si*qi/density;
double src_ri_r = 0.0;
double src_ri_i = 0.0;
double src_ri_s = 0.0;
double src_sl_r = 0.0;
double src_sl_s = 0.0;
double src_rl_r = factor_r*e_rl*ql/density;
double src_si_s = factor_s*e_si*qi/density;
double rime_sl = factor_s*e_sl*ql/density;
double src_sl = 0.0;

if( temperature > 273.16 ){
src_sl = -cvl/lf0*(temperature-273.16)*rime_sl;
src_rl = src_rl + rime_sl - src_sl;
src_sl_s = -cvl/lf0*(temperature-273.16)*rime_sl;
src_sl_r = (1.0 + cvl/lf0*(temperature-273.16))*rime_sl;
}
else{
src_sl = rime_sl + (factor_r*e_ri*qi + piacr)/density;
src_ri_i = factor_r*e_ri*qi/density;
src_ri_r = -piacr/density;
src_sl_s = rime_sl;
}

src_ri_s = -src_ri_r + src_ri_i; //both rain-ice collision terms contribute to snow tendency

/* Now precip-precip interactions */
double src_r = 0.0;
double src_s = 0.0;
Expand All @@ -376,10 +383,10 @@ void accretion_all(double density, double p0, double temperature, double ccn, do
}
}

*qrain_tendency = src_r + src_rl + src_ri;
*qsnow_tendency = src_s + src_sl + src_si;
*ql_tendency = -(src_rl + rime_sl);
*qi_tendency = -(src_ri + src_si);
*qrain_tendency = src_r + src_rl_r + src_ri_r + src_sl_r;
*qsnow_tendency = src_s + src_sl_s + src_ri_s + src_si_s;
*ql_tendency = -src_rl_r - src_sl_s - src_sl_r;
*qi_tendency = -src_ri_i - src_si_s;

return;
};
Expand Down Expand Up @@ -1103,3 +1110,90 @@ void melt_snow_wrapper(const struct DimStruct *dims, double* density, double* te
return;

};

void get_n_ice(const struct DimStruct *dims, double* density, double* qi, double n0i, double* n_ice){

const ssize_t istride = dims->nlg[1] * dims->nlg[2];
const ssize_t jstride = dims->nlg[2];
const ssize_t imin = dims->gw;
const ssize_t jmin = dims->gw;
const ssize_t kmin = dims->gw;
const ssize_t imax = dims->nlg[0]-dims->gw;
const ssize_t jmax = dims->nlg[1]-dims->gw;
const ssize_t kmax = dims->nlg[2]-dims->gw;

for(ssize_t i=imin; i<imax; i++){
const ssize_t ishift = i * istride;
for(ssize_t j=jmin; j<jmax; j++){
const ssize_t jshift = j * jstride;
for(ssize_t k=kmin; k<kmax; k++){
const ssize_t ijk = ishift + jshift + k;

double lambda_ = ice_lambda(density[ijk], qi[ijk], n0i);

n_ice[ijk] = n0i / lambda_;

}
}
}
return;

};

void get_n_rain(const struct DimStruct *dims, double* density, double* qrain, double* n0rain, double* n_rain){

const ssize_t istride = dims->nlg[1] * dims->nlg[2];
const ssize_t jstride = dims->nlg[2];
const ssize_t imin = dims->gw;
const ssize_t jmin = dims->gw;
const ssize_t kmin = dims->gw;
const ssize_t imax = dims->nlg[0]-dims->gw;
const ssize_t jmax = dims->nlg[1]-dims->gw;
const ssize_t kmax = dims->nlg[2]-dims->gw;

for(ssize_t i=imin; i<imax; i++){
const ssize_t ishift = i * istride;
for(ssize_t j=jmin; j<jmax; j++){
const ssize_t jshift = j * jstride;
for(ssize_t k=kmin; k<kmax; k++){
const ssize_t ijk = ishift + jshift + k;

double lambda_ = rain_lambda(density[ijk], qrain[ijk], n0rain[ijk]);

n_rain[ijk] = n0rain[ijk] / lambda_;

}
}
}
return;

};

void get_n_snow(const struct DimStruct *dims, double* density, double* qsnow, double* n0snow, double* n_snow){

const ssize_t istride = dims->nlg[1] * dims->nlg[2];
const ssize_t jstride = dims->nlg[2];
const ssize_t imin = dims->gw;
const ssize_t jmin = dims->gw;
const ssize_t kmin = dims->gw;
const ssize_t imax = dims->nlg[0]-dims->gw;
const ssize_t jmax = dims->nlg[1]-dims->gw;
const ssize_t kmax = dims->nlg[2]-dims->gw;

for(ssize_t i=imin; i<imax; i++){
const ssize_t ishift = i * istride;
for(ssize_t j=jmin; j<jmax; j++){
const ssize_t jshift = j * jstride;
for(ssize_t k=kmin; k<kmax; k++){
const ssize_t ijk = ishift + jshift + k;

double lambda_ = snow_lambda(density[ijk], qsnow[ijk], n0snow[ijk]);

n_snow[ijk] = n0snow[ijk] / lambda_;

}
}
}
return;

};
4 changes: 4 additions & 0 deletions Forcing.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ cdef class ForcingIsdacCC:
double [:] nudge_coeff_scalars
double [:] w_half
double z_top
double [:] source_u_nudge
double [:] source_v_nudge
double [:] source_s_nudge
double [:] source_qt_nudge

double divergence
cpdef initialize(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, Th, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
Expand Down
99 changes: 69 additions & 30 deletions Forcing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,10 @@ cdef class ForcingIsdacCC:
self.initial_u = np.zeros(Gr.dims.nlg[2],dtype=np.double,order='c')
self.initial_v = np.zeros(Gr.dims.nlg[2],dtype=np.double,order='c')
self.w_half = np.zeros(Gr.dims.nlg[2],dtype=np.double,order='c')

self.source_u_nudge = np.zeros(Gr.dims.nlg[2],dtype=np.double,order='c')
self.source_v_nudge = np.zeros(Gr.dims.nlg[2],dtype=np.double,order='c')
self.source_s_nudge = np.zeros(Gr.dims.nlg[2],dtype=np.double,order='c')
self.source_qt_nudge = np.zeros(Gr.dims.nlg[2],dtype=np.double,order='c')
cdef:
Py_ssize_t k

Expand All @@ -837,8 +840,8 @@ cdef class ForcingIsdacCC:
for k in xrange(Gr.dims.nlg[2]):

#Set velocity profile
self.initial_v[k] = -2.0 + 0.003 * Gr.zl_half[k]
self.initial_u[k] = -7.0
self.initial_v[k] = -2.0 + 0.003 * Gr.zl_half[k] - RS.v0
self.initial_u[k] = -7.0 - RS.u0

if Gr.zl_half[k] <= self.z_top:
self.nudge_coeff_velocities[k] = (1/7200.0)*0.5*(1 - cos(pi*Gr.zl_half[k]/self.z_top))
Expand Down Expand Up @@ -877,17 +880,53 @@ cdef class ForcingIsdacCC:
Py_ssize_t s_shift = PV.get_varshift(Gr, 's')
Py_ssize_t qt_shift = PV.get_varshift(Gr,'qt')
Py_ssize_t t_shift = DV.get_varshift(Gr, 'temperature')
Py_ssize_t imin = Gr.dims.gw
Py_ssize_t jmin = Gr.dims.gw
Py_ssize_t kmin = Gr.dims.gw
Py_ssize_t imax = Gr.dims.nlg[0] - Gr.dims.gw
Py_ssize_t jmax = Gr.dims.nlg[1] - Gr.dims.gw
Py_ssize_t kmax = Gr.dims.nlg[2] - Gr.dims.gw
Py_ssize_t istride = Gr.dims.nlg[1] * Gr.dims.nlg[2]
Py_ssize_t jstride = Gr.dims.nlg[2]
Py_ssize_t i, j, k, ishift, jshift, ijk

apply_subsidence(&Gr.dims,&RS.rho0[0],&RS.rho0_half[0],&self.w_half[0],&PV.values[s_shift],&PV.tendencies[s_shift])
apply_subsidence(&Gr.dims,&RS.rho0[0],&RS.rho0_half[0],&self.w_half[0],&PV.values[qt_shift],&PV.tendencies[qt_shift])
apply_subsidence(&Gr.dims,&RS.rho0[0],&RS.rho0_half[0],&self.w_half[0],&PV.values[u_shift],&PV.tendencies[u_shift])
apply_subsidence(&Gr.dims,&RS.rho0[0],&RS.rho0_half[0],&self.w_half[0],&PV.values[v_shift],&PV.tendencies[v_shift])

apply_nudging(&Gr.dims,&self.nudge_coeff_velocities[0],&self.initial_u[0],&PV.values[u_shift],&PV.tendencies[u_shift])
apply_nudging(&Gr.dims,&self.nudge_coeff_velocities[0],&self.initial_v[0],&PV.values[v_shift],&PV.tendencies[v_shift])
apply_nudging(&Gr.dims,&self.nudge_coeff_scalars[0],&self.initial_entropy[0],&PV.values[s_shift],&PV.tendencies[s_shift])
apply_nudging(&Gr.dims,&self.nudge_coeff_scalars[0],&self.initial_qt[0],&PV.values[qt_shift],&PV.tendencies[qt_shift])
# apply_nudging(&Gr.dims,&self.nudge_coeff_velocities[0],&self.initial_u[0],&PV.values[u_shift],&PV.tendencies[u_shift])
# apply_nudging(&Gr.dims,&self.nudge_coeff_velocities[0],&self.initial_v[0],&PV.values[v_shift],&PV.tendencies[v_shift])
# apply_nudging(&Gr.dims,&self.nudge_coeff_scalars[0],&self.initial_entropy[0],&PV.values[s_shift],&PV.tendencies[s_shift])
# apply_nudging(&Gr.dims,&self.nudge_coeff_scalars[0],&self.initial_qt[0],&PV.values[qt_shift],&PV.tendencies[qt_shift])

#Get domain mean profiles
cdef:
double [:] umean = Pa.HorizontalMean(Gr, &PV.values[u_shift])
double [:] vmean = Pa.HorizontalMean(Gr, &PV.values[v_shift])
double [:] smean = Pa.HorizontalMean(Gr, &PV.values[s_shift])
double [:] qtmean = Pa.HorizontalMean(Gr, &PV.values[qt_shift])

# Calculate nudging
with nogil:
for k in xrange(kmin, kmax):
# Nudge mean wind profiles through entire depth
self.source_u_nudge[k] = -(umean[k] - self.initial_u[k]) * self.nudge_coeff_velocities[k]
self.source_v_nudge[k] = -(vmean[k] - self.initial_v[k]) * self.nudge_coeff_velocities[k]
self.source_s_nudge[k] = -(smean[k] - self.initial_entropy[k]) * self.nudge_coeff_scalars[k]
self.source_qt_nudge[k] = -(qtmean[k] - self.initial_qt[k]) * self.nudge_coeff_scalars[k]

with nogil:
for i in xrange(imin,imax):
ishift = i * istride
for j in xrange(jmin,jmax):
jshift = j * jstride
for k in xrange(kmin,kmax):
ijk = ishift + jshift + k
PV.tendencies[u_shift + ijk] += self.source_u_nudge[k]
PV.tendencies[v_shift + ijk] += self.source_v_nudge[k]
PV.tendencies[s_shift + ijk] += self.source_s_nudge[k]
PV.tendencies[qt_shift + ijk] += self.source_qt_nudge[k]

return

Expand Down Expand Up @@ -928,29 +967,29 @@ cdef class ForcingIsdacCC:
mean_tendency = Pa.HorizontalMean(Gr,&tmp_tendency[0])
NS.write_profile('v_subsidence_tendency',mean_tendency[Gr.dims.gw:-Gr.dims.gw],Pa)

tmp_tendency[:] = 0.0
apply_nudging(&Gr.dims,&self.nudge_coeff_velocities[0],&self.initial_u[0],&PV.values[u_shift],
&tmp_tendency[0])
mean_tendency = Pa.HorizontalMean(Gr,&tmp_tendency[0])
NS.write_profile('u_nudging_tendency',mean_tendency[Gr.dims.gw:-Gr.dims.gw],Pa)

tmp_tendency[:] = 0.0
apply_nudging(&Gr.dims,&self.nudge_coeff_velocities[0],&self.initial_v[0],&PV.values[v_shift],
&tmp_tendency[0])
mean_tendency = Pa.HorizontalMean(Gr,&tmp_tendency[0])
NS.write_profile('v_nudging_tendency',mean_tendency[Gr.dims.gw:-Gr.dims.gw],Pa)

tmp_tendency[:] = 0.0
apply_nudging(&Gr.dims,&self.nudge_coeff_scalars[0],&self.initial_entropy[0],&PV.values[s_shift],
&tmp_tendency[0])
mean_tendency = Pa.HorizontalMean(Gr,&tmp_tendency[0])
NS.write_profile('s_nudging_tendency',mean_tendency[Gr.dims.gw:-Gr.dims.gw],Pa)

tmp_tendency[:] = 0.0
apply_nudging(&Gr.dims,&self.nudge_coeff_scalars[0],&self.initial_qt[0],&PV.values[qt_shift],
&tmp_tendency[0])
mean_tendency = Pa.HorizontalMean(Gr,&tmp_tendency[0])
NS.write_profile('qt_nudging_tendency',mean_tendency[Gr.dims.gw:-Gr.dims.gw],Pa)
# tmp_tendency[:] = 0.0
# apply_nudging(&Gr.dims,&self.nudge_coeff_velocities[0],&self.initial_u[0],&PV.values[u_shift],
# &tmp_tendency[0])
# mean_tendency = Pa.HorizontalMean(Gr,&tmp_tendency[0])
NS.write_profile('u_nudging_tendency',self.source_u_nudge[Gr.dims.gw:-Gr.dims.gw],Pa)
#
# tmp_tendency[:] = 0.0
# apply_nudging(&Gr.dims,&self.nudge_coeff_velocities[0],&self.initial_v[0],&PV.values[v_shift],
# &tmp_tendency[0])
# mean_tendency = Pa.HorizontalMean(Gr,&tmp_tendency[0])
NS.write_profile('v_nudging_tendency',self.source_v_nudge[Gr.dims.gw:-Gr.dims.gw],Pa)

# tmp_tendency[:] = 0.0
# apply_nudging(&Gr.dims,&self.nudge_coeff_scalars[0],&self.initial_entropy[0],&PV.values[s_shift],
# &tmp_tendency[0])
# mean_tendency = Pa.HorizontalMean(Gr,&tmp_tendency[0])
NS.write_profile('s_nudging_tendency',self.source_s_nudge[Gr.dims.gw:-Gr.dims.gw],Pa)

# tmp_tendency[:] = 0.0
# apply_nudging(&Gr.dims,&self.nudge_coeff_scalars[0],&self.initial_qt[0],&PV.values[qt_shift],
# &tmp_tendency[0])
# mean_tendency = Pa.HorizontalMean(Gr,&tmp_tendency[0])
NS.write_profile('qt_nudging_tendency',self.source_qt_nudge[Gr.dims.gw:-Gr.dims.gw],Pa)

return

Expand Down
76 changes: 29 additions & 47 deletions Initialization.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1231,62 +1231,44 @@ def InitSheba(namelist, Grid.Grid Gr,PrognosticVariables.PrognosticVariables PV,
Py_ssize_t qt_varshift = PV.get_varshift(Gr,'qt')
double [:] thetal = np.zeros((Gr.dims.nlg[2],),dtype=np.double,order='c')
double [:] qt = np.zeros((Gr.dims.nlg[2],),dtype=np.double,order='c')
double [:] wt = np.zeros((Gr.dims.nlg[2],),dtype=np.double,order='c')
double p_inv = 95700.0
double [:] ps
double [:] us
double [:] vs
double [:] v = np.zeros((Gr.dims.nlg[2],),dtype=np.double,order='c')
double [:] u = np.zeros((Gr.dims.nlg[2],),dtype=np.double,order='c')

for k in xrange(Gr.dims.nlg[2]):

#Set thetal and qt profile
if RS.p0_half[k] > p_inv:
thetal[k] = 255.7 #257.0
wt[k] = 0.91 #0.915 #Mixing ratio in g/kg
else:
thetal[k] = 255.7+6.9 #263.9
wt[k] = 0.8
sheba_init = np.loadtxt('./SHEBAdata/sheba_init.txt', comments='!')
sheba_p = sheba_init[:, 0]
sheba_t = sheba_init[:, 1]
sheba_rh = sheba_init[:, 2]
sheba_rl = sheba_init[:, 3]
sheba_thetal = sheba_t*(p_tilde/sheba_p)**(Rd/cpd)*np.exp(-(sheba_rl*2.501e6) / (sheba_t*cpd))
sheba_u = sheba_init[:, 4]
sheba_v = sheba_init[:, 5]

for k in xrange(Gr.dims.nlg[2]-1):
if RS.p0_half[k] < p_inv:
thetal[k+1] = thetal[k] + ((1.0/exner_c(RS.p0_half[k+1]))*fmin(3.631e-8*(p_inv - RS.p0_half[k+1]), 5.7e-4))*(RS.p0_half[k]-RS.p0_half[k+1])
wt[k+1] = wt[k] - 1.4e-5*(RS.p0_half[k]-RS.p0_half[k+1])

#Convert mixing ratio to specific humidity
qt[k] = wt[k]/(1.0 + wt[k]/1000.0)/1000.0

#Horizontal wind profiles from Colleen's JPLLES code

ps = np.array([1017.0,1012.0,1007.0,1002.0,997.0,992.0,987.0,982.0,977.0,972.0,967.0,962.0,957.01,957.0,
956.99,952.0,947.0,942.0,937.0,932.0,927.0,922.0,917.0,912.0,907.0,902.0,897.0,892.0,
887.0,882.0,877.0,872.0,867.0,862.0,857.0,852.0,847.0,842.0,837.0,832.0,827.0,822.0,817.0,
812.0,807.0,802.0,797.0,792.0,787.0,782.0,777.0,772.0,767.0,762.0,757.0,752.0,747.0,742.0,
737.0,732.0,727.0,722.0,717.0,712.0,707.0,702.0,697.0,692.0,687.0,682.0,677.0,672.0,667.0,
662.0,657.0,652.0,647.0,642.0,637.0,632.0,627.0,622.0,617.0,612.0,607.0],dtype=np.double,order='c')*100.0

us = np.array([2.916,2.8999,2.7895,2.679,2.5568,2.417,2.2772,2.1374,1.9976,1.8856,1.7926,1.6996,1.6066,1.6066,
1.6066,1.5136,1.4205,1.3248,1.2203,1.1159,1.0114,0.90701,0.80257,0.69813,0.59368,0.48564,0.37645,
0.26726,0.15807,0.048881,-0.06031,-0.1695,-0.27869,-0.42739,-0.61744,-0.80748,-0.99753,-1.1876,
-1.3776,-1.5677,-1.7577,-1.9477,-2.0576,-2.1326,-2.2076,-2.2826,-2.3576,-2.4326,-2.5076,-2.5826,
-2.6576,-2.6911,-2.6961,-2.701,-2.7059,-2.7109,-2.7158,-2.7207,-2.7257,-2.7306,-2.7137,-2.653,
-2.5923,-2.5316,-2.4708,-2.4101,-2.3494,-2.2886,-2.2279,-2.1662,-2.08,-1.9938,-1.9076,-1.8214,
-1.7352,-1.649,-1.5629,-1.4767,-1.3905,-1.302,-1.213,-1.124,-1.035,-0.94601,-0.85701],dtype=np.double,order='c')

vs = np.array([2.8497,2.9023,3.2622,3.6221,3.8701,3.9526,4.0351,4.1177,4.2002,4.2743,4.3427,4.4112,4.4796,4.4796,
4.4796,4.548,4.6165,4.6831,4.744,4.8048,4.8657,4.9266,4.9874,5.0483,5.1092,5.1671,5.2241,5.2811,
5.3381,5.3951,5.4521,5.5091,5.5662,5.6245,5.6844,5.7442,5.8041,5.8639,5.9238,5.9836,6.0434,6.1033,
6.1444,6.1774,6.2105,6.2435,6.2765,6.3096,6.3426,6.3756,6.4086,6.4722,6.5567,6.6412,6.7258,6.8103,
6.8948,6.9794,7.0639,7.1484,7.2388,7.3407,7.4426,7.5446,7.6465,7.7485,7.8504,7.9524,8.0543,8.1574,
8.2893,8.4211,8.553,8.6848,8.8167,8.9485,9.0804,9.2122,9.3441,9.493,9.6463,9.7995,9.9527,10.106,
10.259],dtype=np.double,order='c')
sheba_pv = np.zeros_like(sheba_u)
for n, t_ in enumerate(sheba_t):
sheba_pv[n] = Th.get_pv_star(t_)*sheba_rh[n]/100.0
sheba_wt = eps_v * sheba_pv/(sheba_p - sheba_pv) + sheba_rl
sheba_qt = sheba_wt/(1.0 + sheba_wt)
sheba_ql = sheba_rl/(1.0 + sheba_rl)

#Interpolate to LES grid
for k in xrange(Gr.dims.nlg[2]):
u[k] = interp_pchip(RS.p0[k], ps[::-1], us[::-1])
v[k] = interp_pchip(RS.p0[k], ps[::-1], vs[::-1])

u[k] = interp_pchip(RS.p0_half[k], sheba_p, sheba_u)
v[k] = interp_pchip(RS.p0_half[k], sheba_p, sheba_v)
thetal[k] = interp_pchip(RS.p0_half[k], sheba_p, sheba_thetal)
qt[k] = interp_pchip(RS.p0_half[k], sheba_p, sheba_qt)

# plt.figure()
# plt.subplot(121)
# plt.plot(thetal, RS.p0_half)
# plt.plot(sheba_thetal, sheba_p)
# plt.ylim([110000, 80000])
# plt.subplot(122)
# plt.plot(qt, RS.p0_half)
# plt.plot(sheba_qt, sheba_p)
# plt.ylim([110000, 80000])
# plt.show()

RS.u0 = 0.5 * (np.amax(u)+np.amin(u))
RS.v0 = 0.5 * (np.amax(v)+np.amin(v))
Expand Down
2 changes: 2 additions & 0 deletions Microphysics_Arctic_1M.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ cdef class Microphysics_Arctic_1M:
TimeStepping.TimeStepping TS, ParallelMPI.ParallelMPI Pa)
cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, Th, PrognosticVariables.PrognosticVariables PV,
DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)
cpdef micro_fields(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, PrognosticVariables.PrognosticVariables PV,
DiagnosticVariables.DiagnosticVariables DV)
cpdef ice_stats(self, Grid.Grid Gr, ReferenceState.ReferenceState Ref, PrognosticVariables.PrognosticVariables PV,
DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa)

Loading