diff --git a/CMakeLists.txt b/CMakeLists.txt index b00d443..c369a14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/src/atmosphere/photochem_atmosphere_rhs.f90 b/src/atmosphere/photochem_atmosphere_rhs.f90 index d7e7c17..294f3e4 100644 --- a/src/atmosphere/photochem_atmosphere_rhs.f90 +++ b/src/atmosphere/photochem_atmosphere_rhs.f90 @@ -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) @@ -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, & diff --git a/src/evoatmosphere/photochem_evoatmosphere_rhs.f90 b/src/evoatmosphere/photochem_evoatmosphere_rhs.f90 index 7a2810d..d4ec5aa 100644 --- a/src/evoatmosphere/photochem_evoatmosphere_rhs.f90 +++ b/src/evoatmosphere/photochem_evoatmosphere_rhs.f90 @@ -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) @@ -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, &