Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
d5ff5d5
initial concept
AntoniaBerger May 13, 2025
cd09ef8
ASM3: compute p2-5
cbix May 13, 2025
cd8d388
ASM3: compute r6-12
cbix May 13, 2025
3c56f72
ASM3: set up parameters and derived variables
cbix May 13, 2025
9971358
register model and jacobian equation as pseudo code
AntoniaBerger May 14, 2025
12a5b67
ASM3: add Aeration
cbix May 14, 2025
5e65317
ASM3: basic stoichiometry definition
cbix May 14, 2025
26d0ff1
ASM3: parameter set required for stoichiometry
cbix May 14, 2025
d07851e
ASM3: differentiate p1-5
cbix May 14, 2025
8bb2dff
ASM3: differentiate r6-12
cbix May 14, 2025
acabe81
ASM3: compute jacobian
cbix May 14, 2025
5af98cf
add ad test
AntoniaBerger May 14, 2025
47c5378
Merge branch 'feature/ActiveSludgeModel3' of github.com:modsim/CADET …
AntoniaBerger May 14, 2025
055af7f
get parameter from parameterprovider
AntoniaBerger May 14, 2025
ff508ae
ASM3: set up params for codegen
cbix May 14, 2025
564fc8c
add ASM3 to factory
AntoniaBerger May 14, 2025
15e7864
Merge branch 'feature/ActiveSludgeModel3' of github.com:modsim/CADET …
AntoniaBerger May 14, 2025
b3660e7
ASM3: fix codegen json
cbix May 14, 2025
f704613
ASM3: use scalar external params
cbix May 14, 2025
c36c198
fix parameter
AntoniaBerger May 14, 2025
324a1da
Merge branch 'feature/ActiveSludgeModel3' of github.com:modsim/CADET …
AntoniaBerger May 14, 2025
49dd73c
ASM3: fix jacobian computation
cbix May 14, 2025
e78df34
overload ScalarParameter methods for reaction model compatibility
cbix May 14, 2025
507847c
parameter declariation and jacobian fix
AntoniaBerger May 15, 2025
0750d08
fic internal variable determination numbered value int-> double
AntoniaBerger May 15, 2025
785dd6c
ASM3: start documenting parameters
cbix May 17, 2025
ee896db
ASM3: document remaining params from SIMBA#
cbix May 19, 2025
ce294c2
fix lost of jacobi equaitons
AntoniaBerger May 19, 2025
e133544
Merge branch 'feature/ActiveSludgeModel3' of github.com:cadet/CADET-C…
AntoniaBerger May 19, 2025
3a34839
ASM3: fix doc typos
cbix May 19, 2025
d56bda7
Merge branch 'master' of https://github.com/cadet/cadet-core into fea…
cbix May 19, 2025
1773de2
ASM3: use ScalarParameter fix from #412
cbix May 19, 2025
69a968f
add jacobian test and fix jacobian
AntoniaBerger May 20, 2025
844f2fc
Merge branch 'feature/ActiveSludgeModel3' of github.com:cadet/CADET-C…
AntoniaBerger May 20, 2025
2ce03de
add AD test only for reactions in liquit phase
AntoniaBerger May 20, 2025
5e1c124
ASM3: group parameter documentation
cbix May 20, 2025
bcebcee
Merge branch 'master' of https://github.com/cadet/cadet-core into fea…
cbix May 27, 2025
8473f77
change parameter name to lowercase
AntoniaBerger Jun 6, 2025
94a0a99
add example set up for cadet_python to doc
AntoniaBerger Jun 6, 2025
1d92cd1
fixup! add example set up for cadet_python to doc
AntoniaBerger Jun 6, 2025
ad9355f
start error messaging
AntoniaBerger Jun 7, 2025
8ab57cf
configurable component index
cbix Jun 21, 2025
3f406b1
check ASM3_COMP_IDX exists before reading
cbix Jun 22, 2025
a39e4cd
document ASM3_COMP_IDX, use bold sub headings
cbix Jun 22, 2025
775b437
update stoichimoetry using custom indexes
cbix Jun 22, 2025
8614939
Merge branch 'master' of https://github.com/cadet/cadet-core into fea…
cbix Jun 23, 2025
05c40fd
Seperation of SS and SI and flexible index for jacobinan
AntoniaBerger Jun 30, 2025
f334197
fixup! Seperation of SS and SI and flexible index for jacobinan
AntoniaBerger Jun 30, 2025
12a4376
Add time dependent fraction
AntoniaBerger Jun 30, 2025
b0f2bfc
clean up for fractionate option
AntoniaBerger Aug 4, 2025
0be749e
Merge branch 'master' of https://github.com/cadet/cadet-core into fea…
cbix Sep 11, 2025
512cae7
asm3: fix warning when using fractionated SS/SI
cbix Sep 15, 2025
b0d9552
change internal parameter names
AntoniaBerger Nov 19, 2025
9b99534
fix ASM3 test
AntoniaBerger Nov 19, 2025
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
276 changes: 276 additions & 0 deletions doc/interface/reaction/activated_sludge_model.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
.. _activated_sludge_model_config:

Activated Sludge Model (ASM3h)
~~~~~~~~~~~~~~~~~~~~~~~~~

**Group /input/model/unit_XXX/reaction - REACTION_MODEL = ACTIVATED_SLUDGE_MODEL3**

For information on model equations, refer to :ref:`activated_sludge_model`.

**Component configuration**

``ASM3_COMP_IDX``

Optional component indexes. Set this in case the relevant components start at a certain offset or are provided
in a different order than listed below:

============= =========
**Component** **Index**
============= =========
SO 0
SS 1
SNH 2
SNO 3
SN2 4
SALK 5
SI 6
XI 7
XS 8
XH 9
XSTO 10
XA 11
XMI 12
============= =========


================ ============================= ========================================================
**Type:** double **Range:** :math:`\mathbb{N}` **Length:** 13
================ ============================= ========================================================

**Environment/process parameters**

``ASM3_T``

Temperature :math:`T`.

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

``ASM3_V``

Reactor volume :math:`V`. Set this to the column volume since the model can't compute it itself.

================ ============================= ========================================================
**Type:** double **Range:** :math:`\gt 0` **Length:** 1
================ ============================= ========================================================

``ASM3_IO2``

Aeration oxygen input :math:`iO_2`.

================ ============================= ========================================================
**Type:** double **Range:** :math:`\ge 0` **Length:** 1
================ ============================= ========================================================

**Maximum rates**

``ASM3_KH20``

Hydrolysis rate constant :math:`k_H` at 20 °C.

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

``ASM3_KSTO20``

Maximum storage rate :math:`K_{STO}` at 20 °C.

================ ============================= ========================================================
**Type:** double **Range:** :math:`\gt 0` **Length:** 1
================ ============================= ========================================================

``ASM3_MU_H20``

Heterotrophic max. growth rate :math:`\mu_{H}` at 20 °C.

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

``ASM3_BH20``

Rate constant for lysis and decay :math:`b_H` at 20 °C.

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

``ASM3_MU_AUT20``

Autotrophic max. growth rate :math:`\mu_{AUT}` at 20 °C.

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

``ASM3_BAUT20``

Rate constant :math:`b_{AUT}` for decay of autotrophs at 20 °C.

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

**Anoxic reduction factors**

``ASM3_ETA_HNO3``

Anoxic reduction factor :math:`\eta_{HNO_3}` – heterotrophic growth.

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

``ASM3_ETAH_END``

Anoxic reduction factor :math:`\eta_{H_{end}}` – endogenous respiration XH.

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

``ASM3_ETAN_END``

Anoxic reduction factor :math:`\eta_{N_{end}}` – endogenous respiration XA.

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

**Saturation/inhibition coefficients**

``ASM3_KX``

Saturation/inhibition coefficient :math:`KX` for particulate COD.

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

``ASM3_KHO2``

Saturation/inhibition coefficient :math:`KHO_2` for oxygen, heterotrophic growth.

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

``ASM3_KHSS``

Saturation/inhibition coefficient :math:`KHSS` for readily biodegradable substrates.

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

``ASM3_KHNO3``

Saturation/inhibition coefficient :math:`KHNO_3` for nitrate.

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

``ASM3_KHNH4``

Saturation/inhibition coefficient :math:`KHNH_4` for ammonium (nutrient).

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

``ASM3_KHALK``

Saturation coefficient :math:`KH_{ALK}` for alkalinity (HCO3-).

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

``ASM3_KHSTO``

Saturation coefficient :math:`KH_{STO}` for storage products.

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

``ASM3_KNO2``

Saturation coefficient :math:`K_{NO_2}` for oxygen, autotrophic growth.

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

``ASM3_KNNH4``

Saturation coefficient :math:`K_{NNH_4}` for ammonium (substrate), autotrophic growth.

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

``ASM3_KNALK``

Saturation coefficient :math:`K_{NALK}` for alkalinity (HCO3-), autotrophic growth.

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

**Example**

.. python::

# Example of setting up an ASM3 reaction model in a unit operation with bulk reaction

# Setup ASM3 reaction for unit 000 with example values
model.root.input.model.unit_000.reaction_model = 'ACTIVATED_SLUDGE_MODEL3'
model.root.input.model.unit_000.reaction_bulk.asm3_insi = 0.01
model.root.input.model.unit_000.reaction_bulk.asm3_inss = 0.03
model.root.input.model.unit_000.reaction_bulk.asm3_inxi = 0.04
model.root.input.model.unit_000.reaction_bulk.asm3_inxs = 0.03
model.root.input.model.unit_000.reaction_bulk.asm3_inbm = 0.07
model.root.input.model.unit_000.reaction_bulk.asm3_ivss_xi = 0.751879699
model.root.input.model.unit_000.reaction_bulk.asm3_ivss_xs = 0.555555556
model.root.input.model.unit_000.reaction_bulk.asm3_ivss_sto = 0.6
model.root.input.model.unit_000.reaction_bulk.asm3_ivss_bm = 0.704225352
model.root.input.model.unit_000.reaction_bulk.asm3_itss_vss_bm = 1.086956522


model.root.input.model.unit_000.reaction_bulk.asm3_fiss_bm_prod = 1
model.root.input.model.unit_000.reaction_bulk.asm3_fsi = 0
model.root.input.model.unit_000.reaction_bulk.asm3_yh_aer = 0.8
model.root.input.model.unit_000.reaction_bulk.asm3_yh_anox = 0.65

model.root.input.model.unit_000.reaction_bulk.asm3_ysto_aer = 0.8375
model.root.input.model.unit_000.reaction_bulk.asm3_ysto_anox = 0.7
model.root.input.model.unit_000.reaction_bulk.asm3_fxi = 0.2
model.root.input.model.unit_000.reaction_bulk.asm3_ya = 0.24
model.root.input.model.unit_000.reaction_bulk.asm3_kh20 = 9
model.root.input.model.unit_000.reaction_bulk.asm3_kx = 1
model.root.input.model.unit_000.reaction_bulk.asm3_ksto20 = 12
model.root.input.model.unit_000.reaction_bulk.asm3_mu_h20 = 3
model.root.input.model.unit_000.reaction_bulk.asm3_bh20 = 0.33
model.root.input.model.unit_000.reaction_bulk.asm3_eta_hno3 = 0.5
model.root.input.model.unit_000.reaction_bulk.asm3_khO2 = 0.2
model.root.input.model.unit_000.reaction_bulk.asm3_khss = 10
model.root.input.model.unit_000.reaction_bulk.asm3_khno3 = 0.5
model.root.input.model.unit_000.reaction_bulk.asm3_khnh4 = 0.01
model.root.input.model.unit_000.reaction_bulk.asm3_khalk = 0.1
model.root.input.model.unit_000.reaction_bulk.asm3_khsto = 0.1
model.root.input.model.unit_000.reaction_bulk.asm3_mu_aut20 = 1.12
model.root.input.model.unit_000.reaction_bulk.asm3_baut20 = 0.18
model.root.input.model.unit_000.reaction_bulk.asm3_etah_end = 0.5
model.root.input.model.unit_000.reaction_bulk.asm3_etan_end = 0.5
model.root.input.model.unit_000.reaction_bulk.asm3_kno2 = 0.5
model.root.input.model.unit_000.reaction_bulk.asm3_knnh4 = 0.7
model.root.input.model.unit_000.reaction_bulk.asm3_knalk = 0.5
model.root.input.model.unit_000.reaction_bulk.asm3_t = 12


model.root.input.model.unit_000.reaction_bulk.asm3_v = 1000.0
model.root.input.model.unit_000.reaction_bulk.asm3_io2 = 0.0
1 change: 1 addition & 0 deletions doc/interface/reaction/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Reaction models

mass_action_law
michaelis_menten_kinetics
activated_sludge_model

Externally dependent reaction models
------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions doc/modelling/reaction/activated_sludge_model.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _activated_sludge_model:

Activated Sludge Model (ASM3h)
-------------------------

Activated Sludge Models are a group of reaction models published by the International Water Association (IWA)
and mostly used for modelling biological processes in wastewater treatment plants.

The ASM3h model implemented in CADET is a variant of the ASM3 model and documented in the SIMBA# software suite.

For more information on model parameters required to define in CADET file format, see :ref:`activated_sludge_model_config`.
4 changes: 4 additions & 0 deletions doc/modelling/reaction/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Historically, a chromatography system is modeled as a reaction system without co
- :ref:`thomas_model`
- :ref:`rate_constant_distribution_theory`

More specialized models are also implemented:

- :ref:`activated_sludge_model`

.. _dependence-on-external-function_react:

Dependence on external function
Expand Down
2 changes: 1 addition & 1 deletion src/libcadet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ set(LIBCADET_REACTIONMODEL_SOURCES
${CMAKE_SOURCE_DIR}/src/libcadet/model/reaction/DummyReaction.cpp
${CMAKE_SOURCE_DIR}/src/libcadet/model/reaction/MassActionLawReaction.cpp
${CMAKE_SOURCE_DIR}/src/libcadet/model/reaction/MichaelisMentenReaction.cpp

${CMAKE_SOURCE_DIR}/src/libcadet/model/reaction/ActivatedSludgeModelThree.cpp
${CMAKE_SOURCE_DIR}/src/libcadet/model/reaction/CrystallizationReaction.cpp
)

Expand Down
2 changes: 2 additions & 0 deletions src/libcadet/ReactionModelFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace cadet
void registerMassActionLawReaction(std::unordered_map<std::string, std::function<model::IDynamicReactionModel*()>>& reactions);
void registerDummyReaction(std::unordered_map<std::string, std::function<model::IDynamicReactionModel*()>>& reactions);
void registerMichaelisMentenReaction(std::unordered_map<std::string, std::function<model::IDynamicReactionModel*()>>& reactions);
void registerActivatedSludgeModelThreeReaction(std::unordered_map<std::string, std::function<model::IDynamicReactionModel* ()>>& reactions);

void registerCrystallizationReaction(std::unordered_map<std::string, std::function<model::IDynamicReactionModel*()>>& reactions);
}
Expand All @@ -33,6 +34,7 @@ namespace cadet
model::reaction::registerDummyReaction(_dynamicModels);
model::reaction::registerMassActionLawReaction(_dynamicModels);
model::reaction::registerMichaelisMentenReaction(_dynamicModels);
model::reaction::registerActivatedSludgeModelThreeReaction(_dynamicModels);

model::reaction::registerCrystallizationReaction(_dynamicModels);
}
Expand Down
Loading
Loading