Skip to content

Commit

Permalink
Merge branch 'cleanup_util' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
RolfSander committed Jun 27, 2022
2 parents fe946e5 + 0107ae6 commit a0be6b4
Show file tree
Hide file tree
Showing 15 changed files with 739 additions and 774 deletions.
8 changes: 4 additions & 4 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
},
{
"name": "Michael Long",
"affiliation": "Harvard University"
"affiliation": "Renaissance Fiber, LLC, North Carolina, USA"
},
{
"name": "Robert Yantosca",
"affiliation": "Harvard University"
"affiliation": "Harvard University, Cambridge, MA, USA"
},
{
"name": "Haipeng Lin",
"affiliation": "Harvard University"
"affiliation": "Harvard University, Cambridge, MA, USA"
}
],
"description": "The Kinetic Pre-Processor (KPP)",
Expand All @@ -34,6 +34,6 @@
"climate-modeling",
"fortran-90"
],
"license": "GNU GPLv3",
"license": "GNU General Public License v2.0 or later",
"upload_type": "software"
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ This is the repository for the The Kinetic PreProcessor (KPP) source code.
KPP is distributed under [GPLv3, the general public license](https://github.com/KineticPreProcessor/KPP/blob/main/LICENSE.txt).

## Documentation
Please see our comprehensive KPP User's Guide (https://kpp.readthedocs.io) for installation and usage instructions.
Please see our comprehensive KPP User's Guide
([html](https://kpp.readthedocs.io),
[pdf](https://kpp.readthedocs.io/_/downloads/en/latest/pdf/)) for
installation and usage instructions.
10 changes: 10 additions & 0 deletions docs/source/getting_started/00_revision_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ is currently still in preparation.
consistently for the maximum number of Newton iterations in all
integrators.

- The utility functions :code:`ARR`, :code:`ARR2`, :code:`k_3rd` and
:code:`k_arr` have been replaced by the new set of the consistent
functions :code:`ARR_abc`, :code:`ARR_ab`, :code:`ARR_ac`,
:code:`k3rd_jpl`, :code:`k3rd_jpl_activation`, and
:code:`k3rd_iupac`. We recommend to upgrade to the new functions,
which all use the temperature from the :code:`temp` variable in
:file:`ROOT_Global.f90`. Alternatively, it is possible to copy the
old functions into a separate file and make them available via
:code:`F90_RCONST`.

.. _kpp260:

=========
Expand Down
97 changes: 56 additions & 41 deletions docs/source/using_kpp/04_input_for_kpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,35 @@ part of the species composition. Examples for these sections are:

The chemical mechanism is specified in the :command:`#EQUATIONS`
section. Each equation is written in the natural way in which a
chemist would write it, e.g.:
chemist would write it:

.. code-block:: console
#EQUATIONS
NO2 + hv = NO + O : 0.533*SUN;
OH + NO2 = HNO3 : k_3rd(temp,
cair,2.E-30,3.,2.5E-11,0.,0.6);
<1> NO2 + hv = NO + O3P : 6.69e-1*(SUN/60.0e0);
<2> O3P + O2 + AIR = O3 : ARR_ac(5.68e-34, -2.80e0);
<3> O3P + O3 = 2O2 : ARR_ab(8.00e-12, 2060.0e0);
<4> O3P + NO + AIR = NO2 : ARR_ac(1.00e-31, -1.60e0);
... etc ...
.. note::

The above example is taken from the :command:`saprc99` mechanism
(see :file:`models/saprc99.eqn`), with some whitespace deleted for
clarity. Optional :ref:`equation tags <eqntags-cmd>` are specified
by text within :code:`< >` angle brackets. Functions that compute
**saprc99** equation rates (e.g. :code:`ARR_ac`,
:code:`ARR_ab`) are defined in :file:`util/UserRateLaws.f90`
and :file:`util/UserRateLawsInterfaces.f90`.

Only the names of already defined species can be used. The rate
coefficient has to be placed at the end of each equation, separated by a
colon. The rate coefficient does not necessarily need to be a numerical
value. Instead, it can be a valid expression in the
:ref:`target language <language-cmd>`. If there are several
:command:`#EQUATIONS` sections in the input, their contents will be
concatenated.
value. Instead, it can be a valid expression (or a call to an
:ref:`inlined rate law function <inlined-code>`) in the :ref:`target
language <language-cmd>`. If there are several :command:`#EQUATIONS`
sections in the input, their contents will be concatenated.

A minus sign in an equation shows that a species is consumed in a
reaction but it does not affect the reaction rate. For example, the
Expand Down Expand Up @@ -200,8 +213,9 @@ surface can be written as:
O3 = PROD : v_d_O3;
The same equation must not occur twice in the :command:`#EQUATIONS`
section. For example, you may have both the gas-phase reaction of :literal:`N2O5` with
water in your mechanism and also the heterogeneous reaction on aerosols:
section. For example, you may have both the gas-phase reaction of
:literal:`N2O5` with water in your mechanism and also the
heterogeneous reaction on aerosols:

.. code-block:: console
Expand All @@ -212,7 +226,7 @@ These reactions must be merged by adding the rate coefficients:

.. code-block:: console
N2O5 + H2O = 2 HNO3 : k_gas+k_aerosol;
N2O5 + H2O = 2 HNO3 : k_gas + k_aerosol;
.. _families:

Expand Down Expand Up @@ -531,12 +545,12 @@ mechanisms with and without sulfuric acid, you can use this code:
#EQNTAGS
--------

Each reaction in the :command:`#EQNTAGS` section may start with an
Each reaction in the :ref:`equations` section may start with an
equation tag which is enclosed in angle brackets, e.g.:

.. code-block:: console
<J1> NO2 + hv = NO + O : 0.533*SUN;
<1> NO2 + hv = NO + O3P : 6.69e-1*(SUN/60.0e0);
With :command:`#EQNTAGS` set to :command:`ON`, this equation tag can
be used to refer to a specific equation
Expand Down Expand Up @@ -1033,34 +1047,35 @@ files, as shown in :ref:`table-aux-files`.
.. table:: Table 2: Auxiliary files for Fortran90
:align: center

+-----------------------------+--------------------------------------------+
| File | Contents |
+=============================+============================================+
| ``dFun_dRcoeff.f90`` | Derivatives with respect to reaction |
| | rates. |
+-----------------------------+--------------------------------------------+
| ``dJac_dRcoeff.f90`` | Derivatives with respect to reaction |
| | rates. |
+-----------------------------+--------------------------------------------+
| ``Makefile_f90`` and | Makefiles to build Fortran-90 code. |
| ``Makefile_upper_F90`` | |
+-----------------------------+--------------------------------------------+
| ``Mex_Fun.f90`` | Mex files. |
+-----------------------------+--------------------------------------------+
| ``Mex_Jac_SP.f90`` | Mex files. |
+-----------------------------+--------------------------------------------+
| ``Mex_Hessian.f90`` | Mex files. |
+-----------------------------+--------------------------------------------+
| ``sutil.f90`` | Sparse utility functions. |
+-----------------------------+--------------------------------------------+
| ``tag2num.f90`` | Function related to equation tags. |
+-----------------------------+--------------------------------------------+
| ``UpdateSun.f90`` | Function related to solar zenith angle. |
+-----------------------------+--------------------------------------------+
| ``UserRateLaws.f90`` | User-defined rate-law functions. |
+-----------------------------+--------------------------------------------+
| ``util.f90`` | Input/output utilities. |
+-----------------------------+--------------------------------------------+
+--------------------------------+------------------------------------------+
| File | Contents |
+================================+==========================================+
| ``dFun_dRcoeff.f90`` | Derivatives with respect to reaction |
| | rates. |
+--------------------------------+------------------------------------------+
| ``dJac_dRcoeff.f90`` | Derivatives with respect to reaction |
| | rates. |
+--------------------------------+------------------------------------------+
| ``Makefile_f90`` and | Makefiles to build Fortran-90 code. |
| ``Makefile_upper_F90`` | |
+--------------------------------+------------------------------------------+
| ``Mex_Fun.f90`` | Mex files. |
+--------------------------------+------------------------------------------+
| ``Mex_Jac_SP.f90`` | Mex files. |
+--------------------------------+------------------------------------------+
| ``Mex_Hessian.f90`` | Mex files. |
+--------------------------------+------------------------------------------+
| ``sutil.f90`` | Sparse utility functions. |
+--------------------------------+------------------------------------------+
| ``tag2num.f90`` | Function related to equation tags. |
+--------------------------------+------------------------------------------+
| ``UpdateSun.f90`` | Function related to solar zenith angle. |
+--------------------------------+------------------------------------------+
| ``UserRateLaws.f90`` and | User-defined rate-law functions. |
| ``UserRateLawsInterfaces.f90`` | |
+--------------------------------+------------------------------------------+
| ``util.f90`` | Input/output utilities. |
+--------------------------------+------------------------------------------+

.. _list-of-symbols-replaced:

Expand Down
6 changes: 3 additions & 3 deletions docs/source/using_kpp/05_output_from_kpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ angle brackets, e.g.:

.. code-block:: console
<J1> NO2 + hv = NO + O : 0.533*SUN;
<1> NO2 + hv = NO + O3P : 6.69e-1*(SUN/60.0e0);
If the equation tags are switched on, KPP also generates the
:code:`PARAMETER` array :code:`EQN_TAGS`. In combination with
Expand All @@ -114,7 +114,7 @@ describe a reaction:

.. code-block:: none
PRINT*, ’Reaction J1 is:’, EQN_NAMES( tag2num( ’J1’ ) )
PRINT*, ’Reaction 1 is:’, EQN_NAMES( tag2num( ’1’ ) )
.. _Precision:

Expand Down Expand Up @@ -1217,7 +1217,7 @@ ISTATUS

Number of Hessian calls.

.. option:: ISTATUS(11) ... ISTATUS(20)
.. option:: ISTATUS(10) ... ISTATUS(20)

currently not used

Expand Down
14 changes: 7 additions & 7 deletions int/radau5.f90
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,10 @@ SUBROUTINE RAD_Integrator( &

#ifdef FULL_ALGEBRA
KPP_REAL :: FJAC(NVAR,NVAR), E1(NVAR,NVAR)
DOUBLE COMPLEX :: E2(NVAR,NVAR)
COMPLEX(kind=dp) :: E2(NVAR,NVAR)
#else
KPP_REAL :: FJAC(LU_NONZERO), E1(LU_NONZERO)
DOUBLE COMPLEX :: E2(LU_NONZERO)
COMPLEX(kind=dp) :: E2(LU_NONZERO)
#endif

!~~~> Local variables
Expand Down Expand Up @@ -1011,10 +1011,10 @@ SUBROUTINE RAD_DecompCmplx(N,FJAC,ALPHA,BETA,E2,IP2,ISING)
INTEGER :: N, ISING
#ifdef FULL_ALGEBRA
KPP_REAL :: FJAC(N,N)
DOUBLE COMPLEX :: E2(N,N)
COMPLEX(kind=dp) :: E2(N,N)
#else
KPP_REAL :: FJAC(LU_NONZERO)
DOUBLE COMPLEX :: E2(LU_NONZERO)
COMPLEX(kind=dp) :: E2(LU_NONZERO)
#endif
KPP_REAL :: ALPHA, BETA
INTEGER :: IP2(N), i, j
Expand Down Expand Up @@ -1049,15 +1049,15 @@ SUBROUTINE RAD_Solve(N,FJAC,GAMMA,ALPHA,BETA,E1,E2,&
INTEGER :: N,IP1(NVAR),IP2(NVAR),ISING
#ifdef FULL_ALGEBRA
KPP_REAL :: FJAC(NVAR,NVAR), E1(NVAR,NVAR)
DOUBLE COMPLEX :: E2(NVAR,NVAR)
COMPLEX(kind=dp) :: E2(NVAR,NVAR)
#else
KPP_REAL :: FJAC(LU_NONZERO), E1(LU_NONZERO)
DOUBLE COMPLEX :: E2(LU_NONZERO)
COMPLEX(kind=dp) :: E2(LU_NONZERO)
#endif
KPP_REAL :: Z1(N),Z2(N),Z3(N), &
F1(N),F2(N),F3(N),CONT(N), &
GAMMA,ALPHA,BETA
DOUBLE COMPLEX :: BC(N)
COMPLEX(kind=dp) :: BC(N)
INTEGER :: i,j
KPP_REAL :: S2, S3
!
Expand Down

0 comments on commit a0be6b4

Please sign in to comment.