SAMSIM
Functions/Subroutines
mo_functions Module Reference

Module houses functions which have no home :(. More...

Functions/Subroutines

real(wp) function func_density (T, S)
 Calculates the physical density for given S and T. More...
 
real(wp) function func_freeboard (N_active, Nlayer, psi_s, psi_g, m, thick, m_snow, freeboard_snow_flag)
 Calculates the freeboard of the 1d ice column. More...
 
real(wp) function func_albedo (thick_snow, T_snow, psi_l, thick_min, albedo_flag)
 Calculates the albedo. More...
 
real(wp) function func_sat_o2 (T, S_bu)
 Calculates the oxygen saturation as a function of salinity and temperature. More...
 
real(wp) function func_t_freeze (S_bu, salt_flag)
 Calculates the freezing temperature. Salt_flag determines if either ocean salt or NAcl is used. More...
 
subroutine sub_notzflux (time, fl_sw, fl_rest)
 Calculates the incoming shortwave and other fluxes according to p. 193-194 PhD Notz. More...
 
subroutine sub_input (length_input, fl_sw_input, fl_lw_input, T2m_input, precip_input, time_input)
 Reads in data for atmoflux_flag ==2. More...
 
subroutine sub_turb_flux (T_bottom, S_bu_bottom, T, S_abs, m, dt, N_bgc, bgc_bottom, bgc_abs)
 Calculates salt and tracer mixing between lowest layer and underlying water. More...
 
subroutine sub_melt_thick (psi_l, psi_s, psi_g, T, T_freeze, T_top, fl_Q, thick_snow, dt, melt_thick, thick, thick_min)
 Calculates the thickness of the meltwater film. More...
 
subroutine sub_melt_snow (melt_thick, thick, thick_snow, H_abs, H_abs_snow, m, m_snow, psi_g_snow)
 Calculates how the meltwater film interacts with snow. More...
 

Detailed Description

Module houses functions which have no home :(.

Created because I wanted to calculate the freeboard separately and didn't know where to put it.

Author
Philipp Griewank

Function/Subroutine Documentation

real(wp) function mo_functions::func_albedo ( real(wp), intent(in)  thick_snow,
real(wp), intent(in)  T_snow,
real(wp), intent(in)  psi_l,
real(wp), intent(in)  thick_min,
integer, intent(in)  albedo_flag 
)

Calculates the albedo.

Calculates the albedo according to top conditions. This is not a good albedo scheme! It is only a quick approach. Non-continuous switching between wet and dry ice. Linear change from wet ice to water. Linear change from ice_dry snow for snow thinner than 30cm.

psi_l(1)> 0.75 water psi_l(1)> 0.6 linear change from wet ice to water psi_l(1)> 0.2 wet ice psi_l(1)< 0.2 -> dry ice T_snow = 0 -> wet snow T_snow < 0 -> dry snow

Revision History
Built to spill by Philipp Griewank (2011-02-12)
real(wp) function mo_functions::func_density ( real(wp), intent(in)  T,
real(wp), intent(in)  S 
)

Calculates the physical density for given S and T.

Although the model treats Salinity as a massless tracer, sometimes it is necessary to determine the exact density for specific purposes. First implemented to calculate simple turbulence between liquid layer and ocean. Uses following simplification of Frank J. Millero and Alain Poisson 1981: Density = density_0 +A*S+B*S**1.5

Revision History
Started by Philipp Griewank (2011-02-24)
real(wp) function mo_functions::func_freeboard ( integer, intent(in)  N_active,
integer, intent(in)  Nlayer,
real(wp), dimension(nlayer), intent(in)  psi_s,
real(wp), dimension(nlayer), intent(in)  psi_g,
real(wp), dimension(nlayer), intent(in)  m,
real(wp), dimension(nlayer), intent(in)  thick,
real(wp), intent(in)  m_snow,
integer, intent(in)  freeboard_snow_flag 
)

Calculates the freeboard of the 1d ice column.

The freeboard is calculated by first finding out which layer is at water level, and then finding out how deep the layer is submerged. For the correct freeboard the mass above water equals the buoyancy of the submerged part. Since the density of each layer is constant, step two can be calculated explicitly. The freeboard is the distance from the top of the ice to the water level. If snow pushes the ice underwater the freeboard becomes negative

Revision History
Built to spill by Philipp Griewank (2011-01-07)
Negative freeboard included by Philipp Griewank (2011-01-09)
Patched bug by Philipp Griewank (2011-03-10)
Add freeboard_snow_flag calculation of snow mass, check the code for further explanations by Niels Fuchs, MPIMET (2017-03-91)
real(wp) function mo_functions::func_sat_o2 ( real(wp), intent(in)  T,
real(wp), intent(in)  S_bu 
)

Calculates the oxygen saturation as a function of salinity and temperature.

Calculates the concentration of oxygen dissolved in freshwater and seawater in equilibrium with the atmosphere The value should be umol/kg. I switched to the solubility of nitrogen, oxygen and argon in water and sea wate from Weiss R.F. 1970 because I couldn't get the other one to work out

Revision History
Written by Dr. Philipp Griewank (2014-02-25)
real(wp) function mo_functions::func_t_freeze ( real(wp), intent(in)  S_bu,
integer, intent(in)  salt_flag 
)

Calculates the freezing temperature. Salt_flag determines if either ocean salt or NAcl is used.

Revision History
Written to procrastinate by Philipp Griewank (2011-05-05)
subroutine mo_functions::sub_input ( integer, intent(in)  length_input,
real(wp), dimension(:), intent(out), allocatable  fl_sw_input,
real(wp), dimension(:), intent(out), allocatable  fl_lw_input,
real(wp), dimension(:), intent(out), allocatable  T2m_input,
real(wp), dimension(:), intent(out), allocatable  precip_input,
real(wp), dimension(:), intent(out), allocatable  time_input 
)

Reads in data for atmoflux_flag ==2.

Standard setup used for testcase 4 and all Griewank & Notz 2013/14 reanalysis forced runs is 4.5 years of three hourly values of shortwave incoming, longwave incoming, two meter T, and total precipitation. Data is read from ascii files and stored in long 1D arrays. ERA-interim derived input files in the standard length for various Arctic locations are located under /input/ERA/ Latent and sensible heat fluxes are not included, but could be added if needed.

Revision History
Moved here from mo_grotz by Philipp Griewank (2014-04-20)
subroutine mo_functions::sub_melt_snow ( real(wp), intent(inout)  melt_thick,
real(wp), intent(inout)  thick,
real(wp), intent(inout)  thick_snow,
real(wp), intent(inout)  H_abs,
real(wp), intent(inout)  H_abs_snow,
real(wp), intent(inout)  m,
real(wp), intent(inout)  m_snow,
real(wp), intent(inout)  psi_g_snow 
)

Calculates how the meltwater film interacts with snow.

Is activated when a thin snow layer (thinner then thick_min) is on top of meltwater. The snow is flooded and turned into ice.

Revision History
Put together by Philipp Griewank (2011-10-17)
subroutine mo_functions::sub_melt_thick ( real(wp), intent(in)  psi_l,
real(wp), intent(in)  psi_s,
real(wp), intent(in)  psi_g,
real(wp), intent(in)  T,
real(wp), intent(in)  T_freeze,
real(wp), intent(in)  T_top,
real(wp), intent(in)  fl_Q,
real(wp), intent(in)  thick_snow,
real(wp), intent(in)  dt,
real(wp), intent(out)  melt_thick,
real(wp), intent(inout)  thick,
real(wp), intent(in)  thick_min 
)

Calculates the thickness of the meltwater film.

If the top ice layer is being melted (T_top>T_freeze) it is assumed that a thin meltwater film appears at the top. The thickness of this film is determined by the amount of incoming heat and diffusive transport. The incoming heat is an input (fl_q(1)) and the diffusive heat is (T(1)-T_freeze)/R. See the thermodynamics section for R. The thickness of the meltlayer is determined by dividing the heat intake of the meltwater film by the amount of latent heat needed to melt the solid fraction of the top layer. If the solid fractions sinks below a given threshold (psi_s_top_min) a different approach is used. The melt thickness is then calculated by assuming that the ice below the meltwater film has a solid fraction of psi_s_top_min. Although the thickness can be reduced, variations of mass, salinity and enthalpy are calculated in the flushing subroutine.

Revision History
Introduced by Philipp Griewank (2011-05-09)
subroutine mo_functions::sub_notzflux ( real(wp), intent(in)  time,
real(wp), intent(out)  fl_sw,
real(wp), intent(out)  fl_rest 
)

Calculates the incoming shortwave and other fluxes according to p. 193-194 PhD Notz.

Simplified version of the Untersteiner Fluxes. Returns only two fluxes as a function of time. Simplified Year, 12 months of 30 days. fl_sw is set to zero for November till February Returns fluxes for day with day zero being 1. Jan. Depending on when the run starts the time should be modified when calling

Revision History
Ripped from Dirk by Philipp Griewank (2011-02-13)
subroutine mo_functions::sub_turb_flux ( real(wp), intent(in)  T_bottom,
real(wp), intent(in)  S_bu_bottom,
real(wp), intent(in)  T,
real(wp), intent(inout)  S_abs,
real(wp), intent(in)  m,
real(wp), intent(in)  dt,
integer, intent(in)  N_bgc,
real(wp), dimension(n_bgc), intent(in), optional  bgc_bottom,
real(wp), dimension(n_bgc), intent(inout), optional  bgc_abs 
)

Calculates salt and tracer mixing between lowest layer and underlying water.

Very simple turbulence assumption which mixes the lowest layer with the underlying water. Based on assumption that there is a constant amount of turbulence A. This turbulence is amplified when the lowest layer is denser then the ocean mixed layer. And also dampened when the lowest layer is less dense then the mixed layer. Assumption; turb=A*exp(B(density_layer-density_ocean)) A and B set in parameters.i A = turb_A , B = turb_B

Revision History
Moved from grotz by Philipp Griewank (2014-04-2)