From a38b298e482258e70676383051c45e010f91bb68 Mon Sep 17 00:00:00 2001 From: Graeme MacGilchrist Date: Tue, 20 Aug 2019 15:37:21 -0400 Subject: [PATCH 1/9] added diagnostic for internal heat in 3D --- .../vertical/MOM_geothermal.F90 | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/parameterizations/vertical/MOM_geothermal.F90 b/src/parameterizations/vertical/MOM_geothermal.F90 index 15f1116190..8fb96e2c97 100644 --- a/src/parameterizations/vertical/MOM_geothermal.F90 +++ b/src/parameterizations/vertical/MOM_geothermal.F90 @@ -35,6 +35,8 @@ module MOM_geothermal type(time_type), pointer :: Time => NULL() !< A pointer to the ocean model's clock. type(diag_ctrl), pointer :: diag => NULL() !< A structure that is used to !! regulate the timing of diagnostic output. + integer :: id_internal_heat_tend_3d = -1 ! ID for 3D diagnostic of internal heat + end type geothermal_CS contains @@ -100,6 +102,11 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) real :: Irho_cp ! inverse of heat capacity per unit layer volume ! [degC H m2 J-1 ~> degC m3 J-1 or degC kg J-1] + real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: temp_old ! Temperature of each layer before any heat is added, for diagnostics [degC] + real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: h_old ! Thickness of each layer before any heat is added, for diagnostics [m or kg m-2] + real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: work_3d ! Scratch variable used to calculate change in heat due to geothermal + real :: Idt ! inverse of the timestep [s-1] + logical :: do_i(SZI_(G)) integer :: i, j, k, is, ie, js, je, nz, k2, i2 integer :: isj, iej, num_start, num_left, nkmb, k_tgt @@ -119,6 +126,7 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) Angstrom = GV%Angstrom_H H_neglect = GV%H_subroundoff p_ref(:) = tv%P_Ref + Idt = 1/dt if (.not.associated(tv%T)) call MOM_error(FATAL, "MOM geothermal: "//& "Geothermal heating can only be applied if T & S are state variables.") @@ -136,6 +144,10 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) !$OMP wt_in_place,dTemp,dRcv,h_transfer,heating, & !$OMP I_h) +! Save temperature and thickness before any changes are made (for diagnostic) +temp_old = tv%T +h_old = h + do j=js,je ! 1. Only work on columns that are being heated. ! 2. Find the deepest layer with any mass. @@ -304,6 +316,14 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) enddo ; endif enddo ! j-loop +! Calculate heat tendency due to addition and transfer of internal heat +if (CS%id_internal_heat_tend_3d > 0) then + do k=1,nz ; do j=js,je ; do i=is,ie + work_3d(i,j,k) = GV%H_to_kg_m2 * tv%C_p * Idt * (h(i,j,k) * tv%T(i,j,k) - h_old(i,j,k) * temp_old(i,j,k)) + enddo ; enddo ; enddo + call post_data(CS%id_internal_heat_tend_3d, work_3d, CS%diag, alt_h = h_old) +endif + ! do i=is,ie ; do j=js,je ! resid(i,j) = tv%internal_heat(i,j) - resid(i,j) - GV%H_to_kg_m2 * & ! (G%mask2dT(i,j) * (CS%geo_heat(i,j) * (dt*Irho_cp))) @@ -392,6 +412,12 @@ subroutine geothermal_init(Time, G, param_file, diag, CS) x_cell_method='mean', y_cell_method='mean', area_cell_method='mean') if (id > 0) call post_data(id, CS%geo_heat, diag, .true.) + ! Diagnostic for tendency due to internal heat (in 3d) + CS%id_internal_heat_tend_3d = register_diag_field('ocean_model',& + 'internal_heat_tend_3d', diag%axesTL, Time, & + 'Internal heat tendency in 3D, reveals layer(s) that heat is added to','W m-2',& + v_extensive = .true.) + end subroutine geothermal_init !> Clean up and deallocate memory associated with the geothermal heating module. From ee2e09059bd9e1040540e8a7beaab0ef6cb4f3a9 Mon Sep 17 00:00:00 2001 From: Graeme MacGilchrist Date: Tue, 20 Aug 2019 16:49:55 -0400 Subject: [PATCH 2/9] further modifications to internal heat diagnostic --- .../vertical/MOM_geothermal.F90 | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/parameterizations/vertical/MOM_geothermal.F90 b/src/parameterizations/vertical/MOM_geothermal.F90 index 8fb96e2c97..4121795766 100644 --- a/src/parameterizations/vertical/MOM_geothermal.F90 +++ b/src/parameterizations/vertical/MOM_geothermal.F90 @@ -35,7 +35,7 @@ module MOM_geothermal type(time_type), pointer :: Time => NULL() !< A pointer to the ocean model's clock. type(diag_ctrl), pointer :: diag => NULL() !< A structure that is used to !! regulate the timing of diagnostic output. - integer :: id_internal_heat_tend_3d = -1 ! ID for 3D diagnostic of internal heat + integer :: id_internal_heat_tend_3d = -1 !< ID for 3D diagnostic of internal heat end type geothermal_CS @@ -102,9 +102,15 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) real :: Irho_cp ! inverse of heat capacity per unit layer volume ! [degC H m2 J-1 ~> degC m3 J-1 or degC kg J-1] - real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: temp_old ! Temperature of each layer before any heat is added, for diagnostics [degC] - real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: h_old ! Thickness of each layer before any heat is added, for diagnostics [m or kg m-2] - real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: work_3d ! Scratch variable used to calculate change in heat due to geothermal + real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: temp_old ! Temperature of each layer + ! before any heat is added, + ! for diagnostics [degC] + real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: h_old ! Thickness of each layer + ! before any heat is added, + ! for diagnostics [m or kg m-2] + real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: work_3d ! Scratch variable used to + ! calculate change in heat + ! due to geothermal real :: Idt ! inverse of the timestep [s-1] logical :: do_i(SZI_(G)) @@ -126,7 +132,7 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) Angstrom = GV%Angstrom_H H_neglect = GV%H_subroundoff p_ref(:) = tv%P_Ref - Idt = 1/dt + Idt = 1.0 / dt if (.not.associated(tv%T)) call MOM_error(FATAL, "MOM geothermal: "//& "Geothermal heating can only be applied if T & S are state variables.") @@ -144,9 +150,9 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) !$OMP wt_in_place,dTemp,dRcv,h_transfer,heating, & !$OMP I_h) -! Save temperature and thickness before any changes are made (for diagnostic) -temp_old = tv%T -h_old = h + ! Save temperature and thickness before any changes are made (for diagnostic) + temp_old = tv%T + h_old = h do j=js,je ! 1. Only work on columns that are being heated. @@ -316,13 +322,13 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) enddo ; endif enddo ! j-loop -! Calculate heat tendency due to addition and transfer of internal heat -if (CS%id_internal_heat_tend_3d > 0) then - do k=1,nz ; do j=js,je ; do i=is,ie - work_3d(i,j,k) = GV%H_to_kg_m2 * tv%C_p * Idt * (h(i,j,k) * tv%T(i,j,k) - h_old(i,j,k) * temp_old(i,j,k)) - enddo ; enddo ; enddo - call post_data(CS%id_internal_heat_tend_3d, work_3d, CS%diag, alt_h = h_old) -endif + ! Calculate heat tendency due to addition and transfer of internal heat + if (CS%id_internal_heat_tend_3d > 0) then + do k=1,nz ; do j=js,je ; do i=is,ie + work_3d(i,j,k) = GV%H_to_kg_m2 * tv%C_p * Idt * (h(i,j,k) * tv%T(i,j,k) - h_old(i,j,k) * temp_old(i,j,k)) + enddo ; enddo ; enddo + call post_data(CS%id_internal_heat_tend_3d, work_3d, CS%diag, alt_h = h_old) + endif ! do i=is,ie ; do j=js,je ! resid(i,j) = tv%internal_heat(i,j) - resid(i,j) - GV%H_to_kg_m2 * & @@ -413,10 +419,10 @@ subroutine geothermal_init(Time, G, param_file, diag, CS) if (id > 0) call post_data(id, CS%geo_heat, diag, .true.) ! Diagnostic for tendency due to internal heat (in 3d) - CS%id_internal_heat_tend_3d = register_diag_field('ocean_model',& - 'internal_heat_tend_3d', diag%axesTL, Time, & - 'Internal heat tendency in 3D, reveals layer(s) that heat is added to','W m-2',& - v_extensive = .true.) + CS%id_internal_heat_tend_3d=register_diag_field('ocean_model', & + 'internal_heat_tend_3d', diag%axesTL, Time, & + 'Internal heat tendency in 3D, reveals layer(s) that heat is added to', & + 'W m-2', v_extensive = .true.) end subroutine geothermal_init From a3c5ef9bc91eda92b5da50b68bdf30be582fc409 Mon Sep 17 00:00:00 2001 From: Graeme MacGilchrist Date: Thu, 22 Aug 2019 13:44:51 -0400 Subject: [PATCH 3/9] testing stream --- src/parameterizations/vertical/MOM_geothermal.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parameterizations/vertical/MOM_geothermal.F90 b/src/parameterizations/vertical/MOM_geothermal.F90 index 4121795766..7fe6d53bea 100644 --- a/src/parameterizations/vertical/MOM_geothermal.F90 +++ b/src/parameterizations/vertical/MOM_geothermal.F90 @@ -35,7 +35,7 @@ module MOM_geothermal type(time_type), pointer :: Time => NULL() !< A pointer to the ocean model's clock. type(diag_ctrl), pointer :: diag => NULL() !< A structure that is used to !! regulate the timing of diagnostic output. - integer :: id_internal_heat_tend_3d = -1 !< ID for 3D diagnostic of internal heat + integer :: id_internal_heat_tend_3d = -1 !< test ID for 3D diagnostic of internal heat end type geothermal_CS From dde649246767632fb599d17e47e79be4bc62ad97 Mon Sep 17 00:00:00 2001 From: Graeme MacGilchrist Date: Thu, 22 Aug 2019 13:46:47 -0400 Subject: [PATCH 4/9] testing stream --- src/parameterizations/vertical/MOM_geothermal.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parameterizations/vertical/MOM_geothermal.F90 b/src/parameterizations/vertical/MOM_geothermal.F90 index 7fe6d53bea..4121795766 100644 --- a/src/parameterizations/vertical/MOM_geothermal.F90 +++ b/src/parameterizations/vertical/MOM_geothermal.F90 @@ -35,7 +35,7 @@ module MOM_geothermal type(time_type), pointer :: Time => NULL() !< A pointer to the ocean model's clock. type(diag_ctrl), pointer :: diag => NULL() !< A structure that is used to !! regulate the timing of diagnostic output. - integer :: id_internal_heat_tend_3d = -1 !< test ID for 3D diagnostic of internal heat + integer :: id_internal_heat_tend_3d = -1 !< ID for 3D diagnostic of internal heat end type geothermal_CS From 177ed82f613ba52abf33db322bc15cbcdf479c53 Mon Sep 17 00:00:00 2001 From: Graeme MacGilchrist Date: Thu, 22 Aug 2019 16:43:35 -0400 Subject: [PATCH 5/9] updated calculation of internal heat diagnostic --- .../vertical/MOM_geothermal.F90 | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/parameterizations/vertical/MOM_geothermal.F90 b/src/parameterizations/vertical/MOM_geothermal.F90 index 4121795766..d2dc565bde 100644 --- a/src/parameterizations/vertical/MOM_geothermal.F90 +++ b/src/parameterizations/vertical/MOM_geothermal.F90 @@ -102,15 +102,12 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) real :: Irho_cp ! inverse of heat capacity per unit layer volume ! [degC H m2 J-1 ~> degC m3 J-1 or degC kg J-1] - real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: temp_old ! Temperature of each layer - ! before any heat is added, - ! for diagnostics [degC] - real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: h_old ! Thickness of each layer - ! before any heat is added, - ! for diagnostics [m or kg m-2] - real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: work_3d ! Scratch variable used to - ! calculate change in heat - ! due to geothermal + real :: T_old ! Temperature of each layer before any heat is added, + ! for diagnostics [degC] + real, allocatable, dimension(:,:,:) :: h_old ! Thickness of each layer before any heat is added, + ! for diagnostics [m or kg m-2] + real, allocatable, dimension(:,:,:) :: work_3d ! Scratch variable used to calculate change in heat + ! due to geothermal real :: Idt ! inverse of the timestep [s-1] logical :: do_i(SZI_(G)) @@ -150,9 +147,11 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) !$OMP wt_in_place,dTemp,dRcv,h_transfer,heating, & !$OMP I_h) - ! Save temperature and thickness before any changes are made (for diagnostic) - temp_old = tv%T - h_old = h + ! Allocate diagnostic arrays if required + if (CS%id_internal_heat_tend_3d > 0) then + allocate(h_old(is:ie,js:je,nz)) ; h_old(:,:,:) = 0.0 + allocate(work_3d(is:ie,js:je,nz)) ; work_3d(:,:,:) = 0.0 + endif do j=js,je ! 1. Only work on columns that are being heated. @@ -193,6 +192,12 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) do k=nz,1,-1 do i=isj,iej ; if (do_i(i)) then + ! Save temperature and thickness before any changes are made (for diagnostic) + if (CS%id_internal_heat_tend_3d > 0) then + T_old = tv%T(i,j,k) + h_old(i,j,k) = h(i,j,k) + endif + if (h(i,j,k) > Angstrom) then if ((h(i,j,k)-Angstrom) >= h_geo_rem(i)) then h_heated = h_geo_rem(i) @@ -312,6 +317,12 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) ! endif endif endif + + ! Calculate heat tendency due to addition and transfer of internal heat + if (CS%id_internal_heat_tend_3d > 0) then + work_3d(i,j,k) = ((GV%H_to_kg_m2 * tv%C_p) * Idt) * (h(i,j,k) * tv%T(i,j,k) - h_old(i,j,k) * T_old) + endif + endif ; enddo if (num_left <= 0) exit enddo ! k-loop @@ -322,12 +333,11 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) enddo ; endif enddo ! j-loop - ! Calculate heat tendency due to addition and transfer of internal heat + ! Post diagnostic of internal heat tendency in 3D if (CS%id_internal_heat_tend_3d > 0) then - do k=1,nz ; do j=js,je ; do i=is,ie - work_3d(i,j,k) = GV%H_to_kg_m2 * tv%C_p * Idt * (h(i,j,k) * tv%T(i,j,k) - h_old(i,j,k) * temp_old(i,j,k)) - enddo ; enddo ; enddo call post_data(CS%id_internal_heat_tend_3d, work_3d, CS%diag, alt_h = h_old) + deallocate(h_old) + deallocate(work_3d) endif ! do i=is,ie ; do j=js,je @@ -421,7 +431,7 @@ subroutine geothermal_init(Time, G, param_file, diag, CS) ! Diagnostic for tendency due to internal heat (in 3d) CS%id_internal_heat_tend_3d=register_diag_field('ocean_model', & 'internal_heat_tend_3d', diag%axesTL, Time, & - 'Internal heat tendency in 3D, reveals layer(s) that heat is added to', & + '3D heat tendency due to internal (geothermal) sources', & 'W m-2', v_extensive = .true.) end subroutine geothermal_init From a04e559781b431660d50c4706a9056e2c93cb5d0 Mon Sep 17 00:00:00 2001 From: Graeme MacGilchrist Date: Thu, 22 Aug 2019 19:21:08 -0400 Subject: [PATCH 6/9] included diagnostics for T and h from internal heat, and improved logic --- .../vertical/MOM_geothermal.F90 | 74 ++++++++++++------- 1 file changed, 48 insertions(+), 26 deletions(-) diff --git a/src/parameterizations/vertical/MOM_geothermal.F90 b/src/parameterizations/vertical/MOM_geothermal.F90 index d2dc565bde..e80af18220 100644 --- a/src/parameterizations/vertical/MOM_geothermal.F90 +++ b/src/parameterizations/vertical/MOM_geothermal.F90 @@ -35,7 +35,9 @@ module MOM_geothermal type(time_type), pointer :: Time => NULL() !< A pointer to the ocean model's clock. type(diag_ctrl), pointer :: diag => NULL() !< A structure that is used to !! regulate the timing of diagnostic output. - integer :: id_internal_heat_tend_3d = -1 !< ID for 3D diagnostic of internal heat + integer :: id_internal_heat_heat_tendency = -1 !< ID for diagnostic of heat tendency + integer :: id_internal_heat_temp_tendency = -1 !< ID for diagnostic of temperature tendency + integer :: id_internal_heat_h_tendency = -1 !< ID for diagnostic of thickness tendency end type geothermal_CS @@ -102,12 +104,15 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) real :: Irho_cp ! inverse of heat capacity per unit layer volume ! [degC H m2 J-1 ~> degC m3 J-1 or degC kg J-1] - real :: T_old ! Temperature of each layer before any heat is added, - ! for diagnostics [degC] - real, allocatable, dimension(:,:,:) :: h_old ! Thickness of each layer before any heat is added, - ! for diagnostics [m or kg m-2] - real, allocatable, dimension(:,:,:) :: work_3d ! Scratch variable used to calculate change in heat - ! due to geothermal + real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: T_old ! Temperature of each layer + ! before any heat is added, + ! for diagnostics [degC] + real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: h_old ! Thickness of each layer + ! before any heat is added, + ! for diagnostics [m or kg m-2] + real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: work_3d ! Scratch variable used to + ! calculate change in heat + ! due to geothermal real :: Idt ! inverse of the timestep [s-1] logical :: do_i(SZI_(G)) @@ -147,12 +152,6 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) !$OMP wt_in_place,dTemp,dRcv,h_transfer,heating, & !$OMP I_h) - ! Allocate diagnostic arrays if required - if (CS%id_internal_heat_tend_3d > 0) then - allocate(h_old(is:ie,js:je,nz)) ; h_old(:,:,:) = 0.0 - allocate(work_3d(is:ie,js:je,nz)) ; work_3d(:,:,:) = 0.0 - endif - do j=js,je ! 1. Only work on columns that are being heated. ! 2. Find the deepest layer with any mass. @@ -193,10 +192,15 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) do i=isj,iej ; if (do_i(i)) then ! Save temperature and thickness before any changes are made (for diagnostic) - if (CS%id_internal_heat_tend_3d > 0) then - T_old = tv%T(i,j,k) + if (CS%id_internal_heat_h_tendency > 0 & + .or. CS%id_internal_heat_heat_tendency & + .or. CS%id_internal_heat_temp_tendency ) then h_old(i,j,k) = h(i,j,k) endif + if (CS%id_internal_heat_heat_tendency > 0 .or. CS%id_internal_heat_temp_tendency) then + T_old(i,j,k) = tv%T(i,j,k) + endif + if (h(i,j,k) > Angstrom) then if ((h(i,j,k)-Angstrom) >= h_geo_rem(i)) then @@ -319,8 +323,8 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) endif ! Calculate heat tendency due to addition and transfer of internal heat - if (CS%id_internal_heat_tend_3d > 0) then - work_3d(i,j,k) = ((GV%H_to_kg_m2 * tv%C_p) * Idt) * (h(i,j,k) * tv%T(i,j,k) - h_old(i,j,k) * T_old) + if (CS%id_internal_heat_heat_tendency > 0) then + work_3d(i,j,k) = ((GV%H_to_kg_m2 * tv%C_p) * Idt) * (h(i,j,k) * tv%T(i,j,k) - h_old(i,j,k) * T_old(i,j,k)) endif endif ; enddo @@ -333,11 +337,21 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) enddo ; endif enddo ! j-loop - ! Post diagnostic of internal heat tendency in 3D - if (CS%id_internal_heat_tend_3d > 0) then - call post_data(CS%id_internal_heat_tend_3d, work_3d, CS%diag, alt_h = h_old) - deallocate(h_old) - deallocate(work_3d) + ! Post diagnostic of 3D tendencies (heat, temperature, and thickness) due to internal heat + if (CS%id_internal_heat_heat_tendency > 0) then + call post_data(CS%id_internal_heat_heat_tendemcy, work_3d, CS%diag, alt_h = h_old) + endif + if (CS%id_internal_heat_temp_tendency > 0) then + do j=js,je; do i=is,ie; do k=ks,ke + work_3d(i,j,k) = Idt * (tv%T(i,j,k) - T_old(i,j,k)) + enddo; enddo; enddo + call post_data(CS%id_T_internal_heat_temp_tendency, work_3d, CS%diag, alt_h = h_old) + endif + if (CS%id_internal_heat_h_tendency > 0) then + do j=js,je; do i=is,ie; do k=ks,ke + work_3d(i,j,k) = Idt * (h(i,j,k) - h_old(i,j,k)) + enddo; enddo; enddo + call post_data(CS%id_internal_heat_h_tendency, work_3d, CS%diag, alt_h = h_old) endif ! do i=is,ie ; do j=js,je @@ -428,11 +442,19 @@ subroutine geothermal_init(Time, G, param_file, diag, CS) x_cell_method='mean', y_cell_method='mean', area_cell_method='mean') if (id > 0) call post_data(id, CS%geo_heat, diag, .true.) - ! Diagnostic for tendency due to internal heat (in 3d) - CS%id_internal_heat_tend_3d=register_diag_field('ocean_model', & - 'internal_heat_tend_3d', diag%axesTL, Time, & - '3D heat tendency due to internal (geothermal) sources', & + ! Diagnostic for tendencies due to internal heat (in 3d) + CS%id_internal_heat_heat_tendency=register_diag_field('ocean_model', & + 'internal_heat_heat_tendency', diag%axesTL, Time, & + 'Heat tendency (in 3D) due to internal (geothermal) sources', & 'W m-2', v_extensive = .true.) + CS%id_internal_heat_temp_tendency=register_diag_field('ocean_model', & + 'internal_heat_temp_tendency', diag%axesTL, Time, & + 'Temperature tendency (in 3D) due to internal (geothermal) sources', & + 'degC s-1', v_extensive = .true.) + CS%id_internal_heat_h_tendency=register_diag_field('ocean_model', & + 'internal_heat_h_tendency', diag%axesTL, Time, & + 'Thickness tendency (in 3D) due to internal (geothermal) sources', & + 'm OR kg m-2', v_extensive = .true.) end subroutine geothermal_init From ed7382e1a731d13b718c9d1b4bfd13875ca1a5cf Mon Sep 17 00:00:00 2001 From: Graeme MacGilchrist Date: Thu, 22 Aug 2019 19:25:32 -0400 Subject: [PATCH 7/9] minor adjustment --- src/parameterizations/vertical/MOM_geothermal.F90 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/parameterizations/vertical/MOM_geothermal.F90 b/src/parameterizations/vertical/MOM_geothermal.F90 index e80af18220..5c29c3667c 100644 --- a/src/parameterizations/vertical/MOM_geothermal.F90 +++ b/src/parameterizations/vertical/MOM_geothermal.F90 @@ -339,16 +339,16 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) ! Post diagnostic of 3D tendencies (heat, temperature, and thickness) due to internal heat if (CS%id_internal_heat_heat_tendency > 0) then - call post_data(CS%id_internal_heat_heat_tendemcy, work_3d, CS%diag, alt_h = h_old) + call post_data(CS%id_internal_heat_heat_tendency, work_3d, CS%diag, alt_h = h_old) endif if (CS%id_internal_heat_temp_tendency > 0) then - do j=js,je; do i=is,ie; do k=ks,ke + do j=js,je; do i=is,ie; do k=nz,1,-1 work_3d(i,j,k) = Idt * (tv%T(i,j,k) - T_old(i,j,k)) enddo; enddo; enddo - call post_data(CS%id_T_internal_heat_temp_tendency, work_3d, CS%diag, alt_h = h_old) + call post_data(CS%id_internal_heat_temp_tendency, work_3d, CS%diag, alt_h = h_old) endif if (CS%id_internal_heat_h_tendency > 0) then - do j=js,je; do i=is,ie; do k=ks,ke + do j=js,je; do i=is,ie; do k=nz,1,-1 work_3d(i,j,k) = Idt * (h(i,j,k) - h_old(i,j,k)) enddo; enddo; enddo call post_data(CS%id_internal_heat_h_tendency, work_3d, CS%diag, alt_h = h_old) @@ -455,7 +455,7 @@ subroutine geothermal_init(Time, G, param_file, diag, CS) 'internal_heat_h_tendency', diag%axesTL, Time, & 'Thickness tendency (in 3D) due to internal (geothermal) sources', & 'm OR kg m-2', v_extensive = .true.) - + end subroutine geothermal_init !> Clean up and deallocate memory associated with the geothermal heating module. From ebec6108ef6bb30022f0a7be24cb62c80a491d7c Mon Sep 17 00:00:00 2001 From: Graeme MacGilchrist Date: Thu, 22 Aug 2019 23:11:17 -0400 Subject: [PATCH 8/9] removed whitespace --- src/parameterizations/vertical/MOM_geothermal.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parameterizations/vertical/MOM_geothermal.F90 b/src/parameterizations/vertical/MOM_geothermal.F90 index 5c29c3667c..5885473459 100644 --- a/src/parameterizations/vertical/MOM_geothermal.F90 +++ b/src/parameterizations/vertical/MOM_geothermal.F90 @@ -455,7 +455,7 @@ subroutine geothermal_init(Time, G, param_file, diag, CS) 'internal_heat_h_tendency', diag%axesTL, Time, & 'Thickness tendency (in 3D) due to internal (geothermal) sources', & 'm OR kg m-2', v_extensive = .true.) - + end subroutine geothermal_init !> Clean up and deallocate memory associated with the geothermal heating module. From 7c811e2bd9e87fb77c18cf4268d62a4378660468 Mon Sep 17 00:00:00 2001 From: Graeme MacGilchrist Date: Thu, 22 Aug 2019 23:59:44 -0400 Subject: [PATCH 9/9] fixed problem in conditional statements --- src/parameterizations/vertical/MOM_geothermal.F90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/parameterizations/vertical/MOM_geothermal.F90 b/src/parameterizations/vertical/MOM_geothermal.F90 index 5885473459..10fe37da89 100644 --- a/src/parameterizations/vertical/MOM_geothermal.F90 +++ b/src/parameterizations/vertical/MOM_geothermal.F90 @@ -193,11 +193,12 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, CS, halo) ! Save temperature and thickness before any changes are made (for diagnostic) if (CS%id_internal_heat_h_tendency > 0 & - .or. CS%id_internal_heat_heat_tendency & - .or. CS%id_internal_heat_temp_tendency ) then + .or. CS%id_internal_heat_heat_tendency > 0 & + .or. CS%id_internal_heat_temp_tendency > 0 ) then h_old(i,j,k) = h(i,j,k) endif - if (CS%id_internal_heat_heat_tendency > 0 .or. CS%id_internal_heat_temp_tendency) then + if (CS%id_internal_heat_heat_tendency > 0 & + .or. CS%id_internal_heat_temp_tendency > 0) then T_old(i,j,k) = tv%T(i,j,k) endif