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

external gridded forcing capability for SCAM #628

Open
wants to merge 9 commits into
base: cam_development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
73 changes: 73 additions & 0 deletions bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5551,6 +5551,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
cacraigucar marked this conversation as resolved.
Show resolved Hide resolved
cacraigucar marked this conversation as resolved.
Show resolved Hide resolved
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" category="scam"
group="scam_nl" valid_values="" >
template for analysis forcing dataset.
Default: set by build-namelist.
</entry>

<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.
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
Comment on lines +1 to +2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Delete commented out lines here and below

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes

iopfile="$CASEROOT/STUB_iop.nc"
Copy link
Collaborator

Choose a reason for hiding this comment

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

The file in cime_config/usermods_dirs/scam_STUB/scripts/STUB_iop.nc should be stored in the svn inputdata repo and accessed accordingly. Will need to remove this file from the commit.

!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'
Copy link
Collaborator

Choose a reason for hiding this comment

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

All files need to be put into the svn repo and referenced without full pathnames

Copy link
Collaborator

Choose a reason for hiding this comment

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

@JulioTBacmeister will email the list of files to put into the svn inputdata repo

Copy link
Collaborator

Choose a reason for hiding this comment

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

The files to use are one month of ERAI data from /glade/p/cdg/amp/juliob/ERAI/f09_omega/L58/2010 and will put the month "04" files into the inputdata svn repo.


!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'
Comment on lines +10 to +12
Copy link
Collaborator

Choose a reason for hiding this comment

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

What fields here and below are necessary for a STUB SCAM run and which are being used for testing purposes? Should remove the ones which are not required


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/chemistry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ subroutine chem_init(phys_state, pbuf2d)
use fire_emissions, only : fire_emissions_init
use short_lived_species, only : short_lived_species_initic
use ocean_emis, only : ocean_emis_init
use scamMod, only : single_column

type(physics_buffer_desc), pointer :: pbuf2d(:,:)
type(physics_state), intent(in):: phys_state(begchunk:endchunk)
Expand Down Expand Up @@ -809,7 +810,11 @@ subroutine chem_init(phys_state, pbuf2d)
if ( 1.e-2_r8 >= ptop_ref .and. ptop_ref > 1.e-5_r8 ) then ! around waccm top, below top of waccmx
cnst_fixed_ubc(1) = .true.
else if ( 1.e1_r8 > ptop_ref .and. ptop_ref > 1.e-2_r8 ) then ! well above top of cam and below top of waccm
call endrun('chem_init: do not know how to set water vapor upper boundary when model top is near mesopause')
if(.not.(single_column)) then
call endrun('chem_init: do not know how to set water vapor upper boundary when model top is near mesopause')
else
cnst_fixed_ubc(1) = .true.
endif
endif

if ( masterproc ) write(iulog,*) 'chem_init: addfld done'
Expand Down
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
58 changes: 57 additions & 1 deletion src/control/history_scam.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ subroutine scm_intht()
call addfld ('UDIFF', (/ 'lev' /), 'A', 'K','difference from observed u wind', gridname='gauss_grid')
call addfld ('VDIFF', (/ 'lev' /), 'A', 'K','difference from observed v wind', gridname='gauss_grid')

call addfld ('TOBS', (/ 'lev' /), 'A', 'K','observed temp')
call addfld ('TOBS', (/ 'lev' /), 'A', 'K','observed temp', gridname='gauss_grid')
call addfld ('UOBS', (/ 'lev' /), 'A', 'm/s','observed zonal wind', gridname='gauss_grid')
call addfld ('VOBS', (/ 'lev' /), 'A', 'm/s','observed meridional wind', gridname='gauss_grid')

call addfld ('QDIFF', (/ 'lev' /), 'A', 'kg/kg','difference from observed water', gridname='gauss_grid')

call addfld ('QOBS', (/ 'lev' /), 'A', 'kg/kg','observed water', gridname='physgrid')
Expand Down Expand Up @@ -100,6 +103,59 @@ subroutine scm_intht()
call addfld ('NLTEN_PHYS', (/ 'lev' /), 'I','#/kg/s', 'NL vertical advective forcing', gridname='gauss_grid' )
call addfld ('NITEN_PHYS', (/ 'lev' /), 'I','#/kg/s', 'NI vertical advective forcing', gridname='gauss_grid' )

!++jtb
call addfld ('U_IOP', (/ 'lev' /), 'I', 'm/s', 'Zonal Wind from IOP ', gridname='gauss_grid' )
call addfld ('V_IOP', (/ 'lev' /), 'I', 'm/s', 'Mer. Wind from IOP ', gridname='gauss_grid' )
call addfld ('OMEGA_IOP', (/ 'lev' /), 'I', 'Pa/s', 'Vertical velocity (from IOP) ', gridname='gauss_grid' )
call addfld ('OMEGA_ANA', (/ 'lev' /), 'I', 'Pa/s', 'Vertical velocity (analysis) ', gridname='gauss_grid' )
call addfld ('ETAD_ANA', (/ 'lev' /), 'I', 'Pa/s', 'Eta_dot (analysis) ', gridname='gauss_grid' )
call addfld ('ZETA_ANA', (/ 'lev' /), 'I', '1/s', 'Rel. Vorticity (analysis) ', gridname='gauss_grid' )
call addfld ('T_ANA', (/ 'lev' /), 'I', 'K', 'Temperature (analysis) ', gridname='gauss_grid' )
call addfld ('Q_ANA', (/ 'lev' /), 'I', 'g/g', 'Spec. humidity (analysis) ', gridname='gauss_grid' )
call addfld ('U_ANA', (/ 'lev' /), 'I', 'm/s', 'Zonal wind (analysis) ', gridname='gauss_grid' )
call addfld ('V_ANA', (/ 'lev' /), 'I', 'm/s', 'Mer. Wind (analysis) ', gridname='gauss_grid' )
call addfld ('TV_ANA', (/ 'lev' /), 'I', 'K', 'Temperature (analysis) ', gridname='gauss_grid' )
call addfld ('TTEN_TOTDYN_ANA', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' )
call addfld ('UTEN_TOTDYN_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('VTEN_TOTDYN_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('QTEN_TOTDYN_ANA', (/ 'lev' /), 'I', 'kg/kg/s', 'tracer tendency (analysis)', gridname='gauss_grid' )

call addfld ('UTEN_TOTDYN_ANAR', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('VTEN_TOTDYN_ANAR', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' )

call addfld ('UTEN_DYCORE_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('VTEN_DYCORE_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('TTEN_DYCORE_ANA', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' )
call addfld ('OMEGA_DYCORE_ANA', (/ 'lev' /), 'I', 'Pa/s','Pressure tendency/velocity (analysis)', gridname='gauss_grid' )
call addfld ('OMEGA_RECALC_ANA', (/ 'lev' /), 'I', 'Pa/s','Pressure tendency/velocity (analysis)', gridname='gauss_grid' )

call addfld ('UTEN_PRG_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('UTEN_PHIG_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('UTEN_KEG_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('UTEN_VORT_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('UTEN_PFRC_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('UTEN_VADV_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('UTEN_HADV_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('UTEN_CORIOL', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' )


call addfld ('VTEN_VORT_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('VTEN_PFRC_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('VTEN_VADV_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('VTEN_HADV_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' )
call addfld ('VTEN_CORIOL', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' )

call addfld ('TTEN_VADV_ANA', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' )
call addfld ('TTEN_HADV_ANA', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' )
call addfld ('TTEN_COMP_ANA', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' )
call addfld ('TTEN_COMP_IOP', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' )

call addfld ('QTEN_VADV_ANA', (/ 'lev' /), 'I', '1/s', 'Temperature tendency (analysis)', gridname='gauss_grid' )
call addfld ('QTEN_HADV_ANA', (/ 'lev' /), 'I', '1/s', 'Temperature tendency (analysis)', gridname='gauss_grid' )

!--jtb


cacraigucar marked this conversation as resolved.
Show resolved Hide resolved
end subroutine scm_intht

!#######################################################################
Expand Down
33 changes: 31 additions & 2 deletions src/control/scamMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ module scamMod
character*(max_path_len), public :: lsmsurffile
character*(max_path_len), public :: lsminifile

!++jtb
logical, public :: use_scm_ana_frc = .false.
character*(max_path_len), public :: scm_ana_frc_file_template
character*(max_path_len), public :: scm_ana_frc_path

logical, public :: scm_ana_x_plevels = .true.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Setting this to true will effect other SCAM runs (see dynamics/eul/get_ana_dynfrc_4scam.F90). Will this be an issue? Is the assumption that the false values below will allow SCAM to run as it always has correct - I did not check this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Set to default as false

Copy link
Collaborator

Choose a reason for hiding this comment

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

Has been changed to false. Verify that all of the other fields do turn off their mods with false

logical, public :: scm_ana_direct_omega = .false.
logical, public :: scm_ana_direct_ttend = .false.
logical, public :: scm_ana_t_react = .false.
logical, public :: scm_ana_q_react = .false.
logical, public :: scm_ana_u_react = .false.
logical, public :: scm_ana_v_react = .false.
logical, public :: scm_ana_upwind = .false.
!+++ARH
logical, public :: scm_use_ana_iop = .false.
!---ARH
!--jtb

! note that scm_zadv_q is set to slt to be consistent with CAM BFB testing


Expand Down Expand Up @@ -250,7 +268,13 @@ subroutine scam_readnl(nlfile,single_column_in,scmlat_in,scmlon_in)
scm_cambfb_mode,scm_crm_mode,scm_zadv_uv,scm_zadv_T,scm_zadv_q,&
scm_use_obs_T, scm_use_obs_uv, scm_use_obs_qv, &
scm_relax_linear, scm_relax_tau_top_sec, &
scm_relax_tau_bot_sec, scm_force_latlon, scm_relax_fincl, scm_backfill_iop_w_init
scm_relax_tau_bot_sec, scm_force_latlon, scm_relax_fincl, scm_backfill_iop_w_init, &
!+jtb
use_scm_ana_frc, scm_ana_frc_path, scm_ana_frc_file_template, &
scm_ana_x_plevels, scm_ana_direct_omega, &
scm_ana_t_react, scm_ana_q_react, scm_ana_u_react, scm_ana_v_react, &
scm_ana_upwind, scm_ana_direct_ttend, scm_use_ana_iop
!--jtb

single_column=single_column_in

Expand Down Expand Up @@ -306,6 +330,9 @@ subroutine scam_readnl(nlfile,single_column_in,scmlat_in,scmlon_in)
use_camiop = .false.
endif

write(*,*) "!!!!!!!!!! ScamMod !!!!!!!! "
write(*,*) scm_force_latlon , scmlon, scmlat

cacraigucar marked this conversation as resolved.
Show resolved Hide resolved
! If we are not forcing the lat and lon from the namelist use the closest lat and lon that is found in the IOP file.
if (.not.scm_force_latlon) then
call shr_scam_GetCloseLatLon( ncid, scmlat, scmlon, ioplat, ioplon, latidx, lonidx )
Expand All @@ -316,7 +343,9 @@ subroutine scam_readnl(nlfile,single_column_in,scmlat_in,scmlon_in)
scmlat = ioplat
scmlon = ioplon
end if

write(*,*) " after " , scmlon, scmlat


cacraigucar marked this conversation as resolved.
Show resolved Hide resolved
if (masterproc) then
write (iulog,*) 'Single Column Model Options: '
write (iulog,*) '============================='
Expand Down
Loading