From e5e792af081a297746a7e554939a4101afcbfbe7 Mon Sep 17 00:00:00 2001 From: Nick Wogan Date: Fri, 23 Feb 2024 13:17:05 -0800 Subject: [PATCH] heat flow bug --- src/adiabat/clima_adiabat_solve.f90 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/adiabat/clima_adiabat_solve.f90 b/src/adiabat/clima_adiabat_solve.f90 index a556058..85ca19e 100644 --- a/src/adiabat/clima_adiabat_solve.f90 +++ b/src/adiabat/clima_adiabat_solve.f90 @@ -296,11 +296,10 @@ subroutine AdiabatClimate_objective_(self, P_i_surf, T_in, ignore_convection, re call self%rad%apply_radiation_enhancement(rad_enhancement) endblock; endif - self%rad%f_total(1) = self%rad%f_total(1) + self%surface_heat_flow - do i = 1,self%nz+1 f_total(i) = self%rad%f_total(2*i-1)/1.0e3_dp ! we normalized here for the purposes of optimization enddo + f_total(1) = f_total(1) + self%surface_heat_flow/1.0e3_dp ! normalized ! Radiative energy going into each layer fluxes(1) = f_total(1) @@ -520,7 +519,11 @@ subroutine AdiabatClimate_residuals_with_convection(self, f_total, lapse_rate, l endif ind_upper = self%ind_conv_upper(i) - f_upper = f_total(ind_upper) + if (ind_lower == 1) then + f_upper = f_total(ind_upper) + self%surface_heat_flow/1.0e3_dp ! normalized + else + f_upper = f_total(ind_upper) + endif ! Radiative energy going into the convective layer res(ind_upper) = f_upper - f_lower