Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ add_feature_info(ENABLE_DEBUG_THREADING ENABLE_DEBUG_THREADING "Use multi-thread
option(ENABLE_2D_MODELS "Build 2D models (e.g., 2D general rate model, multichannel transport)" ON)
add_feature_info(ENABLE_2D_MODELS ENABLE_2D_MODELS "Build 2D models (e.g., 2D general rate model, multichannel transport)")

option(ENABLE_DG "Build DG variants of models" ON)
add_feature_info(ENABLE_DG ENABLE_DG "Build DG variants of models")

option(ENABLE_SUNDIALS_OPENMP "Prefer OpenMP vector implementation of SUNDIALS if available (for large problems)" OFF)
add_feature_info(ENABLE_SUNDIALS_OPENMP ENABLE_SUNDIALS_OPENMP "Prefer OpenMP vector implementation of SUNDIALS if available (for large problems)")

Expand Down Expand Up @@ -425,16 +422,14 @@ if (ENABLE_2D_MODELS)
endif()

set(EIGEN_TARGET "")
if (ENABLE_DG)
find_package(Eigen3 3.4 REQUIRED NO_MODULE)
find_package(Eigen3 3.4 REQUIRED NO_MODULE)

# Disable DG if Eigen is not present
if (NOT TARGET Eigen3::Eigen)
message(STATUS "Disabling DG support because Eigen3 could not be found")
set(ENABLE_DG OFF)
else()
set(EIGEN_TARGET "Eigen3::Eigen")
endif()
# Disable DG if Eigen is not present
if (NOT TARGET Eigen3::Eigen)
message(STATUS "Disabling DG support because Eigen3 could not be found")
set(ENABLE_DG OFF)
else()
set(EIGEN_TARGET "Eigen3::Eigen")
endif()

set(IPO_AVAILABLE OFF)
Expand Down Expand Up @@ -664,12 +659,10 @@ if (ENABLE_2D_MODELS)
endif()
endif()

if (ENABLE_DG)
message("Found Eigen3: ${Eigen3_FOUND}")
if (TARGET Eigen3::Eigen)
message(" Version ${Eigen3_VERSION}")
message(" Includes ${Eigen3_INCLUDE_DIRS}")
endif()
message("Found Eigen3: ${Eigen3_FOUND}")
if (TARGET Eigen3::Eigen)
message(" Version ${Eigen3_VERSION}")
message(" Includes ${Eigen3_INCLUDE_DIRS}")
endif()

message("Found HDF5: ${HDF5_FOUND}")
Expand Down
1 change: 0 additions & 1 deletion doc/developer_guide/build_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ The following build arguments can be set in the cmakeSettings.json or from the c
- ``DENABLE_PLATFORM_TIMER``: Utilizes a platform-dependent timer.
- ``DENABLE_DEBUG_THREADING``: Activates multi-threading in debug builds.
- ``DENABLE_2D_MODELS``: Builds 2D models such as the 2D general rate model and multichannel transport.
- ``DENABLE_DG``: Constructs DG variants of models.
- ``DENABLE_SUNDIALS_OPENMP``: Prefers the OpenMP vector implementation of SUNDIALS for large problems if available.
- ``DENABLE_CADET_CLI``: Builds the CADET-Core command line interface.
- ``DENABLE_CADET_TOOLS``: Constructs CADET-Core tools.
Expand Down
4 changes: 2 additions & 2 deletions doc/developer_guide/cadet_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This simplifies using the frontend.
The package includes a ``Cadet`` class which serves as a generic HDF5 frontend.

As an example, we consider setting the external porosity for the column model (``unit_001``).
From :ref:`file format <general_rate_model_config>`, the path for this is ``/input/model/unit_001/COL_POROSITY``.
From :ref:`file format <axial_flow_column_1D_config>`, the path for this is ``/input/model/unit_001/COL_POROSITY``.
In the Python frontend, this becomes:

.. code-block:: Python3
Expand Down Expand Up @@ -86,7 +86,7 @@ General Rate Model
We now add a second unit operation, the column model.
For the :ref:`general rate model model <general_rate_model_model>`, we set the ``unit_type`` parameter of the corresponding unit operation model to ``GENERAL_RATE_MODEL``.
In this group, we set the parameters related to transport and column geometry.
For a more detailed description of the parameters and their units, see the :ref:`corresponding file format <general_rate_model_config>`.
For a more detailed description of the parameters and their units, see the :ref:`corresponding file format <axial_flow_column_1D_config>`.

.. literalinclude:: examples/breakthrough.py
:lines: 20-34
Expand Down
48 changes: 22 additions & 26 deletions doc/developer_guide/examples/breakthrough.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,39 @@
model.root.input.model.unit_001.col_porosity = 0.37 # -
model.root.input.model.unit_001.par_porosity = 0.33 # -
model.root.input.model.unit_001.par_radius = 1e-6 # m
## Transport

## Bulk transport
model.root.input.model.unit_001.col_dispersion = 1e-8 # m^2 / s (interstitial volume)
model.root.input.model.unit_001.film_diffusion = [1e-5] # m / s
model.root.input.model.unit_001.par_diffusion = [1e-10,] # m^2 / s (mobile phase)
model.root.input.model.unit_001.par_surfdiffusion = [0.0,] # m^2 / s (solid phase)

## Particle transport
model.root.input.model.unit_001.particle_type_000.film_diffusion = [1e-5] # m / s
model.root.input.model.unit_001.particle_type_000.pore_diffusion = [1e-10,] # m^2 / s (mobile phase)
model.root.input.model.unit_001.particle_type_000.surface_diffusion = [0.0,] # m^2 / s (solid phase)

## Adsorption
model.root.input.model.unit_001.adsorption_model = 'MULTI_COMPONENT_LANGMUIR'
model.root.input.model.unit_001.nbound = [1]
model.root.input.model.unit_001.adsorption.is_kinetic = True # Kinetic binding
model.root.input.model.unit_001.adsorption.mcl_ka = [1.0,] # m^3 / (mol * s) (mobile phase)
model.root.input.model.unit_001.adsorption.mcl_kd = [1.0,] # 1 / s (desorption)
model.root.input.model.unit_001.adsorption.mcl_qmax = [100.0,] # mol / m^3 (solid phase)
model.root.input.model.unit_001.particle_type_000.adsorption_model = 'MULTI_COMPONENT_LANGMUIR'
model.root.input.model.unit_001.particle_type_000.nbound = [1]
model.root.input.model.unit_001.particle_type_000.adsorption.is_kinetic = True # Kinetic binding
model.root.input.model.unit_001.particle_type_000.adsorption.mcl_ka = [1.0,] # m^3 / (mol * s) (mobile phase)
model.root.input.model.unit_001.particle_type_000.adsorption.mcl_kd = [1.0,] # 1 / s (desorption)
model.root.input.model.unit_001.particle_type_000.adsorption.mcl_qmax = [100.0,] # mol / m^3 (solid phase)

## Initial conditions
model.root.input.model.unit_001.init_c = [0.0,]
model.root.input.model.unit_001.init_q = [0.0,]
model.root.input.model.unit_001.particle_type_000.init_cp = [0.0,]
model.root.input.model.unit_001.particle_type_000.init_cs = [0.0,]

## Discretization
### Grid cells
model.root.input.model.unit_001.discretization.spatial_method = "FV"
model.root.input.model.unit_001.discretization.ncol = 20
model.root.input.model.unit_001.discretization.npar = 5

model.root.input.model.unit_001.discretization.spatial_method = "DG" # "FV" recommended for strong gradients, where DG might oscillate
model.root.input.model.unit_001.discretization.polydeg = 3 # recommended to be increased up to 5 if higher resolution is desired for smooth solutions
model.root.input.model.unit_001.discretization.nelem = 3 # recommended to be increased if higher resolution is desired
model.root.input.model.unit_001.particle_type_000.discretization.spatial_method = "DG"
model.root.input.model.unit_001.particle_type_000.discretization.par_polydeg = 3 # recommended to be increased if higher resolution is desired
model.root.input.model.unit_001.particle_type_000.discretization.par_nelem = 1 # recommended to stay fixed at 1 except for targeted resolution of particle (ie user defined par_disc_type)
### Other options
model.root.input.model.unit_001.discretization.par_disc_type = 'EQUIDISTANT_PAR'
model.root.input.model.unit_001.discretization.particle_type_000.par_disc_type = 'EQUIDISTANT'
model.root.input.model.unit_001.discretization.use_analytic_jacobian = 1
model.root.input.model.unit_001.discretization.reconstruction = 'WENO'
model.root.input.model.unit_001.discretization.gs_type = 1
model.root.input.model.unit_001.discretization.max_krylov = 0
model.root.input.model.unit_001.discretization.max_restarts = 10
model.root.input.model.unit_001.discretization.schur_safety = 1.0e-8

model.root.input.model.unit_001.discretization.weno.boundary_model = 0
model.root.input.model.unit_001.discretization.weno.weno_eps = 1e-10
model.root.input.model.unit_001.discretization.weno.weno_order = 3

## Outlet
model.root.input.model.unit_002.unit_type = 'OUTLET'
Expand Down
2 changes: 1 addition & 1 deletion doc/developer_guide/model_expansion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The first, model independent steps are:

1. Add ``NewModel.cpp`` and ``NewModel.hpp`` files in ``src\libcadet\model`` folder (copy and rename existing ones). Note that we'll call the new model "NewModel" from here on, so make sure to substitute this with the actual name of your model.
2. Add ``${CMAKE_SOURCE_DIR}/src/libcadet/model/NewModel.cpp`` to the ``src/libcadet/CMakeLists.txt``
3. (Optional) In the root/CMakeLists.txt file, you can add a build option to make building your new model optional. This enables building CADET versions with and without the new extension. This can be done, e.g., when additional dependencies are required or when build time should be reduced. See e.g. ``ENABLE_GRM_2D`` or ``ENABLE_DG``.
3. (Optional) In the root/CMakeLists.txt file, you can add a build option to make building your new model optional. This enables building CADET versions with and without the new extension. This can be done, e.g., when additional dependencies are required or when build time should be reduced.
4. Add new model to ModelBuilder (in ModelBuilderImpl.cpp, just like the other models are included):
5. Rename everything to the new model
a. Change the ``identifier()`` function in the ``NewModel.hpp`` to return a new unique model name (here: "NewModel")
Expand Down
2 changes: 1 addition & 1 deletion doc/interface/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Note that all components of component dependent datasets have to be section depe
* - FILM_DIFFUSION
- ✓
- ✓
* - PAR_DIFFUSION
* - PORE_DIFFUSION
- ✓
- ✓
* - PAR_SURDIFFUSION
Expand Down
36 changes: 18 additions & 18 deletions doc/interface/parameter_dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ Currently, the dependence of surface diffusion on the particle liquid salt compo
Group /input/model/unit_XXX
---------------------------

``PAR_SURFDIFFUSION_DEP``
``SURFACE_DIFFUSION_DEP``

Parameter dependence of :math:`\texttt{PAR_SURFDIFFUSION}` on the particle liquid salt component (i.e. component with index 0). Valid dependencies are:
Parameter dependence of :math:`\texttt{SURFACE_DIFFUSION}` on the particle liquid salt component (i.e. component with index 0). Valid dependencies are:

- :math:`\texttt{NONE}` Original parameter is used unmodified.
- :math:`\texttt{LIQUID_SALT_EXPONENTIAL}` Original parameter is modified by exponential law of liquid phase salt concentration.
Expand All @@ -93,87 +93,87 @@ Group /input/model/unit_XXX
**Type:** string **Length:** :math:`1 / \texttt{NPARTYPE}`
================ =========================================

``PAR_SURFDIFFUSION_EXPFACTOR``
``SURFACE_DIFFUSION_EXPFACTOR``

Factor :math:`\texttt{p1}` in exponential law particle surface diffusion relation
:math:`D_{s, i, m} = \tilde{D}_{s, i, m} p_{1, i, m} exp \left(p_{2, i, m} c_{0}^{p} \right)`, where :math:`\tilde{D}_{s, i, m}` is the original surface diffusion coefficient.
Only required if :math:`\texttt{PAR_SURFDIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_EXPONENTIAL}`.
Only required if :math:`\texttt{SURFACE_DIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_EXPONENTIAL}`.

================ ========================= ===================================
**Type:** double **Range:** :math:`\geq 0` **Length:** :math:`\texttt{NBOUND}`
================ ========================= ===================================

``PAR_SURFDIFFUSION_EXPFACTOR``
``SURFACE_DIFFUSION_EXPFACTOR``
:math:`D_{s, i, m} = \tilde{D}_{s, i, m} \left[ p_{4, i, m} \left( k_{i, m} \left( c_{0}^{p} \right) \right)^{p_{5, i, m}} p_{6, i, m} exp \left( p_{7, i, m} k_{i, m} \left( c_{0}^{p} \right) \right) \right]`
where :math:`\tilde{D}_{s, i, m}` is the original surface diffusion coefficient and
:math:`k_{i, m} \left( c_{0}^{p} \right) = p_{1, i, m}\left( c_{0}^{p} \right)^{p_{2, i, m}} + p_{3, i, m}`.
Only required if :math:`\texttt{PAR_SURFDIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_COLLOIDAL_AFFINITY}`.
Only required if :math:`\texttt{SURFACE_DIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_COLLOIDAL_AFFINITY}`.

================ ============================= ===================================
**Type:** double **Range:** :math:`\mathbb{R}` **Length:** :math:`\texttt{NBOUND}`
================ ============================= ===================================

``PAR_SURFDIFFUSION_EXPARGMULT``
``SURFACE_DIFFUSION_EXPARGMULT``

Factor :math:`\texttt{p2}` in exponential law particle surface diffusion relation
:math:`D_{s, i, m} = \tilde{D}_{s, i, m} p_{1, i, m} exp \left(p_{2, i, m} c_{0}^{p} \right)`
where :math:`\tilde{D}_{s, i, m}` is the original surface diffusion coefficient. Only required if :math:`\texttt{PAR_SURFDIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_EXPONENTIAL}`.
where :math:`\tilde{D}_{s, i, m}` is the original surface diffusion coefficient. Only required if :math:`\texttt{SURFACE_DIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_EXPONENTIAL}`.

================ ============================= ===================================
**Type:** double **Range:** :math:`\mathbb{R}` **Length:** :math:`\texttt{NBOUND}`
================ ============================= ===================================

``PAR_SURFDIFFUSION_POWFACTOR``
``SURFACE_DIFFUSION_POWFACTOR``

Factor :math:`\texttt{p1}` in power law particle surface diffusion relation
:math:`D_{s, i, m} = \tilde{D}_{s, i, m} p_{1, i, m} \left( c_{0}^{p} \right)^{p_{2, i, m}}`
where :math:`\tilde{D}_{s, i, m}` is the original surface diffusion coefficient. Only required if :math:`\texttt{PAR_SURFDIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_POWER}`.
where :math:`\tilde{D}_{s, i, m}` is the original surface diffusion coefficient. Only required if :math:`\texttt{SURFACE_DIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_POWER}`.

================ ========================= ===================================
**Type:** double **Range:** :math:`\geq 0` **Length:** :math:`\texttt{NBOUND}`
================ ========================= ===================================

``PAR_SURFDIFFUSION_POWEXP``
``SURFACE_DIFFUSION_POWEXP``

Fjactor :math:`\texttt{p2}` in power law particle surface diffusion relation
:math:`D_{s, i, m} = \tilde{D}_{s, i, m} p_{1, i, m} \left( c_{0}^{p} \right)^{p_{2, i, m}}`
where :math:`\tilde{D}_{s, i, m}` is the original surface diffusion coefficient. Only required if :math:`\texttt{PAR_SURFDIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_POWER}`.
where :math:`\tilde{D}_{s, i, m}` is the original surface diffusion coefficient. Only required if :math:`\texttt{SURFACE_DIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_POWER}`.

================ ============================= ===================================
**Type:** double **Range:** :math:`\mathbb{R}` **Length:** :math:`\texttt{NBOUND}`
================ ============================= ===================================

``PAR_SURFDIFFUSION_LOGKEQFACTOR``
``SURFACE_DIFFUSION_LOGKEQFACTOR``

Factor :math:`\texttt{p1}` in colloidal affinity law particle surface diffusion relation
:math:`D_{s, i, m} = \tilde{D}_{s, i, m} \left[ p_{4, i, m} \left( k_{i, m} \left( c_{0}^{p} \right) \right)^{p_{5, i, m}} p_{6, i, m} exp \left( p_{7, i, m} k_{i, m} \left( c_{0}^{p} \right) \right) \right]`
where :math:`\tilde{D}_{s, i, m}` is the original surface diffusion coefficient and
:math:`k_{i, m} \left( c_{0}^{p} \right) = p_{1, i, m}\left( c_{0}^{p} \right)^{p_{2, i, m}} + p_{3, i, m}`.
Only required if :math:`\texttt{PAR_SURFDIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_COLLOIDAL_AFFINITY}`.
Only required if :math:`\texttt{SURFACE_DIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_COLLOIDAL_AFFINITY}`.

================ ============================= ===================================
**Type:** double **Range:** :math:`\mathbb{R}` **Length:** :math:`\texttt{NBOUND}`
================ ============================= ===================================

``PAR_SURFDIFFUSION_LOGKEQEXP``
``SURFACE_DIFFUSION_LOGKEQEXP``

Factor :math:`\texttt{p2}` in colloidal affinity law particle surface diffusion relation
:math:`D_{s, i, m} = \tilde{D}_{s, i, m} \left[ p_{4, i, m} \left( k_{i, m} \left( c_{0}^{p} \right) \right)^{p_{5, i, m}} p_{6, i, m} exp \left( p_{7, i, m} k_{i, m} \left( c_{0}^{p} \right) \right) \right]`
where :math:`\tilde{D}_{s, i, m}` is the original surface diffusion coefficient and
:math:`k_{i, m} \left( c_{0}^{p} \right) = p_{1, i, m}\left( c_{0}^{p} \right)^{p_{2, i, m}} + p_{3, i, m}`.
Only required if :math:`\texttt{PAR_SURFDIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_COLLOIDAL_AFFINITY}`.
Only required if :math:`\texttt{SURFACE_DIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_COLLOIDAL_AFFINITY}`.

================ ============================= ===================================
**Type:** double **Range:** :math:`\mathbb{R}` **Length:** :math:`\texttt{NBOUND}`
================ ============================= ===================================

``PAR_SURFDIFFUSION_LOGKEQCONST``
``SURFACE_DIFFUSION_LOGKEQCONST``

Factor :math:`\texttt{p3}` in colloidal affinity law particle surface diffusion relation
:math:`D_{s, i, m} = \tilde{D}_{s, i, m} \left[ p_{4, i, m} \left( k_{i, m} \left( c_{0}^{p} \right) \right)^{p_{5, i, m}} p_{6, i, m} exp \left( p_{7, i, m} k_{i, m} \left( c_{0}^{p} \right) \right) \right]`
where :math:`\tilde{D}_{s, i, m}` is the original surface diffusion coefficient and
:math:`k_{i, m} \left( c_{0}^{p} \right) = p_{1, i, m}\left( c_{0}^{p} \right)^{p_{2, i, m}} + p_{3, i, m}`.
Only required if :math:`\texttt{PAR_SURFDIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_COLLOIDAL_AFFINITY}`.
Only required if :math:`\texttt{SURFACE_DIFFUSION_DEP}` is :math:`\texttt{LIQUID_SALT_COLLOIDAL_AFFINITY}`.

================ ============================= ===================================
**Type:** double **Range:** :math:`\mathbb{R}` **Length:** :math:`\texttt{NBOUND}`
Expand Down
2 changes: 1 addition & 1 deletion doc/interface/sensitivities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Group /input/sensitivity/param_XXX

``SENS_PARTYPE``

Particle type index (:math:`-1` if parameter is independent of particle types, see the multiplexing of the corresponding parameter, e.g. `PAR_DIFFUSION_MULTIPLEX`)
Particle type index (:math:`-1` if parameter is independent of particle types, see the multiplexing of the corresponding parameter, e.g. `PORE_DIFFUSION_MULTIPLEX`)

============= ========================== ===========================
**Type:** int **Range:** :math:`\geq -1` **Length:** :math:`\geq 1`
Expand Down
Loading
Loading