@@ -3,7 +3,7 @@ module MOM_geothermal
3
3
4
4
! This file is part of MOM6. See LICENSE.md for the license.
5
5
6
- use MOM_diag_mediator, only : post_data, register_diag_field, safe_alloc_ptr
6
+ use MOM_diag_mediator, only : post_data, register_diag_field, safe_alloc_alloc
7
7
use MOM_diag_mediator, only : register_static_field, time_type, diag_ctrl
8
8
use MOM_domains, only : pass_var
9
9
use MOM_error_handler, only : MOM_error, FATAL, WARNING
@@ -23,22 +23,21 @@ module MOM_geothermal
23
23
24
24
! > Control structure for geothermal heating
25
25
type, public :: geothermal_CS ; private
26
- real :: dRcv_dT_inplace ! < The value of dRcv_dT above which (dRcv_dT is
27
- ! ! negative) the water is heated in place instead
28
- ! ! of moving upward between layers [R degC-1 ~> kg m-3 degC-1].
29
- real , pointer :: geo_heat (:,:) = > NULL () ! < The geothermal heat flux [J m-2 T-1 ~> W m-2].
26
+ real :: dRcv_dT_inplace ! < The value of dRcv_dT above which (dRcv_dT is negative) the
27
+ ! ! water is heated in place instead of moving upward between
28
+ ! ! layers in non-ALE layered mode [R degC-1 ~> kg m-3 degC-1]
29
+ real , allocatable , dimension (:,:) :: geo_heat ! < The geothermal heat flux [J m-2 T-1 ~> W m-2]
30
30
real :: geothermal_thick ! < The thickness over which geothermal heating is
31
- ! ! applied [H ~> m or kg m-2].
32
- logical :: apply_geothermal ! < If true, geothermal heating will be applied
33
- ! ! otherwise GEOTHERMAL_SCALE has been set to 0 and
34
- ! ! there is no heat to apply.
35
-
36
- type (time_type), pointer :: Time = > NULL () ! < A pointer to the ocean model's clock.
37
- type (diag_ctrl), pointer :: diag = > NULL () ! < A structure that is used to
38
- ! ! regulate the timing of diagnostic output.
39
- integer :: id_internal_heat_heat_tendency = - 1 ! < ID for diagnostic of heat tendency
40
- integer :: id_internal_heat_temp_tendency = - 1 ! < ID for diagnostic of temperature tendency
41
- integer :: id_internal_heat_h_tendency = - 1 ! < ID for diagnostic of thickness tendency
31
+ ! ! applied [H ~> m or kg m-2]
32
+ logical :: apply_geothermal ! < If true, geothermal heating will be applied. This is false if
33
+ ! ! GEOTHERMAL_SCALE is 0 and there is no heat to apply.
34
+
35
+ type (time_type), pointer :: Time = > NULL () ! < A pointer to the ocean model's clock
36
+ type (diag_ctrl), pointer :: diag = > NULL () ! < A structure that is used to regulate the timing
37
+ ! ! timing of diagnostic output
38
+ integer :: id_internal_heat_heat_tendency = - 1 ! < ID for diagnostic of heat tendency
39
+ integer :: id_internal_heat_temp_tendency = - 1 ! < ID for diagnostic of temperature tendency
40
+ integer :: id_internal_heat_h_tendency = - 1 ! < ID for diagnostic of thickness tendency
42
41
43
42
end type geothermal_CS
44
43
@@ -532,7 +531,7 @@ subroutine geothermal_init(Time, G, GV, US, param_file, diag, CS, useALEalgorith
532
531
CS% apply_geothermal = .not. (geo_scale == 0.0 )
533
532
if (.not. CS% apply_geothermal) return
534
533
535
- call safe_alloc_ptr (CS% geo_heat, isd, ied, jsd, jed) ; CS% geo_heat(:,:) = 0.0
534
+ call safe_alloc_alloc (CS% geo_heat, isd, ied, jsd, jed) ; CS% geo_heat(:,:) = 0.0
536
535
537
536
call get_param(param_file, mdl, " GEOTHERMAL_FILE" , geo_file, &
538
537
" The file from which the geothermal heating is to be " // &
@@ -544,7 +543,8 @@ subroutine geothermal_init(Time, G, GV, US, param_file, diag, CS, useALEalgorith
544
543
" The value of drho_dT above which geothermal heating " // &
545
544
" simply heats water in place instead of moving it between " // &
546
545
" isopycnal layers. This must be negative." , &
547
- units= " kg m-3 K-1" , scale= US% kg_m3_to_R, default=- 0.01 )
546
+ units= " kg m-3 K-1" , scale= US% kg_m3_to_R, default=- 0.01 , &
547
+ do_not_log= ((GV% nk_rho_varies<= 0 ).or. (GV% nk_rho_varies>= GV% ke)) )
548
548
if (CS% dRcv_dT_inplace >= 0.0 ) call MOM_error(FATAL, " geothermal_init: " // &
549
549
" GEOTHERMAL_DRHO_DT_INPLACE must be negative." )
550
550
@@ -554,8 +554,8 @@ subroutine geothermal_init(Time, G, GV, US, param_file, diag, CS, useALEalgorith
554
554
filename = trim (inputdir)// trim (geo_file)
555
555
call log_param(param_file, mdl, " INPUTDIR/GEOTHERMAL_FILE" , filename)
556
556
call get_param(param_file, mdl, " GEOTHERMAL_VARNAME" , geotherm_var, &
557
- " The name of the geothermal heating variable in " // &
558
- " GEOTHERMAL_FILE. " , default= " geo_heat" )
557
+ " The name of the geothermal heating variable in GEOTHERMAL_FILE. " , &
558
+ default= " geo_heat" )
559
559
call MOM_read_data(filename, trim (geotherm_var), CS% geo_heat, G% Domain)
560
560
do j= jsd,jed ; do i= isd,ied
561
561
CS% geo_heat(i,j) = (G% mask2dT(i,j) * geo_scale) * CS% geo_heat(i,j)
@@ -601,7 +601,7 @@ end subroutine geothermal_init
601
601
subroutine geothermal_end (CS )
602
602
type (geothermal_CS), intent (inout ) :: CS ! < Geothermal heating control structure that
603
603
! ! will be deallocated in this subroutine.
604
- deallocate (CS% geo_heat)
604
+ if ( allocated (CS % geo_heat)) deallocate (CS% geo_heat)
605
605
end subroutine geothermal_end
606
606
607
607
! > \namespace mom_geothermal
0 commit comments