16 implicit none ;
private
18 #include <MOM_memory.h>
33 real :: flat_shelf_width
34 real :: shelf_slope_scale
35 real :: pos_shelf_edge_0
37 logical :: first_call = .true.
46 real,
dimension(SZDI_(G),SZDJ_(G)), &
47 intent(out) :: mass_shelf
49 real,
dimension(SZDI_(G),SZDJ_(G)), &
50 intent(out) :: h_shelf
51 real,
dimension(SZDI_(G),SZDJ_(G)), &
52 intent(out) :: area_shelf_h
53 real,
dimension(SZDI_(G),SZDJ_(G)), &
59 logical,
intent(in) :: new_sim
66 real :: flat_shelf_width
68 character(len=40) :: mdl =
"USER_initialize_shelf_mass"
74 if (.not.
associated(cs))
allocate(cs)
78 cs%first_call = .false.
79 call get_param(param_file, mdl,
"RHO_0", cs%Rho_ocean, &
80 "The mean ocean density used with BOUSSINESQ true to "//&
81 "calculate accelerations and the mass for conservation "//&
82 "properties, or with BOUSSINSEQ false to convert some "//&
83 "parameters from vertical units of m to kg m-2.", &
84 units=
"kg m-3", default=1035.0, scale=us%Z_to_m)
85 call get_param(param_file, mdl,
"SHELF_MAX_DRAFT", cs%max_draft, &
86 units=
"m", default=1.0, scale=us%m_to_Z)
87 call get_param(param_file, mdl,
"SHELF_MIN_DRAFT", cs%min_draft, &
88 units=
"m", default=1.0, scale=us%m_to_Z)
89 call get_param(param_file, mdl,
"FLAT_SHELF_WIDTH", cs%flat_shelf_width, &
90 units=
"axis_units", default=0.0)
91 call get_param(param_file, mdl,
"SHELF_SLOPE_SCALE", cs%shelf_slope_scale, &
92 units=
"axis_units", default=0.0)
93 call get_param(param_file, mdl,
"SHELF_EDGE_POS_0", cs%pos_shelf_edge_0, &
94 units=
"axis_units", default=0.0)
95 call get_param(param_file, mdl,
"SHELF_SPEED", cs%shelf_speed, &
96 units=
"axis_units day-1", default=0.0)
105 real,
dimension(SZDI_(G),SZDJ_(G)), &
106 intent(out) :: h_shelf
107 real,
dimension(SZDI_(G),SZDJ_(G)), &
108 intent(out) :: area_shelf_h
109 real,
dimension(SZDI_(G),SZDJ_(G)), &
117 real,
dimension(SZI_(G),SZJ_(G)) :: mass_shelf
127 real,
dimension(SZDI_(G),SZDJ_(G)), &
128 intent(inout) :: mass_shelf
130 real,
dimension(SZDI_(G),SZDJ_(G)), &
131 intent(inout) :: area_shelf_h
132 real,
dimension(SZDI_(G),SZDJ_(G)), &
133 intent(inout) :: h_shelf
134 real,
dimension(SZDI_(G),SZDJ_(G)), &
135 intent(inout) :: hmask
138 type(time_type),
intent(in) :: time
139 logical,
intent(in) :: new_sim
142 real :: c1, edge_pos, slope_pos
145 edge_pos = cs%pos_shelf_edge_0 + cs%shelf_speed*(time_type_to_real(time) / 86400.0)
147 slope_pos = edge_pos - cs%flat_shelf_width
148 c1 = 0.0 ;
if (cs%shelf_slope_scale > 0.0) c1 = 1.0 / cs%shelf_slope_scale
153 if (((j+g%jdg_offset) <= g%domain%njglobal+g%domain%njhalo) .AND. &
154 ((j+g%jdg_offset) >= g%domain%njhalo+1))
then
161 if ((j >= g%jsc) .and. (j <= g%jec))
then
163 if (new_sim)
then ;
if (g%geoLonCu(i-1,j) >= edge_pos)
then
165 mass_shelf(i,j) = 0.0
166 area_shelf_h(i,j) = 0.0
170 if (g%geoLonCu(i,j) > edge_pos)
then
171 area_shelf_h(i,j) = g%US%L_to_m**2*g%areaT(i,j) * (edge_pos - g%geoLonCu(i-1,j)) / &
172 (g%geoLonCu(i,j) - g%geoLonCu(i-1,j))
175 area_shelf_h(i,j) = g%US%L_to_m**2*g%areaT(i,j)
179 if (g%geoLonT(i,j) > slope_pos)
then
180 h_shelf(i,j) = cs%min_draft
181 mass_shelf(i,j) = cs%Rho_ocean * cs%min_draft
183 mass_shelf(i,j) = cs%Rho_ocean * (cs%min_draft + &
184 (cs%max_draft - cs%min_draft) * &
185 min(1.0, (c1*(slope_pos - g%geoLonT(i,j)))**2) )
186 h_shelf(i,j) = (cs%min_draft + &
187 (cs%max_draft - cs%min_draft) * &
188 min(1.0, (c1*(slope_pos - g%geoLonT(i,j)))**2) )
191 endif ;
endif ;
endif
193 if ((i+g%idg_offset) == g%domain%nihalo+1)
then
197 enddo ;
endif ;
enddo
205 character(len=128) :: version =
'$Id: user_shelf_init.F90,v 1.1.2.7 2012/06/19 22:15:52 Robert.Hallberg Exp $'
206 character(len=128) :: tagname =
'$Name: MOM_ogrp $'
207 character(len=40) :: mdl =
"user_shelf_init"
209 call log_version(param_file, mdl, version, tagname)