Skip to content

Commit

Permalink
Added MICE outputs (including scribe). Re-ordered 1 and 2 to be consi…
Browse files Browse the repository at this point in the history
…sten

with ICE module
  • Loading branch information
josephzhang8 committed Dec 26, 2024
1 parent 1c0c8f7 commit 37ba09c
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 9 deletions.
13 changes: 13 additions & 0 deletions sample_inputs/param.nml
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,19 @@
! iof_ice(7)= 0 !ice concentration [-] {iceTracer_2} 2D
! iof_ice(8)= 0 !snow volume [m] {iceTracer_3} 2D

!-----------------------------------------------------------------------
! Multi-class ice module outputs (if USE_MICE is on)
!-----------------------------------------------------------------------
! iof_mice(1)= 0 !divergence @ elem ('Delta') [1/sec] {iceStrainRate} 2D
! iof_mice(2)= 0 !ice advective velcoity vector [m/s] {iceVelocityX,Y} 2D vector
! iof_mice(3)= 0 !net heat flux to ocean (>0 warm up SST) [W/m/m] {iceNetHeatFlux} 2D
! iof_mice(4)= 0 !net fresh water flux to ocean (>0 freshens up SSS) [kg/s/m/m] {iceFreshwaterFlux} 2D
! iof_mice(5)= 0 !ice temperature [C] at air-ice interface {iceTopTemperature} 2D

! iof_mice(6)= 0 !ice volume [m] {iceTracer_1} 2D
! iof_mice(7)= 0 !ice concentration [-] {iceTracer_2} 2D
! iof_mice(8)= 0 !snow volume [m] {iceTracer_3} 2D

!-----------------------------------------------------------------------
! Analysis module outputs (USE_ANALYSIS)
!-----------------------------------------------------------------------
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 @@ -98,7 +98,7 @@ module schism_glbl
integer,save :: ntrs(natrm),nnu_pts(natrm),mnu_pts,lev_tr_source(natrm)
integer,save,dimension(:),allocatable :: iof_hydro,iof_wwm,iof_gen,iof_age,iof_sed,iof_eco, &
&iof_icm,iof_icm_core,iof_icm_silica,iof_icm_zb,iof_icm_ph,iof_icm_srm,iof_cos,iof_fib, &
&iof_sed2d,iof_ice,iof_ana,iof_marsh,iof_dvd,iadjust_mass_consv,lev_tr_source2(:)
&iof_sed2d,iof_ice,iof_mice,iof_ana,iof_marsh,iof_dvd,iadjust_mass_consv,lev_tr_source2(:)

real(rkind),save :: dt,h0,drampbc,drampwind,drampwafo,dramp,dramp_ss,wtiminc,npstime,npstiminc, &
&surf_time1,surf_time2,time_nu,step_nu,time_nu_tr,step_nu_tr,dzb_min,vdmax_pp1, &
Expand Down
42 changes: 39 additions & 3 deletions src/Hydro/schism_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ subroutine schism_init(iorder,indir,iths,ntime)

namelist /SCHOUT/nc_out,iof_hydro,iof_wwm,iof_gen,iof_age,iof_sed,iof_eco,iof_icm_core, &
&iof_icm_silica,iof_icm_zb,iof_icm_ph,iof_icm_srm,iof_icm_sav,iof_icm_marsh,iof_icm_sfm, &
&iof_icm_ba,iof_icm_clam,iof_cos,iof_fib,iof_sed2d,iof_ice,iof_ana,iof_marsh,iof_dvd, &
&iof_icm_ba,iof_icm_clam,iof_cos,iof_fib,iof_sed2d,iof_ice,iof_mice,iof_ana,iof_marsh,iof_dvd, &
&nhot,nhot_write,iout_sta,nspool_sta,iof_ugrid

!-------------------------------------------------------------------------------
Expand Down Expand Up @@ -445,7 +445,7 @@ subroutine schism_init(iorder,indir,iths,ntime)
if(iorder==0) then
allocate(iof_hydro(40),iof_wwm(40),iof_gen(max(1,ntracer_gen)),iof_age(max(1,ntracer_age)),level_age(ntracer_age/2), &
&iof_sed(3*sed_class+20),iof_eco(max(1,eco_class)),iof_icm_core(17),iof_icm_silica(2),iof_icm_zb(2),iof_icm_ph(4), &
&iof_icm_srm(4),iof_cos(20),iof_fib(5),iof_sed2d(14),iof_ice(10),iof_ana(20),iof_marsh(2),iof_dvd(max(1,ntrs(12))), &
&iof_icm_srm(4),iof_cos(20),iof_fib(5),iof_sed2d(14),iof_ice(10),iof_mice(10),iof_ana(20),iof_marsh(2),iof_dvd(max(1,ntrs(12))), &
!dim of srqst7 increased to account for 2D elem/side etc
&srqst7(nscribes+10),veg_vert_z(nbins_veg_vert+1),veg_vert_scale_cd(nbins_veg_vert+1), &
&veg_vert_scale_N(nbins_veg_vert+1),veg_vert_scale_D(nbins_veg_vert+1),stat=istat)
Expand Down Expand Up @@ -519,7 +519,7 @@ subroutine schism_init(iorder,indir,iths,ntime)
iof_hydro(1)=1; iof_hydro(25:26)=1
iof_icm_core=0; iof_icm_silica=0; iof_icm_zb=0; iof_icm_ph=0; iof_icm_srm=0; iof_icm_sav=0
iof_icm_marsh=0; iof_icm_sfm=0; iof_icm_ba=0; iof_icm_clam=0; iof_cos=0; iof_fib=0; iof_sed2d=0
iof_ice=0; iof_ana=0; iof_marsh=0; nhot=0; nhot_write=8640; iout_sta=0; nspool_sta=10; iof_ugrid=0
iof_ice=0; iof_mice=0; iof_ana=0; iof_marsh=0; nhot=0; nhot_write=8640; iout_sta=0; nspool_sta=10; iof_ugrid=0

read(15,nml=OPT)
read(15,nml=SCHOUT)
Expand Down Expand Up @@ -6398,6 +6398,33 @@ subroutine schism_init(iorder,indir,iths,ntime)
enddo !i
#endif /*USE_ICE*/

#ifdef USE_MICE
if(iof_mice(2)==1) then
ncount_2dnode=ncount_2dnode+2
iout_23d(ncount_2dnode-1:ncount_2dnode)=1
out_name(ncount_2dnode-1)='iceVelocityX'
out_name(ncount_2dnode)='iceVelocityY'
endif

do i=3,5+ntr_ice
if(iof_mice(i)==1) then
ncount_2dnode=ncount_2dnode+1
iout_23d(ncount_2dnode)=1
if(i==3) then
out_name(ncount_2dnode)='iceNetHeatFlux'
else if(i==4) then
out_name(ncount_2dnode)='iceFreshwaterFlux'
else if(i==5) then
out_name(ncount_2dnode)='iceTopTemperature'
else
write(ifile_char,'(i12)')i-5
ifile_char=adjustl(ifile_char); itmp2=len_trim(ifile_char)
out_name(ncount_2dnode)='iceTracer_'//ifile_char(1:itmp2)
endif !i
endif !iof
enddo !i
#endif /*USE_MICE*/

! Done with 2D node outputs; init counter_out_name to be used for other
! outputs
counter_out_name=ncount_2dnode !index of out_name
Expand Down Expand Up @@ -6472,6 +6499,15 @@ subroutine schism_init(iorder,indir,iths,ntime)
endif
#endif

#ifdef USE_MICE
if(iof_ice(1)==1) then
ncount_2delem=ncount_2delem+1
counter_out_name=counter_out_name+1
out_name(counter_out_name)='iceStrainRate'
iout_23d(counter_out_name)=4
endif
#endif

#ifdef USE_ANALYSIS
if(iof_ana(1)==1) then
ncount_2delem=ncount_2delem+1
Expand Down
44 changes: 39 additions & 5 deletions src/Hydro/schism_step.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9271,10 +9271,10 @@ subroutine schism_step(it)
#endif

#ifdef USE_MICE
if(iof_ice(1)==1) call writeout_nc(id_out_var(noutput+5), &
&'ICE_velocity',1,1,npa,u_ice,v_ice)
if(iof_ice(2)==1) call writeout_nc(id_out_var(noutput+6), &
if(iof_ice(1)==1) call writeout_nc(id_out_var(noutput+6), &
&'ICE_strain_rate',4,1,nea,delta_ice)
if(iof_ice(2)==1) call writeout_nc(id_out_var(noutput+5), &
&'ICE_velocity',1,1,npa,u_ice,v_ice)
if(iof_ice(3)==1) call writeout_nc(id_out_var(noutput+7), &
&'ICE_net_heat_flux',1,1,npa,net_heat_flux)
if(iof_ice(4)==1) call writeout_nc(id_out_var(noutput+8), &
Expand All @@ -9292,7 +9292,7 @@ subroutine schism_step(it)
enddo !i
noutput=noutput+ntr_ice
call io_icepack(noutput)
#endif
#endif /*USE_MICE*/

#ifdef USE_ICE
if(iof_ice(1)==1) call writeout_nc(id_out_var(noutput+5), &
Expand All @@ -9315,7 +9315,7 @@ subroutine schism_step(it)
&'ICE_tracer_'//it_char(1:lit),1,1,npa,ice_tr(i,:))
enddo !i
noutput=noutput+ntr_ice
#endif
#endif /*USE_ICE*/

#ifdef USE_ANALYSIS
if(iof_ana(1)==1) call writeout_nc(id_out_var(noutput+5), &
Expand Down Expand Up @@ -9572,6 +9572,32 @@ subroutine schism_step(it)
enddo !i
#endif /*USE_ICE*/

#ifdef USE_MICE
if(iof_mice(2)==1) then
icount=icount+2
if(icount>ncount_2dnode) call parallel_abort('STEP: icount>nscribes(2.31)')
varout_2dnode(icount-1,:)=u_ice(1:np)
varout_2dnode(icount,:)=v_ice(1:np)
endif

do i=3,5+ntr_ice
if(iof_mice(i)==1) then
icount=icount+1
if(icount>ncount_2dnode) call parallel_abort('STEP: icount>nscribes(2.41)')
if(i==3) then
varout_2dnode(icount,:)=net_heat_flux(1:np)
else if(i==4) then
varout_2dnode(icount,:)=fresh_wa_flux(1:np)
else if(i==5) then
varout_2dnode(icount,:)=t_oi(1:np)
else
varout_2dnode(icount,:)=ice_tr(i-5,1:np)
endif
endif !iof
enddo !i
call io_icepack(noutput)
#endif /*USE_MICE*/

!Check total # of vars
if(icount/=ncount_2dnode) then
write(errmsg,*)'STEP: 2D count wrong:',icount,ncount_2dnode
Expand Down Expand Up @@ -9642,6 +9668,14 @@ subroutine schism_step(it)
endif
#endif

#ifdef USE_MICE
if(iof_mice(1)==1) then
icount=icount+1
if(icount>ncount_2delem) call parallel_abort('STEP: icount>nscribes(1.31)')
varout_2delem(icount,:)=delta_ice(1:ne)
endif
#endif

#ifdef USE_ANALYSIS
if(iof_ana(1)==1) then
icount=icount+1
Expand Down

0 comments on commit 37ba09c

Please sign in to comment.