Skip to content

Commit

Permalink
heat flow bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholaswogan committed Feb 23, 2024
1 parent a14e6c0 commit e5e792a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/adiabat/clima_adiabat_solve.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e5e792a

Please sign in to comment.