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 capability for SCAM forcing based on gridded met fields. #595

Closed
Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e7c0a09
Want to start GW development from latest cam_development
Dec 2, 2021
0f219fd
Merge branch 'ESCOMP:cam_development' into cam_development
JulioTBacmeister May 10, 2022
14b65ee
Merge branch 'ESCOMP:cam_development' into cam_development
JulioTBacmeister May 20, 2022
7f43caa
Capability for SCAM to be driven by gridded met fields
May 20, 2022
496c209
Merge branch 'cam_development' of https://github.com/JulioTBacmeister…
May 20, 2022
bb4cca9
correcting dimensions of PKO,RV in get_ana_dynfrc_4scam.F90
May 24, 2022
d542611
moving mountain
May 26, 2022
103a3c5
trying to restore original intent
May 26, 2022
6be8815
buildnml mod to accomodate templtes with %
May 27, 2022
91dc7e4
must be necessary
May 27, 2022
6b98a09
missing )
May 27, 2022
31846dd
revert change to build-namelest
May 31, 2022
5c96d42
revert again
May 31, 2022
e51206f
Merge pull request #1 from peverwhee/scam_julio
JulioTBacmeister Jun 1, 2022
e7133bf
redo build-namelist
Jun 1, 2022
77aa2cc
updated make_basecase.auto.csh
Jun 7, 2022
2d1ded5
removed cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csf
Jun 7, 2022
807811f
removed cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.aut…
Jun 7, 2022
89fac35
Updated to new CLUBB external
Jul 14, 2022
5ca9af9
Python tools etc for SCAM
Jul 16, 2022
e5be7c3
forgot case_name
Jul 16, 2022
6560907
name change
Jul 18, 2022
35d50be
working on python, clubbtop
Jul 20, 2022
0b9fad0
Externals_CAM updated
Jul 20, 2022
33f1d5c
mflit etc
Jul 21, 2022
7fa25e0
adding some plotting
Jul 25, 2022
7660d98
adding support for cheyenne and L93
JulioTBacmeister Jul 26, 2022
fd648c6
typo/syntax and UBC for H2O
JulioTBacmeister Jul 26, 2022
b8ec3dc
Merge branch 'cam_development' of https://github.com/JulioTBacmeister…
Jul 26, 2022
8405550
added machine recognition, ie., izumi, cheyenne
Jul 27, 2022
3676dc7
more support for diff machines etc.
Jul 27, 2022
e9cdc1b
clean up
Jul 28, 2022
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
5 changes: 2 additions & 3 deletions bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -4404,9 +4404,8 @@ sub check_input_files {
print $fh "$var = $pathname\n";
}
else {
if (-e $pathname) { # use -e rather than -f since the absolute pathname
# might be a directory
print "OK -- found $var = $pathname\n";
if (!($pathname =~ '%.*')) {
print $fh "$var = $pathname\n";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this should be needed (see below) and could have unintended effects.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these lines be removed altogether? Or replaced with what was there before?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be replaced with what was there before. I opened a PR with the changes if that helps (you can also close it if you don't need it):

JulioTBacmeister#1

Apologies for any whiplash you may be experiencing.

}
else {
print "NOT FOUND: $var = $pathname\n";
Expand Down
73 changes: 73 additions & 0 deletions bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5336,6 +5336,79 @@ Force scam to use the lat lon fields specified in the scam namelist not what is
Default: FALSE
</entry>

<entry id="use_scm_ana_frc" type="logical" category="scam"
group="scam_nl" valid_values="">
SCAM to calculate or read tendencies from a global ana/dycore
Default: FALSE
</entry>

<entry id="scm_ana_upwind" type="logical" category="scam"
group="scam_nl" valid_values="">
Use 1st order upwind for ana tendencies (instead of 2nd order space centered)
Default: FALSE
</entry>

<entry id="scm_ana_t_react" type="logical" category="scam"
group="scam_nl" valid_values="">
Use scam state as center column in stencil for ana adv tendencies
Default: FALSE
</entry>

<entry id="scm_ana_q_react" type="logical" category="scam"
group="scam_nl" valid_values="">
Use scam state as center column in stencil for ana adv tendencies
Default: FALSE
</entry>

<entry id="scm_ana_u_react" type="logical" category="scam"
group="scam_nl" valid_values="">
Use scam state as center column in stencil for ana adv tendencies
Default: FALSE
</entry>

<entry id="scm_ana_v_react" type="logical" category="scam"
group="scam_nl" valid_values="">
Use scam state as center column in stencil for ana adv tendencies
Default: FALSE
</entry>

<entry id="scm_ana_direct_ttend" type="logical" category="scam"
group="scam_nl" valid_values="">
Force scam to use tendencies directly from dycore or ana (not recalculated)
Default: FALSE
</entry>

<entry id="scm_ana_direct_omega" type="logical" category="scam"
group="scam_nl" valid_values="">
Force scam to use omega directly from dycore or ana (not recalculated)
Default: FALSE
</entry>

<entry id="scm_ana_x_plevels" type="logical" category="scam"
group="scam_nl" valid_values="">
Interpolate ana fields to constant pressure surfaces
Default: FALSE
</entry>


<entry id="scm_ana_frc_file_template" type="char*128" input_pathname="abs" category="scam"
group="scam_nl" valid_values="" >
template for analysis forcing dataset.
Default: set by build-namelist.
</entry>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable is a string, not a filename (path), therefore, it should not have the input_pathname attribute. I believe this is the source of the build-namelist problems.


<entry id="scm_ana_frc_path" type="char*128" input_pathname="abs" category="scam"
group="scam_nl" valid_values="" >
templatefull path for analysis forcing dataset.
Default: set by build-namelist.
</entry>

<entry id="scm_use_ana_iop" type="logical" category="scam"
group="scam_nl" valid_values="">
Force scam to compute large-scale forcing from renalysis or 3D model output
Default: FALSE
</entry>

<!-- Solar Parameters -->

<entry id="solar_const" type="real" category="solar"
Expand Down
Binary file not shown.
105 changes: 105 additions & 0 deletions cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/bin/csh -f
#
# Makes base case that can later be spawned to different
# lats and lons. Start with ARM SGP coords cuz we're comfortable
# there, lots of data etc. ...


if ( "$#argv" != 3) then
echo "Wrong number of arguments specified:"
echo " -arg 1 lat"
echo " -arg 2 lon"
echo " -arg 3 case string"
exit
endif

set n = 1
set case_lat = "$argv[$n]"
set n = 2
set case_lon = "$argv[$n]"
set n = 3
set loc_string = "$argv[$n]"

set COMPSET=FSCAM

set src=cam6_3_041.dtsens

#set mach=izumi
#set queue=short
#set srcpath=/home/$USER/src
#set scratchdir=/scratch/cluster/$USER

set mach=cheyenne
set queue=share
set srcpath=/glade/u/home/$USER/src
set scratchdir=/glade/scratch/$USER

set case_year = 2010
set case_mon = 05
set case_day = 01

set case_date = $case_year$case_mon$case_day
set case_sdate = $case_year"-"$case_mon"-"$case_day

echo $case_date
echo $case_sdate

set laa = `echo $case_lat | cut -d '.' -f 1`
echo $laa
set loo = `echo $case_lon | cut -d '.' -f 1`
echo $loo

# set basecase name
set CASE="${src}_${COMPSET}_L58dev_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_test0"

# create new basecase
${srcpath}/${src}/cime/scripts/create_newcase --case ${scratchdir}/${CASE} --compset ${COMPSET} --res T42_T42 --user-mods-dir ${srcpath}/${src}/cime_config/usermods_dirs/scam_STUB --walltime 00:30:00 --mach ${mach} --pecount 1 --compiler intel --driver mct --queue ${queue} --run-unsupported

cd ${scratchdir}/${CASE}

#sed -i 's/intel\/18.0.3/intel\/20.0.1/' ./env_mach_specific.xml
#sed -i 's/intel\/mvapich2-2.3rc2-intel-18.0.3/intel\/mvapich2-2.1-qlc/' ./env_mach_specific.xml
./case.setup

#./xmlchange DEBUG=TRUE
./xmlchange DOUT_S=FALSE

# Append to CAM configure options
./xmlchange --append CAM_CONFIG_OPTS='-phys cam_dev -nlev 58'

# ATM_NCPL should be at least 192 to accomodate
# high wind cases in SH winter
./xmlchange ATM_NCPL=96

# Default to 123 days of runtime
# i.e., 123*96=11808
./xmlchange STOP_N=11807
./xmlchange START_TOD=00000
./xmlchange STOP_OPTION=nsteps

echo "scm_use_ana_iop = .true.">>user_nl_cam

echo "cld_macmic_num_steps=3">>user_nl_cam
#echo "clubb_timestep=150.D0">>user_nl_cam
#echo "clubb_gamma_coef = 0.27D0">>user_nl_cam
#echo "clubb_c14 = 1.6D0">>user_nl_cam
#echo "clubb_l_trapezoidal_rule_zm = .false.">>user_nl_cam
#echo "clubb_l_trapezoidal_rule_zt = .false.">>user_nl_cam

#Set case specific variables
./xmlchange PTS_LAT=${case_lat}
./xmlchange PTS_LON=${case_lon}
./xmlchange RUN_STARTDATE=${case_sdate}

cp ${srcpath}/${src}/cime_config/usermods_dirs/scam_STUB/scripts/STUB_iop.nc ./

ncap2 --overwrite -s "bdate=${case_date}" STUB_iop.nc STUB_iop.nc
ncap2 --overwrite -s "lat[lat]=${case_lat}" STUB_iop.nc STUB_iop.nc
ncap2 --overwrite -s "lon[lon]=${case_lon}" STUB_iop.nc STUB_iop.nc

pwd

echo "READY TO BUILD/SUBMIT "${CASE}
./case.build
./case.submit
exit
72 changes: 72 additions & 0 deletions cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/csh -f

set src = cam6_3_041.dtsens

set lat = 23.08900523560209
set lon = 205
set casenam = st10
source make_basecase.auto.csh $lat $lon $casenam

#cd /glade/u/home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts

#set lat = 24.03141361256544
#set lon = 207.5
#set casenam = st9
#source make_basecase.auto.csh $lat $lon $casenam

#cd /glade/u/home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts

#set lat = 24.9738219895288
#set lon = 210.
#set casenam = st8
#source make_basecase.auto.csh $lat $lon $casenam

#cd /glade/u/home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts

#set lat = 25.91623036649214
#set lon = 212.5
#set casenam = st7
#source make_basecase.auto.csh $lat $lon $casenam

#cd /glade/u/home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts

#set lat = 27.80104712041884
#set lon = 217.5
#set casenam = st6
#source make_basecase.auto.csh $lat $lon $casenam

#cd /glade/u/home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts

#set lat = 29.68586387434554
#set lon = 222.5
#set casenam = st5
#source make_basecase.auto.csh $lat $lon $casenam

#cd /glade/u/home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts

#set lat = 31.57068062827226
#set lon = 228.75
#set casenam = st4
#source make_basecase.auto.csh $lat $lon $casenam

#cd /glade/u/home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts

#set lat = 32.5130890052356
#set lon = 231.25
#set casenam = st3
#source make_basecase.auto.csh $lat $lon $casenam

#cd /glade/u/home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts/

#set lat = 33.45549738219896
#set lon = 233.75
#set casenam = st2
#source make_basecase.auto.csh $lat $lon $casenam

#cd /glade/u/home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts

#set lat = 33.45549738219896
#set lon = 240.
#set casenam = st1
#source make_basecase.auto.csh $lat $lon $casenam

16 changes: 16 additions & 0 deletions cime_config/usermods_dirs/scam_STUB/shell_commands
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# setup SCAM lon and lat for this iop
# this should correspond to the forcing IOP coordinates
#./xmlchange PTS_LON=scmlon
#./xmlchange PTS_LAT=scmlat

# Specify the starting/ending time for the IOP
# The complete time slice of IOP file is specified below
# but you may simulate any within the IOP start and end times.
#./xmlchange RUN_STARTDATE=yyyy-mm-dd
#./xmlchange START_TOD=0
#./xmlchange STOP_OPTION=nsteps
#./xmlchange STOP_N=nnnn

# usermods_dir/scam_mandatory will be included for all single column
# runs by default. This usermods directory contains mandatory settings
# for scam and shouldn't be modified by the user.
42 changes: 42 additions & 0 deletions cime_config/usermods_dirs/scam_STUB/user_nl_cam
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
!scmlon=$PTS_LON
!scmlat=$PTS_LAT
iopfile="$CASEROOT/STUB_iop.nc"
!ncdata="/home/aherring/scam/inic/SCAM_IC_288x192_L58_48_BL10.nc"
ncdata = '/glade/work/aherring/grids/vertical-res/L58/SCAM_IC_288x192_L58_48_BL10.nc'

!bnd_topo="/fs/cgd/csm/inputdata/atm/cam/topo/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_c170103.nc"
bnd_topo = '/glade/p/cesmdata/inputdata/atm/cam/topo/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_c170103.nc'

mfilt=2000
nhtfrq=1
avgflag_pertape(1)='A'

scm_use_obs_uv = .false.
scm_relaxation = .false.
scm_relax_fincl = 'T', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a2',
'ncl_a3', 'num_a1', 'num_a2', 'num_a3',
'num_a4', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa_a1', 'soa_a2'
scm_relax_bot_p = 105000.
scm_relax_top_p = 200.
scm_relax_linear = .true.
scm_relax_tau_bot_sec = 864000.
scm_relax_tau_top_sec = 172800.

use_scm_ana_frc = .true.
!scm_ana_frc_path = "/project/amp/aherring/cam6_3_006.dev_FHIST_f09_f09_mg17_144pes_210818_L58_cam64_MJJA2010/run/"
scm_ana_frc_path = "/glade/p/cesm/amwg/aherring/FORC_FOR_SCAM/cam6_3_006.dev_FHIST_f09_f09_mg17_144pes_210818_L58_cam64_MJJA2010/run/"
scm_ana_frc_file_template = "cam6_3_006.dev_FHIST_f09_f09_mg17_144pes_210818_L58_cam64_MJJA2010.cam.h2.%y-%m-%d-%s.nc"

scm_ana_x_plevels = .true.
scm_ana_direct_omega = .true.
scm_ana_direct_ttend = .false.
scm_ana_t_react = .false.
scm_ana_q_react = .false.
scm_ana_u_react = .false.
scm_ana_v_react = .false.
scm_ana_upwind = .false.


use_gw_convect_dp = .false.
use_gw_convect_sh = .false.
use_gw_front = .false.
7 changes: 6 additions & 1 deletion src/chemistry/mozart/upper_bc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,16 @@ subroutine ubc_init()
use mo_snoe, only: snoe_inti
use mo_msis_ubc, only: msis_ubc_inti
use constituents,only: cnst_get_ind
use scamMod,only: single_column

!---------------------------Local workspace-----------------------------
logical :: zonal_avg
!-----------------------------------------------------------------------
apply_upper_bc = ptop_ref<1._r8 ! Pa
if (single_column) then
apply_upper_bc = .FALSE.
else
apply_upper_bc = ptop_ref<1._r8 ! Pa
endif

if (.not.apply_upper_bc) return

Expand Down
Loading