11 integer :: gsw_error_flag = 0
15 real (r8) :: saturation_fraction
17 real (r8),
dimension(:,:),
allocatable :: lat,
long 20 real (r8),
dimension(:,:),
allocatable :: value
21 real (r8),
dimension(:,:),
allocatable :: val1, val2, val3, val4, val5
22 real (r8),
dimension(:,:),
allocatable :: val6, val7, val8
25 real (r8),
dimension(:,:),
allocatable :: c, r, sr, sstar, pt, entropy
26 real (r8),
dimension(:,:),
allocatable :: h, ctf, tf, diff, z
27 real (r8),
dimension(:,:),
allocatable :: ctf_poly, tf_poly, pt0
62 print*,
'============================================================================' 64 print*,
' Gibbs SeaWater (GSW) Oceanographic Toolbox of TEOS-10 (Fortran)' 66 print*,
'============================================================================' 68 print*,
' These are the check values for the subset of functions that have been ' 70 print*,
' converted into FORTRAN 95 from the Gibbs SeaWater (GSW) Oceanographic ' 72 print*,
' Toolbox of TEOS-10.' 88 call section_title(
'Absolute Salinity, Preformed Salinity and Conservative Temperature')
100 call section_title(
'Other conversions between Temperatures, Salinities, Entropy, Pressure and Height')
326 saturation_fraction = 0.5_r8
376 call check_accuracy(
'pot_enthalpy_ice_freezing_first_derivatives',val1, &
378 call check_accuracy(
'pot_enthalpy_ice_freezing_first_derivatives',val2, &
382 call check_accuracy(
'pot_enthalpy_ice_freezing_first_derivatives_poly',val1, &
384 call check_accuracy(
'pot_enthalpy_ice_freezing_first_derivatives_poly',val2, &
388 call section_title(
'Isobaric Melting Enthalpy and Isobaric Evaporation Enthalpy')
406 call section_title(
'Density and enthalpy in terms of CT, derived from the exact Gibbs function')
416 call check_accuracy(
'enthalpy_second_derivatives_CT_exact',val1, &
418 call check_accuracy(
'enthalpy_second_derivatives_CT_exact',val2, &
420 call check_accuracy(
'enthalpy_second_derivatives_CT_exact',val3, &
424 call section_title(
'Basic thermodynamic properties in terms of in-situ t, based on the exact Gibbs function')
460 call check_accuracy(
't_deriv_chem_potential_water_t_exact',
value, &
479 deallocate(val1,val2,val3,val4,val5)
490 call gsw_turner_rsubrho(
sa(:,i),
ct(:,i),
p(:,i),val1(:,i),val2(:,i), &
498 call gsw_nsquared(
sa(:,i),
ct(:,i),
p(:,i),lat(:,i),val1(:,i),val2(:,i))
504 call gsw_nsquared_min(
sa(:,i),
ct(:,i),
p(:,i),lat(:,i),val1(:,i),val2(:,i), &
505 val3(:,i),val4(:,i),val5(:,i),val6(:,i),val7(:,i),val8(:,i))
534 call section_title(
'Geostrophic streamfunctions and acoustic travel time')
536 deallocate(val1,val2)
541 n = count(
sa(:,i) .lt. 1e90_r8)
631 saturation_fraction = 0.5_r8
638 call section_title(
'Thermodynamic interaction between ice and seawater')
640 deallocate(val1,val2,val3)
654 call check_accuracy(
'melting_ice_equilibrium_sa_ct_ratio',
value, &
658 call check_accuracy(
'melting_ice_equilibrium_sa_ct_ratio_poly',
value, &
662 t_ice,val1,val2,val3)
718 call section_title(
'Thermodynamic interaction between seaice and seawater')
731 call check_accuracy(
'melting_seaice_equilibrium_sa_ct_ratio',
value, &
735 call check_accuracy(
'melting_seaice_equilibrium_sa_ct_ratio_poly',
value, &
755 if (gsw_error_flag.eq.1)
then 758 print*,
'Your installation of the Gibbs SeaWater (GSW) Oceanographic Toolbox has errors!' 762 print*,
'Well done! The gsw_check_fuctions confirms that the' 763 print*,
'Gibbs SeaWater (GSW) Oceanographic Toolbox is installed correctly.' 773 character (*),
intent(in) :: title
776 print *,
"----------------------------------------------------------------------------" 785 subroutine check_accuracy (func_name, fvalue, result, result_ice, &
786 result_mpres, result_cast, vprint)
792 character (*),
intent(in) :: func_name
793 real (r8),
intent(in) :: fvalue(:,:)
794 type(gsw_result),
intent(in),
optional :: result
795 type(gsw_result_ice),
intent(in),
optional :: result_ice
796 type(gsw_result_mpres),
intent(in),
optional :: result_mpres
797 type(gsw_result_cast),
intent(in),
optional :: result_cast
798 logical,
intent(in),
optional :: vprint
800 integer :: ndots, i, j, k, ik=1, jk=1
801 real (r8) :: dmax, drel, comp_accuracy
802 real (r8) :: diff(size(fvalue,1),size(fvalue,2))
803 real (r8) :: rvalue(size(fvalue,1),size(fvalue,2))
804 character (80) :: message
805 character (50) :: var_name
806 character (4) :: errflg
808 character (*),
parameter :: att_name =
'computation_accuracy' 809 character (*),
parameter :: &
810 dots =
' .............................................................' 812 if (
present(result))
then 813 rvalue = result%values
814 var_name = result%variable_name
815 comp_accuracy = result%computation_accuracy
816 else if (
present(result_ice))
then 817 rvalue = result_ice%values
818 var_name = result_ice%variable_name
819 comp_accuracy = result_ice%computation_accuracy
820 else if (
present(result_mpres))
then 821 rvalue = result_mpres%values
822 var_name = result_mpres%variable_name
823 comp_accuracy = result_mpres%computation_accuracy
824 else if (
present(result_cast))
then 825 rvalue(:,1) = result_cast%values
826 var_name = result_cast%variable_name
827 comp_accuracy = result_cast%computation_accuracy
830 if (trim(var_name).ne.func_name)
then 831 if (len(func_name)+len_trim(var_name).gt.55)
then 832 k = len(func_name) + len_trim(var_name) - 55
833 message = func_name //
' (..' // trim(var_name(k:)) //
')' 835 message = func_name //
' (' // trim(var_name) //
')' 841 diff = abs(fvalue - rvalue)
842 where (rvalue .eq. 9e90_r8) diff = 0.0_r8
844 if (
present(vprint))
then 846 print *,
"Limit =", comp_accuracy
847 print
'(i3,3ES24.15)', ((i,fvalue(i,j),rvalue(i,j),diff(i,j), &
848 i=1,
size(fvalue,1)), j=1,
size(fvalue,2))
854 rvalue .lt. 1e90_r8))
then 860 ndots = 65 - len_trim(message)
862 if (any(diff .gt. comp_accuracy))
then 865 do i = 1,
size(fvalue,1)
866 do j = 1,
size(fvalue,2)
867 if (diff(i,j) .gt. dmax)
then 874 drel = dmax*100.0_r8/abs(fvalue(ik,jk))
875 print *, trim(message), dots(:ndots-3),
' << failed >>' 877 print *,
" Max. difference =", dmax,
", limit =", comp_accuracy
878 print *,
" Max. diff (rel) =", drel,
", limit =", &
879 comp_accuracy*100.0_r8/abs(fvalue(ik,jk))
882 print *, trim(message), dots(:ndots),
' passed', errflg
type(gsw_result) beta_const_t_exact
real(r8), dimension(cast_n) lat_cast
integer, parameter cast_m
real(r8), dimension(cast_m, cast_n) sk
program gsw_check_functions
type(gsw_result_ice) frazil_properties_potential_poly_sa_final
type(gsw_result) eta_ct_ct
real(r8), dimension(cast_m, cast_n) p_deep
type(gsw_result_mpres) n2min_dct
type(gsw_result_mpres) p_mid_n2
type(gsw_result_ice) melting_seaice_equilibrium_sa_ct_ratio_poly
type(gsw_result) pot_enthalpy_ice_freezing_sa_poly
real(r8), dimension(cast_m, cast_n) sp
type(gsw_result_ice) kappa_ice
type(gsw_result_mpres) p_mid_tursr
type(gsw_result) pot_enthalpy_ice_freezing
type(gsw_result) z_from_p
type(gsw_result) h_sa_ct_exact
type(gsw_result_mpres) p_mid_ipvfn2
type(gsw_result_ice) seaice_fraction_to_freeze_seawater_ct_freeze
type(gsw_result) ctfreezing_sa
type(gsw_result_ice) pt_from_t_ice
type(gsw_result_ice) melting_ice_equilibrium_sa_ct_ratio
type(gsw_result) ct_from_enthalpy
type(gsw_result_ice) specvol_ice
type(gsw_result) geo_strf_dyn_height
type(gsw_result_ice) dsa_dct_frazil_poly
type(gsw_result) t_deriv_chem_potential_water_t_exact
type(gsw_result_ice) seaice_fraction_to_freeze_seawater_w_ih
integer, parameter cast_mpres_m
type(gsw_result) rho_ct_ct
integer, parameter, public long
type(gsw_result_ice) frazil_properties_potential_poly_w_ih_final
type(gsw_result) entropy_from_t
type(gsw_result) tfreezing_sa_poly
type(gsw_result) geo_strf_dyn_height_pc
type(gsw_result) cabbeling
type(gsw_result_ice) seaice_fraction_to_freeze_seawater_sa_freeze
integer, parameter cast_mpres_n
type(gsw_result) beta_vab
type(gsw_result_ice) ice_fraction_to_freeze_seawater_sa_freeze
type(gsw_result) rho_ct_p
type(gsw_result_ice) pot_enthalpy_from_pt_ice
subroutine section_title(title)
type(gsw_result_ice) frazil_properties_sa_final
subroutine check_accuracy(func_name, fvalue, result, result_ice, result_mpres, result_cast, vprint)
type(gsw_result_ice) pressure_freezing_ct
type(gsw_result_ice) melting_ice_sa_ct_ratio_poly
real(r8), dimension(cast_n) long_cast
type(gsw_result) rho_t_exact
type(gsw_result_ice) ice_fraction_to_freeze_seawater_ct_freeze
type(gsw_result) h_sa_ct_ct_exact
type(gsw_result) sa_freezing_from_ct_poly
type(gsw_result) sound_speed_t_exact
type(gsw_result) pt_from_ct
type(gsw_result_ice) frazil_properties_potential_poly_ct_final
type(gsw_result) ct_freezing_poly
type(gsw_result) ct_from_pt
type(gsw_result_ice) pt_from_pot_enthalpy_ice
type(gsw_result) sp_from_c
type(gsw_result_ice) enthalpy_ice
type(gsw_result) deltasa_atlas
type(gsw_result_ice) alpha_wrt_t_ice
type(gsw_result) ct_sa_pt
type(gsw_result) tfreezing_p_poly
type(gsw_result) pot_enthalpy_ice_freezing_p_poly
type(gsw_result) enthalpy_ct_exact
type(gsw_result_ice) melting_seaice_sa_ct_ratio
type(gsw_result) rho_sa_wrt_h
type(gsw_result_ice) frazil_properties_potential_w_ih_final
type(gsw_result_ice) melting_seaice_sa_ct_ratio_poly
type(gsw_result) sa_from_rho
type(gsw_result_ice) dsa_dp_frazil_poly
type(gsw_result_mpres) n2min_pmid
type(gsw_result) pt_sa_sa
type(gsw_result) v_sa_sa_wrt_h
type(gsw_result_ice) frazil_properties_w_ih_final
type(gsw_result_ice) dct_dp_frazil_poly
real(r8), dimension(cast_m, cast_n) p
type(gsw_result) p_from_z
type(gsw_result_ice) entropy_ice
type(gsw_result) entropy_from_pt
type(gsw_result) deltasa_from_sp
type(gsw_result_ice) pressure_coefficient_ice
type(gsw_result) chem_potential_water_t_exact
real(r8), parameter, public gsw_error_limit
type(gsw_result) pt_from_entropy
real(r8), dimension(cast_ice_m, cast_ice_n) sa_arctic
type(gsw_result_ice) melting_ice_equilibrium_sa_ct_ratio_poly
type(gsw_result) eta_sa_ct
type(gsw_result_ice) melting_seaice_into_seawater_sa_final
type(gsw_result) dilution_coefficient_t_exact
type(gsw_result) geo_strf_dyn_height_pc_p_mid
real(r8), dimension(cast_ice_m, cast_ice_n) h_bulk
type(gsw_result) tfreezing_sa
type(gsw_result) ctfreezing_sa_poly
type(gsw_result) ct_from_t
type(gsw_result) alpha_vab
type(gsw_result_ice) rho_ice
real(r8), dimension(cast_ice_m, cast_ice_n) w_seaice
type(gsw_result_ice) pot_enthalpy_from_pt_ice_poly
integer, parameter cast_n
type(gsw_result_ice) sound_speed_ice
type(gsw_result_ice) frazil_properties_potential_sa_final
type(gsw_result) t_from_ct
type(gsw_result) t_freezing
type(gsw_result_ice) adiabatic_lapse_rate_ice
type(gsw_result) ct_p_wrt_t
type(gsw_result) latentheat_melting
type(gsw_result) sstar_from_sa
type(gsw_result) alpha_rab
type(gsw_result) dynamic_enthalpy
type(gsw_result) sr_from_sp
type(gsw_result) rho_sa_ct
type(gsw_result_ice) helmholtz_energy_ice
type(gsw_result_ice) melting_seaice_equilibrium_sa_ct_ratio
type(gsw_result) sp_from_sstar
type(gsw_result) ct_pt_pt
type(gsw_result_ice) pt0_from_t_ice
type(gsw_result_ice) internal_energy_ice
type(gsw_result) v_sa_wrt_h
type(gsw_result) pt_from_t
type(gsw_result) rho_sa_h
real(r8), dimension(cast_ice_m, cast_ice_n) p_arctic
type(gsw_result) ctfreezing_p_poly
type(gsw_result) latentheat_evap_t
type(gsw_result) sp_from_sk
type(gsw_result) sp_from_sa
type(gsw_result) enthalpy
type(gsw_result) pot_enthalpy_ice_freezing_poly
real(r8), dimension(cast_m, cast_n) p_shallow
real(r8), dimension(cast_ice_m, cast_ice_n) t_seaice
type(gsw_result_ice) melting_seaice_into_seawater_ct_final
type(gsw_result) rho_sa_p
real(r8), dimension(cast_m, cast_n) ct
real(r8), dimension(cast_ice_m, cast_ice_n) h_pot_bulk
type(gsw_result) sa_from_sstar
type(gsw_result) enthalpy_t_exact
type(gsw_result_ice) frazil_properties_ct_final
type(gsw_result) sa_freezing_from_t_poly
type(gsw_result_mpres) n2
type(gsw_result) specvol_t_exact
real(r8), dimension(cast_ice_m, cast_ice_n) w_ice
type(gsw_result) eta_sa_sa
type(gsw_result) tfreezing_p
type(gsw_result_ice) chem_potential_water_ice
type(gsw_result_mpres) n2min_dsa
real, parameter, public grav
Acceleration due to gravity [m/s^2].
type(gsw_result_ice) dct_dp_frazil
type(gsw_result_ice) pt_from_pot_enthalpy_ice_poly
type(gsw_result) pt_ct_ct
type(gsw_result_mpres) ipvfn2
real(r8), dimension(cast_m, cast_n) delta_p
type(gsw_result) sa_freezing_from_t
type(gsw_result_ice) ice_fraction_to_freeze_seawater_w_ih
type(gsw_result) ct_maxdensity
type(gsw_result_mpres) n2min_dp
type(gsw_result) t_freezing_poly
type(gsw_result) h_ct_ct_ct_exact
type(gsw_result) specvol_anom_standard
type(gsw_result) latentheat_evap_ct
type(gsw_result) kappa_t_exact
type(gsw_result) rho_sa_sa
type(gsw_result) sound_speed
type(gsw_result_ice) cp_ice
real(r8), dimension(cast_ice_m, cast_ice_n) sa_seaice
type(gsw_result) pot_rho_t_exact
type(gsw_result) n2_lowerlimit
type(gsw_result) alpha_wrt_t_exact
type(gsw_result_mpres) rsubrho
type(gsw_result) sp_from_sr
type(gsw_result) pot_enthalpy_ice_freezing_p
real(r8), dimension(cast_m, cast_n) t
type(gsw_result_ice) melting_ice_into_seawater_sa_final
type(gsw_result) ct_sa_sa
type(gsw_result) thermobaric
type(gsw_result) enthalpy_diff
type(gsw_result_ice) melting_ice_into_seawater_ct_final
type(gsw_result) pt_sa_ct
type(gsw_result) internal_energy
real(r8), dimension(cast_ice_m, cast_ice_n) sa_bulk
type(gsw_result_cast) mlp
type(gsw_result) c_from_sp
type(gsw_result_mpres) tu
type(gsw_result) alpha_on_beta
type(gsw_result) ct_from_entropy
type(gsw_result_mpres) n2min_beta
type(gsw_result) ctfreezing_p
type(gsw_result) adiabatic_lapse_rate_from_ct
type(gsw_result_ice) kappa_const_t_ice
type(gsw_result_ice) t_from_pt0_ice
type(gsw_result_mpres) n2min_specvol
type(gsw_result_ice) frazil_properties_potential_ct_final
type(gsw_result) ct_from_rho
type(gsw_result) sa_freezing_from_ct
type(gsw_result) ct_t_wrt_t
integer, parameter cast_ice_m
type(gsw_result) beta_rab
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)
type(gsw_result) h_sa_sa_ct_exact
type(gsw_result) sa_from_sp
real, parameter, public kappa
RDGAS / CP_AIR [dimensionless].
type(gsw_result) rho_sa_sa_wrt_h
integer, parameter cast_ice_n
type(gsw_result) pot_enthalpy_ice_freezing_sa
type(gsw_result) sstar_from_sp
type(gsw_result) ct_sa_wrt_t
type(gsw_result_ice) melting_ice_sa_ct_ratio
real(r8), dimension(cast_m, cast_n) sa
type(gsw_result_ice) dsa_dct_frazil
type(gsw_result) ct_freezing
type(gsw_result_ice) dsa_dp_frazil
type(gsw_result_mpres) n2min_alpha
real(r8), dimension(cast_ice_m, cast_ice_n) ct_arctic
real(r8), dimension(cast_ice_m, cast_ice_n) t_ice
type(gsw_result) pt0_from_t
type(gsw_result) h_ct_ct_exact
type(gsw_result_mpres) n2min