10 use datetime_mod,
only: datetime, datetime_to_string
11 use kinds,
only: kind_real
14 use fms_io_mod,
only : fms_io_init, fms_io_exit
15 use mom_restart,
only : save_restart
16 use mom_surface_forcing,
only : set_forcing
17 use mom_time_manager,
only :
operator(+)
18 use mom_time_manager,
only : real_to_time, time_type_to_real
19 use mom,
only : step_mom
20 use mpp_domains_mod,
only : mpp_update_domains
21 use time_manager_mod,
only : time_type, set_date
36 integer :: advance_mom6
37 real(kind=kind_real) :: dt0
39 real(kind_real),
dimension(2) :: tocn_minmax, socn_minmax
47 procedure :: setup => soca_model_setup
50 procedure :: delete => soca_model_delete
58 procedure :: init => soca_model_init
61 procedure :: propagate => soca_model_propagate
64 procedure :: finalize => soca_model_finalize
80 subroutine soca_model_setup(self, geom)
84 self%mom6_config%f_comm = geom%f_comm
87 end subroutine soca_model_setup
94 subroutine soca_model_init(self, flds)
102 do i=1,
size(flds%fields)
103 call flds%get(flds%fields(i)%name, field)
106 call mpp_update_domains(field%val, flds%geom%Domain%mpp_domain)
109 select case (field%name)
111 if ( self%tocn_minmax(1) /= real(-999., kind=8) ) &
112 where( field%val < self%tocn_minmax(1) ) field%val = self%tocn_minmax(1)
113 if ( self%tocn_minmax(2) /= real(-999., kind=8) ) &
114 where( field%val > self%tocn_minmax(2) ) field%val = self%tocn_minmax(2)
115 self%mom6_config%MOM_CSp%T = real(field%val, kind=8)
117 if ( self%socn_minmax(1) /= real(-999., kind=8) ) &
118 where( field%val < self%socn_minmax(1) ) field%val = self%socn_minmax(1)
119 if ( self%socn_minmax(2) /= real(-999., kind=8) ) &
120 where( field%val > self%socn_minmax(2) ) field%val = self%socn_minmax(2)
121 self%mom6_config%MOM_CSp%S = real(field%val, kind=8)
123 self%mom6_config%MOM_CSp%u = real(field%val, kind=8)
125 self%mom6_config%MOM_CSp%v = real(field%val, kind=8)
129 select case(field%name)
131 field%val(:,:,1) = - real(self%mom6_config%fluxes%sw, kind=kind_real)
133 field%val(:,:,1) = - real(self%mom6_config%fluxes%lw, kind=kind_real)
135 field%val(:,:,1) = - real(self%mom6_config%fluxes%latent, kind=kind_real)
137 field%val(:,:,1) = - real(self%mom6_config%fluxes%sens, kind=kind_real)
139 field%val(:,:,1) = real(self%mom6_config%fluxes%ustar, kind=kind_real)
142 end subroutine soca_model_init
149 subroutine soca_model_propagate(self, flds, fldsdate)
152 type(datetime),
intent(in) :: fldsdate
155 type(time_type) :: ocean_time
156 integer :: year, month, day, hour, minute, second, i
157 character(len=20) :: strdate
160 call datetime_to_string(fldsdate, strdate)
167 self%mom6_config%Time = set_date(year, month, day, hour, minute, second)
168 ocean_time = self%mom6_config%Time
170 if (self%advance_mom6==1)
then
173 call set_forcing(self%mom6_config%sfc_state,&
174 self%mom6_config%forces,&
175 self%mom6_config%fluxes,&
176 self%mom6_config%Time,&
177 self%mom6_config%Time_step_ocean,&
178 self%mom6_config%grid, &
179 self%mom6_config%scaling, &
180 self%mom6_config%surface_forcing_CSp)
184 call step_mom(self%mom6_config%forces, &
185 self%mom6_config%fluxes, &
186 self%mom6_config%sfc_state, &
187 self%mom6_config%Time, &
188 real(self%mom6_config%dt_forcing, kind=8), &
189 self%mom6_config%MOM_CSp,&
190 start_cycle=.false.,&
191 cycle_length=self%mom6_config%MOM_CSp%dt)
195 ocean_time = ocean_time + real_to_time(self%mom6_config%MOM_CSp%dt)
196 self%mom6_config%Time = ocean_time
199 do i=1,
size(flds%fields)
200 field => flds%fields(i)
201 select case(field%name)
203 field%val = real(self%mom6_config%MOM_CSp%T, kind=kind_real)
205 field%val = real(self%mom6_config%MOM_CSp%S, kind=kind_real)
207 field%val = real(self%mom6_config%MOM_CSp%h, kind=kind_real)
209 field%val(:,:,1) = real(self%mom6_config%MOM_CSp%ave_ssh_ibc, kind=kind_real)
211 field%val = real(self%mom6_config%MOM_CSp%u, kind=kind_real)
213 field%val = real(self%mom6_config%MOM_CSp%v, kind=kind_real)
215 field%val(:,:,1) = - real(self%mom6_config%fluxes%sw, kind=kind_real)
217 field%val(:,:,1) = - real(self%mom6_config%fluxes%lw, kind=kind_real)
219 field%val(:,:,1) = - real(self%mom6_config%fluxes%latent, kind=kind_real)
221 field%val(:,:,1) = - real(self%mom6_config%fluxes%sens, kind=kind_real)
223 field%val(:,:,1) = real(self%mom6_config%fluxes%ustar, kind=kind_real)
226 end subroutine soca_model_propagate
233 subroutine soca_model_finalize(self, flds)
241 do i=1,
size(flds%fields)
242 field => flds%fields(i)
245 call mpp_update_domains(field%val, flds%geom%Domain%mpp_domain)
248 select case(field%name)
250 if ( self%tocn_minmax(1) /= real(-999., kind=8) ) &
251 where( field%val < self%tocn_minmax(1) ) field%val = self%tocn_minmax(1)
252 if ( self%tocn_minmax(2) /= real(-999., kind=8) ) &
253 where( field%val > self%tocn_minmax(2) ) field%val = self%tocn_minmax(2)
254 self%mom6_config%MOM_CSp%T = real(field%val, kind=8)
256 if ( self%socn_minmax(1) /= real(-999., kind=8) ) &
257 where( field%val < self%socn_minmax(1) ) field%val = self%socn_minmax(1)
258 if ( self%socn_minmax(2) /= real(-999., kind=8) ) &
259 where( field%val > self%socn_minmax(2) ) field%val = self%socn_minmax(2)
260 self%mom6_config%MOM_CSp%S = real(field%val, kind=8)
262 self%mom6_config%MOM_CSp%u = real(field%val, kind=8)
264 self%mom6_config%MOM_CSp%v = real(field%val, kind=8)
269 call save_restart(self%mom6_config%dirs%restart_output_dir, &
270 self%mom6_config%Time, &
271 self%mom6_config%grid, &
272 self%mom6_config%restart_CSp, &
273 gv=self%mom6_config%GV)
275 end subroutine soca_model_finalize
282 subroutine soca_model_delete(self)
287 end subroutine soca_model_delete
Handle fields for the model.
Structure holding configuration variables for the model.
subroutine, public soca_mom6_init(mom6_config, partial_init)
Setup/initialize/prepare mom6 for time integration.
subroutine, public soca_mom6_end(mom6_config)
Release memory and possibly dump mom6's restart.
various utility functions
subroutine, public soca_str2int(str, int)
Holds all data and metadata related to a single field variable.
Fortran derived type to hold configuration data for the model.
Data structure neccessary to initialize/run mom6.