\hypertarget{MOM__ice__shelf_8F90_source}{}\section{M\+O\+M\+\_\+ice\+\_\+shelf.\+F90}
\label{MOM__ice__shelf_8F90_source}\index{/home/cermak/src/\+M\+O\+M6/src/ice\+\_\+shelf/\+M\+O\+M\+\_\+ice\+\_\+shelf.\+F90@{/home/cermak/src/\+M\+O\+M6/src/ice\+\_\+shelf/\+M\+O\+M\+\_\+ice\+\_\+shelf.\+F90}}

\begin{DoxyCode}
00001 \textcolor{comment}{!> Implements the thermodynamic aspects of ocean / ice-shelf interactions,}
00002 \textcolor{comment}{!!  along with a crude placeholder for a later implementation of full}
00003 \textcolor{comment}{!!  ice shelf dynamics, all using the MOM framework and coding style.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00004}\hyperlink{namespacemom__ice__shelf}{00004} \textcolor{keyword}{module} \hyperlink{namespacemom__ice__shelf}{mom\_ice\_shelf}
00005 
00006 \textcolor{comment}{! This file is part of MOM6. See LICENSE.md for the license.}
00007 
00008 \textcolor{keywordtype}{use }mom\_constants\textcolor{keywordtype}{, only} : hlf
00009 \textcolor{keywordtype}{use }mom\_cpu\_clock\textcolor{keywordtype}{, only} : cpu\_clock\_id, cpu\_clock\_begin, cpu\_clock\_end
00010 \textcolor{keywordtype}{use }mom\_cpu\_clock\textcolor{keywordtype}{, only} : clock\_component, clock\_routine
00011 \textcolor{keywordtype}{use }mom\_diag\_mediator\textcolor{keywordtype}{, only} : post\_data, register\_diag\_field, safe\_alloc\_ptr
00012 \textcolor{keywordtype}{use }mom\_diag\_mediator\textcolor{keywordtype}{, only} : diag\_mediator\_init, set\_diag\_mediator\_grid, diag\_ctrl, time\_type
00013 \textcolor{keywordtype}{use }mom\_diag\_mediator\textcolor{keywordtype}{, only} : enable\_averages, enable\_averaging, disable\_averaging
00014 \textcolor{keywordtype}{use }mom\_domains\textcolor{keywordtype}{, only} : mom\_domains\_init, clone\_mom\_domain
00015 \textcolor{keywordtype}{use }mom\_domains\textcolor{keywordtype}{, only} : pass\_var, pass\_vector, to\_all, cgrid\_ne, bgrid\_ne, corner
00016 \textcolor{keywordtype}{use }mom\_dyn\_horgrid\textcolor{keywordtype}{, only} : dyn\_horgrid\_type, create\_dyn\_horgrid, destroy\_dyn\_horgrid
00017 \textcolor{keywordtype}{use }mom\_dyn\_horgrid\textcolor{keywordtype}{, only} : rescale\_dyn\_horgrid\_bathymetry
00018 \textcolor{keywordtype}{use }mom\_error\_handler\textcolor{keywordtype}{, only} : mom\_error, mom\_mesg, fatal, warning, is\_root\_pe
00019 \textcolor{keywordtype}{use }mom\_file\_parser\textcolor{keywordtype}{, only} : read\_param, get\_param, log\_param, log\_version, param\_file\_type
00020 \textcolor{keywordtype}{use }mom\_grid\textcolor{keywordtype}{, only} : mom\_grid\_init, ocean\_grid\_type
00021 \textcolor{keywordtype}{use }mom\_grid\_initialize\textcolor{keywordtype}{, only} : set\_grid\_metrics
00022 \textcolor{keywordtype}{use }mom\_fixed\_initialization\textcolor{keywordtype}{, only} : mom\_initialize\_topography
00023 \textcolor{keywordtype}{use }mom\_fixed\_initialization\textcolor{keywordtype}{, only} : mom\_initialize\_rotation
00024 \textcolor{keywordtype}{use }user\_initialization\textcolor{keywordtype}{, only} : user\_initialize\_topography
00025 \textcolor{keywordtype}{use }mom\_io\textcolor{keywordtype}{, only} : field\_exists, file\_exists, mom\_read\_data, write\_version\_number
00026 \textcolor{keywordtype}{use }mom\_io\textcolor{keywordtype}{, only} : slasher, fieldtype
00027 \textcolor{keywordtype}{use }mom\_io\textcolor{keywordtype}{, only} : write\_field, close\_file, single\_file, multiple
00028 \textcolor{keywordtype}{use }mom\_restart\textcolor{keywordtype}{, only} : register\_restart\_field, query\_initialized, save\_restart
00029 \textcolor{keywordtype}{use }mom\_restart\textcolor{keywordtype}{, only} : restart\_init, restore\_state, mom\_restart\_cs
00030 \textcolor{keywordtype}{use }mom\_time\_manager\textcolor{keywordtype}{, only} : time\_type, time\_type\_to\_real, real\_to\_time, \textcolor{keyword}{operator}(>), \textcolor{keyword}{operator}(-)
00031 \textcolor{keywordtype}{use }mom\_transcribe\_grid\textcolor{keywordtype}{, only} : copy\_dyngrid\_to\_mom\_grid, copy\_mom\_grid\_to\_dyngrid
00032 \textcolor{keywordtype}{use }\hyperlink{namespacemom__unit__scaling}{mom\_unit\_scaling}\textcolor{keywordtype}{, only} : \hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\_scale\_type}, 
      \hyperlink{namespacemom__unit__scaling_a74867ddf628f93dcee854980e08bbe21}{unit\_scaling\_init}, \hyperlink{namespacemom__unit__scaling_a0d99ae286970838e8f4cd534e3a2744c}{fix\_restart\_unit\_scaling}
00033 \textcolor{keywordtype}{use }mom\_variables\textcolor{keywordtype}{, only} : surface
00034 \textcolor{keywordtype}{use }mom\_forcing\_type\textcolor{keywordtype}{, only} : forcing, allocate\_forcing\_type, mom\_forcing\_chksum
00035 \textcolor{keywordtype}{use }mom\_forcing\_type\textcolor{keywordtype}{, only} : mech\_forcing, allocate\_mech\_forcing, mom\_mech\_forcing\_chksum
00036 \textcolor{keywordtype}{use }mom\_forcing\_type\textcolor{keywordtype}{, only} : copy\_common\_forcing\_fields
00037 \textcolor{keywordtype}{use }mom\_get\_input\textcolor{keywordtype}{, only} : directories, get\_mom\_input
00038 \textcolor{keywordtype}{use }\hyperlink{namespacemom__eos}{mom\_eos}\textcolor{keywordtype}{, only} : \hyperlink{interfacemom__eos_1_1calculate__density}{calculate\_density}, 
      \hyperlink{interfacemom__eos_1_1calculate__density__derivs}{calculate\_density\_derivs}, \hyperlink{interfacemom__eos_1_1calculate__tfreeze}{calculate\_tfreeze}, 
      \hyperlink{namespacemom__eos_a782d326108e390902e520efc078e8296}{eos\_domain}
00039 \textcolor{keywordtype}{use }\hyperlink{namespacemom__eos}{mom\_eos}\textcolor{keywordtype}{, only} : \hyperlink{structmom__eos_1_1eos__type}{eos\_type}, \hyperlink{namespacemom__eos_a3ab220b9c98dac3b8f6b7c1606b811cf}{eos\_init}
00040 \textcolor{keywordtype}{use }mom\_ice\_shelf\_dynamics\textcolor{keywordtype}{, only} : ice\_shelf\_dyn\_cs, update\_ice\_shelf
00041 \textcolor{keywordtype}{use }mom\_ice\_shelf\_dynamics\textcolor{keywordtype}{, only} : register\_ice\_shelf\_dyn\_restarts, initialize\_ice\_shelf\_dyn
00042 \textcolor{keywordtype}{use }mom\_ice\_shelf\_dynamics\textcolor{keywordtype}{, only} : ice\_shelf\_min\_thickness\_calve
00043 \textcolor{keywordtype}{use }mom\_ice\_shelf\_dynamics\textcolor{keywordtype}{, only} : ice\_time\_step\_cfl, ice\_shelf\_dyn\_end
00044 \textcolor{keywordtype}{use }mom\_ice\_shelf\_initialize\textcolor{keywordtype}{, only} : initialize\_ice\_thickness
00045 \textcolor{comment}{!MJH use MOM\_ice\_shelf\_initialize, only : initialize\_ice\_shelf\_boundary}
00046 \textcolor{keywordtype}{use }mom\_ice\_shelf\_state\textcolor{keywordtype}{, only} : ice\_shelf\_state, ice\_shelf\_state\_end, ice\_shelf\_state\_init
00047 \textcolor{keywordtype}{use }user\_shelf\_init\textcolor{keywordtype}{, only} : user\_initialize\_shelf\_mass, user\_update\_shelf\_mass
00048 \textcolor{keywordtype}{use }user\_shelf\_init\textcolor{keywordtype}{, only} : user\_ice\_shelf\_cs
00049 \textcolor{keywordtype}{use }mom\_coms\textcolor{keywordtype}{, only} : reproducing\_sum
00050 \textcolor{keywordtype}{use }mom\_spatial\_means\textcolor{keywordtype}{, only} : global\_area\_integral
00051 \textcolor{keywordtype}{use }mom\_checksums\textcolor{keywordtype}{, only} : hchksum, qchksum, chksum, uchksum, vchksum, uvchksum
00052 \textcolor{keywordtype}{use }time\_interp\_external\_mod\textcolor{keywordtype}{, only} : init\_external\_field, time\_interp\_external
00053 \textcolor{keywordtype}{use }time\_interp\_external\_mod\textcolor{keywordtype}{, only} : time\_interp\_external\_init
00054 \textcolor{keywordtype}{implicit none} ; \textcolor{keywordtype}{private}
00055 
00056 \textcolor{preprocessor}{#include <MOM\_memory.h>}
00057 \textcolor{preprocessor}{}\textcolor{preprocessor}{#ifdef SYMMETRIC\_LAND\_ICE}
00058 \textcolor{preprocessor}{}\textcolor{preprocessor}{#  define GRID\_SYM\_ .true.}
00059 \textcolor{preprocessor}{}\textcolor{preprocessor}{#else}
00060 \textcolor{preprocessor}{}\textcolor{preprocessor}{#  define GRID\_SYM\_ .false.}
00061 \textcolor{preprocessor}{}\textcolor{preprocessor}{#endif}
00062 \textcolor{preprocessor}{}
00063 \textcolor{keywordtype}{public} \hyperlink{namespacemom__ice__shelf_a21a2a3ddec5ea25c7bca246419e4dcfe}{shelf\_calc\_flux}, \hyperlink{namespacemom__ice__shelf_a8f7eae8642835e30aff99f77f3836945}{add\_shelf\_flux}, 
      \hyperlink{namespacemom__ice__shelf_a5990f9918493ff4984245eac74e5f4d9}{initialize\_ice\_shelf}, \hyperlink{namespacemom__ice__shelf_a6d0412c7264e0480d5144d26995dd8d3}{ice\_shelf\_end}
00064 \textcolor{keywordtype}{public} \hyperlink{namespacemom__ice__shelf_a40ae01bbe3155191647f2150903dda69}{ice\_shelf\_save\_restart}, \hyperlink{namespacemom__ice__shelf_a0678e919d45fc9e9e9b00dce3564a2fc}{solo\_step\_ice\_shelf}, 
      \hyperlink{namespacemom__ice__shelf_a0274b25df07d5fa712d038c31f921cbc}{add\_shelf\_forces}
00065 
00066 \textcolor{comment}{! A note on unit descriptions in comments: MOM6 uses units that can be rescaled for dimensional}
00067 \textcolor{comment}{! consistency testing. These are noted in comments with units like Z, H, L, and T, along with}
00068 \textcolor{comment}{! their mks counterparts with notation like "a velocity [Z T-1 ~> m s-1]".  If the units}
00069 \textcolor{comment}{! vary with the Boussinesq approximation, the Boussinesq variant is given first.}
00070 \textcolor{comment}{}
00071 \textcolor{comment}{!> Control structure that contains ice shelf parameters and diagnostics handles}
\Hypertarget{MOM__ice__shelf_8F90_source_l00072}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{00072} \textcolor{keyword}{type}, \textcolor{keyword}{public} :: \hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs} ; \textcolor{keywordtype}{private}
00073   \textcolor{comment}{! Parameters}
\Hypertarget{MOM__ice__shelf_8F90_source_l00074}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a53e228d2f145f9b8e0631ee76bc6a092}{00074}   \textcolor{keywordtype}{type}(mom\_restart\_cs), \textcolor{keywordtype}{pointer} :: restart\_csp => null() \textcolor{comment}{!< A pointer to the restart control}
00075 \textcolor{comment}{                                          !! structure for the ice shelves}
\Hypertarget{MOM__ice__shelf_8F90_source_l00076}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a892f42dc1121b690d33c43b42eb6d32d}{00076}   \textcolor{keywordtype}{type}(ocean\_grid\_type) :: grid\textcolor{comment}{           !< Grid for the ice-shelf model}
\Hypertarget{MOM__ice__shelf_8F90_source_l00077}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a19955dea7c4f20d0eabddb8119d7f91f}{00077}   \textcolor{keywordtype}{type}(\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\_scale\_type}), \textcolor{keywordtype}{pointer} :: &
00078     us => null()       \textcolor{comment}{!< A structure containing various unit conversion factors}
00079   \textcolor{comment}{!type(dyn\_horgrid\_type), pointer :: dG  !< Dynamic grid for the ice-shelf model}
\Hypertarget{MOM__ice__shelf_8F90_source_l00080}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ad504253e40adc1e63de5fda987b761b6}{00080}   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{pointer} :: ocn\_grid => null() \textcolor{comment}{!< A pointer to the ocean model grid}
00081 \textcolor{comment}{                                          !! The rest is private}
\Hypertarget{MOM__ice__shelf_8F90_source_l00082}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_aff41b0cf5034c801ef1c9c2ee4c38d0f}{00082}   \textcolor{keywordtype}{real} ::   flux\_factor = 1.0\textcolor{comment}{             !< A factor that can be used to turn off ice shelf}
00083 \textcolor{comment}{                                          !! melting (flux\_factor = 0) [nondim].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00084}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a40ebb9276267b5c701553836e226528e}{00084}   \textcolor{keywordtype}{character(len=128)} :: restart\_output\_dir = \textcolor{stringliteral}{' '}\textcolor{comment}{ !< The directory in which to write restart files}
\Hypertarget{MOM__ice__shelf_8F90_source_l00085}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ac5e157a3885284bd55562ed53067da2c}{00085}   \textcolor{keywordtype}{type}(ice\_shelf\_state), \textcolor{keywordtype}{pointer} :: iss => null() \textcolor{comment}{!< A structure with elements that describe}
00086 \textcolor{comment}{                                          !! the ice-shelf state}
\Hypertarget{MOM__ice__shelf_8F90_source_l00087}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_aa31242c861c44baa48a9ee3c46538105}{00087}   \textcolor{keywordtype}{type}(ice\_shelf\_dyn\_cs), \textcolor{keywordtype}{pointer} :: dcs => null() \textcolor{comment}{!< The control structure for the ice-shelf dynamics.}
00088 
\Hypertarget{MOM__ice__shelf_8F90_source_l00089}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_aae7f4f994e46da88be85ff34879611aa}{00089}   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{dimension(:,:)} :: &
00090     utide   => null()  \textcolor{comment}{!< An unresolved tidal velocity [L T-1 ~> m s-1]}
00091 
\Hypertarget{MOM__ice__shelf_8F90_source_l00092}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a97a77ff9f47c1c19ce19e2a79fce922f}{00092}   \textcolor{keywordtype}{real} :: ustar\_bg\textcolor{comment}{     !< A minimum value for ustar under ice shelves [Z T-1 ~> m s-1].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00093}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ab0415a6af60fc42badf837cf04996359}{00093}   \textcolor{keywordtype}{real} :: cdrag\textcolor{comment}{        !< drag coefficient under ice shelves [nondim].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00094}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_af8a67f7e6e10f2296e2f422b1b5a2071}{00094}   \textcolor{keywordtype}{real} :: g\_earth\textcolor{comment}{      !< The gravitational acceleration [L2 Z-1 T-2 ~> m s-2]}
\Hypertarget{MOM__ice__shelf_8F90_source_l00095}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a6a0533cb412bda03c4798a407f2e771a}{00095}   \textcolor{keywordtype}{real} :: cp\textcolor{comment}{           !< The heat capacity of sea water [Q degC-1 ~> J kg-1 degC-1].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00096}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a1c8856bdc24e7aceb097f42ff8a36df8}{00096}   \textcolor{keywordtype}{real} :: rho\_ocn\textcolor{comment}{      !< A reference ocean density [R ~> kg m-3].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00097}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a7ede42db82612632edc039ab4b6cdc60}{00097}   \textcolor{keywordtype}{real} :: cp\_ice\textcolor{comment}{       !< The heat capacity of fresh ice [Q degC-1 ~> J kg-1 degC-1].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00098}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a0b9979a9d71a9b25ee9746950856fde0}{00098}   \textcolor{keywordtype}{real} :: gamma\_t\textcolor{comment}{      !< The (fixed) turbulent exchange velocity in the}
00099 \textcolor{comment}{                       !< 2-equation formulation [Z T-1 ~> m s-1].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00100}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a2d7c8da47c64ca130c8629f66a67fcfa}{00100}   \textcolor{keywordtype}{real} :: salin\_ice\textcolor{comment}{    !< The salinity of shelf ice [ppt].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00101}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a455aa67091820556ce834860438c71d5}{00101}   \textcolor{keywordtype}{real} :: temp\_ice\textcolor{comment}{     !< The core temperature of shelf ice [degC].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00102}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_abfb7a69267181d6c1b6bcd11d2f25d59}{00102}   \textcolor{keywordtype}{real} :: kv\_ice\textcolor{comment}{       !< The viscosity of ice [L4 Z-2 T-1 ~> m2 s-1].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00103}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ad55dbb6bc7c6a4ba8c97dad524ec7763}{00103}   \textcolor{keywordtype}{real} :: density\_ice\textcolor{comment}{  !< A typical density of ice [R ~> kg m-3].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00104}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a287174e0afaa4966a30ba768ef555617}{00104}   \textcolor{keywordtype}{real} :: kv\_molec\textcolor{comment}{     !< The molecular kinematic viscosity of sea water [Z2 T-1 ~> m2 s-1].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00105}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a4d41bd6afab1e2624b122b0a24d522c9}{00105}   \textcolor{keywordtype}{real} :: kd\_molec\_salt\textcolor{comment}{!< The molecular diffusivity of salt [Z2 T-1 ~> m2 s-1].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00106}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a2898b2da881a4f4350716fb857efd472}{00106}   \textcolor{keywordtype}{real} :: kd\_molec\_temp\textcolor{comment}{!< The molecular diffusivity of heat [Z2 T-1 ~> m2 s-1].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00107}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a63e3e964daf52869fbafead8045fdba1}{00107}   \textcolor{keywordtype}{real} :: lat\_fusion\textcolor{comment}{   !< The latent heat of fusion [Q ~> J kg-1].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00108}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_aeb83cc157fa4fbb0da66cd8e0338a9b8}{00108}   \textcolor{keywordtype}{real} :: gamma\_t\_3eq\textcolor{comment}{  !<  Nondimensional heat-transfer coefficient, used in the 3Eq. formulation}
\Hypertarget{MOM__ice__shelf_8F90_source_l00109}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a2d5b05cbc005693fda08e16a6af6abb9}{00109}   \textcolor{keywordtype}{real} :: gamma\_s\_3eq\textcolor{comment}{  !<  Nondimensional salt-transfer coefficient, used in the 3Eq. formulation}
00110 \textcolor{comment}{                       !<  This number should be specified by the user.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00111}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_aa91cb76cfefdef6031dee74a4f73d7ab}{00111}   \textcolor{keywordtype}{real} :: col\_mass\_melt\_threshold\textcolor{comment}{ !< An ocean column mass below the iceshelf below which melting}
00112 \textcolor{comment}{                       !! does not occur [R Z ~> kg m-2]}
\Hypertarget{MOM__ice__shelf_8F90_source_l00113}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ab2bbd6a07b8d44e25628c241882afc9b}{00113}   \textcolor{keywordtype}{logical} :: mass\_from\_file\textcolor{comment}{ !< Read the ice shelf mass from a file every dt}
00114 
00115   \textcolor{comment}{!!!! PHYSICAL AND NUMERICAL PARAMETERS FOR ICE DYNAMICS !!!!!!}
00116 
\Hypertarget{MOM__ice__shelf_8F90_source_l00117}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a49badff4ab2bc71cbc5d6e3212ef265a}{00117}   \textcolor{keywordtype}{real} :: time\_step\textcolor{comment}{    !< this is the shortest timestep that the ice shelf sees, and}
00118 \textcolor{comment}{                       !! is equal to the forcing timestep (it is passed in when the shelf}
00119 \textcolor{comment}{                       !! is initialized - so need to reorganize MOM driver.}
00120 \textcolor{comment}{                       !! it will be the prognistic timestep ... maybe.}
00121 
\Hypertarget{MOM__ice__shelf_8F90_source_l00122}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ab3164e7e3927ec8265823babad498952}{00122}   \textcolor{keywordtype}{logical} :: solo\_ice\_sheet\textcolor{comment}{ !< whether the ice model is running without being}
00123 \textcolor{comment}{                            !! coupled to the ocean}
\Hypertarget{MOM__ice__shelf_8F90_source_l00124}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a31be987df2b84bbc5b5f54429b6bb0b3}{00124}   \textcolor{keywordtype}{logical} :: gl\_regularize\textcolor{comment}{  !< whether to regularize the floatation condition}
00125 \textcolor{comment}{                            !! at the grounding line a la Goldberg Holland Schoof 2009}
\Hypertarget{MOM__ice__shelf_8F90_source_l00126}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a0715df507da8e9cda7e7b51ce10a084e}{00126}   \textcolor{keywordtype}{logical} :: gl\_couple\textcolor{comment}{      !< whether to let the floatation condition be}
00127 \textcolor{comment}{                            !!determined by ocean column thickness means update\_OD\_ffrac}
00128 \textcolor{comment}{                            !! will be called (note: GL\_regularize and GL\_couple}
00129 \textcolor{comment}{                            !! should be exclusive)}
\Hypertarget{MOM__ice__shelf_8F90_source_l00130}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a1efecc2750dd093ece52160348bbc9f4}{00130}   \textcolor{keywordtype}{logical} :: calve\_to\_mask\textcolor{comment}{  !< If true, calve any ice that passes outside of a masked area}
\Hypertarget{MOM__ice__shelf_8F90_source_l00131}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a8ae4eab0d4b6f32bb13266573ab0cb4f}{00131}   \textcolor{keywordtype}{real} :: min\_thickness\_simple\_calve\textcolor{comment}{ !< min. ice shelf thickness criteria for calving [Z ~> m].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00132}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_afb3f5aab430ff89bbc8f7da4efff391c}{00132}   \textcolor{keywordtype}{real} :: t0\textcolor{comment}{                !< temperature at ocean surface in the restoring region [degC]}
\Hypertarget{MOM__ice__shelf_8F90_source_l00133}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a1c1a7af588cd3b5369fec28dd593de00}{00133}   \textcolor{keywordtype}{real} :: s0\textcolor{comment}{                !< Salinity at ocean surface in the restoring region [ppt].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00134}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_afb6907e703411c98bd3668c1b62302d0}{00134}   \textcolor{keywordtype}{real} :: input\_flux\textcolor{comment}{        !< Ice volume flux at an upstream open boundary [m3 s-1].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00135}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_afc8deddd477f2b1d7a7237f4c7cbc719}{00135}   \textcolor{keywordtype}{real} :: input\_thickness\textcolor{comment}{   !< Ice thickness at an upstream open boundary [m].}
00136 
\Hypertarget{MOM__ice__shelf_8F90_source_l00137}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ac46c1a6e79f5cc6a4c7bb5dd29118c46}{00137}   \textcolor{keywordtype}{type}(time\_type) :: time\textcolor{comment}{                !< The component's time.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00138}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a58f36604c6e5b2d1c6b41d95bc8c686b}{00138}   \textcolor{keywordtype}{type}(\hyperlink{structmom__eos_1_1eos__type}{eos\_type}), \textcolor{keywordtype}{pointer} :: eqn\_of\_state => null() \textcolor{comment}{!< Type that indicates the}
00139 \textcolor{comment}{                                         !! equation of state to use.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00140}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a43e21d61f58d808fb6cd3e4beabb2ac2}{00140}   \textcolor{keywordtype}{logical} :: active\_shelf\_dynamics\textcolor{comment}{       !< True if the ice shelf mass changes as a result}
00141 \textcolor{comment}{                                         !! the dynamic ice-shelf model.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00142}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_abaa0f57ec4ec43bc505dec49d4038202}{00142}   \textcolor{keywordtype}{logical} :: override\_shelf\_movement\textcolor{comment}{     !< If true, user code specifies the shelf movement}
00143 \textcolor{comment}{                                         !! instead of using the dynamic ice-shelf mode.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00144}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ad1d53ca49894cb67df2843f2fa485d37}{00144}   \textcolor{keywordtype}{logical} :: isthermo\textcolor{comment}{                    !< True if the ice shelf can exchange heat and}
00145 \textcolor{comment}{                                         !! mass with the underlying ocean.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00146}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a4f27d3f57be0c1f7b2dcc41542cd8112}{00146}   \textcolor{keywordtype}{logical} :: threeeq\textcolor{comment}{                     !< If true, the 3 equation consistency equations are}
00147 \textcolor{comment}{                                         !! used to calculate the flux at the ocean-ice}
00148 \textcolor{comment}{                                         !! interface.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00149}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ad85e02ac082b4075c044f5beac79c73b}{00149}   \textcolor{keywordtype}{logical} :: insulator\textcolor{comment}{                   !< If true, ice shelf is a perfect insulator}
\Hypertarget{MOM__ice__shelf_8F90_source_l00150}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a347abcbb4df78956ae37ca0a7953cb28}{00150}   \textcolor{keywordtype}{logical} :: const\_gamma\textcolor{comment}{                 !< If true, gamma\_T is specified by the user.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00151}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ae45beed6807a1bab47eeb47685af8598}{00151}   \textcolor{keywordtype}{logical} :: constant\_sea\_level\textcolor{comment}{          !< if true, apply an evaporative, heat and salt}
00152 \textcolor{comment}{                                         !! fluxes. It will avoid large increase in sea level.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00153}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a1e55a4e44b6038c90b5a831476e57435}{00153}   \textcolor{keywordtype}{real}    :: min\_ocean\_mass\_float\textcolor{comment}{        !< The minimum ocean mass per unit area before the ice}
00154 \textcolor{comment}{                                         !! shelf is considered to float when constant\_sea\_level}
00155 \textcolor{comment}{                                         !! is used [R Z ~> kg m-2]}
\Hypertarget{MOM__ice__shelf_8F90_source_l00156}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ab59aa3b9227448a1b9df35f9fb4ebfb6}{00156}   \textcolor{keywordtype}{real}    :: cutoff\_depth\textcolor{comment}{                !< Depth above which melt is set to zero (>= 0) [Z ~> m].}
\Hypertarget{MOM__ice__shelf_8F90_source_l00157}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_afe6ab68ed9b2dcd18c207aafc95ba8c8}{00157}   \textcolor{keywordtype}{logical} :: find\_salt\_root\textcolor{comment}{              !< If true, if true find Sbdry using a quadratic eq.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00158}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a95649da09ff37f9c11121e963a574ef7}{00158}   \textcolor{keywordtype}{real}    :: tfr\_0\_0\textcolor{comment}{                     !< The freezing point at 0 pressure and 0 salinity [degC]}
\Hypertarget{MOM__ice__shelf_8F90_source_l00159}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ac551ddcd3a04237dc1656ea65181e941}{00159}   \textcolor{keywordtype}{real}    :: dtfr\_ds\textcolor{comment}{                     !< Partial derivative of freezing temperature with salinity [degC
       ppt-1]}
\Hypertarget{MOM__ice__shelf_8F90_source_l00160}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a404790194cd6d67d83de003de200a476}{00160}   \textcolor{keywordtype}{real}    :: dtfr\_dp\textcolor{comment}{                     !< Partial derivative of freezing temperature with}
00161 \textcolor{comment}{                                         !! pressure [degC T2 R-1 L-2 ~> degC Pa-1]}
00162 \textcolor{comment}{  !>@\{ Diagnostic handles}
\Hypertarget{MOM__ice__shelf_8F90_source_l00163}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a5892a9b94b525d7317d9b498d0cece1f}{00163}   \textcolor{keywordtype}{integer} :: id\_melt = -1, id\_exch\_vel\_s = -1, id\_exch\_vel\_t = -1, &
00164              id\_tfreeze = -1, id\_tfl\_shelf = -1, &
00165              id\_thermal\_driving = -1, id\_haline\_driving = -1, &
00166              id\_u\_ml = -1, id\_v\_ml = -1, id\_sbdry = -1, &
00167              id\_h\_shelf = -1, id\_h\_mask = -1, &
00168              id\_surf\_elev = -1, id\_bathym = -1, &
00169              id\_area\_shelf\_h = -1, &
00170              id\_ustar\_shelf = -1, id\_shelf\_mass = -1, id\_mass\_flux = -1\textcolor{comment}{}
00171 \textcolor{comment}{  !>@\}}
00172 
\Hypertarget{MOM__ice__shelf_8F90_source_l00173}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_ad19892e18df88659bbdf16273daf9fac}{00173}   \textcolor{keywordtype}{integer} :: id\_read\_mass\textcolor{comment}{ !< An integer handle used in time interpolation of}
00174 \textcolor{comment}{                          !! the ice shelf mass read from a file}
\Hypertarget{MOM__ice__shelf_8F90_source_l00175}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_aba8bc1ef43773d893ef12d7bbd12a405}{00175}   \textcolor{keywordtype}{integer} :: id\_read\_area\textcolor{comment}{ !< An integer handle used in time interpolation of}
00176 \textcolor{comment}{                          !! the ice shelf mass read from a file}
00177 
\Hypertarget{MOM__ice__shelf_8F90_source_l00178}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_adf1bec6e02d0db2f9941d52e58ca7048}{00178}   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{pointer} :: diag => null() \textcolor{comment}{!< A structure that is used to control diagnostic output.}
\Hypertarget{MOM__ice__shelf_8F90_source_l00179}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a28451ccf8a9684843d462ed2c9471275}{00179}   \textcolor{keywordtype}{type}(user\_ice\_shelf\_cs), \textcolor{keywordtype}{pointer} :: user\_cs => null() \textcolor{comment}{!< A pointer to the control structure for}
00180 \textcolor{comment}{                                  !! user-supplied modifications to the ice shelf code.}
00181 
\Hypertarget{MOM__ice__shelf_8F90_source_l00182}\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs_a012f5cbd1f6596306c28fea4540172fd}{00182}   \textcolor{keywordtype}{logical} :: debug\textcolor{comment}{                !< If true, write verbose checksums for debugging purposes}
00183 \textcolor{comment}{                                  !! and use reproducible sums}
00184 \textcolor{keyword}{end type }\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs}
00185 
\Hypertarget{MOM__ice__shelf_8F90_source_l00186}\hyperlink{namespacemom__ice__shelf_a5aff3e9a37cb5bc2b5b998bf296437ff}{00186} \textcolor{keywordtype}{integer} :: \hyperlink{namespacemom__ice__shelf_a5aff3e9a37cb5bc2b5b998bf296437ff}{id\_clock\_shelf}\textcolor{comment}{ !< CPU Clock for the ice shelf code}
\Hypertarget{MOM__ice__shelf_8F90_source_l00187}\hyperlink{namespacemom__ice__shelf_a3db8709f10aa77ed302598f3a23a608d}{00187} \textcolor{keywordtype}{integer} :: \hyperlink{namespacemom__ice__shelf_a3db8709f10aa77ed302598f3a23a608d}{id\_clock\_pass}\textcolor{comment}{ !< CPU Clock for group pass calls}
00188 
00189 \textcolor{keyword}{contains}
00190 \textcolor{comment}{}
00191 \textcolor{comment}{!> Calculates fluxes between the ocean and ice-shelf using the three-equations}
00192 \textcolor{comment}{!! formulation (optional to use just two equations).}
00193 \textcolor{comment}{!! See \(\backslash\)ref section\_ICE\_SHELF\_equations}
00194 \textcolor{keyword}{subroutine }\hyperlink{namespacemom__ice__shelf_a21a2a3ddec5ea25c7bca246419e4dcfe}{shelf\_calc\_flux}(sfc\_state, fluxes, Time, time\_step, CS, forces)
\Hypertarget{MOM__ice__shelf_8F90_source_l00195}\hyperlink{namespacemom__ice__shelf_a21a2a3ddec5ea25c7bca246419e4dcfe}{00195}   \textcolor{keywordtype}{type}(surface),         \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< A structure containing fields that}
00196 \textcolor{comment}{                                                !! describe the surface state of the ocean.  The}
00197 \textcolor{comment}{                                                !! intent is only inout to allow for halo updates.}
00198   \textcolor{keywordtype}{type}(forcing),         \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< structure containing pointers to any possible}
00199 \textcolor{comment}{                                                !! thermodynamic or mass-flux forcing fields.}
00200   \textcolor{keywordtype}{type}(time\_type),       \textcolor{keywordtype}{intent(in)}    :: Time\textcolor{comment}{  !< Start time of the fluxes.}
00201   \textcolor{keywordtype}{real},                  \textcolor{keywordtype}{intent(in)}    :: time\_step\textcolor{comment}{ !< Length of time over which these fluxes}
00202 \textcolor{comment}{                                                !! will be applied [s].}
00203   \textcolor{keywordtype}{type}(\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs}),    \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{    !< A pointer to the control structure returned}
00204 \textcolor{comment}{                                                !! by a previous call to initialize\_ice\_shelf.}
00205   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: forces\textcolor{comment}{ !< A structure with the driving mechanical forces}
00206 
00207   \textcolor{comment}{! Local variables}
00208   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{pointer} :: G => null()  \textcolor{comment}{!< The grid structure used by the ice shelf.}
00209   \textcolor{keywordtype}{type}(\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\_scale\_type}), \textcolor{keywordtype}{pointer} :: US => null() \textcolor{comment}{!< Pointer to a structure containing}
00210 \textcolor{comment}{                                                 !! various unit conversion factors}
00211   \textcolor{keywordtype}{type}(ice\_shelf\_state), \textcolor{keywordtype}{pointer} :: ISS => null() \textcolor{comment}{!< A structure with elements that describe}
00212 \textcolor{comment}{                                                 !! the ice-shelf state}
00213 
00214   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(CS%grid))} :: &
00215     Rhoml, &   !< Ocean mixed layer density [R ~> kg m-3].
00216     dR0\_dT, &  !< Partial derivative of the mixed layer density
00217 \textcolor{comment}{               !< with temperature [R degC-1 ~> kg m-3 degC-1].}
00218     dr0\_ds, &  \textcolor{comment}{!< Partial derivative of the mixed layer density}
00219 \textcolor{comment}{               !< with salinity [R ppt-1 ~> kg m-3 ppt-1].}
00220     p\_int      \textcolor{comment}{!< The pressure at the ice-ocean interface [R L2 T-2 ~> Pa].}
00221 
00222   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(CS%grid),SZJ\_(CS%grid))} :: &
00223     exch\_vel\_t, &  !< Sub-shelf thermal exchange velocity [Z T-1 ~> m s-1]
00224     exch\_vel\_s\textcolor{comment}{     !< Sub-shelf salt exchange velocity [Z T-1 ~> m s-1]}
00225 
00226   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZDI\_(CS%grid),SZDJ\_(CS%grid))} :: &
00227     mass\_flux\textcolor{comment}{  !< Total mass flux of freshwater across the ice-ocean interface. [R Z L2 T-1 ~> kg/s]}
00228   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZDI\_(CS%grid),SZDJ\_(CS%grid))} :: &
00229     haline\_driving\textcolor{comment}{ !< (SSS - S\_boundary) ice-ocean}
00230 \textcolor{comment}{               !! interface, positive for melting and negative for freezing.}
00231 \textcolor{comment}{               !! This is computed as part of the ISOMIP diagnostics.}
00232   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{parameter} :: VK    = 0.40\textcolor{comment}{ !< Von Karman's constant - dimensionless}
00233   \textcolor{keywordtype}{real} :: ZETA\_N = 0.052\textcolor{comment}{ !> The fraction of the boundary layer over which the}
00234 \textcolor{comment}{               !! viscosity is linearly increasing [nondim]. (Was 1/8. Why?)}
00235   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{parameter} :: RC    = 0.20     \textcolor{comment}{! critical flux Richardson number.}
00236   \textcolor{keywordtype}{real} :: I\_ZETA\_N\textcolor{comment}{ !< The inverse of ZETA\_N [nondim].}
00237   \textcolor{keywordtype}{real} :: I\_LF\textcolor{comment}{     !< The inverse of the latent heat of fusion [Q-1 ~> kg J-1].}
00238   \textcolor{keywordtype}{real} :: I\_VK\textcolor{comment}{     !< The inverse of the Von Karman constant [nondim].}
00239   \textcolor{keywordtype}{real} :: PR, SC\textcolor{comment}{   !< The Prandtl number and Schmidt number [nondim].}
00240 
00241   \textcolor{comment}{! 3 equations formulation variables}
00242   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZDI\_(CS%grid),SZDJ\_(CS%grid))} :: &
00243     Sbdry\textcolor{comment}{     !< Salinities in the ocean at the interface with the ice shelf [ppt].}
00244   \textcolor{keywordtype}{real} :: Sbdry\_it
00245   \textcolor{keywordtype}{real} :: Sbdry1, Sbdry2
00246   \textcolor{keywordtype}{real} :: S\_a, S\_b, S\_c  \textcolor{comment}{! Variables used to find salt roots}
00247   \textcolor{keywordtype}{real} :: dS\_it\textcolor{comment}{    !< The interface salinity change during an iteration [ppt].}
00248   \textcolor{keywordtype}{real} :: hBL\_neut\textcolor{comment}{ !< The neutral boundary layer thickness [Z ~> m].}
00249   \textcolor{keywordtype}{real} :: hBL\_neut\_h\_molec\textcolor{comment}{ !< The ratio of the neutral boundary layer thickness}
00250 \textcolor{comment}{                   !! to the molecular boundary layer thickness [nondim].}
00251   \textcolor{keywordtype}{real} :: wT\_flux\textcolor{comment}{ !< The downward vertical flux of heat just inside the ocean [degC Z T-1 ~> degC m s-1].}
00252   \textcolor{keywordtype}{real} :: wB\_flux\textcolor{comment}{ !< The downward vertical flux of buoyancy just inside the ocean [Z2 T-3 ~> m2 s-3].}
00253   \textcolor{keywordtype}{real} :: dB\_dS\textcolor{comment}{   !< The derivative of buoyancy with salinity [Z T-2 ppt-1 ~> m s-2 ppt-1].}
00254   \textcolor{keywordtype}{real} :: dB\_dT\textcolor{comment}{   !< The derivative of buoyancy with temperature [Z T-2 degC-1 ~> m s-2 degC-1].}
00255   \textcolor{keywordtype}{real} :: I\_n\_star \textcolor{comment}{! [nondim]}
00256   \textcolor{keywordtype}{real} :: n\_star\_term \textcolor{comment}{! A term in the expression for nstar [T3 Z-2 ~> s3 m-2]}
00257   \textcolor{keywordtype}{real} :: absf     \textcolor{comment}{! The absolute value of the Coriolis parameter [T-1 ~> s-1]}
00258   \textcolor{keywordtype}{real} :: dIns\_dwB\textcolor{comment}{ !< The partial derivative of I\_n\_star with wB\_flux, in [T3 Z-2 ~> s3 m-2]}
00259   \textcolor{keywordtype}{real} :: dT\_ustar \textcolor{comment}{! The difference between the the freezing point and the ocean boundary layer}
00260                    \textcolor{comment}{! temperature times the friction velocity [degC Z T-1 ~> degC m s-1]}
00261   \textcolor{keywordtype}{real} :: dS\_ustar \textcolor{comment}{! The difference between the salinity at the ice-ocean interface and the ocean}
00262                    \textcolor{comment}{! boundary layer salinity times the friction velocity [ppt Z T-1 ~> ppt m s-1]}
00263   \textcolor{keywordtype}{real} :: ustar\_h  \textcolor{comment}{! The friction velocity in the water below the ice shelf [Z T-1 ~> m s-1]}
00264   \textcolor{keywordtype}{real} :: Gam\_turb \textcolor{comment}{! [nondim]}
00265   \textcolor{keywordtype}{real} :: Gam\_mol\_t, Gam\_mol\_s \textcolor{comment}{! Relative coefficients of molecular diffusivites [nondim]}
00266   \textcolor{keywordtype}{real} :: RhoCp     \textcolor{comment}{! A typical ocean density times the heat capacity of water [Q R ~> J m-3]}
00267   \textcolor{keywordtype}{real} :: ln\_neut
00268   \textcolor{keywordtype}{real} :: mass\_exch \textcolor{comment}{! A mass exchange rate [R Z T-1 ~> kg m-2 s-1]}
00269   \textcolor{keywordtype}{real} :: Sb\_min, Sb\_max
00270   \textcolor{keywordtype}{real} :: dS\_min, dS\_max
00271   \textcolor{comment}{! Variables used in iterating for wB\_flux.}
00272   \textcolor{keywordtype}{real} :: wB\_flux\_new, dDwB\_dwB\_in
00273   \textcolor{keywordtype}{real} :: I\_Gam\_T, I\_Gam\_S
00274   \textcolor{keywordtype}{real} :: dG\_dwB   \textcolor{comment}{! The derivative of Gam\_turb with wB [T3 Z-2 ~> s3 m-2]}
00275   \textcolor{keywordtype}{real} :: taux2, tauy2 \textcolor{comment}{! The squared surface stresses [R2 L2 Z2 T-4 ~> Pa2].}
00276   \textcolor{keywordtype}{real} :: u2\_av, v2\_av \textcolor{comment}{! The ice-area weighted average squared ocean velocities [L2 T-2 ~> m2 s-2]}
00277   \textcolor{keywordtype}{real} :: asu1, asu2   \textcolor{comment}{! Ocean areas covered by ice shelves at neighboring u-}
00278   \textcolor{keywordtype}{real} :: asv1, asv2   \textcolor{comment}{! and v-points [L2 ~> m2].}
00279   \textcolor{keywordtype}{real} :: I\_au, I\_av   \textcolor{comment}{! The Adcroft reciprocals of the ice shelf areas at adjacent points [L-2 ~> m-2]}
00280   \textcolor{keywordtype}{real} :: Irho0        \textcolor{comment}{! The inverse of the mean density times a unit conversion factor [R-1 L Z-1 ~> m3
       kg-1]}
00281   \textcolor{keywordtype}{logical} :: Sb\_min\_set, Sb\_max\_set
00282   \textcolor{keywordtype}{logical} :: update\_ice\_vel \textcolor{comment}{! If true, it is time to update the ice shelf velocities.}
00283   \textcolor{keywordtype}{logical} :: coupled\_GL     \textcolor{comment}{! If true, the grouding line position is determined based on}
00284                             \textcolor{comment}{! coupled ice-ocean dynamics.}
00285 
00286   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{parameter} :: c2\_3 = 2.0/3.0
00287   \textcolor{keywordtype}{character(len=160)} :: mesg  \textcolor{comment}{! The text of an error message}
00288   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(2)} :: EOSdom \textcolor{comment}{! The i-computational domain for the equation of state}
00289   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, ied, jed, it1, it3
00290 
00291   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"shelf\_calc\_flux: "}// &
00292        \textcolor{stringliteral}{"initialize\_ice\_shelf must be called before shelf\_calc\_flux."})
00293   \textcolor{keyword}{call }cpu\_clock\_begin(\hyperlink{namespacemom__ice__shelf_a5aff3e9a37cb5bc2b5b998bf296437ff}{id\_clock\_shelf})
00294 
00295   g => cs%grid ; us => cs%US
00296   iss => cs%ISS
00297 
00298   \textcolor{comment}{! useful parameters}
00299   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; ied = g%ied ; jed = g%jed
00300   i\_zeta\_n = 1.0 / zeta\_n
00301   i\_lf = 1.0 / cs%Lat\_fusion
00302   sc = cs%kv\_molec/cs%kd\_molec\_salt
00303   pr = cs%kv\_molec/cs%kd\_molec\_temp
00304   i\_vk = 1.0/vk
00305   rhocp = cs%Rho\_ocn * cs%Cp
00306 
00307   \textcolor{comment}{!first calculate molecular component}
00308   gam\_mol\_t = 12.5 * (pr**c2\_3) - 6.0
00309   gam\_mol\_s = 12.5 * (sc**c2\_3) - 6.0
00310 
00311   \textcolor{comment}{! GMM, zero some fields of the ice shelf structure (ice\_shelf\_CS)}
00312   \textcolor{comment}{! these fields are already set to zero during initialization}
00313   \textcolor{comment}{! However, they seem to be changed somewhere and, for diagnostic}
00314   \textcolor{comment}{! reasons, it is better to set them to zero again.}
00315   exch\_vel\_t(:,:) = 0.0 ; exch\_vel\_s(:,:) = 0.0
00316   iss%tflux\_shelf(:,:) = 0.0 ; iss%water\_flux(:,:) = 0.0
00317   iss%salt\_flux(:,:) = 0.0 ; iss%tflux\_ocn(:,:) = 0.0 ; iss%tfreeze(:,:) = 0.0
00318   \textcolor{comment}{! define Sbdry to avoid Run-Time Check Failure, when melt is not computed.}
00319   haline\_driving(:,:) = 0.0
00320   sbdry(:,:) = sfc\_state%sss(:,:)
00321 
00322   \textcolor{comment}{!update time}
00323   cs%Time = time
00324 
00325   \textcolor{keywordflow}{if} (cs%override\_shelf\_movement) \textcolor{keywordflow}{then}
00326     cs%time\_step = time\_step
00327     \textcolor{comment}{! update shelf mass}
00328     \textcolor{keywordflow}{if} (cs%mass\_from\_file) \textcolor{keyword}{call }\hyperlink{namespacemom__ice__shelf_a6f0fa9f98ac01752ca2983c7e9816097}{update\_shelf\_mass}(g, us, cs, iss, time)
00329 \textcolor{keywordflow}{  endif}
00330 
00331   \textcolor{keywordflow}{if} (cs%debug) \textcolor{keywordflow}{then}
00332     \textcolor{keyword}{call }hchksum(fluxes%frac\_shelf\_h, \textcolor{stringliteral}{"frac\_shelf\_h before apply melting"}, g%HI, haloshift=0)
00333     \textcolor{keyword}{call }hchksum(sfc\_state%sst, \textcolor{stringliteral}{"sst before apply melting"}, g%HI, haloshift=0)
00334     \textcolor{keyword}{call }hchksum(sfc\_state%sss, \textcolor{stringliteral}{"sss before apply melting"}, g%HI, haloshift=0)
00335     \textcolor{keyword}{call }hchksum(sfc\_state%u, \textcolor{stringliteral}{"u\_ml before apply melting"}, g%HI, haloshift=0, scale=us%L\_T\_to\_m\_s)
00336     \textcolor{keyword}{call }hchksum(sfc\_state%v, \textcolor{stringliteral}{"v\_ml before apply melting"}, g%HI, haloshift=0, scale=us%L\_T\_to\_m\_s)
00337     \textcolor{keyword}{call }hchksum(sfc\_state%ocean\_mass, \textcolor{stringliteral}{"ocean\_mass before apply melting"}, g%HI, haloshift=0, &
00338                  scale=us%RZ\_to\_kg\_m2)
00339 \textcolor{keywordflow}{  endif}
00340 
00341   \textcolor{comment}{! Calculate the friction velocity under ice shelves, using taux\_shelf and tauy\_shelf if possible.}
00342   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%taux\_shelf) .and. \textcolor{keyword}{allocated}(sfc\_state%tauy\_shelf)) \textcolor{keywordflow}{then}
00343     \textcolor{keyword}{call }pass\_vector(sfc\_state%taux\_shelf, sfc\_state%tauy\_shelf, g%domain, to\_all, cgrid\_ne)
00344 \textcolor{keywordflow}{  endif}
00345   irho0 = us%Z\_to\_L / cs%Rho\_ocn
00346   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; \textcolor{keywordflow}{if} (fluxes%frac\_shelf\_h(i,j) > 0.0) \textcolor{keywordflow}{then}
00347     taux2 = 0.0 ; tauy2 = 0.0 ; u2\_av = 0.0 ; v2\_av = 0.0
00348     asu1 = (iss%area\_shelf\_h(i-1,j) + iss%area\_shelf\_h(i,j))
00349     asu2 = (iss%area\_shelf\_h(i,j) + iss%area\_shelf\_h(i+1,j))
00350     asv1 = (iss%area\_shelf\_h(i,j-1) + iss%area\_shelf\_h(i,j))
00351     asv2 = (iss%area\_shelf\_h(i,j) + iss%area\_shelf\_h(i,j+1))
00352     i\_au = 0.0 ; \textcolor{keywordflow}{if} (asu1 + asu2 > 0.0) i\_au = 1.0 / (asu1 + asu2)
00353     i\_av = 0.0 ; \textcolor{keywordflow}{if} (asv1 + asv2 > 0.0) i\_av = 1.0 / (asv1 + asv2)
00354     \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%taux\_shelf) .and. \textcolor{keyword}{allocated}(sfc\_state%tauy\_shelf)) \textcolor{keywordflow}{then}
00355       taux2 = (asu1 * sfc\_state%taux\_shelf(i-1,j)**2 + asu2 * sfc\_state%taux\_shelf(i,j)**2  ) * i\_au
00356       tauy2 = (asv1 * sfc\_state%tauy\_shelf(i,j-1)**2 + asv2 * sfc\_state%tauy\_shelf(i,j)**2  ) * i\_av
00357 \textcolor{keywordflow}{    endif}
00358     u2\_av = (asu1 * sfc\_state%u(i-1,j)**2 + asu2 * sfc\_state%u(i,j)**2) * i\_au
00359     v2\_av = (asv1 * sfc\_state%v(i,j-1)**2 + asu2 * sfc\_state%v(i,j)**2) * i\_av
00360 
00361     \textcolor{keywordflow}{if} (taux2 + tauy2 > 0.0) \textcolor{keywordflow}{then}
00362       fluxes%ustar\_shelf(i,j) = max(cs%ustar\_bg, us%L\_to\_Z * &
00363           sqrt(irho0 * sqrt(taux2 + tauy2) + cs%cdrag*cs%utide(i,j)**2))
00364     \textcolor{keywordflow}{else}   \textcolor{comment}{! Take care of the cases when taux\_shelf is not set or not allocated.}
00365       fluxes%ustar\_shelf(i,j) = max(cs%ustar\_bg, us%L\_TO\_Z * &
00366           sqrt(cs%cdrag*((u2\_av + v2\_av) + cs%utide(i,j)**2)))
00367 \textcolor{keywordflow}{    endif}
00368   \textcolor{keywordflow}{else} \textcolor{comment}{! There is no shelf here.}
00369     fluxes%ustar\_shelf(i,j) = 0.0
00370 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
00371 
00372   eosdom(:) = eos\_domain(g%HI)
00373   \textcolor{keywordflow}{do} j=js,je
00374     \textcolor{comment}{! Find the pressure at the ice-ocean interface, averaged only over the}
00375     \textcolor{comment}{! part of the cell covered by ice shelf.}
00376     \textcolor{keywordflow}{do} i=is,ie ; p\_int(i) = cs%g\_Earth * iss%mass\_shelf(i,j) ;\textcolor{keywordflow}{ enddo}
00377 
00378     \textcolor{comment}{! Calculate insitu densities and expansion coefficients}
00379     \textcolor{keyword}{call }\hyperlink{interfacemom__eos_1_1calculate__density}{calculate\_density}(sfc\_state%sst(:,j), sfc\_state%sss(:,j), p\_int, rhoml(:), &
00380                                  cs%eqn\_of\_state, eosdom)
00381     \textcolor{keyword}{call }\hyperlink{interfacemom__eos_1_1calculate__density__derivs}{calculate\_density\_derivs}(sfc\_state%sst(:,j), sfc\_state%sss(:,j), p\_int, 
      dr0\_dt, dr0\_ds, &
00382                                  cs%eqn\_of\_state, eosdom)
00383 
00384     \textcolor{keywordflow}{do} i=is,ie
00385       \textcolor{keywordflow}{if} ((sfc\_state%ocean\_mass(i,j) > cs%col\_mass\_melt\_threshold) .and. &
00386           (iss%area\_shelf\_h(i,j) > 0.0) .and. cs%isthermo) \textcolor{keywordflow}{then}
00387 
00388         \textcolor{keywordflow}{if} (cs%threeeq) \textcolor{keywordflow}{then}
00389           \textcolor{comment}{!   Iteratively determine a self-consistent set of fluxes, with the ocean}
00390           \textcolor{comment}{! salinity just below the ice-shelf as the variable that is being}
00391           \textcolor{comment}{! iterated for.}
00392 
00393           ustar\_h = fluxes%ustar\_shelf(i,j)
00394 
00395           \textcolor{comment}{! Estimate the neutral ocean boundary layer thickness as the minimum of the}
00396           \textcolor{comment}{! reported ocean mixed layer thickness and the neutral Ekman depth.}
00397           absf = 0.25*((abs(g%CoriolisBu(i,j)) + abs(g%CoriolisBu(i-1,j-1))) + &
00398                                  (abs(g%CoriolisBu(i,j-1)) + abs(g%CoriolisBu(i-1,j))))
00399           \textcolor{keywordflow}{if} (absf*sfc\_state%Hml(i,j) <= vk*ustar\_h) \textcolor{keywordflow}{then} ; hbl\_neut = sfc\_state%Hml(i,j)
00400           \textcolor{keywordflow}{else} ; hbl\_neut = (vk*ustar\_h) / absf ;\textcolor{keywordflow}{ endif}
00401           hbl\_neut\_h\_molec = zeta\_n * ((hbl\_neut * ustar\_h) / (5.0 * cs%kv\_molec))
00402 
00403           \textcolor{comment}{! Determine the mixed layer buoyancy flux, wB\_flux.}
00404           db\_ds = (us%L\_to\_Z**2*cs%g\_Earth / rhoml(i)) * dr0\_ds(i)
00405           db\_dt = (us%L\_to\_Z**2*cs%g\_Earth / rhoml(i)) * dr0\_dt(i)
00406           ln\_neut = 0.0 ; \textcolor{keywordflow}{if} (hbl\_neut\_h\_molec > 1.0) ln\_neut = log(hbl\_neut\_h\_molec)
00407 
00408           \textcolor{keywordflow}{if} (cs%find\_salt\_root) \textcolor{keywordflow}{then}
00409             \textcolor{comment}{! Solve for the skin salinity using the linearized liquidus parameters and}
00410             \textcolor{comment}{! balancing the turbulent fresh water flux in the near-boundary layer with}
00411             \textcolor{comment}{! the net fresh water or salt added by melting:}
00412             \textcolor{comment}{! (Cp/Lat\_fusion)*Gamma\_T\_3Eq*(TFr\_skin-T\_ocn) = Gamma\_S\_3Eq*(S\_skin-S\_ocn)/S\_skin}
00413 
00414             \textcolor{comment}{! S\_a is always < 0.0 with a realistic expression for the freezing point.}
00415             s\_a = cs%dTFr\_dS * cs%Gamma\_T\_3EQ * cs%Cp
00416             s\_b = cs%Gamma\_T\_3EQ*cs%Cp*(cs%TFr\_0\_0 + cs%dTFr\_dp*p\_int(i) - sfc\_state%sst(i,j)) - &
00417                   cs%Lat\_fusion * cs%Gamma\_S\_3EQ    \textcolor{comment}{! S\_b Can take either sign, but is usually negative.}
00418             s\_c = cs%Lat\_fusion * cs%Gamma\_S\_3EQ * sfc\_state%sss(i,j) \textcolor{comment}{! Always >= 0}
00419 
00420             \textcolor{keywordflow}{if} (s\_c == 0.0) \textcolor{keywordflow}{then}  \textcolor{comment}{! The solution for fresh water.}
00421               sbdry(i,j) = 0.0
00422             \textcolor{keywordflow}{elseif} (s\_a < 0.0) \textcolor{keywordflow}{then} \textcolor{comment}{! This is the usual ocean case}
00423               \textcolor{keywordflow}{if} (s\_b < 0.0) \textcolor{keywordflow}{then} \textcolor{comment}{! This is almost always the case}
00424                 sbdry(i,j) = 2.0*s\_c / (-s\_b + sqrt(s\_b*s\_b - 4.*s\_a*s\_c))
00425               \textcolor{keywordflow}{else}
00426                 sbdry(i,j) = (s\_b + sqrt(s\_b*s\_b - 4.*s\_a*s\_c)) / (-2.*s\_a)
00427 \textcolor{keywordflow}{              endif}
00428             \textcolor{keywordflow}{elseif} ((s\_a == 0.0) .and. (s\_b < 0.0)) \textcolor{keywordflow}{then} \textcolor{comment}{! It should be the case that S\_b < 0.}
00429               sbdry(i,j) = -s\_c / s\_b
00430             \textcolor{keywordflow}{else}
00431               \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"Impossible conditions found in 3-equation skin salinity calculation."})
00432 \textcolor{keywordflow}{            endif}
00433 
00434             \textcolor{comment}{! Safety check}
00435             \textcolor{keywordflow}{if} (sbdry(i,j) < 0.) \textcolor{keywordflow}{then}
00436               \textcolor{keyword}{write}(mesg,*) \textcolor{stringliteral}{'sfc\_state%sss(i,j) = '},sfc\_state%sss(i,j), \textcolor{stringliteral}{'S\_a, S\_b, S\_c'}, s\_a, s\_b, s\_c
00437               \textcolor{keyword}{call }mom\_error(warning, mesg, .true.)
00438               \textcolor{keyword}{write}(mesg,*) \textcolor{stringliteral}{'I,J,Sbdry1,Sbdry2'},i,j,sbdry1,sbdry2
00439               \textcolor{keyword}{call }mom\_error(warning, mesg, .true.)
00440               \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"shelf\_calc\_flux: Negative salinity (Sbdry)."})
00441 \textcolor{keywordflow}{            endif}
00442           \textcolor{keywordflow}{else}
00443             \textcolor{comment}{! Guess sss as the iteration starting point for the boundary salinity.}
00444             sbdry(i,j) = sfc\_state%sss(i,j) ; sb\_max\_set = .false.
00445             sb\_min\_set = .false.
00446 \textcolor{keywordflow}{          endif} \textcolor{comment}{!find\_salt\_root}
00447 
00448           \textcolor{keywordflow}{do} it1 = 1,20
00449             \textcolor{comment}{! Determine the potential temperature at the ice-ocean interface.}
00450             \textcolor{keyword}{call }\hyperlink{interfacemom__eos_1_1calculate__tfreeze}{calculate\_tfreeze}(sbdry(i,j), p\_int(i), iss%tfreeze(i,j), cs%eqn\_of\_state
      , &
00451                                    pres\_scale=us%RL2\_T2\_to\_Pa)
00452 
00453             dt\_ustar = (iss%tfreeze(i,j) - sfc\_state%sst(i,j)) * ustar\_h
00454             ds\_ustar = (sbdry(i,j) - sfc\_state%sss(i,j)) * ustar\_h
00455 
00456             \textcolor{comment}{! First, determine the buoyancy flux assuming no effects of stability}
00457             \textcolor{comment}{! on the turbulence.  Following H & J '99, this limit also applies}
00458             \textcolor{comment}{! when the buoyancy flux is destabilizing.}
00459 
00460             \textcolor{keywordflow}{if} (cs%const\_gamma) \textcolor{keywordflow}{then} \textcolor{comment}{! if using a constant gamma\_T}
00461               \textcolor{comment}{! note the different form, here I\_Gam\_T is NOT 1/Gam\_T!}
00462               i\_gam\_t = cs%Gamma\_T\_3EQ
00463               i\_gam\_s = cs%Gamma\_S\_3EQ
00464             \textcolor{keywordflow}{else}
00465               gam\_turb = i\_vk * (ln\_neut + (0.5 * i\_zeta\_n - 1.0))
00466               i\_gam\_t = 1.0 / (gam\_mol\_t + gam\_turb)
00467               i\_gam\_s = 1.0 / (gam\_mol\_s + gam\_turb)
00468 \textcolor{keywordflow}{            endif}
00469 
00470             wt\_flux = dt\_ustar * i\_gam\_t
00471             wb\_flux = db\_ds * (ds\_ustar * i\_gam\_s) + db\_dt * wt\_flux
00472 
00473             \textcolor{keywordflow}{if} (wb\_flux < 0.0) \textcolor{keywordflow}{then}
00474               \textcolor{comment}{! The buoyancy flux is stabilizing and will reduce the tubulent}
00475               \textcolor{comment}{! fluxes, and iteration is required.}
00476               n\_star\_term = (zeta\_n/rc) * (hbl\_neut * vk) / (ustar\_h)**3
00477               \textcolor{keywordflow}{do} it3 = 1,30
00478                \textcolor{comment}{! n\_star <= 1.0 is the ratio of working boundary layer thickness}
00479                \textcolor{comment}{! to the neutral thickness.}
00480                \textcolor{comment}{! hBL = n\_star*hBL\_neut ; hSub = 1/8*n\_star*hBL}
00481 
00482                 i\_n\_star = sqrt(1.0 - n\_star\_term * wb\_flux)
00483                 dins\_dwb = 0.5 * n\_star\_term / i\_n\_star
00484                 \textcolor{keywordflow}{if} (hbl\_neut\_h\_molec > i\_n\_star**2) \textcolor{keywordflow}{then}
00485                   gam\_turb = i\_vk * ((ln\_neut - 2.0*log(i\_n\_star)) + &
00486                                     (0.5*i\_zeta\_n*i\_n\_star - 1.0))
00487                   dg\_dwb =  i\_vk * ( -2.0 / i\_n\_star + (0.5 * i\_zeta\_n)) * dins\_dwb
00488                 \textcolor{keywordflow}{else}
00489                   \textcolor{comment}{!   The layer dominated by molecular viscosity is smaller than}
00490                   \textcolor{comment}{! the assumed boundary layer.  This should be rare!}
00491                   gam\_turb = i\_vk * (0.5 * i\_zeta\_n*i\_n\_star - 1.0)
00492                   dg\_dwb = i\_vk * (0.5 * i\_zeta\_n) * dins\_dwb
00493 \textcolor{keywordflow}{                endif}
00494 
00495                 \textcolor{keywordflow}{if} (cs%const\_gamma) \textcolor{keywordflow}{then} \textcolor{comment}{! if using a constant gamma\_T}
00496                   \textcolor{comment}{! note the different form, here I\_Gam\_T is NOT 1/Gam\_T!}
00497                   i\_gam\_t = cs%Gamma\_T\_3EQ
00498                   i\_gam\_s = cs%Gamma\_S\_3EQ
00499                 \textcolor{keywordflow}{else}
00500                   i\_gam\_t = 1.0 / (gam\_mol\_t + gam\_turb)
00501                   i\_gam\_s = 1.0 / (gam\_mol\_s + gam\_turb)
00502 \textcolor{keywordflow}{                endif}
00503 
00504                 wt\_flux = dt\_ustar * i\_gam\_t
00505                 wb\_flux\_new = db\_ds * (ds\_ustar * i\_gam\_s) + db\_dt * wt\_flux
00506 
00507                 \textcolor{comment}{! Find the root where wB\_flux\_new = wB\_flux.  Make the 1.0e-4 below into a parameter?}
00508                 \textcolor{keywordflow}{if} (abs(wb\_flux\_new - wb\_flux) < 1.0e-4*(abs(wb\_flux\_new) + abs(wb\_flux))) \textcolor{keywordflow}{exit}
00509 
00510                 ddwb\_dwb\_in = dg\_dwb * (db\_ds * (ds\_ustar * i\_gam\_s**2) + &
00511                                         db\_dt * (dt\_ustar * i\_gam\_t**2)) - 1.0
00512                 \textcolor{comment}{! This is Newton's method without any bounds.  Should bounds be needed?}
00513                 wb\_flux\_new = wb\_flux - (wb\_flux\_new - wb\_flux) / ddwb\_dwb\_in
00514 \textcolor{keywordflow}{              enddo} \textcolor{comment}{!it3}
00515 \textcolor{keywordflow}{            endif}
00516 
00517             iss%tflux\_ocn(i,j)  = rhocp * wt\_flux
00518             exch\_vel\_t(i,j) = ustar\_h * i\_gam\_t
00519             exch\_vel\_s(i,j) = ustar\_h * i\_gam\_s
00520 
00521             \textcolor{comment}{! Calculate the heat flux inside the ice shelf.}
00522             \textcolor{comment}{! Vertical adv/diff as in H+J 1999, eqns (26) & approx from (31).}
00523             \textcolor{comment}{!   Q\_ice = density\_ice * CS%Cp\_ice * K\_ice * dT/dz (at interface)}
00524             \textcolor{comment}{! vertical adv/diff as in H+J 1999, eqs (31) & (26)...}
00525             \textcolor{comment}{!   dT/dz ~= min( (lprec/(density\_ice*K\_ice))*(CS%Temp\_Ice-T\_freeze) , 0.0 )}
00526             \textcolor{comment}{! If this approximation is not made, iterations are required... See H+J Fig 3.}
00527 
00528             \textcolor{keywordflow}{if} (iss%tflux\_ocn(i,j) >= 0.0) \textcolor{keywordflow}{then}
00529               \textcolor{comment}{! Freezing occurs due to downward ocean heat flux, so zero iout ce heat flux.}
00530               iss%water\_flux(i,j) = -i\_lf * iss%tflux\_ocn(i,j)
00531               iss%tflux\_shelf(i,j) = 0.0
00532             \textcolor{keywordflow}{else}
00533               \textcolor{keywordflow}{if} (cs%insulator) \textcolor{keywordflow}{then}
00534                 \textcolor{comment}{!no conduction/perfect insulator}
00535                 iss%tflux\_shelf(i,j) = 0.0
00536                 iss%water\_flux(i,j) = i\_lf * (iss%tflux\_shelf(i,j) - iss%tflux\_ocn(i,j))
00537 
00538               \textcolor{keywordflow}{else}
00539                 \textcolor{comment}{! With melting, from H&J 1999, eqs (31) & (26)...}
00540                 \textcolor{comment}{!   Q\_ice ~= Cp\_ice * (CS%Temp\_Ice-T\_freeze) * lprec}
00541                 \textcolor{comment}{!   RhoLF*lprec = Q\_ice - ISS%tflux\_ocn(i,j)}
00542                 \textcolor{comment}{!   lprec = -(ISS%tflux\_ocn(i,j)) / (CS%Lat\_fusion + Cp\_ice * (T\_freeze-CS%Temp\_Ice))}
00543                 iss%water\_flux(i,j) = -iss%tflux\_ocn(i,j) / &
00544                      (cs%Lat\_fusion + cs%Cp\_ice * (iss%tfreeze(i,j) - cs%Temp\_Ice))
00545 
00546                 iss%tflux\_shelf(i,j) = iss%tflux\_ocn(i,j) + cs%Lat\_fusion*iss%water\_flux(i,j)
00547 \textcolor{keywordflow}{              endif}
00548 
00549 \textcolor{keywordflow}{            endif}
00550             \textcolor{comment}{!other options: dTi/dz linear through shelf, with draft in [Z ~> m], KTI in [Z2 T-1 ~> m2 s-1]}
00551             \textcolor{comment}{!    dTi\_dz = (CS%Temp\_Ice - ISS%tfreeze(i,j)) / draft(i,j)}
00552             \textcolor{comment}{!    ISS%tflux\_shelf(i,j) = Rho\_Ice * CS%Cp\_ice * KTI * dTi\_dz}
00553 
00554 
00555             \textcolor{keywordflow}{if} (cs%find\_salt\_root) \textcolor{keywordflow}{then}
00556               \textcolor{keywordflow}{exit} \textcolor{comment}{! no need to do interaction, so exit loop}
00557             \textcolor{keywordflow}{else}
00558 
00559               mass\_exch = exch\_vel\_s(i,j) * cs%Rho\_ocn
00560               sbdry\_it = (sfc\_state%sss(i,j) * mass\_exch + cs%Salin\_ice * iss%water\_flux(i,j)) / &
00561                          (mass\_exch + iss%water\_flux(i,j))
00562               ds\_it = sbdry\_it - sbdry(i,j)
00563               \textcolor{keywordflow}{if} (abs(ds\_it) < 1.0e-4*(0.5*(sfc\_state%sss(i,j) + sbdry(i,j) + 1.0e-10))) \textcolor{keywordflow}{exit}
00564 
00565 
00566               \textcolor{keywordflow}{if} (ds\_it < 0.0) \textcolor{keywordflow}{then} \textcolor{comment}{! Sbdry is now the upper bound.}
00567                 \textcolor{keywordflow}{if} (sb\_max\_set .and. (sbdry(i,j) > sb\_max)) &
00568                   \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"shelf\_calc\_flux: Irregular iteration for Sbdry (max)."})
00569                 sb\_max = sbdry(i,j) ; ds\_max = ds\_it ; sb\_max\_set = .true.
00570               \textcolor{keywordflow}{else} \textcolor{comment}{! Sbdry is now the lower bound.}
00571                 \textcolor{keywordflow}{if} (sb\_min\_set .and. (sbdry(i,j) < sb\_min)) &
00572                    \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"shelf\_calc\_flux: Irregular iteration for Sbdry (min)."})
00573                  sb\_min = sbdry(i,j) ; ds\_min = ds\_it ; sb\_min\_set = .true.
00574 \textcolor{keywordflow}{              endif} \textcolor{comment}{! dS\_it < 0.0}
00575 
00576               \textcolor{keywordflow}{if} (sb\_min\_set .and. sb\_max\_set) \textcolor{keywordflow}{then}
00577                 \textcolor{comment}{! Use the false position method for the next iteration.}
00578                 sbdry(i,j) = sb\_min + (sb\_max-sb\_min) * (ds\_min / (ds\_min - ds\_max))
00579               \textcolor{keywordflow}{else}
00580                 sbdry(i,j) = sbdry\_it
00581 \textcolor{keywordflow}{              endif} \textcolor{comment}{! Sb\_min\_set}
00582 
00583               sbdry(i,j) = sbdry\_it
00584 \textcolor{keywordflow}{            endif} \textcolor{comment}{! CS%find\_salt\_root}
00585 
00586 \textcolor{keywordflow}{          enddo} \textcolor{comment}{!it1}
00587           \textcolor{comment}{! Check for non-convergence and/or non-boundedness?}
00588 
00589         \textcolor{keywordflow}{else}
00590           \textcolor{comment}{!   In the 2-equation form, the mixed layer turbulent exchange velocity}
00591           \textcolor{comment}{! is specified and large enough that the ocean salinity at the interface}
00592           \textcolor{comment}{! is about the same as the boundary layer salinity.}
00593 
00594           \textcolor{keyword}{call }\hyperlink{interfacemom__eos_1_1calculate__tfreeze}{calculate\_tfreeze}(sfc\_state%sss(i,j), p\_int(i), iss%tfreeze(i,j), cs
      %eqn\_of\_state, &
00595                                  pres\_scale=us%RL2\_T2\_to\_Pa)
00596 
00597           exch\_vel\_t(i,j) = cs%gamma\_t
00598           iss%tflux\_ocn(i,j) = rhocp * exch\_vel\_t(i,j) * (iss%tfreeze(i,j) - sfc\_state%sst(i,j))
00599           iss%tflux\_shelf(i,j) = 0.0
00600           iss%water\_flux(i,j) = -i\_lf * iss%tflux\_ocn(i,j)
00601           sbdry(i,j) = 0.0
00602 \textcolor{keywordflow}{        endif}
00603       \textcolor{keywordflow}{elseif} (iss%area\_shelf\_h(i,j) > 0.0) \textcolor{keywordflow}{then} \textcolor{comment}{! This is an ice-sheet, not a floating shelf.}
00604         iss%tflux\_ocn(i,j) = 0.0
00605       \textcolor{keywordflow}{else} \textcolor{comment}{! There is no ice shelf or sheet here.}
00606         iss%tflux\_ocn(i,j) = 0.0
00607 \textcolor{keywordflow}{      endif}
00608 
00609 \textcolor{comment}{!      haline\_driving(i,j) = sfc\_state%sss(i,j) - Sbdry(i,j)}
00610 
00611 \textcolor{keywordflow}{    enddo} \textcolor{comment}{! i-loop}
00612 \textcolor{keywordflow}{  enddo} \textcolor{comment}{! j-loop}
00613 
00614 
00615   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
00616     \textcolor{comment}{! ISS%water\_flux = net liquid water into the ocean [R Z T-1 ~> kg m-2 s-1]}
00617     fluxes%iceshelf\_melt(i,j) = iss%water\_flux(i,j) * cs%flux\_factor
00618 
00619     \textcolor{keywordflow}{if} ((sfc\_state%ocean\_mass(i,j) > cs%col\_mass\_melt\_threshold) .and. &
00620         (iss%area\_shelf\_h(i,j) > 0.0) .and.  (cs%isthermo)) \textcolor{keywordflow}{then}
00621 
00622       \textcolor{comment}{! Set melt to zero above a cutoff pressure (CS%Rho\_ocn*CS%cutoff\_depth*CS%g\_Earth).}
00623       \textcolor{comment}{! This is needed for the ISOMIP test case.}
00624       \textcolor{keywordflow}{if} (iss%mass\_shelf(i,j) < cs%Rho\_ocn*cs%cutoff\_depth) \textcolor{keywordflow}{then}
00625         iss%water\_flux(i,j) = 0.0
00626         fluxes%iceshelf\_melt(i,j) = 0.0
00627 \textcolor{keywordflow}{      endif}
00628       \textcolor{comment}{! Compute haline driving, which is one of the diags. used in ISOMIP}
00629       haline\_driving(i,j) = (iss%water\_flux(i,j) * sbdry(i,j)) / (cs%Rho\_ocn * exch\_vel\_s(i,j))
00630 
00631       \textcolor{comment}{!!!!!!!!!!!!!!!!!!!!!!!!!!!!Safety checks !!!!!!!!!!!!!!!!!!!!!!!!!}
00632       \textcolor{comment}{!1)Check if haline\_driving computed above is consistent with}
00633       \textcolor{comment}{! haline\_driving = sfc\_state%sss - Sbdry}
00634       \textcolor{comment}{!if (fluxes%iceshelf\_melt(i,j) /= 0.0) then}
00635       \textcolor{comment}{!   if (haline\_driving(i,j) /= (sfc\_state%sss(i,j) - Sbdry(i,j))) then}
00636       \textcolor{comment}{!     write(mesg,*) 'at i,j=',i,j,' haline\_driving, sss-Sbdry',haline\_driving(i,j), &}
00637       \textcolor{comment}{!                   (sfc\_state%sss(i,j) - Sbdry(i,j))}
00638       \textcolor{comment}{!     call MOM\_error(FATAL, &}
00639       \textcolor{comment}{!            "shelf\_calc\_flux: Inconsistency in melt and haline\_driving"//trim(mesg))}
00640       \textcolor{comment}{!   endif}
00641       \textcolor{comment}{!endif}
00642 
00643       \textcolor{comment}{! 2) check if |melt| > 0 when ustar\_shelf = 0.}
00644       \textcolor{comment}{! this should never happen}
00645       \textcolor{keywordflow}{if} ((abs(fluxes%iceshelf\_melt(i,j))>0.0) .and. (fluxes%ustar\_shelf(i,j) == 0.0)) \textcolor{keywordflow}{then}
00646         \textcolor{keyword}{write}(mesg,*) \textcolor{stringliteral}{"|melt| = "},fluxes%iceshelf\_melt(i,j),\textcolor{stringliteral}{" > 0 and ustar\_shelf = 0. at i,j"}, i, j
00647         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"shelf\_calc\_flux: "}//trim(mesg))
00648 \textcolor{keywordflow}{      endif}
00649        \textcolor{comment}{!!!!!!!!!!!!!!!!!!!!!!!!!!!!End of safety checks !!!!!!!!!!!!!!!!!!!}
00650     \textcolor{keywordflow}{elseif} (iss%area\_shelf\_h(i,j) > 0.0) \textcolor{keywordflow}{then}
00651       \textcolor{comment}{! This is grounded ice, that could be modified to melt if a geothermal heat flux were used.}
00652       haline\_driving(i,j) = 0.0
00653       iss%water\_flux(i,j) = 0.0
00654       fluxes%iceshelf\_melt(i,j) = 0.0
00655 \textcolor{keywordflow}{    endif} \textcolor{comment}{! area\_shelf\_h}
00656 
00657     \textcolor{comment}{! mass flux [R Z L2 T-1 ~> kg s-1], part of ISOMIP diags.}
00658     mass\_flux(i,j) = iss%water\_flux(i,j) * iss%area\_shelf\_h(i,j)
00659 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} \textcolor{comment}{! i- and j-loops}
00660 
00661   \textcolor{keywordflow}{if} (cs%active\_shelf\_dynamics .or. cs%override\_shelf\_movement) \textcolor{keywordflow}{then}
00662     \textcolor{keyword}{call }cpu\_clock\_begin(\hyperlink{namespacemom__ice__shelf_a3db8709f10aa77ed302598f3a23a608d}{id\_clock\_pass})
00663     \textcolor{keyword}{call }pass\_var(iss%area\_shelf\_h, g%domain, complete=.false.)
00664     \textcolor{keyword}{call }pass\_var(iss%mass\_shelf, g%domain)
00665     \textcolor{keyword}{call }cpu\_clock\_end(\hyperlink{namespacemom__ice__shelf_a3db8709f10aa77ed302598f3a23a608d}{id\_clock\_pass})
00666 \textcolor{keywordflow}{  endif}
00667 
00668   \textcolor{comment}{! Melting has been computed, now is time to update thickness and mass}
00669   \textcolor{keywordflow}{if} ( cs%override\_shelf\_movement .and. (.not.cs%mass\_from\_file)) \textcolor{keywordflow}{then}
00670     \textcolor{keyword}{call }\hyperlink{namespacemom__ice__shelf_a787fc1ef4951b3bb4a7d654efb147fc4}{change\_thickness\_using\_melt}(iss, g, us, us%s\_to\_T*time\_step, fluxes, cs
      %density\_ice, cs%debug)
00671 
00672     \textcolor{keywordflow}{if} (cs%debug) \textcolor{keywordflow}{then}
00673       \textcolor{keyword}{call }hchksum(iss%h\_shelf, \textcolor{stringliteral}{"h\_shelf after change thickness using melt"}, g%HI, haloshift=0, scale=us
      %Z\_to\_m)
00674       \textcolor{keyword}{call }hchksum(iss%mass\_shelf, \textcolor{stringliteral}{"mass\_shelf after change thickness using melt"}, g%HI, haloshift=0, &
00675                    scale=us%RZ\_to\_kg\_m2)
00676 \textcolor{keywordflow}{    endif}
00677 \textcolor{keywordflow}{  endif}
00678 
00679   \textcolor{keywordflow}{if} (cs%debug) \textcolor{keyword}{call }mom\_forcing\_chksum(\textcolor{stringliteral}{"Before add shelf flux"}, fluxes, g, cs%US, haloshift=0)
00680 
00681   \textcolor{keyword}{call }\hyperlink{namespacemom__ice__shelf_a8f7eae8642835e30aff99f77f3836945}{add\_shelf\_flux}(g, us, cs, sfc\_state, fluxes)
00682 
00683   \textcolor{comment}{! now the thermodynamic data is passed on... time to update the ice dynamic quantities}
00684 
00685   \textcolor{keywordflow}{if} (cs%active\_shelf\_dynamics) \textcolor{keywordflow}{then}
00686     update\_ice\_vel = .false.
00687     coupled\_gl = (cs%GL\_couple .and. .not.cs%solo\_ice\_sheet)
00688 
00689     \textcolor{comment}{! advect the ice shelf, and advance the front. Calving will be in here somewhere as well..}
00690     \textcolor{comment}{! when we decide on how to do it}
00691     \textcolor{keyword}{call }update\_ice\_shelf(cs%dCS, iss, g, us, us%s\_to\_T*time\_step, time, &
00692                           sfc\_state%ocean\_mass, coupled\_gl)
00693 
00694 \textcolor{keywordflow}{  endif}
00695 
00696   \textcolor{keyword}{call }enable\_averaging(time\_step,time,cs%diag)
00697   \textcolor{keywordflow}{if} (cs%id\_shelf\_mass > 0) \textcolor{keyword}{call }post\_data(cs%id\_shelf\_mass, iss%mass\_shelf, cs%diag)
00698   \textcolor{keywordflow}{if} (cs%id\_area\_shelf\_h > 0) \textcolor{keyword}{call }post\_data(cs%id\_area\_shelf\_h, iss%area\_shelf\_h, cs%diag)
00699   \textcolor{keywordflow}{if} (cs%id\_ustar\_shelf > 0) \textcolor{keyword}{call }post\_data(cs%id\_ustar\_shelf, fluxes%ustar\_shelf, cs%diag)
00700   \textcolor{keywordflow}{if} (cs%id\_melt > 0) \textcolor{keyword}{call }post\_data(cs%id\_melt, fluxes%iceshelf\_melt, cs%diag)
00701   \textcolor{keywordflow}{if} (cs%id\_thermal\_driving > 0) \textcolor{keyword}{call }post\_data(cs%id\_thermal\_driving, (sfc\_state%sst-iss%tfreeze), cs%diag
      )
00702   \textcolor{keywordflow}{if} (cs%id\_Sbdry > 0) \textcolor{keyword}{call }post\_data(cs%id\_Sbdry, sbdry, cs%diag)
00703   \textcolor{keywordflow}{if} (cs%id\_haline\_driving > 0) \textcolor{keyword}{call }post\_data(cs%id\_haline\_driving, haline\_driving, cs%diag)
00704   \textcolor{keywordflow}{if} (cs%id\_mass\_flux > 0) \textcolor{keyword}{call }post\_data(cs%id\_mass\_flux, mass\_flux, cs%diag)
00705   \textcolor{keywordflow}{if} (cs%id\_u\_ml > 0) \textcolor{keyword}{call }post\_data(cs%id\_u\_ml, sfc\_state%u, cs%diag)
00706   \textcolor{keywordflow}{if} (cs%id\_v\_ml > 0) \textcolor{keyword}{call }post\_data(cs%id\_v\_ml, sfc\_state%v, cs%diag)
00707   \textcolor{keywordflow}{if} (cs%id\_tfreeze > 0) \textcolor{keyword}{call }post\_data(cs%id\_tfreeze, iss%tfreeze, cs%diag)
00708   \textcolor{keywordflow}{if} (cs%id\_tfl\_shelf > 0) \textcolor{keyword}{call }post\_data(cs%id\_tfl\_shelf, iss%tflux\_shelf, cs%diag)
00709   \textcolor{keywordflow}{if} (cs%id\_exch\_vel\_t > 0) \textcolor{keyword}{call }post\_data(cs%id\_exch\_vel\_t, exch\_vel\_t, cs%diag)
00710   \textcolor{keywordflow}{if} (cs%id\_exch\_vel\_s > 0) \textcolor{keyword}{call }post\_data(cs%id\_exch\_vel\_s, exch\_vel\_s, cs%diag)
00711   \textcolor{keywordflow}{if} (cs%id\_h\_shelf > 0) \textcolor{keyword}{call }post\_data(cs%id\_h\_shelf, iss%h\_shelf, cs%diag)
00712   \textcolor{keywordflow}{if} (cs%id\_h\_mask > 0) \textcolor{keyword}{call }post\_data(cs%id\_h\_mask,iss%hmask,cs%diag)
00713   \textcolor{keyword}{call }disable\_averaging(cs%diag)
00714 
00715   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(forces)) \textcolor{keywordflow}{then}
00716     \textcolor{keyword}{call }\hyperlink{namespacemom__ice__shelf_a0274b25df07d5fa712d038c31f921cbc}{add\_shelf\_forces}(g, us, cs, forces, do\_shelf\_area=(cs%active\_shelf\_dynamics .or. &
00717                                                         cs%override\_shelf\_movement))
00718 \textcolor{keywordflow}{  endif}
00719 
00720   \textcolor{keyword}{call }cpu\_clock\_end(\hyperlink{namespacemom__ice__shelf_a5aff3e9a37cb5bc2b5b998bf296437ff}{id\_clock\_shelf})
00721 
00722   \textcolor{keywordflow}{if} (cs%debug) \textcolor{keyword}{call }mom\_forcing\_chksum(\textcolor{stringliteral}{"End of shelf calc flux"}, fluxes, g, cs%US, haloshift=0)
00723 
00724 \textcolor{keyword}{end subroutine }\hyperlink{namespacemom__ice__shelf_a21a2a3ddec5ea25c7bca246419e4dcfe}{shelf\_calc\_flux}
00725 \textcolor{comment}{}
00726 \textcolor{comment}{!> Changes the thickness (mass) of the ice shelf based on sub-ice-shelf melting}
00727 \textcolor{keyword}{subroutine }\hyperlink{namespacemom__ice__shelf_a787fc1ef4951b3bb4a7d654efb147fc4}{change\_thickness\_using\_melt}(ISS, G, US, time\_step, fluxes,
       density\_ice, debug)
\Hypertarget{MOM__ice__shelf_8F90_source_l00728}\hyperlink{namespacemom__ice__shelf_a787fc1ef4951b3bb4a7d654efb147fc4}{00728}   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{  !< The ocean's grid structure.}
00729   \textcolor{keywordtype}{type}(ice\_shelf\_state), \textcolor{keywordtype}{intent(inout)} :: ISS\textcolor{comment}{ !< A structure with elements that describe}
00730 \textcolor{comment}{                                              !! the ice-shelf state}
00731   \textcolor{keywordtype}{type}(\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\_scale\_type}), \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{   !< A dimensional unit scaling type}
00732   \textcolor{keywordtype}{real},                  \textcolor{keywordtype}{intent(in)}    :: time\_step\textcolor{comment}{ !< The time step for this update [T ~> s].}
00733   \textcolor{keywordtype}{type}(forcing),         \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< structure containing pointers to any possible}
00734 \textcolor{comment}{                                                 !! thermodynamic or mass-flux forcing fields.}
00735   \textcolor{keywordtype}{real},                  \textcolor{keywordtype}{intent(in)}    :: density\_ice\textcolor{comment}{ !< The density of ice-shelf ice [R ~> kg m-3].}
00736   \textcolor{keywordtype}{logical},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: debug\textcolor{comment}{ !< If present and true, write chksums}
00737 
00738   \textcolor{comment}{! locals}
00739   \textcolor{keywordtype}{real} :: I\_rho\_ice \textcolor{comment}{! Ice specific volume [R-1 ~> m3 kg-1]}
00740   \textcolor{keywordtype}{integer} :: i, j
00741 
00742   i\_rho\_ice = 1.0 / density\_ice
00743 
00744 
00745   \textcolor{keywordflow}{do} j=g%jsc,g%jec ; \textcolor{keywordflow}{do} i=g%isc,g%iec
00746     \textcolor{keywordflow}{if} ((iss%hmask(i,j) == 1) .or. (iss%hmask(i,j) == 2)) \textcolor{keywordflow}{then}
00747       \textcolor{comment}{! first, zero out fluxes applied during previous time step}
00748       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%lprec)) fluxes%lprec(i,j) = 0.0
00749       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%sens)) fluxes%sens(i,j) = 0.0
00750       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%frac\_shelf\_h)) fluxes%frac\_shelf\_h(i,j) = 0.0
00751       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%salt\_flux)) fluxes%salt\_flux(i,j) = 0.0
00752 
00753       \textcolor{keywordflow}{if} (iss%water\_flux(i,j) * time\_step / density\_ice < iss%h\_shelf(i,j)) \textcolor{keywordflow}{then}
00754         iss%h\_shelf(i,j) = iss%h\_shelf(i,j) - iss%water\_flux(i,j) * time\_step / density\_ice
00755       \textcolor{keywordflow}{else}
00756         \textcolor{comment}{! the ice is about to melt away, so set thickness, area, and mask to zero}
00757         \textcolor{comment}{! NOTE: this is not mass conservative should maybe scale salt & heat flux for this cell}
00758         iss%h\_shelf(i,j) = 0.0
00759         iss%hmask(i,j) = 0.0
00760         iss%area\_shelf\_h(i,j) = 0.0
00761 \textcolor{keywordflow}{      endif}
00762       iss%mass\_shelf(i,j) = iss%h\_shelf(i,j) * density\_ice
00763 \textcolor{keywordflow}{    endif}
00764 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
00765 
00766   \textcolor{keyword}{call }pass\_var(iss%area\_shelf\_h, g%domain)
00767   \textcolor{keyword}{call }pass\_var(iss%h\_shelf, g%domain)
00768   \textcolor{keyword}{call }pass\_var(iss%hmask, g%domain)
00769   \textcolor{keyword}{call }pass\_var(iss%mass\_shelf, g%domain)
00770 
00771 \textcolor{keyword}{end subroutine }\hyperlink{namespacemom__ice__shelf_a787fc1ef4951b3bb4a7d654efb147fc4}{change\_thickness\_using\_melt}
00772 \textcolor{comment}{}
00773 \textcolor{comment}{!> This subroutine adds the mechanical forcing fields and perhaps shelf areas, based on}
00774 \textcolor{comment}{!! the ice state in ice\_shelf\_CS.}
00775 \textcolor{keyword}{subroutine }\hyperlink{namespacemom__ice__shelf_a0274b25df07d5fa712d038c31f921cbc}{add\_shelf\_forces}(G, US, CS, forces, do\_shelf\_area)
\Hypertarget{MOM__ice__shelf_8F90_source_l00776}\hyperlink{namespacemom__ice__shelf_a0274b25df07d5fa712d038c31f921cbc}{00776}   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{    !< The ocean's grid structure.}
00777   \textcolor{keywordtype}{type}(\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\_scale\_type}), \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{   !< A dimensional unit scaling type}
00778   \textcolor{keywordtype}{type}(\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs}),    \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{   !< This module's control structure.}
00779   \textcolor{keywordtype}{type}(mech\_forcing),    \textcolor{keywordtype}{intent(inout)} :: forces\textcolor{comment}{ !< A structure with the driving mechanical forces}
00780   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)}    :: do\_shelf\_area\textcolor{comment}{ !< If true find the shelf-covered areas.}
00781 
00782   \textcolor{keywordtype}{real} :: kv\_rho\_ice \textcolor{comment}{! The viscosity of ice divided by its density [L4 T-1 R-1 Z-2 ~> m5 kg-1 s-1].}
00783   \textcolor{keywordtype}{real} :: press\_ice  \textcolor{comment}{! The pressure of the ice shelf per unit area of ocean (not ice) [R L2 T-2 ~> Pa].}
00784   \textcolor{keywordtype}{logical} :: find\_area \textcolor{comment}{! If true find the shelf areas at u & v points.}
00785   \textcolor{keywordtype}{type}(ice\_shelf\_state), \textcolor{keywordtype}{pointer} :: ISS => null() \textcolor{comment}{! A structure with elements that describe}
00786                                           \textcolor{comment}{! the ice-shelf state}
00787 
00788   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, isd, ied, jsd, jed
00789   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
00790   isd = g%isd ; jsd = g%jsd ; ied = g%ied ; jed = g%jed
00791 
00792   \textcolor{keywordflow}{if} ((cs%grid%isc /= g%isc) .or. (cs%grid%iec /= g%iec) .or. &
00793       (cs%grid%jsc /= g%jsc) .or. (cs%grid%jec /= g%jec)) &
00794     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"add\_shelf\_forces: Incompatible ocean and ice shelf grids."})
00795 
00796   iss => cs%ISS
00797 
00798   find\_area = .true. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(do\_shelf\_area)) find\_area = do\_shelf\_area
00799 
00800   \textcolor{keywordflow}{if} (find\_area) \textcolor{keywordflow}{then}
00801     \textcolor{comment}{! The frac\_shelf is set over the widest possible area. Could it be smaller?}
00802     \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isd,ied-1
00803       forces%frac\_shelf\_u(i,j) = 0.0
00804       \textcolor{keywordflow}{if} ((g%areaT(i,j) + g%areaT(i+1,j) > 0.0)) & \textcolor{comment}{! .and. (G%areaCu(I,j) > 0.0)) &}
00805         forces%frac\_shelf\_u(i,j) = (iss%area\_shelf\_h(i,j) + iss%area\_shelf\_h(i+1,j)) / &
00806                                    (g%areaT(i,j) + g%areaT(i+1,j))
00807 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
00808     \textcolor{keywordflow}{do} j=jsd,jed-1 ; \textcolor{keywordflow}{do} i=isd,ied
00809       forces%frac\_shelf\_v(i,j) = 0.0
00810       \textcolor{keywordflow}{if} ((g%areaT(i,j) + g%areaT(i,j+1) > 0.0)) & \textcolor{comment}{! .and. (G%areaCv(i,J) > 0.0)) &}
00811         forces%frac\_shelf\_v(i,j) = (iss%area\_shelf\_h(i,j) + iss%area\_shelf\_h(i,j+1)) / &
00812                                    (g%areaT(i,j) + g%areaT(i,j+1))
00813 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
00814     \textcolor{keyword}{call }pass\_vector(forces%frac\_shelf\_u, forces%frac\_shelf\_v, g%domain, to\_all, cgrid\_ne)
00815 \textcolor{keywordflow}{  endif}
00816 
00817   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
00818     press\_ice = (iss%area\_shelf\_h(i,j) * g%IareaT(i,j)) * (cs%g\_Earth * iss%mass\_shelf(i,j))
00819     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces%p\_surf)) \textcolor{keywordflow}{then}
00820       \textcolor{keywordflow}{if} (.not.forces%accumulate\_p\_surf) forces%p\_surf(i,j) = 0.0
00821       forces%p\_surf(i,j) = forces%p\_surf(i,j) + press\_ice
00822 \textcolor{keywordflow}{    endif}
00823     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces%p\_surf\_full)) \textcolor{keywordflow}{then}
00824       \textcolor{keywordflow}{if} (.not.forces%accumulate\_p\_surf) forces%p\_surf\_full(i,j) = 0.0
00825       forces%p\_surf\_full(i,j) = forces%p\_surf\_full(i,j) + press\_ice
00826 \textcolor{keywordflow}{    endif}
00827 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
00828 
00829   \textcolor{comment}{! For various reasons, forces%rigidity\_ice\_[uv] is always updated here. Note}
00830   \textcolor{comment}{! that it may have been zeroed out where IOB is translated to forces and}
00831   \textcolor{comment}{! contributions from icebergs and the sea-ice pack added subsequently.}
00832   \textcolor{comment}{!### THE RIGIDITY SHOULD ALSO INCORPORATE AREAL-COVERAGE INFORMATION.}
00833   kv\_rho\_ice = cs%kv\_ice / cs%density\_ice
00834   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is-1,ie
00835     \textcolor{keywordflow}{if} (.not.forces%accumulate\_rigidity) forces%rigidity\_ice\_u(i,j) = 0.0
00836     forces%rigidity\_ice\_u(i,j) = forces%rigidity\_ice\_u(i,j) + &
00837             kv\_rho\_ice * min(iss%mass\_shelf(i,j), iss%mass\_shelf(i+1,j))
00838 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
00839   \textcolor{keywordflow}{do} j=js-1,je ; \textcolor{keywordflow}{do} i=is,ie
00840     \textcolor{keywordflow}{if} (.not.forces%accumulate\_rigidity) forces%rigidity\_ice\_v(i,j) = 0.0
00841     forces%rigidity\_ice\_v(i,j) = forces%rigidity\_ice\_v(i,j) + &
00842             kv\_rho\_ice * min(iss%mass\_shelf(i,j), iss%mass\_shelf(i,j+1))
00843 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
00844 
00845   \textcolor{keywordflow}{if} (cs%debug) \textcolor{keywordflow}{then}
00846     \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"rigidity\_ice\_[uv]"}, forces%rigidity\_ice\_u, forces%rigidity\_ice\_v, &
00847                   g%HI, symmetric=.true., scale=us%L\_to\_m**3*us%L\_to\_Z*us%s\_to\_T)
00848     \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"frac\_shelf\_[uv]"}, forces%frac\_shelf\_u, forces%frac\_shelf\_v, &
00849                   g%HI, symmetric=.true.)
00850 \textcolor{keywordflow}{  endif}
00851 
00852 \textcolor{keyword}{end subroutine }\hyperlink{namespacemom__ice__shelf_a0274b25df07d5fa712d038c31f921cbc}{add\_shelf\_forces}
00853 \textcolor{comment}{}
00854 \textcolor{comment}{!> This subroutine adds the ice shelf pressure to the fluxes type.}
00855 \textcolor{keyword}{subroutine }\hyperlink{namespacemom__ice__shelf_aca1d1c1db015f270ce1b1f93d16dea91}{add\_shelf\_pressure}(G, US, CS, fluxes)
\Hypertarget{MOM__ice__shelf_8F90_source_l00856}\hyperlink{namespacemom__ice__shelf_aca1d1c1db015f270ce1b1f93d16dea91}{00856}   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{    !< The ocean's grid structure.}
00857   \textcolor{keywordtype}{type}(\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\_scale\_type}), \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{   !< A dimensional unit scaling type}
00858   \textcolor{keywordtype}{type}(\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs}),    \textcolor{keywordtype}{intent(in)}    :: CS\textcolor{comment}{   !< This module's control structure.}
00859   \textcolor{keywordtype}{type}(forcing),         \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{  !< A structure of surface fluxes that may be updated.}
00860 
00861   \textcolor{keywordtype}{real} :: press\_ice\textcolor{comment}{       !< The pressure of the ice shelf per unit area of ocean (not ice) [R L2 T-2 ~>
       Pa].}
00862   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, isd, ied, jsd, jed
00863   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
00864 
00865   \textcolor{keywordflow}{if} ((cs%grid%isc /= g%isc) .or. (cs%grid%iec /= g%iec) .or. &
00866       (cs%grid%jsc /= g%jsc) .or. (cs%grid%jec /= g%jec)) &
00867     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"add\_shelf\_pressure: Incompatible ocean and ice shelf grids."})
00868 
00869   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
00870     press\_ice = (cs%ISS%area\_shelf\_h(i,j) * g%IareaT(i,j)) * (cs%g\_Earth * cs%ISS%mass\_shelf(i,j))
00871     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%p\_surf)) \textcolor{keywordflow}{then}
00872       \textcolor{keywordflow}{if} (.not.fluxes%accumulate\_p\_surf) fluxes%p\_surf(i,j) = 0.0
00873       fluxes%p\_surf(i,j) = fluxes%p\_surf(i,j) + press\_ice
00874 \textcolor{keywordflow}{    endif}
00875     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%p\_surf\_full)) \textcolor{keywordflow}{then}
00876       \textcolor{keywordflow}{if} (.not.fluxes%accumulate\_p\_surf) fluxes%p\_surf\_full(i,j) = 0.0
00877       fluxes%p\_surf\_full(i,j) = fluxes%p\_surf\_full(i,j) + press\_ice
00878 \textcolor{keywordflow}{    endif}
00879 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
00880 
00881 \textcolor{keyword}{end subroutine }\hyperlink{namespacemom__ice__shelf_aca1d1c1db015f270ce1b1f93d16dea91}{add\_shelf\_pressure}
00882 \textcolor{comment}{}
00883 \textcolor{comment}{!> Updates surface fluxes that are influenced by sub-ice-shelf melting}
00884 \textcolor{keyword}{subroutine }\hyperlink{namespacemom__ice__shelf_a8f7eae8642835e30aff99f77f3836945}{add\_shelf\_flux}(G, US, CS, sfc\_state, fluxes)
\Hypertarget{MOM__ice__shelf_8F90_source_l00885}\hyperlink{namespacemom__ice__shelf_a8f7eae8642835e30aff99f77f3836945}{00885}   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{    !< The ocean's grid structure.}
00886   \textcolor{keywordtype}{type}(\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\_scale\_type}), \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{   !< A dimensional unit scaling type}
00887   \textcolor{keywordtype}{type}(\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs}),    \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{   !< This module's control structure.}
00888   \textcolor{keywordtype}{type}(surface),         \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< Surface ocean state}
00889   \textcolor{keywordtype}{type}(forcing),         \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{  !< A structure of surface fluxes that may be
       used/updated.}
00890 
00891   \textcolor{comment}{! local variables}
00892   \textcolor{keywordtype}{real} :: frac\_shelf\textcolor{comment}{       !< The fractional area covered by the ice shelf [nondim].}
00893   \textcolor{keywordtype}{real} :: frac\_open\textcolor{comment}{        !< The fractional area of the ocean that is not covered by the ice shelf
       [nondim].}
00894   \textcolor{keywordtype}{real} :: delta\_mass\_shelf\textcolor{comment}{ !< Change in ice shelf mass over one time step [R Z m2 T-1 ~> kg s-1]}
00895   \textcolor{keywordtype}{real} :: balancing\_flux\textcolor{comment}{   !< The fresh water flux that balances the integrated melt flux [R Z T-1 ~> kg
       m-2 s-1]}
00896   \textcolor{keywordtype}{real} :: balancing\_area\textcolor{comment}{   !< total area where the balancing flux is applied [m2]}
00897   \textcolor{keywordtype}{type}(time\_type) :: dTime\textcolor{comment}{ !< The time step as a time\_type}
00898   \textcolor{keywordtype}{type}(time\_type) :: Time0\textcolor{comment}{ !< The previous time (Time-dt)}
00899   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZDI\_(G),SZDJ\_(G))} :: bal\_frac\textcolor{comment}{  !< Fraction of the cel1 where the mass flux}
00900 \textcolor{comment}{                          !! balancing the net melt flux occurs, 0 to 1 [nondim]}
00901   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZDI\_(G),SZDJ\_(G))} :: last\_mass\_shelf\textcolor{comment}{ !< Ice shelf mass}
00902 \textcolor{comment}{                          !! at at previous time (Time-dt) [R Z ~> kg m-2]}
00903   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZDI\_(G),SZDJ\_(G))} :: delta\_float\_mass\textcolor{comment}{   !< The change in the floating mass between}
00904 \textcolor{comment}{                          !! the two timesteps at (Time) and (Time-dt) [R Z ~> kg m-2].}
00905   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZDI\_(G),SZDJ\_(G))}  :: last\_h\_shelf\textcolor{comment}{ !< Ice shelf thickness [Z ~> m]}
00906 \textcolor{comment}{                          !! at at previous time (Time-dt)}
00907   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZDI\_(G),SZDJ\_(G))}  :: last\_hmask\textcolor{comment}{ !< Ice shelf mask [nondim]}
00908 \textcolor{comment}{                          !! at at previous time (Time-dt)}
00909   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZDI\_(G),SZDJ\_(G))}  :: last\_area\_shelf\_h\textcolor{comment}{ !< Ice shelf area [L2 ~> m2]}
00910 \textcolor{comment}{                          !! at at previous time (Time-dt)}
00911   \textcolor{keywordtype}{type}(ice\_shelf\_state), \textcolor{keywordtype}{pointer} :: ISS => null() \textcolor{comment}{!< A structure with elements that describe}
00912 \textcolor{comment}{                                          !! the ice-shelf state}
00913 
00914   \textcolor{keywordtype}{character(len=160)} :: mesg  \textcolor{comment}{! The text of an error message}
00915   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, isd, ied, jsd, jed
00916   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
00917   isd = g%isd ; jsd = g%jsd ; ied = g%ied ; jed = g%jed
00918 
00919   \textcolor{keywordflow}{if} ((cs%grid%isc /= g%isc) .or. (cs%grid%iec /= g%iec) .or. &
00920       (cs%grid%jsc /= g%jsc) .or. (cs%grid%jec /= g%jec)) &
00921     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"add\_shelf\_flux: Incompatible ocean and ice shelf grids."})
00922 
00923   iss => cs%ISS
00924 
00925 
00926   \textcolor{keyword}{call }\hyperlink{namespacemom__ice__shelf_aca1d1c1db015f270ce1b1f93d16dea91}{add\_shelf\_pressure}(g, us, cs, fluxes)
00927 
00928   \textcolor{comment}{! Determine ustar and the square magnitude of the velocity in the}
00929   \textcolor{comment}{! bottom boundary layer. Together these give the TKE source and}
00930   \textcolor{comment}{! vertical decay scale.}
00931 
00932   \textcolor{keywordflow}{if} (cs%debug) \textcolor{keywordflow}{then}
00933     \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%taux\_shelf) .and. \textcolor{keyword}{allocated}(sfc\_state%tauy\_shelf)) \textcolor{keywordflow}{then}
00934       \textcolor{keyword}{call }uvchksum(\textcolor{stringliteral}{"tau[xy]\_shelf"}, sfc\_state%taux\_shelf, sfc\_state%tauy\_shelf, &
00935                     g%HI, haloshift=0, scale=us%RZ\_T\_to\_kg\_m2s*us%L\_T\_to\_m\_s)
00936 \textcolor{keywordflow}{    endif}
00937 \textcolor{keywordflow}{  endif}
00938 
00939   \textcolor{keywordflow}{if} (cs%active\_shelf\_dynamics .or. cs%override\_shelf\_movement) \textcolor{keywordflow}{then}
00940     \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isd,ied
00941       \textcolor{keywordflow}{if} (g%areaT(i,j) > 0.0) &
00942         fluxes%frac\_shelf\_h(i,j) = min(1.0, iss%area\_shelf\_h(i,j) * g%IareaT(i,j))
00943 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
00944 \textcolor{keywordflow}{  endif}
00945 
00946   \textcolor{keywordflow}{if} (cs%debug) \textcolor{keywordflow}{then}
00947     \textcolor{keyword}{call }mom\_forcing\_chksum(\textcolor{stringliteral}{"Before adding shelf fluxes"}, fluxes, g, cs%US, haloshift=0)
00948 \textcolor{keywordflow}{  endif}
00949 
00950   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie ; \textcolor{keywordflow}{if} (iss%area\_shelf\_h(i,j) > 0.0) \textcolor{keywordflow}{then}
00951     \textcolor{comment}{! Replace fluxes intercepted by the ice shelf with fluxes from the ice shelf}
00952     frac\_shelf = min(1.0, iss%area\_shelf\_h(i,j) * g%IareaT(i,j))
00953     frac\_open = max(0.0, 1.0 - frac\_shelf)
00954 
00955     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%sw)) fluxes%sw(i,j) = frac\_open * fluxes%sw(i,j)
00956     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%sw\_vis\_dir)) fluxes%sw\_vis\_dir(i,j) = frac\_open * fluxes%sw\_vis\_dir(i,j)
00957     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%sw\_vis\_dif)) fluxes%sw\_vis\_dif(i,j) = frac\_open * fluxes%sw\_vis\_dif(i,j)
00958     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%sw\_nir\_dir)) fluxes%sw\_nir\_dir(i,j) = frac\_open * fluxes%sw\_nir\_dir(i,j)
00959     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%sw\_nir\_dif)) fluxes%sw\_nir\_dif(i,j) = frac\_open * fluxes%sw\_nir\_dif(i,j)
00960     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%lw)) fluxes%lw(i,j) = frac\_open * fluxes%lw(i,j)
00961     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%latent)) fluxes%latent(i,j) = frac\_open * fluxes%latent(i,j)
00962     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%evap)) fluxes%evap(i,j) = frac\_open * fluxes%evap(i,j)
00963     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%lprec)) \textcolor{keywordflow}{then}
00964       \textcolor{keywordflow}{if} (iss%water\_flux(i,j) > 0.0) \textcolor{keywordflow}{then}
00965         fluxes%lprec(i,j) =  frac\_shelf*iss%water\_flux(i,j)*cs%flux\_factor + frac\_open * fluxes%lprec(i,j)
00966       \textcolor{keywordflow}{else}
00967         fluxes%lprec(i,j) = frac\_open * fluxes%lprec(i,j)
00968         fluxes%evap(i,j) = fluxes%evap(i,j) + frac\_shelf*iss%water\_flux(i,j)*cs%flux\_factor
00969 \textcolor{keywordflow}{      endif}
00970 \textcolor{keywordflow}{    endif}
00971 
00972     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%sens)) &
00973       fluxes%sens(i,j) = frac\_shelf*iss%tflux\_ocn(i,j)*cs%flux\_factor + frac\_open * fluxes%sens(i,j)
00974     \textcolor{comment}{! The salt flux should be mostly from sea ice, so perhaps none should be intercepted and this should be
       changed.}
00975     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes%salt\_flux)) &
00976       fluxes%salt\_flux(i,j) = frac\_shelf * iss%salt\_flux(i,j)*cs%flux\_factor + frac\_open * fluxes%salt\_flux
      (i,j)
00977 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
00978 
00979   \textcolor{keywordflow}{if} (cs%debug) \textcolor{keywordflow}{then}
00980     \textcolor{keyword}{call }hchksum(iss%water\_flux, \textcolor{stringliteral}{"water\_flux add shelf fluxes"}, g%HI, haloshift=0, scale=us%RZ\_T\_to\_kg\_m2s)
00981     \textcolor{keyword}{call }hchksum(iss%tflux\_ocn, \textcolor{stringliteral}{"tflux\_ocn add shelf fluxes"}, g%HI, haloshift=0, scale=us%QRZ\_T\_to\_W\_m2)
00982     \textcolor{keyword}{call }mom\_forcing\_chksum(\textcolor{stringliteral}{"After adding shelf fluxes"}, fluxes, g, cs%US, haloshift=0)
00983 \textcolor{keywordflow}{  endif}
00984 
00985   \textcolor{comment}{! Keep sea level constant by removing mass via a balancing flux that might be applied}
00986   \textcolor{comment}{! in the open ocean or the sponge region (via virtual precip, vprec). Apply additional}
00987   \textcolor{comment}{! salt/heat fluxes so that the resultant surface buoyancy forcing is ~ 0.}
00988   \textcolor{comment}{! This is needed for some of the ISOMIP+ experiments.}
00989 
00990   \textcolor{keywordflow}{if} (cs%constant\_sea\_level) \textcolor{keywordflow}{then}
00991     \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(fluxes%salt\_flux)) \textcolor{keyword}{allocate}(fluxes%salt\_flux(ie,je))
00992     \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(fluxes%vprec)) \textcolor{keyword}{allocate}(fluxes%vprec(ie,je))
00993     fluxes%salt\_flux(:,:) = 0.0 ; fluxes%vprec(:,:) = 0.0
00994 
00995     \textcolor{comment}{! take into account changes in mass (or thickness) when imposing ice shelf mass}
00996     \textcolor{keywordflow}{if} (cs%override\_shelf\_movement .and. cs%mass\_from\_file) \textcolor{keywordflow}{then}
00997       dtime = real\_to\_time(cs%time\_step)
00998 
00999       \textcolor{comment}{! Compute changes in mass after at least one full time step}
01000       \textcolor{keywordflow}{if} (cs%Time > dtime) \textcolor{keywordflow}{then}
01001         time0 = cs%Time - dtime
01002         \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
01003           last\_hmask(i,j) = iss%hmask(i,j) ; last\_area\_shelf\_h(i,j) = iss%area\_shelf\_h(i,j)
01004 \textcolor{keywordflow}{        enddo} ;\textcolor{keywordflow}{ enddo}
01005         \textcolor{keyword}{call }time\_interp\_external(cs%id\_read\_mass, time0, last\_mass\_shelf)
01006         \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
01007         \textcolor{comment}{! This should only be done if time\_interp\_external did an update.}
01008           last\_mass\_shelf(i,j) = us%kg\_m3\_to\_R*us%m\_to\_Z * last\_mass\_shelf(i,j) \textcolor{comment}{! Rescale after time\_interp}
01009           last\_h\_shelf(i,j) = last\_mass\_shelf(i,j) / cs%density\_ice
01010 \textcolor{keywordflow}{        enddo} ;\textcolor{keywordflow}{ enddo}
01011 
01012         \textcolor{comment}{! apply calving}
01013         \textcolor{keywordflow}{if} (cs%min\_thickness\_simple\_calve > 0.0) \textcolor{keywordflow}{then}
01014           \textcolor{keyword}{call }ice\_shelf\_min\_thickness\_calve(g, last\_h\_shelf, last\_area\_shelf\_h, last\_hmask, &
01015                                        cs%min\_thickness\_simple\_calve, halo=0)
01016           \textcolor{comment}{! convert to mass again}
01017           \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
01018             last\_mass\_shelf(i,j) = last\_h\_shelf(i,j) * cs%density\_ice
01019 \textcolor{keywordflow}{          enddo} ;\textcolor{keywordflow}{ enddo}
01020 \textcolor{keywordflow}{        endif}
01021 
01022         \textcolor{comment}{! get total ice shelf mass at (Time-dt) and (Time), in kg}
01023         \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
01024           \textcolor{comment}{! Just consider the change in the mass of the floating shelf.}
01025           \textcolor{keywordflow}{if} ((sfc\_state%ocean\_mass(i,j) > cs%min\_ocean\_mass\_float) .and. &
01026               (iss%area\_shelf\_h(i,j) > 0.0)) \textcolor{keywordflow}{then}
01027             delta\_float\_mass(i,j) = iss%mass\_shelf(i,j) - last\_mass\_shelf(i,j)
01028           \textcolor{keywordflow}{else}
01029             delta\_float\_mass(i,j) = 0.0
01030 \textcolor{keywordflow}{          endif}
01031 \textcolor{keywordflow}{        enddo} ;\textcolor{keywordflow}{ enddo}
01032         delta\_mass\_shelf = us%kg\_m2s\_to\_RZ\_T*(global\_area\_integral(delta\_float\_mass, g, scale=us
      %RZ\_to\_kg\_m2, &
01033                                                                    area=iss%area\_shelf\_h) / cs%time\_step)
01034       else\textcolor{comment}{! first time step}
01035         delta\_mass\_shelf = 0.0
01036 \textcolor{keywordflow}{      endif}
01037     \textcolor{keywordflow}{else} \textcolor{comment}{! ice shelf mass does not change}
01038       delta\_mass\_shelf = 0.0
01039 \textcolor{keywordflow}{    endif}
01040 
01041     \textcolor{comment}{! average total melt flux over sponge area}
01042     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
01043       \textcolor{keywordflow}{if} ((g%mask2dT(i,j) > 0.0) .AND. (iss%area\_shelf\_h(i,j) * g%IareaT(i,j) < 1.0)) \textcolor{keywordflow}{then}
01044          \textcolor{comment}{! Uncomment this for some ISOMIP cases:}
01045          \textcolor{comment}{!  .AND. (G%geoLonT(i,j) >= 790.0) .AND. (G%geoLonT(i,j) <= 800.0)) then}
01046         bal\_frac(i,j) = max(1.0 - iss%area\_shelf\_h(i,j) * g%IareaT(i,j), 0.0)
01047       \textcolor{keywordflow}{else}
01048         bal\_frac(i,j) = 0.0
01049 \textcolor{keywordflow}{      endif}
01050 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
01051 
01052     balancing\_area = global\_area\_integral(bal\_frac, g)
01053     \textcolor{keywordflow}{if} (balancing\_area > 0.0) \textcolor{keywordflow}{then}
01054       balancing\_flux = ( us%kg\_m2s\_to\_RZ\_T*global\_area\_integral(iss%water\_flux, g, scale=us%RZ\_T\_to\_kg\_m2s,
       &
01055                                                                 area=iss%area\_shelf\_h) + &
01056                          delta\_mass\_shelf ) / balancing\_area
01057     \textcolor{keywordflow}{else}
01058       balancing\_flux = 0.0
01059 \textcolor{keywordflow}{    endif}
01060 
01061     \textcolor{comment}{! apply fluxes}
01062     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
01063       \textcolor{keywordflow}{if} (bal\_frac(i,j) > 0.0) \textcolor{keywordflow}{then}
01064         \textcolor{comment}{! evap is negative, and vprec has units of [R Z T-1 ~> kg m-2 s-1]}
01065         fluxes%vprec(i,j) = -balancing\_flux
01066         fluxes%sens(i,j) = fluxes%vprec(i,j) * cs%Cp * cs%T0 \textcolor{comment}{! [ Q R Z T-1 ~> W /m^2 ]}
01067         fluxes%salt\_flux(i,j) = fluxes%vprec(i,j) * cs%S0*1.0e-3 \textcolor{comment}{! [kgSalt/kg R Z T-1 ~> kgSalt m-2 s-1]}
01068 \textcolor{keywordflow}{      endif}
01069 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
01070 
01071     \textcolor{keywordflow}{if} (cs%debug) \textcolor{keywordflow}{then}
01072       \textcolor{keyword}{write}(mesg,*) \textcolor{stringliteral}{'Balancing flux (kg/(m^2 s)), dt = '}, balancing\_flux*us%RZ\_T\_to\_kg\_m2s, cs%time\_step
01073       \textcolor{keyword}{call }mom\_mesg(mesg)
01074       \textcolor{keyword}{call }mom\_forcing\_chksum(\textcolor{stringliteral}{"After constant sea level"}, fluxes, g, cs%US, haloshift=0)
01075 \textcolor{keywordflow}{    endif}
01076 
01077 \textcolor{keywordflow}{  endif} \textcolor{comment}{! constant\_sea\_level}
01078 
01079 \textcolor{keyword}{end subroutine }\hyperlink{namespacemom__ice__shelf_a8f7eae8642835e30aff99f77f3836945}{add\_shelf\_flux}
01080 
01081 \textcolor{comment}{}
01082 \textcolor{comment}{!> Initializes shelf model data, parameters and diagnostics}
01083 \textcolor{keyword}{subroutine }\hyperlink{namespacemom__ice__shelf_a5990f9918493ff4984245eac74e5f4d9}{initialize\_ice\_shelf}(param\_file, ocn\_grid, Time, CS, diag, forces, fluxes,
       Time\_in, solo\_ice\_sheet\_in)
\Hypertarget{MOM__ice__shelf_8F90_source_l01084}\hyperlink{namespacemom__ice__shelf_a5990f9918493ff4984245eac74e5f4d9}{01084}   \textcolor{keywordtype}{type}(param\_file\_type),        \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
01085   \textcolor{keywordtype}{type}(ocean\_grid\_type),        \textcolor{keywordtype}{pointer}       :: ocn\_grid\textcolor{comment}{   !< The calling ocean model's horizontal grid
       structure}
01086   \textcolor{keywordtype}{type}(time\_type),              \textcolor{keywordtype}{intent(inout)} :: Time\textcolor{comment}{ !< The clock that that will indicate the model time}
01087   \textcolor{keywordtype}{type}(\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs}),           \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{   !< A pointer to the ice shelf control
       structure}
01088   \textcolor{keywordtype}{type}(diag\_ctrl),    \textcolor{keywordtype}{target},   \textcolor{keywordtype}{intent(in)}    :: diag\textcolor{comment}{ !< A structure that is used to regulate the
       diagnostic output.}
01089   \textcolor{keywordtype}{type}(forcing),      \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< A structure containing pointers to any possible}
01090 \textcolor{comment}{                                                   !! thermodynamic or mass-flux forcing fields.}
01091   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: forces\textcolor{comment}{ !< A structure with the driving mechanical forces}
01092   \textcolor{keywordtype}{type}(time\_type),    \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: Time\_in\textcolor{comment}{ !< The time at initialization.}
01093   \textcolor{keywordtype}{logical},            \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: solo\_ice\_sheet\_in\textcolor{comment}{ !< If present, this indicates whether}
01094 \textcolor{comment}{                                                   !! a solo ice-sheet driver.}
01095 
01096   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{pointer} :: G  => null(), og  => null() \textcolor{comment}{! Pointers to grids for convenience.}
01097   \textcolor{keywordtype}{type}(\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\_scale\_type}), \textcolor{keywordtype}{pointer} :: US => null() \textcolor{comment}{! Pointer to a structure containing}
01098                                                  \textcolor{comment}{! various unit conversion factors}
01099   \textcolor{keywordtype}{type}(ice\_shelf\_state), \textcolor{keywordtype}{pointer} :: ISS => null() \textcolor{comment}{!< A structure with elements that describe}
01100 \textcolor{comment}{                                          !! the ice-shelf state}
01101   \textcolor{keywordtype}{type}(directories)  :: dirs
01102   \textcolor{keywordtype}{type}(dyn\_horgrid\_type), \textcolor{keywordtype}{pointer} :: dG => null()
01103   \textcolor{keywordtype}{real}    :: Z\_rescale  \textcolor{comment}{! A rescaling factor for heights from the representation in}
01104                         \textcolor{comment}{! a restart file to the internal representation in this run.}
01105   \textcolor{keywordtype}{real}    :: RZ\_rescale \textcolor{comment}{! A rescaling factor for mass loads from the representation in}
01106                         \textcolor{comment}{! a restart file to the internal representation in this run.}
01107   \textcolor{keywordtype}{real}    :: L\_rescale  \textcolor{comment}{! A rescaling factor for horizontal lengths from the representation in}
01108                         \textcolor{comment}{! a restart file to the internal representation in this run.}
01109   \textcolor{keywordtype}{real} :: meltrate\_conversion \textcolor{comment}{! The conversion factor to use for in the melt rate diagnostic.}
01110   \textcolor{keywordtype}{real} :: dz\_ocean\_min\_float \textcolor{comment}{! The minimum ocean thickness above which the ice shelf is considered}
01111                         \textcolor{comment}{! to be floating when CONST\_SEA\_LEVEL = True [Z ~> m].}
01112   \textcolor{keywordtype}{real} :: cdrag, drag\_bg\_vel
01113   \textcolor{keywordtype}{logical} :: new\_sim, save\_IC, var\_force
01114   \textcolor{comment}{!This include declares and sets the variable "version".}
01115 \textcolor{preprocessor}{# include "version\_variable.h"}
01116 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=200)} :: config
01117   \textcolor{keywordtype}{character(len=200)} :: IC\_file,filename,inputdir
01118   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_ice\_shelf"}  \textcolor{comment}{! This module's name.}
01119   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, isd, ied, jsd, jed, Isdq, Iedq, Jsdq, Jedq
01120   \textcolor{keywordtype}{integer} :: wd\_halos(2)
01121   \textcolor{keywordtype}{logical} :: read\_TideAmp, shelf\_mass\_is\_dynamic, debug
01122   \textcolor{keywordtype}{character(len=240)} :: Tideamp\_file
01123   \textcolor{keywordtype}{real}    :: utide  \textcolor{comment}{! A tidal velocity [L T-1 ~> m s-1]}
01124   \textcolor{keywordtype}{real}    :: col\_thick\_melt\_thresh \textcolor{comment}{! An ocean column thickness below which iceshelf melting}
01125                        \textcolor{comment}{! does not occur [Z ~> m]}
01126   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
01127     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_ice\_shelf.F90, initialize\_ice\_shelf: "}// &
01128                           \textcolor{stringliteral}{"called with an associated control structure."})
01129     \textcolor{keywordflow}{return}
01130 \textcolor{keywordflow}{  endif}
01131   \textcolor{keyword}{allocate}(cs)
01132 
01133   \textcolor{comment}{!   Go through all of the infrastructure initialization calls, since this is}
01134   \textcolor{comment}{! being treated as an independent component that just happens to use the}
01135   \textcolor{comment}{! MOM's grid and infrastructure.}
01136   \textcolor{keyword}{call }get\_mom\_input(dirs=dirs)
01137 
01138   \textcolor{comment}{! Determining the internal unit scaling factors for this run.}
01139   \textcolor{keyword}{call }\hyperlink{namespacemom__unit__scaling_a74867ddf628f93dcee854980e08bbe21}{unit\_scaling\_init}(param\_file, cs%US)
01140 
01141   \textcolor{comment}{! Set up the ice-shelf domain and grid}
01142   wd\_halos(:)=0
01143   \textcolor{keyword}{call }mom\_domains\_init(cs%grid%domain, param\_file, min\_halo=wd\_halos, symmetric=grid\_sym\_)
01144   \textcolor{comment}{! call diag\_mediator\_init(CS%grid,param\_file,CS%diag)}
01145   \textcolor{comment}{! this needs to be fixed - will probably break when not using coupled driver 0}
01146   \textcolor{keyword}{call }mom\_grid\_init(cs%grid, param\_file, cs%US)
01147 
01148   \textcolor{keyword}{call }create\_dyn\_horgrid(dg, cs%grid%HI)
01149   \textcolor{keyword}{call }clone\_mom\_domain(cs%grid%Domain, dg%Domain)
01150 
01151   \textcolor{keyword}{call }set\_grid\_metrics(dg, param\_file, cs%US)
01152   \textcolor{comment}{! call set\_diag\_mediator\_grid(CS%grid, CS%diag)}
01153 
01154   \textcolor{comment}{! The ocean grid possibly uses different symmetry.}
01155   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(ocn\_grid)) \textcolor{keywordflow}{then} ; cs%ocn\_grid => ocn\_grid
01156   \textcolor{keywordflow}{else} ; cs%ocn\_grid => cs%grid ;\textcolor{keywordflow}{ endif}
01157 
01158   \textcolor{comment}{! Convenience pointers}
01159   g => cs%grid
01160   og => cs%ocn\_grid
01161   us => cs%US
01162 
01163   \textcolor{keywordflow}{if} (is\_root\_pe()) \textcolor{keywordflow}{then}
01164     \textcolor{keyword}{write}(0,*) \textcolor{stringliteral}{'OG: '}, og%isd, og%isc, og%iec, og%ied, og%jsd, og%jsc, og%jsd, og%jed
01165     \textcolor{keyword}{write}(0,*) \textcolor{stringliteral}{'IG: '}, g%isd, g%isc, g%iec, g%ied, g%jsd, g%jsc, g%jsd, g%jed
01166 \textcolor{keywordflow}{  endif}
01167 
01168   cs%diag => diag
01169 
01170   \textcolor{comment}{! Are we being called from the solo ice-sheet driver? When called by the ocean}
01171   \textcolor{comment}{! model solo\_ice\_sheet\_in is not preset.}
01172   cs%solo\_ice\_sheet = .false.
01173   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(solo\_ice\_sheet\_in)) cs%solo\_ice\_sheet = solo\_ice\_sheet\_in
01174 
01175   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(time\_in)) time = time\_in
01176 
01177   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
01178   isd = g%isd ; jsd = g%jsd ; ied = g%ied ; jed = g%jed
01179   isdq = g%IsdB ; iedq = g%IedB ; jsdq = g%JsdB ; jedq = g%JedB
01180 
01181   cs%override\_shelf\_movement = .false. ; cs%active\_shelf\_dynamics = .false.
01182 
01183   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})
01184   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DEBUG"}, debug, default=.false.)
01185   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DEBUG\_IS"}, cs%debug, &
01186                  \textcolor{stringliteral}{"If true, write verbose debugging messages for the ice shelf."}, &
01187                  default=debug)
01188   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DYNAMIC\_SHELF\_MASS"}, shelf\_mass\_is\_dynamic, &
01189                  \textcolor{stringliteral}{"If true, the ice sheet mass can evolve with time."}, &
01190                  default=.false.)
01191   \textcolor{keywordflow}{if} (shelf\_mass\_is\_dynamic) \textcolor{keywordflow}{then}
01192     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"OVERRIDE\_SHELF\_MOVEMENT"}, cs%override\_shelf\_movement, &
01193                  \textcolor{stringliteral}{"If true, user provided code specifies the ice-shelf "}//&
01194                  \textcolor{stringliteral}{"movement instead of the dynamic ice model."}, default=.false.)
01195     cs%active\_shelf\_dynamics = .not.cs%override\_shelf\_movement
01196     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GROUNDING\_LINE\_INTERPOLATE"}, cs%GL\_regularize, &
01197                  \textcolor{stringliteral}{"If true, regularize the floatation condition at the "}//&
01198                  \textcolor{stringliteral}{"grounding line as in Goldberg Holland Schoof 2009."}, default=.false.)
01199     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"GROUNDING\_LINE\_COUPLE"}, cs%GL\_couple, &
01200                  \textcolor{stringliteral}{"If true, let the floatation condition be determined by "}//&
01201                  \textcolor{stringliteral}{"ocean column thickness. This means that update\_OD\_ffrac "}//&
01202                  \textcolor{stringliteral}{"will be called.  GL\_REGULARIZE and GL\_COUPLE are exclusive."}, &
01203                  default=.false., do\_not\_log=cs%GL\_regularize)
01204     \textcolor{keywordflow}{if} (cs%GL\_regularize) cs%GL\_couple = .false.
01205 \textcolor{keywordflow}{  endif}
01206 
01207   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_THERMO"}, cs%isthermo, &
01208                  \textcolor{stringliteral}{"If true, use a thermodynamically interactive ice shelf."}, &
01209                  default=.false.)
01210   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"LATENT\_HEAT\_FUSION"}, cs%Lat\_fusion, &
01211                  \textcolor{stringliteral}{"The latent heat of fusion."}, units=\textcolor{stringliteral}{"J/kg"}, default=hlf, scale=us%J\_kg\_to\_Q)
01212   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_THREE\_EQN"}, cs%threeeq, &
01213                  \textcolor{stringliteral}{"If true, use the three equation expression of "}//&
01214                  \textcolor{stringliteral}{"consistency to calculate the fluxes at the ice-ocean "}//&
01215                  \textcolor{stringliteral}{"interface."}, default=.true.)
01216   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_INSULATOR"}, cs%insulator, &
01217                  \textcolor{stringliteral}{"If true, the ice shelf is a perfect insulatior "}//&
01218                  \textcolor{stringliteral}{"(no conduction)."}, default=.false.)
01219   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MELTING\_CUTOFF\_DEPTH"}, cs%cutoff\_depth, &
01220                  \textcolor{stringliteral}{"Depth above which the melt is set to zero (it must be >= 0) "}//&
01221                  \textcolor{stringliteral}{"Default value won't affect the solution."}, units=\textcolor{stringliteral}{"m"}, default=0.0, scale=us%m\_to\_Z)
01222   \textcolor{keywordflow}{if} (cs%cutoff\_depth < 0.) &
01223     \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"Initialize\_ice\_shelf: MELTING\_CUTOFF\_DEPTH must be >= 0."})
01224 
01225   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"CONST\_SEA\_LEVEL"}, cs%constant\_sea\_level, &
01226                  \textcolor{stringliteral}{"If true, apply evaporative, heat and salt fluxes in "}//&
01227                  \textcolor{stringliteral}{"the sponge region. This will avoid a large increase "}//&
01228                  \textcolor{stringliteral}{"in sea level. This option is needed for some of the "}//&
01229                  \textcolor{stringliteral}{"ISOMIP+ experiments (Ocean3 and Ocean4). "}//&
01230                  \textcolor{stringliteral}{"IMPORTANT: it is not currently possible to do "}//&
01231                  \textcolor{stringliteral}{"prefect restarts using this flag."}, default=.false.)
01232   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MIN\_OCEAN\_FLOAT\_THICK"}, dz\_ocean\_min\_float, &
01233                  \textcolor{stringliteral}{"The minimum ocean thickness above which the ice shelf is considered to be "}//&
01234                  \textcolor{stringliteral}{"floating when CONST\_SEA\_LEVEL = True."}, &
01235                  default=0.1, units=\textcolor{stringliteral}{"m"}, scale=us%m\_to\_Z, do\_not\_log=.not.cs%constant\_sea\_level)
01236 
01237   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ISOMIP\_S\_SUR\_SPONGE"}, cs%S0, &
01238                  \textcolor{stringliteral}{"Surface salinity in the restoring region."}, &
01239                 default=33.8, units=\textcolor{stringliteral}{'ppt'}, do\_not\_log=.true.)
01240 
01241   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ISOMIP\_T\_SUR\_SPONGE"}, cs%T0, &
01242                 \textcolor{stringliteral}{"Surface temperature in the restoring region."}, &
01243                 default=-1.9, units=\textcolor{stringliteral}{'degC'}, do\_not\_log=.true.)
01244 
01245   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_3EQ\_GAMMA"}, cs%const\_gamma, &
01246                  \textcolor{stringliteral}{"If true, user specifies a constant nondimensional heat-transfer coefficient "}//&
01247                  \textcolor{stringliteral}{"(GAMMA\_T\_3EQ), from which the default salt-transfer coefficient is set "}//&
01248                  \textcolor{stringliteral}{"as GAMMA\_T\_3EQ/35. This is used with SHELF\_THREE\_EQN."}, default=.false.)
01249   \textcolor{keywordflow}{if} (cs%threeeq) \textcolor{keywordflow}{then}
01250     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_S\_ROOT"}, cs%find\_salt\_root, &
01251                  \textcolor{stringliteral}{"If SHELF\_S\_ROOT = True, salinity at the ice/ocean interface (Sbdry) "}//&
01252                  \textcolor{stringliteral}{"is computed from a quadratic equation. Otherwise, the previous "}//&
01253                  \textcolor{stringliteral}{"interactive method to estimate Sbdry is used."}, default=.false.)
01254   \textcolor{keywordflow}{else}
01255     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_2EQ\_GAMMA\_T"}, cs%gamma\_t, &
01256                  \textcolor{stringliteral}{"If SHELF\_THREE\_EQN is false, this the fixed turbulent "}//&
01257                  \textcolor{stringliteral}{"exchange velocity at the ice-ocean interface."}, &
01258                  units=\textcolor{stringliteral}{"m s-1"}, scale=us%m\_to\_Z*us%T\_to\_s, fail\_if\_missing=.true.)
01259 \textcolor{keywordflow}{  endif}
01260   \textcolor{keywordflow}{if} (cs%const\_gamma .or. cs%find\_salt\_root) \textcolor{keywordflow}{then}
01261     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_3EQ\_GAMMA\_T"}, cs%Gamma\_T\_3EQ, &
01262                  \textcolor{stringliteral}{"Nondimensional heat-transfer coefficient."}, &
01263                   units=\textcolor{stringliteral}{"nondim"}, default=2.2e-2)
01264     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_3EQ\_GAMMA\_S"}, cs%Gamma\_S\_3EQ, &
01265                  \textcolor{stringliteral}{"Nondimensional salt-transfer coefficient."}, &
01266                  default=cs%Gamma\_T\_3EQ/35.0, units=\textcolor{stringliteral}{"nondim"})
01267 \textcolor{keywordflow}{  endif}
01268 
01269   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ICE\_SHELF\_MASS\_FROM\_FILE"}, &
01270                  cs%mass\_from\_file, \textcolor{stringliteral}{"Read the mass of the "}//&
01271                  \textcolor{stringliteral}{"ice shelf (every time step) from a file."}, default=.false.)
01272 
01273   \textcolor{keywordflow}{if} (cs%find\_salt\_root) \textcolor{keywordflow}{then} \textcolor{comment}{! read liquidus coeffs.}
01274      \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TFREEZE\_S0\_P0"}, cs%TFr\_0\_0, &
01275                  \textcolor{stringliteral}{"this is the freezing potential temperature at "}//&
01276                  \textcolor{stringliteral}{"S=0, P=0."}, units=\textcolor{stringliteral}{"degC"}, default=0.0, do\_not\_log=.true.)
01277     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DTFREEZE\_DS"}, cs%dTFr\_dS, &
01278                  \textcolor{stringliteral}{"this is the derivative of the freezing potential temperature with salinity."}, &
01279                  units=\textcolor{stringliteral}{"degC psu-1"}, default=-0.054, do\_not\_log=.true.)
01280     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DTFREEZE\_DP"}, cs%dTFr\_dp, &
01281                  \textcolor{stringliteral}{"this is the derivative of the freezing potential temperature with pressure."}, &
01282                  units=\textcolor{stringliteral}{"degC Pa-1"}, default=0.0, scale=us%RL2\_T2\_to\_Pa, do\_not\_log=.true.)
01283 \textcolor{keywordflow}{  endif}
01284 
01285   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"G\_EARTH"}, cs%g\_Earth, &
01286                  \textcolor{stringliteral}{"The gravitational acceleration of the Earth."}, &
01287                  units=\textcolor{stringliteral}{"m s-2"}, default = 9.80, scale=us%m\_s\_to\_L\_T**2*us%Z\_to\_m)
01288   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"C\_P"}, cs%Cp, &
01289                  \textcolor{stringliteral}{"The heat capacity of sea water, approximated as a constant. "}//&
01290                  \textcolor{stringliteral}{"The default value is from the TEOS-10 definition of conservative temperature."}, &
01291                  units=\textcolor{stringliteral}{"J kg-1 K-1"}, default=3991.86795711963, scale=us%J\_kg\_to\_Q)
01292   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RHO\_0"}, cs%Rho\_ocn, &
01293                  \textcolor{stringliteral}{"The mean ocean density used with BOUSSINESQ true to "}//&
01294                  \textcolor{stringliteral}{"calculate accelerations and the mass for conservation "}//&
01295                  \textcolor{stringliteral}{"properties, or with BOUSSINSEQ false to convert some "}//&
01296                  \textcolor{stringliteral}{"parameters from vertical units of m to kg m-2."}, &
01297                  units=\textcolor{stringliteral}{"kg m-3"}, default=1035.0, scale=us%kg\_m3\_to\_R)
01298   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"C\_P\_ICE"}, cs%Cp\_ice, &
01299                  \textcolor{stringliteral}{"The heat capacity of ice."}, units=\textcolor{stringliteral}{"J kg-1 K-1"}, scale=us%J\_kg\_to\_Q, &
01300                  default=2.10e3)
01301   \textcolor{keywordflow}{if} (cs%constant\_sea\_level) cs%min\_ocean\_mass\_float = dz\_ocean\_min\_float*cs%Rho\_ocn
01302 
01303   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ICE\_SHELF\_FLUX\_FACTOR"}, cs%flux\_factor, &
01304                  \textcolor{stringliteral}{"Non-dimensional factor applied to shelf thermodynamic "}//&
01305                  \textcolor{stringliteral}{"fluxes."}, units=\textcolor{stringliteral}{"none"}, default=1.0)
01306 
01307   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"KV\_ICE"}, cs%kv\_ice, &
01308                  \textcolor{stringliteral}{"The viscosity of the ice."}, &
01309                  units=\textcolor{stringliteral}{"m2 s-1"}, default=1.0e10, scale=us%Z\_to\_L**2*us%m\_to\_L**2*us%T\_to\_s)
01310   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"KV\_MOLECULAR"}, cs%kv\_molec, &
01311                  \textcolor{stringliteral}{"The molecular kinimatic viscosity of sea water at the "}//&
01312                  \textcolor{stringliteral}{"freezing temperature."}, units=\textcolor{stringliteral}{"m2 s-1"}, default=1.95e-6, scale=us%m2\_s\_to\_Z2\_T)
01313   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ICE\_SHELF\_SALINITY"}, cs%Salin\_ice, &
01314                  \textcolor{stringliteral}{"The salinity of the ice inside the ice shelf."}, units=\textcolor{stringliteral}{"psu"}, &
01315                  default=0.0)
01316   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ICE\_SHELF\_TEMPERATURE"}, cs%Temp\_ice, &
01317                  \textcolor{stringliteral}{"The temperature at the center of the ice shelf."}, &
01318                  units = \textcolor{stringliteral}{"degC"}, default=-15.0)
01319   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"KD\_SALT\_MOLECULAR"}, cs%kd\_molec\_salt, &
01320                  \textcolor{stringliteral}{"The molecular diffusivity of salt in sea water at the "}//&
01321                  \textcolor{stringliteral}{"freezing point."}, units=\textcolor{stringliteral}{"m2 s-1"}, default=8.02e-10, scale=us%m2\_s\_to\_Z2\_T)
01322   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"KD\_TEMP\_MOLECULAR"}, cs%kd\_molec\_temp, &
01323                  \textcolor{stringliteral}{"The molecular diffusivity of heat in sea water at the "}//&
01324                  \textcolor{stringliteral}{"freezing point."}, units=\textcolor{stringliteral}{"m2 s-1"}, default=1.41e-7, scale=us%m2\_s\_to\_Z2\_T)
01325   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DT\_FORCING"}, cs%time\_step, &
01326                  \textcolor{stringliteral}{"The time step for changing forcing, coupling with other "}//&
01327                  \textcolor{stringliteral}{"components, or potentially writing certain diagnostics. "}//&
01328                  \textcolor{stringliteral}{"The default value is given by DT."}, units=\textcolor{stringliteral}{"s"}, default=0.0)
01329 
01330   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"COL\_THICK\_MELT\_THRESHOLD"}, col\_thick\_melt\_thresh, &
01331                  \textcolor{stringliteral}{"The minimum ocean column thickness where melting is allowed."}, &
01332                  units=\textcolor{stringliteral}{"m"}, scale=us%m\_to\_Z, default=0.0)
01333   cs%col\_mass\_melt\_threshold =  cs%Rho\_ocn * col\_thick\_melt\_thresh
01334 
01335   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"READ\_TIDEAMP"}, read\_tideamp, &
01336                  \textcolor{stringliteral}{"If true, read a file (given by TIDEAMP\_FILE) containing "}//&
01337                  \textcolor{stringliteral}{"the tidal amplitude with INT\_TIDE\_DISSIPATION."}, default=.false.)
01338 
01339   \textcolor{keyword}{call }safe\_alloc\_ptr(cs%utide,isd,ied,jsd,jed)   ; cs%utide(:,:) = 0.0
01340 
01341   \textcolor{keywordflow}{if} (read\_tideamp) \textcolor{keywordflow}{then}
01342     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TIDEAMP\_FILE"}, tideamp\_file, &
01343                  \textcolor{stringliteral}{"The path to the file containing the spatially varying "}//&
01344                  \textcolor{stringliteral}{"tidal amplitudes."}, &
01345                  default=\textcolor{stringliteral}{"tideamp.nc"})
01346     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR"}, inputdir, default=\textcolor{stringliteral}{"."})
01347     inputdir = slasher(inputdir)
01348     tideamp\_file = trim(inputdir) // trim(tideamp\_file)
01349     \textcolor{keyword}{call }mom\_read\_data(tideamp\_file, \textcolor{stringliteral}{'tideamp'}, cs%utide, g%domain, timelevel=1, scale=us%m\_s\_to\_L\_T)
01350   \textcolor{keywordflow}{else}
01351     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"UTIDE"}, utide, &
01352                  \textcolor{stringliteral}{"The constant tidal amplitude used with INT\_TIDE\_DISSIPATION."}, &
01353                  units=\textcolor{stringliteral}{"m s-1"}, default=0.0 , scale=us%m\_s\_to\_L\_T)
01354     cs%utide(:,:) = utide
01355 \textcolor{keywordflow}{  endif}
01356 
01357   \textcolor{keyword}{call }\hyperlink{namespacemom__eos_a3ab220b9c98dac3b8f6b7c1606b811cf}{eos\_init}(param\_file, cs%eqn\_of\_state)
01358 
01359   \textcolor{comment}{!! new parameters that need to be in MOM\_input}
01360 
01361   \textcolor{keywordflow}{if} (cs%active\_shelf\_dynamics) \textcolor{keywordflow}{then}
01362 
01363     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DENSITY\_ICE"}, cs%density\_ice, &
01364                  \textcolor{stringliteral}{"A typical density of ice."}, units=\textcolor{stringliteral}{"kg m-3"}, default=917.0, scale=us%kg\_m3\_to\_R)
01365 
01366     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUT\_FLUX\_ICE\_SHELF"}, cs%input\_flux, &
01367                  \textcolor{stringliteral}{"volume flux at upstream boundary"}, units=\textcolor{stringliteral}{"m2 s-1"}, default=0.)
01368     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUT\_THICK\_ICE\_SHELF"}, cs%input\_thickness, &
01369                  \textcolor{stringliteral}{"flux thickness at upstream boundary"}, units=\textcolor{stringliteral}{"m"}, default=1000.)
01370   \textcolor{keywordflow}{else}
01371     \textcolor{comment}{! This is here because of inconsistent defaults.  I don't know why.  RWH}
01372     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DENSITY\_ICE"}, cs%density\_ice, &
01373                  \textcolor{stringliteral}{"A typical density of ice."}, units=\textcolor{stringliteral}{"kg m-3"}, default=900.0, scale=us%kg\_m3\_to\_R)
01374 \textcolor{keywordflow}{  endif}
01375   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"MIN\_THICKNESS\_SIMPLE\_CALVE"}, &
01376                 cs%min\_thickness\_simple\_calve, &
01377                  \textcolor{stringliteral}{"Min thickness rule for the very simple calving law"},&
01378                  units=\textcolor{stringliteral}{"m"}, default=0.0, scale=us%m\_to\_Z)
01379 
01380   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"USTAR\_SHELF\_BG"}, cs%ustar\_bg, &
01381                  \textcolor{stringliteral}{"The minimum value of ustar under ice shelves."}, &
01382                  units=\textcolor{stringliteral}{"m s-1"}, default=0.0, scale=us%m\_to\_Z*us%T\_to\_s)
01383   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"CDRAG\_SHELF"}, cdrag, &
01384        \textcolor{stringliteral}{"CDRAG is the drag coefficient relating the magnitude of "}//&
01385        \textcolor{stringliteral}{"the velocity field to the surface stress."}, units=\textcolor{stringliteral}{"nondim"}, &
01386        default=0.003)
01387   cs%cdrag = cdrag
01388   \textcolor{keywordflow}{if} (cs%ustar\_bg <= 0.0) \textcolor{keywordflow}{then}
01389     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DRAG\_BG\_VEL\_SHELF"}, drag\_bg\_vel, &
01390                  \textcolor{stringliteral}{"DRAG\_BG\_VEL is either the assumed bottom velocity (with "}//&
01391                  \textcolor{stringliteral}{"LINEAR\_DRAG) or an unresolved  velocity that is "}//&
01392                  \textcolor{stringliteral}{"combined with the resolved velocity to estimate the "}//&
01393                  \textcolor{stringliteral}{"velocity magnitude."}, units=\textcolor{stringliteral}{"m s-1"}, default=0.0, scale=us%m\_to\_Z*us%T\_to\_s)
01394     \textcolor{keywordflow}{if} (cs%cdrag*drag\_bg\_vel > 0.0) cs%ustar\_bg = sqrt(cs%cdrag)*drag\_bg\_vel
01395 \textcolor{keywordflow}{  endif}
01396 
01397   \textcolor{comment}{! Allocate and initialize state variables to default values}
01398   \textcolor{keyword}{call }ice\_shelf\_state\_init(cs%ISS, cs%grid)
01399   iss => cs%ISS
01400 
01401   \textcolor{comment}{! Allocate the arrays for passing ice-shelf data through the forcing type.}
01402   \textcolor{keywordflow}{if} (.not. cs%solo\_ice\_sheet) \textcolor{keywordflow}{then}
01403     \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"MOM\_ice\_shelf.F90, initialize\_ice\_shelf: allocating fluxes."})
01404      \textcolor{comment}{! GMM: the following assures that water/heat fluxes are just allocated}
01405      \textcolor{comment}{! when SHELF\_THERMO = True. These fluxes are necessary if one wants to}
01406      \textcolor{comment}{! use either ENERGETICS\_SFC\_PBL (ALE mode) or BULKMIXEDLAYER (layer mode).}
01407     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(fluxes)) &
01408       \textcolor{keyword}{call }allocate\_forcing\_type(cs%ocn\_grid, fluxes, ustar=.true., shelf=.true., &
01409                                  press=.true., water=cs%isthermo, heat=cs%isthermo)
01410     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(forces)) &
01411       \textcolor{keyword}{call }allocate\_mech\_forcing(cs%ocn\_grid, forces, ustar=.true., shelf=.true., press=.true.)
01412   \textcolor{keywordflow}{else}
01413     \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"MOM\_ice\_shelf.F90, initialize\_ice\_shelf: allocating fluxes in solo mode."})
01414     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(fluxes)) &
01415       \textcolor{keyword}{call }allocate\_forcing\_type(g, fluxes, ustar=.true., shelf=.true., press=.true.)
01416     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(forces)) &
01417       \textcolor{keyword}{call }allocate\_mech\_forcing(g, forces, ustar=.true., shelf=.true., press=.true.)
01418 \textcolor{keywordflow}{  endif}
01419 
01420   \textcolor{comment}{! Set up the bottom depth, G%D either analytically or from file}
01421   \textcolor{keyword}{call }mom\_initialize\_topography(dg%bathyT, g%max\_depth, dg, param\_file)
01422   \textcolor{keyword}{call }rescale\_dyn\_horgrid\_bathymetry(dg, us%Z\_to\_m)
01423 
01424   \textcolor{comment}{! Set up the Coriolis parameter, G%f, usually analytically.}
01425   \textcolor{keyword}{call }mom\_initialize\_rotation(dg%CoriolisBu, dg, param\_file, us)
01426   \textcolor{comment}{! This copies grid elements, including bathyT and CoriolisBu from dG to CS%grid.}
01427   \textcolor{keyword}{call }copy\_dyngrid\_to\_mom\_grid(dg, cs%grid, us)
01428 
01429   \textcolor{keyword}{call }destroy\_dyn\_horgrid(dg)
01430 
01431   \textcolor{comment}{! Set up the restarts.}
01432   \textcolor{keyword}{call }restart\_init(param\_file, cs%restart\_CSp, \textcolor{stringliteral}{"Shelf.res"})
01433   \textcolor{keyword}{call }register\_restart\_field(iss%mass\_shelf, \textcolor{stringliteral}{"shelf\_mass"}, .true., cs%restart\_CSp, &
01434                               \textcolor{stringliteral}{"Ice shelf mass"}, \textcolor{stringliteral}{"kg m-2"})
01435   \textcolor{keyword}{call }register\_restart\_field(iss%area\_shelf\_h, \textcolor{stringliteral}{"shelf\_area"}, .true., cs%restart\_CSp, &
01436                               \textcolor{stringliteral}{"Ice shelf area in cell"}, \textcolor{stringliteral}{"m2"})
01437   \textcolor{keyword}{call }register\_restart\_field(iss%h\_shelf, \textcolor{stringliteral}{"h\_shelf"}, .true., cs%restart\_CSp, &
01438                               \textcolor{stringliteral}{"ice sheet/shelf thickness"}, \textcolor{stringliteral}{"m"})
01439   \textcolor{keyword}{call }register\_restart\_field(us%m\_to\_Z\_restart, \textcolor{stringliteral}{"m\_to\_Z"}, .false., cs%restart\_CSp, &
01440                               \textcolor{stringliteral}{"Height unit conversion factor"}, \textcolor{stringliteral}{"Z meter-1"})
01441   \textcolor{keyword}{call }register\_restart\_field(us%m\_to\_L\_restart, \textcolor{stringliteral}{"m\_to\_L"}, .false., cs%restart\_CSp, &
01442                               \textcolor{stringliteral}{"Length unit conversion factor"}, \textcolor{stringliteral}{"L meter-1"})
01443   \textcolor{keyword}{call }register\_restart\_field(us%kg\_m3\_to\_R\_restart, \textcolor{stringliteral}{"kg\_m3\_to\_R"}, .false., cs%restart\_CSp, &
01444                               \textcolor{stringliteral}{"Density unit conversion factor"}, \textcolor{stringliteral}{"R m3 kg-1"})
01445   \textcolor{keywordflow}{if} (cs%active\_shelf\_dynamics) \textcolor{keywordflow}{then}
01446     \textcolor{keyword}{call }register\_restart\_field(iss%hmask, \textcolor{stringliteral}{"h\_mask"}, .true., cs%restart\_CSp, &
01447                                 \textcolor{stringliteral}{"ice sheet/shelf thickness mask"} ,\textcolor{stringliteral}{"none"})
01448 \textcolor{keywordflow}{  endif}
01449 
01450   \textcolor{keywordflow}{if} (cs%active\_shelf\_dynamics) \textcolor{keywordflow}{then}
01451     \textcolor{comment}{! Allocate CS%dCS and specify additional restarts for ice shelf dynamics}
01452     \textcolor{keyword}{call }register\_ice\_shelf\_dyn\_restarts(g, param\_file, cs%dCS, cs%restart\_CSp)
01453 \textcolor{keywordflow}{  endif}
01454 
01455   \textcolor{comment}{!GMM - I think we do not need to save ustar\_shelf and iceshelf\_melt in the restart file}
01456   \textcolor{comment}{!if (.not. CS%solo\_ice\_sheet) then}
01457   \textcolor{comment}{!  call register\_restart\_field(fluxes%ustar\_shelf, "ustar\_shelf", .false., CS%restart\_CSp, &}
01458   \textcolor{comment}{!                              "Friction velocity under ice shelves", "m s-1")}
01459   \textcolor{comment}{!endif}
01460 
01461   cs%restart\_output\_dir = dirs%restart\_output\_dir
01462 
01463   new\_sim = .false.
01464   \textcolor{keywordflow}{if} ((dirs%input\_filename(1:1) == \textcolor{stringliteral}{'n'}) .and. &
01465       (len\_trim(dirs%input\_filename) == 1)) new\_sim = .true.
01466 
01467   \textcolor{keywordflow}{if} (cs%override\_shelf\_movement .and. cs%mass\_from\_file) \textcolor{keywordflow}{then}
01468 
01469     \textcolor{comment}{! initialize the ids for reading shelf mass from a netCDF}
01470     \textcolor{keyword}{call }\hyperlink{namespacemom__ice__shelf_ac478a1dd52137f8e851916bee2243fa3}{initialize\_shelf\_mass}(g, param\_file, cs, iss)
01471 
01472     \textcolor{keywordflow}{if} (new\_sim) \textcolor{keywordflow}{then}
01473       \textcolor{comment}{! new simulation, initialize ice thickness as in the static case}
01474       \textcolor{keyword}{call }initialize\_ice\_thickness(iss%h\_shelf, iss%area\_shelf\_h, iss%hmask, g, us, param\_file)
01475 
01476     \textcolor{comment}{! next make sure mass is consistent with thickness}
01477       \textcolor{keywordflow}{do} j=g%jsd,g%jed ; \textcolor{keywordflow}{do} i=g%isd,g%ied
01478         \textcolor{keywordflow}{if} ((iss%hmask(i,j) == 1) .or. (iss%hmask(i,j) == 2)) \textcolor{keywordflow}{then}
01479           iss%mass\_shelf(i,j) = iss%h\_shelf(i,j)*cs%density\_ice
01480 \textcolor{keywordflow}{        endif}
01481 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
01482 
01483       \textcolor{keywordflow}{if} (cs%min\_thickness\_simple\_calve > 0.0) &
01484         \textcolor{keyword}{call }ice\_shelf\_min\_thickness\_calve(g, iss%h\_shelf, iss%area\_shelf\_h, iss%hmask, &
01485                                            cs%min\_thickness\_simple\_calve)
01486 \textcolor{keywordflow}{    endif}
01487 \textcolor{keywordflow}{  endif}
01488 
01489   \textcolor{keywordflow}{if} (cs%active\_shelf\_dynamics) \textcolor{keywordflow}{then}
01490     \textcolor{comment}{! the only reason to initialize boundary conds is if the shelf is dynamic - MJH}
01491 
01492     \textcolor{comment}{! call initialize\_ice\_shelf\_boundary ( CS%u\_face\_mask\_bdry, CS%v\_face\_mask\_bdry, &}
01493     \textcolor{comment}{!                                      CS%u\_flux\_bdry\_val, CS%v\_flux\_bdry\_val, &}
01494     \textcolor{comment}{!                                      CS%u\_bdry\_val, CS%v\_bdry\_val, CS%h\_bdry\_val, &}
01495     \textcolor{comment}{!                                      ISS%hmask, G, param\_file)}
01496 
01497 \textcolor{keywordflow}{  endif}
01498 
01499   \textcolor{keywordflow}{if} (new\_sim .and. (.not. (cs%override\_shelf\_movement .and. cs%mass\_from\_file))) \textcolor{keywordflow}{then}
01500 
01501     \textcolor{comment}{! This model is initialized internally or from a file.}
01502     \textcolor{keyword}{call }initialize\_ice\_thickness(iss%h\_shelf, iss%area\_shelf\_h, iss%hmask, g, us, param\_file)
01503 
01504     \textcolor{comment}{! next make sure mass is consistent with thickness}
01505     \textcolor{keywordflow}{do} j=g%jsd,g%jed ; \textcolor{keywordflow}{do} i=g%isd,g%ied
01506       \textcolor{keywordflow}{if} ((iss%hmask(i,j) == 1) .or. (iss%hmask(i,j) == 2)) \textcolor{keywordflow}{then}
01507         iss%mass\_shelf(i,j) = iss%h\_shelf(i,j)*cs%density\_ice
01508 \textcolor{keywordflow}{      endif}
01509 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
01510 
01511   \textcolor{comment}{! else ! Previous block for new\_sim=.T., this block restores the state.}
01512   \textcolor{keywordflow}{elseif} (.not.new\_sim) \textcolor{keywordflow}{then}
01513     \textcolor{comment}{! This line calls a subroutine that reads the initial conditions from a restart file.}
01514     \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"MOM\_ice\_shelf.F90, initialize\_ice\_shelf: Restoring ice shelf from file."})
01515     \textcolor{keyword}{call }restore\_state(dirs%input\_filename, dirs%restart\_input\_dir, time, &
01516                        g, cs%restart\_CSp)
01517 
01518     \textcolor{keywordflow}{if} ((us%m\_to\_Z\_restart /= 0.0) .and. (us%m\_to\_Z\_restart /= us%m\_to\_Z)) \textcolor{keywordflow}{then}
01519       z\_rescale = us%m\_to\_Z / us%m\_to\_Z\_restart
01520       \textcolor{keywordflow}{do} j=g%jsc,g%jec ; \textcolor{keywordflow}{do} i=g%isc,g%iec
01521         iss%h\_shelf(i,j) = z\_rescale * iss%h\_shelf(i,j)
01522 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
01523 \textcolor{keywordflow}{    endif}
01524 
01525     \textcolor{keywordflow}{if} ((us%m\_to\_Z\_restart*us%kg\_m3\_to\_R\_restart /= 0.0) .and. &
01526         (us%m\_to\_Z*us%kg\_m3\_to\_R /= us%m\_to\_Z\_restart * us%kg\_m3\_to\_R\_restart)) \textcolor{keywordflow}{then}
01527       rz\_rescale = us%m\_to\_Z*us%kg\_m3\_to\_R / (us%m\_to\_Z\_restart * us%kg\_m3\_to\_R\_restart)
01528       \textcolor{keywordflow}{do} j=g%jsc,g%jec ; \textcolor{keywordflow}{do} i=g%isc,g%iec
01529         iss%mass\_shelf(i,j) = rz\_rescale * iss%mass\_shelf(i,j)
01530 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
01531 \textcolor{keywordflow}{    endif}
01532 
01533     \textcolor{keywordflow}{if} ((us%m\_to\_L\_restart /= 0.0) .and. (us%m\_to\_L\_restart /= us%m\_to\_L)) \textcolor{keywordflow}{then}
01534       l\_rescale = us%m\_to\_L / us%m\_to\_L\_restart
01535       \textcolor{keywordflow}{do} j=g%jsc,g%jec ; \textcolor{keywordflow}{do} i=g%isc,g%iec
01536         iss%area\_shelf\_h(i,j) = l\_rescale**2 * iss%area\_shelf\_h(i,j)
01537 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
01538 \textcolor{keywordflow}{    endif}
01539 
01540 \textcolor{keywordflow}{  endif} \textcolor{comment}{! .not. new\_sim}
01541 
01542   cs%Time = time
01543 
01544   \textcolor{keyword}{call }cpu\_clock\_begin(\hyperlink{namespacemom__ice__shelf_a3db8709f10aa77ed302598f3a23a608d}{id\_clock\_pass})
01545   \textcolor{keyword}{call }pass\_var(iss%area\_shelf\_h, g%domain)
01546   \textcolor{keyword}{call }pass\_var(iss%h\_shelf, g%domain)
01547   \textcolor{keyword}{call }pass\_var(iss%mass\_shelf, g%domain)
01548   \textcolor{keyword}{call }pass\_var(iss%hmask, g%domain)
01549   \textcolor{keyword}{call }pass\_var(g%bathyT, g%domain)
01550   \textcolor{keyword}{call }cpu\_clock\_end(\hyperlink{namespacemom__ice__shelf_a3db8709f10aa77ed302598f3a23a608d}{id\_clock\_pass})
01551 
01552   \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isd,ied
01553     \textcolor{keywordflow}{if} (iss%area\_shelf\_h(i,j) > g%areaT(i,j)) \textcolor{keywordflow}{then}
01554       \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"Initialize\_ice\_shelf: area\_shelf\_h exceeds G%areaT."})
01555       iss%area\_shelf\_h(i,j) = g%areaT(i,j)
01556 \textcolor{keywordflow}{    endif}
01557 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
01558   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(fluxes)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isd,ied
01559     \textcolor{keywordflow}{if} (g%areaT(i,j) > 0.0) fluxes%frac\_shelf\_h(i,j) = iss%area\_shelf\_h(i,j) / g%areaT(i,j)
01560 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}
01561 
01562   \textcolor{keywordflow}{if} (cs%debug) \textcolor{keywordflow}{then}
01563     \textcolor{keyword}{call }hchksum(fluxes%frac\_shelf\_h, \textcolor{stringliteral}{"IS init: frac\_shelf\_h"}, g%HI, haloshift=0)
01564 \textcolor{keywordflow}{  endif}
01565 
01566   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(forces)) &
01567     \textcolor{keyword}{call }\hyperlink{namespacemom__ice__shelf_a0274b25df07d5fa712d038c31f921cbc}{add\_shelf\_forces}(g, us, cs, forces, do\_shelf\_area=.not.cs%solo\_ice\_sheet)
01568 
01569   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(fluxes)) \textcolor{keyword}{call }\hyperlink{namespacemom__ice__shelf_aca1d1c1db015f270ce1b1f93d16dea91}{add\_shelf\_pressure}(g, us, cs, fluxes)
01570 
01571   \textcolor{keywordflow}{if} (cs%active\_shelf\_dynamics .and. .not.cs%isthermo) \textcolor{keywordflow}{then}
01572     iss%water\_flux(:,:) = 0.0
01573 \textcolor{keywordflow}{  endif}
01574 
01575   \textcolor{keywordflow}{if} (shelf\_mass\_is\_dynamic) &
01576     \textcolor{keyword}{call }initialize\_ice\_shelf\_dyn(param\_file, time, iss, cs%dCS, g, us, diag, new\_sim, solo\_ice\_sheet\_in)
01577 
01578   \textcolor{keyword}{call }\hyperlink{namespacemom__unit__scaling_a0d99ae286970838e8f4cd534e3a2744c}{fix\_restart\_unit\_scaling}(us)
01579 
01580   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SAVE\_INITIAL\_CONDS"}, save\_ic, &
01581                  \textcolor{stringliteral}{"If true, save the ice shelf initial conditions."}, &
01582                  default=.false.)
01583   \textcolor{keywordflow}{if} (save\_ic) \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_IC\_OUTPUT\_FILE"}, ic\_file,&
01584                  \textcolor{stringliteral}{"The name-root of the output file for the ice shelf "}//&
01585                  \textcolor{stringliteral}{"initial conditions."}, default=\textcolor{stringliteral}{"MOM\_Shelf\_IC"})
01586 
01587   \textcolor{keywordflow}{if} (save\_ic .and. .not.((dirs%input\_filename(1:1) == \textcolor{stringliteral}{'r'}) .and. &
01588                           (len\_trim(dirs%input\_filename) == 1))) \textcolor{keywordflow}{then}
01589     \textcolor{keyword}{call }save\_restart(dirs%output\_directory, cs%Time, g, &
01590                       cs%restart\_CSp, filename=ic\_file)
01591 \textcolor{keywordflow}{  endif}
01592 
01593 
01594   cs%id\_area\_shelf\_h = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'area\_shelf\_h'}, cs%diag%axesT1, cs%Time, &
01595      \textcolor{stringliteral}{'Ice Shelf Area in cell'}, \textcolor{stringliteral}{'meter-2'}, conversion=us%L\_to\_m**2)
01596   cs%id\_shelf\_mass = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'shelf\_mass'}, cs%diag%axesT1, cs%Time, &
01597      \textcolor{stringliteral}{'mass of shelf'}, \textcolor{stringliteral}{'kg/m^2'}, conversion=us%RZ\_to\_kg\_m2)
01598   cs%id\_h\_shelf = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'h\_shelf'}, cs%diag%axesT1, cs%Time, &
01599        \textcolor{stringliteral}{'ice shelf thickness'}, \textcolor{stringliteral}{'m'}, conversion=us%Z\_to\_m)
01600   cs%id\_mass\_flux = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'mass\_flux'}, cs%diag%axesT1,&
01601      cs%Time, \textcolor{stringliteral}{'Total mass flux of freshwater across the ice-ocean interface.'}, &
01602      \textcolor{stringliteral}{'kg/s'}, conversion=us%RZ\_T\_to\_kg\_m2s*us%L\_to\_m**2)
01603 
01604   \textcolor{keywordflow}{if} (cs%const\_gamma) \textcolor{keywordflow}{then} \textcolor{comment}{! use ISOMIP+ eq. with rho\_fw = 1000. kg m-3}
01605     meltrate\_conversion = 86400.0*365.0*us%Z\_to\_m*us%s\_to\_T / (1000.0*us%kg\_m3\_to\_R)
01606   \textcolor{keywordflow}{else} \textcolor{comment}{! use original eq.}
01607     meltrate\_conversion = 86400.0*365.0*us%Z\_to\_m*us%s\_to\_T / cs%density\_ice
01608 \textcolor{keywordflow}{  endif}
01609   cs%id\_melt = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'melt'}, cs%diag%axesT1, cs%Time, &
01610      \textcolor{stringliteral}{'Ice Shelf Melt Rate'}, \textcolor{stringliteral}{'m yr-1'}, conversion= meltrate\_conversion)
01611   cs%id\_thermal\_driving = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'thermal\_driving'}, cs%diag%axesT1, cs%Time, &
01612      \textcolor{stringliteral}{'pot. temp. in the boundary layer minus freezing pot. temp. at the ice-ocean interface.'}, \textcolor{stringliteral}{'Celsius'})
01613   cs%id\_haline\_driving = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'haline\_driving'}, cs%diag%axesT1, cs%Time, &
01614      \textcolor{stringliteral}{'salinity in the boundary layer minus salinity at the ice-ocean interface.'}, \textcolor{stringliteral}{'psu'})
01615   cs%id\_Sbdry = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'sbdry'}, cs%diag%axesT1, cs%Time, &
01616      \textcolor{stringliteral}{'salinity at the ice-ocean interface.'}, \textcolor{stringliteral}{'psu'})
01617   cs%id\_u\_ml = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'u\_ml'}, cs%diag%axesCu1, cs%Time, &
01618      \textcolor{stringliteral}{'Eastward vel. in the boundary layer (used to compute ustar)'}, \textcolor{stringliteral}{'m s-1'}, conversion=us%L\_T\_to\_m\_s)
01619   cs%id\_v\_ml = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'v\_ml'}, cs%diag%axesCv1, cs%Time, &
01620      \textcolor{stringliteral}{'Northward vel. in the boundary layer (used to compute ustar)'}, \textcolor{stringliteral}{'m s-1'}, conversion=us%L\_T\_to\_m\_s)
01621   cs%id\_exch\_vel\_s = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'exch\_vel\_s'}, cs%diag%axesT1, cs%Time, &
01622      \textcolor{stringliteral}{'Sub-shelf salinity exchange velocity'}, \textcolor{stringliteral}{'m s-1'}, conversion=us%Z\_to\_m*us%s\_to\_T)
01623   cs%id\_exch\_vel\_t = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'exch\_vel\_t'}, cs%diag%axesT1, cs%Time, &
01624      \textcolor{stringliteral}{'Sub-shelf thermal exchange velocity'}, \textcolor{stringliteral}{'m s-1'} , conversion=us%Z\_to\_m*us%s\_to\_T)
01625   cs%id\_tfreeze = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'tfreeze'}, cs%diag%axesT1, cs%Time, &
01626      \textcolor{stringliteral}{'In Situ Freezing point at ice shelf interface'}, \textcolor{stringliteral}{'degC'})
01627   cs%id\_tfl\_shelf = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'tflux\_shelf'}, cs%diag%axesT1, cs%Time, &
01628      \textcolor{stringliteral}{'Heat conduction into ice shelf'}, \textcolor{stringliteral}{'W m-2'}, conversion=-us%QRZ\_T\_to\_W\_m2)
01629   cs%id\_ustar\_shelf = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'ustar\_shelf'}, cs%diag%axesT1, cs%Time, &
01630      \textcolor{stringliteral}{'Fric vel under shelf'}, \textcolor{stringliteral}{'m/s'}, conversion=us%Z\_to\_m*us%s\_to\_T)
01631   \textcolor{keywordflow}{if} (cs%active\_shelf\_dynamics) \textcolor{keywordflow}{then}
01632     cs%id\_h\_mask = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'h\_mask'}, cs%diag%axesT1, cs%Time, &
01633        \textcolor{stringliteral}{'ice shelf thickness mask'}, \textcolor{stringliteral}{'none'})
01634 \textcolor{keywordflow}{  endif}
01635 
01636   \hyperlink{namespacemom__ice__shelf_a5aff3e9a37cb5bc2b5b998bf296437ff}{id\_clock\_shelf} = cpu\_clock\_id(\textcolor{stringliteral}{'Ice shelf'}, grain=clock\_component)
01637   \hyperlink{namespacemom__ice__shelf_a3db8709f10aa77ed302598f3a23a608d}{id\_clock\_pass} = cpu\_clock\_id(\textcolor{stringliteral}{' Ice shelf halo updates'}, grain=clock\_routine)
01638 
01639 \textcolor{keyword}{end subroutine }\hyperlink{namespacemom__ice__shelf_a5990f9918493ff4984245eac74e5f4d9}{initialize\_ice\_shelf}
01640 \textcolor{comment}{}
01641 \textcolor{comment}{!> Initializes shelf mass based on three options (file, zero and user)}
01642 \textcolor{keyword}{subroutine }\hyperlink{namespacemom__ice__shelf_ac478a1dd52137f8e851916bee2243fa3}{initialize\_shelf\_mass}(G, param\_file, CS, ISS, new\_sim)
\Hypertarget{MOM__ice__shelf_8F90_source_l01643}\hyperlink{namespacemom__ice__shelf_ac478a1dd52137f8e851916bee2243fa3}{01643} 
01644   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{   !< The ocean's grid structure.}
01645   \textcolor{keywordtype}{type}(param\_file\_type), \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
01646   \textcolor{keywordtype}{type}(\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs}),    \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< A pointer to the ice shelf control structure}
01647   \textcolor{keywordtype}{type}(ice\_shelf\_state), \textcolor{keywordtype}{intent(inout)} :: ISS\textcolor{comment}{ !< The ice shelf state type that is being updated}
01648   \textcolor{keywordtype}{logical},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: new\_sim\textcolor{comment}{ !< If present and false, this run is being restarted}
01649 
01650   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je
01651   \textcolor{keywordtype}{logical} :: read\_shelf\_area, new\_sim\_2
01652   \textcolor{keywordtype}{character(len=240)} :: config, inputdir, shelf\_file, filename
01653   \textcolor{keywordtype}{character(len=120)} :: shelf\_mass\_var  \textcolor{comment}{! The name of shelf mass in the file.}
01654   \textcolor{keywordtype}{character(len=120)} :: shelf\_area\_var \textcolor{comment}{! The name of shelf area in the file.}
01655   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_ice\_shelf"}
01656   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
01657 
01658   new\_sim\_2 = .true. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(new\_sim)) new\_sim\_2 = new\_sim
01659 
01660   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ICE\_SHELF\_CONFIG"}, config, &
01661                  \textcolor{stringliteral}{"A string that specifies how the ice shelf is "}//&
01662                  \textcolor{stringliteral}{"initialized. Valid options include:\(\backslash\)n"}//&
01663                  \textcolor{stringliteral}{" \(\backslash\)tfile\(\backslash\)t Read from a file.\(\backslash\)n"}//&
01664                  \textcolor{stringliteral}{" \(\backslash\)tzero\(\backslash\)t Set shelf mass to 0 everywhere.\(\backslash\)n"}//&
01665                  \textcolor{stringliteral}{" \(\backslash\)tUSER\(\backslash\)t Call USER\_initialize\_shelf\_mass.\(\backslash\)n"}, &
01666                  fail\_if\_missing=.true.)
01667 
01668   \textcolor{keywordflow}{select case} ( trim(config) )
01669     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"file"})
01670 
01671       \textcolor{keyword}{call }time\_interp\_external\_init()
01672 
01673       \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR"}, inputdir, default=\textcolor{stringliteral}{"."})
01674       inputdir = slasher(inputdir)
01675 
01676       \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_FILE"}, shelf\_file, &
01677               \textcolor{stringliteral}{"If DYNAMIC\_SHELF\_MASS = True, OVERRIDE\_SHELF\_MOVEMENT = True "}//&
01678               \textcolor{stringliteral}{"and ICE\_SHELF\_MASS\_FROM\_FILE = True, this is the file from "}//&
01679               \textcolor{stringliteral}{"which to read the shelf mass and area."}, &
01680                default=\textcolor{stringliteral}{"shelf\_mass.nc"})
01681       \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_MASS\_VAR"}, shelf\_mass\_var, &
01682                  \textcolor{stringliteral}{"The variable in SHELF\_FILE with the shelf mass."}, &
01683                  default=\textcolor{stringliteral}{"shelf\_mass"})
01684       \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"READ\_SHELF\_AREA"}, read\_shelf\_area, &
01685                  \textcolor{stringliteral}{"If true, also read the area covered by ice-shelf from SHELF\_FILE."}, &
01686                  default=.false.)
01687 
01688       filename = trim(slasher(inputdir))//trim(shelf\_file)
01689       \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR/SHELF\_FILE"}, filename)
01690 
01691       cs%id\_read\_mass = init\_external\_field(filename, shelf\_mass\_var, &
01692                           domain=g%Domain%mpp\_domain, verbose=cs%debug)
01693 
01694       \textcolor{keywordflow}{if} (read\_shelf\_area) \textcolor{keywordflow}{then}
01695          \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SHELF\_AREA\_VAR"}, shelf\_area\_var, &
01696                   \textcolor{stringliteral}{"The variable in SHELF\_FILE with the shelf area."}, &
01697                   default=\textcolor{stringliteral}{"shelf\_area"})
01698 
01699          cs%id\_read\_area = init\_external\_field(filename,shelf\_area\_var, &
01700                              domain=g%Domain%mpp\_domain)
01701 \textcolor{keywordflow}{      endif}
01702 
01703       \textcolor{keywordflow}{if} (.not.file\_exists(filename, g%Domain)) \textcolor{keyword}{call }mom\_error(fatal, &
01704            \textcolor{stringliteral}{" initialize\_shelf\_mass: Unable to open "}//trim(filename))
01705 
01706     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"zero"})
01707       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
01708         iss%mass\_shelf(i,j) = 0.0
01709         iss%area\_shelf\_h(i,j) = 0.0
01710 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
01711 
01712     \textcolor{keywordflow}{case} (\textcolor{stringliteral}{"USER"})
01713       \textcolor{keyword}{call }user\_initialize\_shelf\_mass(iss%mass\_shelf, iss%area\_shelf\_h, &
01714                    iss%h\_shelf, iss%hmask, g, cs%US, cs%user\_CS, param\_file, new\_sim\_2)
01715 
01716 \textcolor{keywordflow}{    case default} ;  \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"initialize\_ice\_shelf: "}// &
01717       \textcolor{stringliteral}{"Unrecognized ice shelf setup "}//trim(config))
01718 \textcolor{keywordflow}{  end select}
01719 
01720 \textcolor{keyword}{end subroutine }\hyperlink{namespacemom__ice__shelf_ac478a1dd52137f8e851916bee2243fa3}{initialize\_shelf\_mass}
01721 \textcolor{comment}{}
01722 \textcolor{comment}{!> Updates the ice shelf mass using data from a file.}
01723 \textcolor{keyword}{subroutine }\hyperlink{namespacemom__ice__shelf_a6f0fa9f98ac01752ca2983c7e9816097}{update\_shelf\_mass}(G, US, CS, ISS, Time)
\Hypertarget{MOM__ice__shelf_8F90_source_l01724}\hyperlink{namespacemom__ice__shelf_a6f0fa9f98ac01752ca2983c7e9816097}{01724}   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{   !< The ocean's grid structure.}
01725   \textcolor{keywordtype}{type}(\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\_scale\_type}), \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{   !< A dimensional unit scaling type}
01726   \textcolor{keywordtype}{type}(\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs}),    \textcolor{keywordtype}{intent(in)}    :: CS\textcolor{comment}{  !< A pointer to the ice shelf control structure}
01727   \textcolor{keywordtype}{type}(ice\_shelf\_state), \textcolor{keywordtype}{intent(inout)} :: ISS\textcolor{comment}{ !< The ice shelf state type that is being updated}
01728   \textcolor{keywordtype}{type}(time\_type),       \textcolor{keywordtype}{intent(in)}    :: Time\textcolor{comment}{ !< The current model time}
01729 
01730   \textcolor{comment}{! local variables}
01731   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je
01732   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
01733 
01734   \textcolor{keyword}{call }time\_interp\_external(cs%id\_read\_mass, time, iss%mass\_shelf)
01735   \textcolor{comment}{! This should only be done if time\_interp\_external did an update.}
01736   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
01737     iss%mass\_shelf(i,j) = us%kg\_m3\_to\_R*us%m\_to\_Z * iss%mass\_shelf(i,j) \textcolor{comment}{! Rescale after time\_interp}
01738 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
01739 
01740   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
01741     iss%area\_shelf\_h(i,j) = 0.0
01742     iss%hmask(i,j) = 0.
01743     \textcolor{keywordflow}{if} (iss%mass\_shelf(i,j) > 0.0) \textcolor{keywordflow}{then}
01744       iss%area\_shelf\_h(i,j) = g%areaT(i,j)
01745       iss%h\_shelf(i,j) = iss%mass\_shelf(i,j) / cs%density\_ice
01746       iss%hmask(i,j) = 1.
01747 \textcolor{keywordflow}{    endif}
01748 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
01749 
01750   \textcolor{comment}{!call USER\_update\_shelf\_mass(ISS%mass\_shelf, ISS%area\_shelf\_h, ISS%h\_shelf, &}
01751   \textcolor{comment}{!                            ISS%hmask, CS%grid, CS%user\_CS, Time, .true.)}
01752 
01753   \textcolor{keywordflow}{if} (cs%min\_thickness\_simple\_calve > 0.0) \textcolor{keywordflow}{then}
01754     \textcolor{keyword}{call }ice\_shelf\_min\_thickness\_calve(g, iss%h\_shelf, iss%area\_shelf\_h, iss%hmask, &
01755                                        cs%min\_thickness\_simple\_calve, halo=0)
01756 \textcolor{keywordflow}{  endif}
01757 
01758   \textcolor{keyword}{call }pass\_var(iss%area\_shelf\_h, g%domain)
01759   \textcolor{keyword}{call }pass\_var(iss%h\_shelf, g%domain)
01760   \textcolor{keyword}{call }pass\_var(iss%hmask, g%domain)
01761   \textcolor{keyword}{call }pass\_var(iss%mass\_shelf, g%domain)
01762 
01763 \textcolor{keyword}{end subroutine }\hyperlink{namespacemom__ice__shelf_a6f0fa9f98ac01752ca2983c7e9816097}{update\_shelf\_mass}
01764 \textcolor{comment}{}
01765 \textcolor{comment}{!> Save the ice shelf restart file}
01766 \textcolor{keyword}{subroutine }\hyperlink{namespacemom__ice__shelf_a40ae01bbe3155191647f2150903dda69}{ice\_shelf\_save\_restart}(CS, Time, directory, time\_stamped, filename\_suffix)
\Hypertarget{MOM__ice__shelf_8F90_source_l01767}\hyperlink{namespacemom__ice__shelf_a40ae01bbe3155191647f2150903dda69}{01767}   \textcolor{keywordtype}{type}(\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs}),         \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< ice shelf control structure}
01768   \textcolor{keywordtype}{type}(time\_type),            \textcolor{keywordtype}{intent(in)} :: Time\textcolor{comment}{ !< model time at this call}
01769   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: directory\textcolor{comment}{ !< An optional directory into which to write}
01770 \textcolor{comment}{                                               !! these restart files.}
01771   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: time\_stamped\textcolor{comment}{ !< f true, the restart file names include}
01772 \textcolor{comment}{                                               !! a unique time stamp.  The default is false.}
01773   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: filename\_suffix\textcolor{comment}{ !< An optional suffix (e.g., a}
01774 \textcolor{comment}{                                               !! time-stamp) to append to the restart file names.}
01775   \textcolor{comment}{! local variables}
01776   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{pointer} :: G => null()
01777   \textcolor{keywordtype}{character(len=200)} :: restart\_dir
01778 
01779   g => cs%grid
01780 
01781   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(directory)) \textcolor{keywordflow}{then} ; restart\_dir = directory
01782   \textcolor{keywordflow}{else} ; restart\_dir = cs%restart\_output\_dir ;\textcolor{keywordflow}{ endif}
01783 
01784   \textcolor{keyword}{call }save\_restart(restart\_dir, time, cs%grid, cs%restart\_CSp, time\_stamped)
01785 
01786 \textcolor{keyword}{end subroutine }\hyperlink{namespacemom__ice__shelf_a40ae01bbe3155191647f2150903dda69}{ice\_shelf\_save\_restart}
01787 \textcolor{comment}{}
01788 \textcolor{comment}{!> Deallocates all memory associated with this module}
01789 \textcolor{keyword}{subroutine }\hyperlink{namespacemom__ice__shelf_a6d0412c7264e0480d5144d26995dd8d3}{ice\_shelf\_end}(CS)
\Hypertarget{MOM__ice__shelf_8F90_source_l01790}\hyperlink{namespacemom__ice__shelf_a6d0412c7264e0480d5144d26995dd8d3}{01790}   \textcolor{keywordtype}{type}(\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs}), \textcolor{keywordtype}{pointer}   :: CS\textcolor{comment}{ !< A pointer to the ice shelf control structure}
01791 
01792   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
01793 
01794   \textcolor{keyword}{call }ice\_shelf\_state\_end(cs%ISS)
01795 
01796   \textcolor{keywordflow}{if} (cs%active\_shelf\_dynamics) \textcolor{keyword}{call }ice\_shelf\_dyn\_end(cs%dCS)
01797 
01798   \textcolor{keyword}{deallocate}(cs)
01799 
01800 \textcolor{keyword}{end subroutine }\hyperlink{namespacemom__ice__shelf_a6d0412c7264e0480d5144d26995dd8d3}{ice\_shelf\_end}
01801 \textcolor{comment}{}
01802 \textcolor{comment}{!> This routine is for stepping a stand-alone ice shelf model without an ocean.}
01803 \textcolor{keyword}{subroutine }\hyperlink{namespacemom__ice__shelf_a0678e919d45fc9e9e9b00dce3564a2fc}{solo\_step\_ice\_shelf}(CS, time\_interval, nsteps, Time, min\_time\_step\_in)
\Hypertarget{MOM__ice__shelf_8F90_source_l01804}\hyperlink{namespacemom__ice__shelf_a0678e919d45fc9e9e9b00dce3564a2fc}{01804}   \textcolor{keywordtype}{type}(\hyperlink{structmom__ice__shelf_1_1ice__shelf__cs}{ice\_shelf\_cs}), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{      !< A pointer to the ice shelf control structure}
01805   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{intent(in)}    :: time\_interval\textcolor{comment}{ !< The time interval for this update [s].}
01806   \textcolor{keywordtype}{integer},         \textcolor{keywordtype}{intent(inout)} :: nsteps\textcolor{comment}{  !< The running number of ice shelf steps.}
01807   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{intent(inout)} :: Time\textcolor{comment}{    !< The current model time}
01808   \textcolor{keywordtype}{real},  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: min\_time\_step\_in\textcolor{comment}{ !< The minimum permitted time step [T ~> s].}
01809 
01810   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{pointer} :: G => null()  \textcolor{comment}{! A pointer to the ocean's grid structure}
01811   \textcolor{keywordtype}{type}(\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\_scale\_type}), \textcolor{keywordtype}{pointer} :: US => null() \textcolor{comment}{! Pointer to a structure containing}
01812                                                  \textcolor{comment}{! various unit conversion factors}
01813   \textcolor{keywordtype}{type}(ice\_shelf\_state), \textcolor{keywordtype}{pointer} :: ISS => null() \textcolor{comment}{!< A structure with elements that describe}
01814 \textcolor{comment}{                                          !! the ice-shelf state}
01815   \textcolor{keywordtype}{real} :: remaining\_time    \textcolor{comment}{! The remaining time in this call [T ~> s]}
01816   \textcolor{keywordtype}{real} :: time\_step         \textcolor{comment}{! The internal time step during this call [T ~> s]}
01817   \textcolor{keywordtype}{real} :: min\_time\_step     \textcolor{comment}{! The minimal required timestep that would indicate a fatal problem [T ~> s]}
01818   \textcolor{keywordtype}{character(len=240)} :: mesg
01819   \textcolor{keywordtype}{logical} :: update\_ice\_vel \textcolor{comment}{! If true, it is time to update the ice shelf velocities.}
01820   \textcolor{keywordtype}{logical} :: coupled\_GL     \textcolor{comment}{! If true the grouding line position is determined based on}
01821                             \textcolor{comment}{! coupled ice-ocean dynamics.}
01822   \textcolor{keywordtype}{integer} :: is, iec, js, jec, i, j
01823 
01824   g => cs%grid
01825   us => cs%US
01826   iss => cs%ISS
01827   is = g%isc ; iec = g%iec ; js = g%jsc ; jec = g%jec
01828 
01829   remaining\_time = us%s\_to\_T*time\_type\_to\_real(time\_interval)
01830 
01831   \textcolor{keywordflow}{if} (\textcolor{keyword}{present} (min\_time\_step\_in)) \textcolor{keywordflow}{then}
01832     min\_time\_step = min\_time\_step\_in
01833   \textcolor{keywordflow}{else}
01834     min\_time\_step = 1000.0*us%s\_to\_T \textcolor{comment}{! At 1 km resolution this would imply ice is moving at ~1 meter per
       second}
01835 \textcolor{keywordflow}{  endif}
01836 
01837   \textcolor{keyword}{write} (mesg,*) \textcolor{stringliteral}{"TIME in ice shelf call, yrs: "}, time\_type\_to\_real(time)/(365. * 86400.)
01838   \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"solo\_step\_ice\_shelf: "}//mesg, 5)
01839 
01840   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (remaining\_time > 0.0)
01841     nsteps = nsteps+1
01842 
01843     \textcolor{comment}{! If time\_interval is not too long, this is unnecessary.}
01844     time\_step = min(ice\_time\_step\_cfl(cs%dCS, iss, g), remaining\_time)
01845 
01846     \textcolor{keyword}{write} (mesg,*) \textcolor{stringliteral}{"Ice model timestep = "}, us%T\_to\_s*time\_step, \textcolor{stringliteral}{" seconds"}
01847     \textcolor{keywordflow}{if} ((time\_step < min\_time\_step) .and. (time\_step < remaining\_time))  \textcolor{keywordflow}{then}
01848       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"MOM\_ice\_shelf:solo\_step\_ice\_shelf: abnormally small timestep "}//mesg)
01849     \textcolor{keywordflow}{else}
01850       \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"solo\_step\_ice\_shelf: "}//mesg, 5)
01851 \textcolor{keywordflow}{    endif}
01852 
01853     remaining\_time = remaining\_time - time\_step
01854 
01855     \textcolor{comment}{! If the last mini-timestep is a day or less, we cannot expect velocities to change by much.}
01856     \textcolor{comment}{! Do not update the velocities if the last step is very short.}
01857     update\_ice\_vel = ((time\_step > min\_time\_step) .or. (remaining\_time > 0.0))
01858     coupled\_gl = .false.
01859 
01860     \textcolor{keyword}{call }update\_ice\_shelf(cs%dCS, iss, g, us, time\_step, time, must\_update\_vel=update\_ice\_vel)
01861 
01862     \textcolor{keyword}{call }enable\_averages(time\_step, time, cs%diag)
01863     \textcolor{keywordflow}{if} (cs%id\_area\_shelf\_h > 0) \textcolor{keyword}{call }post\_data(cs%id\_area\_shelf\_h, iss%area\_shelf\_h, cs%diag)
01864     \textcolor{keywordflow}{if} (cs%id\_h\_shelf > 0) \textcolor{keyword}{call }post\_data(cs%id\_h\_shelf, iss%h\_shelf, cs%diag)
01865     \textcolor{keywordflow}{if} (cs%id\_h\_mask > 0) \textcolor{keyword}{call }post\_data(cs%id\_h\_mask, iss%hmask, cs%diag)
01866     \textcolor{keyword}{call }disable\_averaging(cs%diag)
01867 
01868 \textcolor{keywordflow}{  enddo}
01869 
01870 \textcolor{keyword}{end subroutine }\hyperlink{namespacemom__ice__shelf_a0678e919d45fc9e9e9b00dce3564a2fc}{solo\_step\_ice\_shelf}
01871 \textcolor{comment}{}
01872 \textcolor{comment}{!> \(\backslash\)namespace mom\_ice\_shelf}
01873 \textcolor{comment}{!!}
01874 \textcolor{comment}{!! \(\backslash\)section section\_ICE\_SHELF}
01875 \textcolor{comment}{!!}
01876 \textcolor{comment}{!! This module implements the thermodynamic aspects of ocean/ice-shelf}
01877 \textcolor{comment}{!! inter-actions using the MOM framework and coding style.}
01878 \textcolor{comment}{!!}
01879 \textcolor{comment}{!! Derived from code by Chris Little, early 2010.}
01880 \textcolor{comment}{!!}
01881 \textcolor{comment}{!!   The ice-sheet dynamics subroutines do the following:}
01882 \textcolor{comment}{!!  initialize\_shelf\_mass - Initializes the ice shelf mass distribution.}
01883 \textcolor{comment}{!!      - Initializes h\_shelf, h\_mask, area\_shelf\_h}
01884 \textcolor{comment}{!!      - CURRENTLY: initializes mass\_shelf as well, but this is unnecessary, as mass\_shelf is initialized
       based on}
01885 \textcolor{comment}{!!             h\_shelf and density\_ice immediately afterwards. Possibly subroutine should be renamed}
01886 \textcolor{comment}{!!  update\_shelf\_mass - updates ice shelf mass via netCDF file}
01887 \textcolor{comment}{!!                      USER\_update\_shelf\_mass (TODO).}
01888 \textcolor{comment}{!!    solo\_step\_ice\_shelf - called only in ice-only mode.}
01889 \textcolor{comment}{!!    shelf\_calc\_flux - after melt rate & fluxes are calculated, ice dynamics are done. currently
       mass\_shelf is}
01890 \textcolor{comment}{!! updated immediately after ice\_shelf\_advect in fully dynamic mode.}
01891 \textcolor{comment}{!!}
01892 \textcolor{comment}{!!   NOTES: be aware that hmask(:,:) has a number of functions; it is used for front advancement,}
01893 \textcolor{comment}{!! for subroutines in the velocity solve, and for thickness boundary conditions (this last one may be
       removed).}
01894 \textcolor{comment}{!! in other words, interfering with its updates will have implications you might not expect.}
01895 \textcolor{comment}{!!}
01896 \textcolor{comment}{!!  Overall issues: Many variables need better documentation and units and the}
01897 \textcolor{comment}{!!                  subgrid on which they are discretized.}
01898 \textcolor{comment}{!!}
01899 \textcolor{comment}{!! \(\backslash\)subsection section\_ICE\_SHELF\_equations ICE\_SHELF equations}
01900 \textcolor{comment}{!!}
01901 \textcolor{comment}{!! The three fundamental equations are:}
01902 \textcolor{comment}{!! Heat flux}
01903 \textcolor{comment}{!! \(\backslash\)f[ \(\backslash\)qquad \(\backslash\)rho\_w  C\_\{pw\} \(\backslash\)gamma\_T (T\_w - T\_b) = \(\backslash\)rho\_i  \(\backslash\)dot\{m\}  L\_f \(\backslash\)f]}
01904 \textcolor{comment}{!! Salt flux}
01905 \textcolor{comment}{!! \(\backslash\)f[  \(\backslash\)qquad \(\backslash\)rho\_w \(\backslash\)gamma\_s (S\_w - S\_b) =  \(\backslash\)rho\_i \(\backslash\)dot\{m\} S\_b \(\backslash\)f]}
01906 \textcolor{comment}{!! Freezing temperature}
01907 \textcolor{comment}{!! \(\backslash\)f[  \(\backslash\)qquad T\_b = a S\_b + b + c P \(\backslash\)f]}
01908 \textcolor{comment}{!!}
01909 \textcolor{comment}{!! where ....}
01910 \textcolor{comment}{!!}
01911 \textcolor{comment}{!! \(\backslash\)subsection section\_ICE\_SHELF\_references References}
01912 \textcolor{comment}{!!}
01913 \textcolor{comment}{!! Asay-Davis, Xylar S., Stephen L. Cornford, Benjamin K. Galton-Fenzi, Rupert M. Gladstone, G. Hilmar
       Gudmundsson,}
01914 \textcolor{comment}{!! David M. Holland, Paul R. Holland, and Daniel F. Martin. Experimental design for three interrelated
       marine ice sheet}
01915 \textcolor{comment}{!! and ocean model intercomparison projects: MISMIP v. 3 (MISMIP+), ISOMIP v. 2 (ISOMIP+) and MISOMIP v. 1
       (MISOMIP1).}
01916 \textcolor{comment}{!! Geoscientific Model Development 9, no. 7 (2016): 2471.}
01917 \textcolor{comment}{!!}
01918 \textcolor{comment}{!! Goldberg, D. N., et al. Investigation of land ice-ocean interaction with a fully coupled ice-ocean
       model: 1.}
01919 \textcolor{comment}{!!  Model description and behavior. Journal of Geophysical Research: Earth Surface 117.F2 (2012).}
01920 \textcolor{comment}{!!}
01921 \textcolor{comment}{!! Goldberg, D. N., et al. Investigation of land ice-ocean interaction with a fully coupled ice-ocean
       model: 2.}
01922 \textcolor{comment}{!! Sensitivity to external forcings. Journal of Geophysical Research: Earth Surface 117.F2 (2012).}
01923 \textcolor{comment}{!!}
01924 \textcolor{comment}{!! Holland, David M., and Adrian Jenkins. Modeling thermodynamic ice-ocean interactions at the base of an
       ice shelf.}
01925 \textcolor{comment}{!! Journal of Physical Oceanography 29.8 (1999): 1787-1800.}
01926 
01927 \textcolor{keyword}{end module }\hyperlink{namespacemom__ice__shelf}{mom\_ice\_shelf}
\end{DoxyCode}
