Skip to content

Commit

Permalink
Add new flag to control nc output, useful for other programs (ESMF etc)
Browse files Browse the repository at this point in the history
to do outputting.
  • Loading branch information
josephzhang8 committed Jan 5, 2021
1 parent 22e84eb commit bcdfce6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
8 changes: 8 additions & 0 deletions sample_inputs/param.nml
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,14 @@
! Output section - all optional. Values shown are default unless otherwise stated,
! and default for most global outputs is off
!-----------------------------------------------------------------------

!-----------------------------------------------------------------------
! Main switch to control netcdf. If =0, SCHISM won't output nc files
! at all (useful for other programs like ESMF to output)
!-----------------------------------------------------------------------
nc_out = 1

!-----------------------------------------------------------------------
! Option for hotstart outputs
!-----------------------------------------------------------------------
nhot = 0 !1: output *_hotstart every 'hotout_write' steps
Expand Down
2 changes: 1 addition & 1 deletion src/Core/schism_glbl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ module schism_glbl
&moitn0,mxitn0,nchi,ibtrack_test,nramp_elev,islip,ibtp,inunfl,shorewafo, &
&inv_atm_bnd,ieos_type,ieos_pres,iupwind_mom,inter_mom,ishapiro,isav, &
&nstep_ice,niter_shap,iunder_deep,ibtrack_openbnd,flag_fib,ielm_transport,max_subcyc, &
&itransport_only,meth_sink,iloadtide
&itransport_only,meth_sink,iloadtide,nc_out
integer,save :: ntrs(natrm),nnu_pts(natrm),mnu_pts
integer,save,dimension(:),allocatable :: iof_hydro,iof_wwm,iof_gen,iof_age,iof_sed,iof_eco, &
&iof_icm,iof_cos,iof_fib,iof_sed2d,iof_ice,iof_ana,iof_marsh,iof_dvd,iadjust_mass_consv
Expand Down
5 changes: 3 additions & 2 deletions src/Hydro/schism_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ subroutine schism_init(iorder,indir,iths,ntime)
&ielm_transport,max_subcyc,i_hmin_airsea_ex,hmin_airsea_ex,itransport_only,meth_sink, &
&iloadtide

namelist /SCHOUT/iof_hydro,iof_wwm,iof_gen,iof_age,iof_sed,iof_eco,iof_icm,iof_cos,iof_fib, &
namelist /SCHOUT/nc_out,iof_hydro,iof_wwm,iof_gen,iof_age,iof_sed,iof_eco,iof_icm,iof_cos,iof_fib, &
&iof_sed2d,iof_ice,iof_ana,iof_marsh,iof_dvd, &
&nhot,nhot_write,iout_sta,nspool_sta

Expand Down Expand Up @@ -470,6 +470,7 @@ subroutine schism_init(iorder,indir,iths,ntime)
iloadtide=0

!Output elev, hvel by detault
nc_out=1
iof_hydro=0; iof_wwm=0; iof_gen=0; iof_age=0; iof_sed=0; iof_eco=0; iof_dvd=0
iof_hydro(1)=1; iof_hydro(25)=1
iof_icm=0; iof_cos=0; iof_fib=0; iof_sed2d=0; iof_ice=0; iof_ana=0; iof_marsh=0
Expand Down Expand Up @@ -5837,7 +5838,7 @@ subroutine schism_init(iorder,indir,iths,ntime)

! Open global output files and write header data
if(ihot<=1) ifile=1 !reset output file #
call fill_nc_header(0)
if(nc_out>0) call fill_nc_header(0)

#ifdef SINGLE_NETCDF_OUTPUT
CALL INIT_NETCDF_SINGLE_OUTPUT(start_year, start_month, start_day, start_hour, 0.d0, 0.d0)
Expand Down
6 changes: 3 additions & 3 deletions src/Hydro/schism_step.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7826,7 +7826,7 @@ subroutine schism_step(it)
! enddo !i

#ifndef SINGLE_NETCDF_OUTPUT
if(mod(it,nspool)==0) then
if(nc_out>0.and.mod(it,nspool)==0) then
call writeout_nc(id_out_var(1),'wetdry_node',1,1,npa,dble(idry))
call writeout_nc(id_out_var(2),'wetdry_elem',4,1,nea,dble(idry_e))
call writeout_nc(id_out_var(3),'wetdry_side',7,1,nsa,dble(idry_s))
Expand Down Expand Up @@ -8563,7 +8563,7 @@ subroutine schism_step(it)
if(noutput+4>2000) call parallel_abort('STEP: index over for id_out_var')

!write(12,*)'id_out_var=',it,id_out_var(1:noutput)
endif !mod(it,nspool)==0
endif !mod(it,nspool)==0 && nc_out>0
#else /*SINGLE_NETCDF_OUTPUT*/
IF (mod(it,nspool)==0) THEN
CALL NETCDF_SINGLE_OUTPUT(it)
Expand All @@ -8578,7 +8578,7 @@ subroutine schism_step(it)
#endif

! Open new global output files and write header data
if(mod(it,ihfskip)==0) then
if(nc_out>0.and.mod(it,ihfskip)==0) then
ifile=ifile+1 !output file #
!ifile=it/ihfskip+1
call fill_nc_header(1)
Expand Down
1 change: 1 addition & 0 deletions src/Readme.beta_notes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Changes in param.[in,nml] and main parameter inputs for other modules:

Github versions:

(Jan 6, 2021): added main switch for nc output 'nc_out' (useful for other programs to control outputs);
28ff9d1 (Dec 16, 2020): added optional self-attraction loading tides; if iloadtide/=0, need
amp/phases in loadtide_[FREQ].gr3 (freq's shared with tidal potential);
f8ba470 (Dec 3, 2020): Added a new option (meth_sink) to treat net sink: if an elem is dry with a net sink, vsource is reset
Expand Down
2 changes: 1 addition & 1 deletion src/Utility/Post-Processing-Fortran/ha_schism.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#Run in dir where hgrid.gr3 is.
#Needs inputs: hgrid.gr3, include.gr3 (hgrid based; to focus on a region or subsample)
#combined or uncombined schout_*.nc, and drives ha_sub.pl (in each parallel task)
#And also arguments to this script. Tested on hurricane and femto.
#And also arguments to this script. Tested on hurricane, cyclops and femto.
#Make sure the batch script, compiled executables are for same system: read_output8_allnodes_simple*,
# tidal_analysis, run_*
#Outputs: amp_[m2,k1].gr3, pha_[m2,k1].gr3 (phases in degrees). Screen dump in ha_schism.out
Expand Down

0 comments on commit bcdfce6

Please sign in to comment.