Skip to content

Commit

Permalink
zero out jacobian
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholaswogan committed Apr 4, 2024
1 parent 52944df commit fb34ac9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION "3.14")
cmake_policy(SET CMP0148 OLD)
project(Photochem LANGUAGES Fortran C VERSION "0.5.0")
project(Photochem LANGUAGES Fortran C VERSION "0.5.1")

include(FortranCInterface)
FortranCInterface_VERIFY()
Expand Down
3 changes: 2 additions & 1 deletion src/atmosphere/photochem_atmosphere_rhs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,8 @@ module subroutine jac_background_gas(self, lda_neqs, neqs, tn, usol_flat, jac, e
call prep_all_background_gas(self, usol_in, err)
if (allocated(err)) return

jac = 0.0_dp

if (.not. var%autodiff) then; block
real(dp) :: usol_perturb(dat%nq,var%nz)
real(dp) :: R(var%nz)
Expand All @@ -797,7 +799,6 @@ module subroutine jac_background_gas(self, lda_neqs, neqs, tn, usol_flat, jac, e
! Finite differenced Jacobian

! compute chemistry contribution to jacobian using forward differences
jac = 0.0_dp
call dochem(self, var%neqs, dat%nsp, dat%np, dat%nsl, dat%nq, var%nz, var%trop_ind, dat%nrT, &
wrk%usol, wrk%density, wrk%rx_rates, &
wrk%gas_sat_den, wrk%molecules_per_particle, &
Expand Down
3 changes: 2 additions & 1 deletion src/evoatmosphere/photochem_evoatmosphere_rhs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,8 @@ module subroutine jac_evo_gas(self, lda_neqs, neqs, usol_flat, jac, err)
call prep_all_evo_gas(self, usol_in, err)
if (allocated(err)) return

jac = 0.0_dp

if (.not. var%autodiff) then; block
real(dp) :: usol_perturb(dat%nq,var%nz)
real(dp) :: R(var%nz)
Expand All @@ -864,7 +866,6 @@ module subroutine jac_evo_gas(self, lda_neqs, neqs, usol_flat, jac, err)
! Finite differenced Jacobian

! compute chemistry contribution to jacobian using forward differences
jac = 0.0_dp
call dochem(self, wrk%usol, wrk%rx_rates, &
wrk%gas_sat_den, wrk%molecules_per_particle, &
wrk%H2O_sat_mix, wrk%H2O_rh, wrk%rainout_rates, &
Expand Down

0 comments on commit fb34ac9

Please sign in to comment.