Skip to content

Commit 7106e9f

Browse files
committed
wip update interface
1 parent 38e0609 commit 7106e9f

File tree

76 files changed

+2418
-16749
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2418
-16749
lines changed

doc/developer_guide/examples/breakthrough.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
## Initial conditions
4545
model.root.input.model.unit_001.init_c = [0.0,]
46-
model.root.input.model.unit_001.init_q = [0.0,]
46+
model.root.input.model.unit_001.INIT_CS = [0.0,]
4747

4848
## Discretization
4949
### Grid cells
@@ -52,7 +52,7 @@
5252
model.root.input.model.unit_001.discretization.npar = 5
5353

5454
### Other options
55-
model.root.input.model.unit_001.discretization.par_disc_type = 'EQUIDISTANT_PAR'
55+
model.root.input.model.unit_001.discretization.par_disc_type = 'EQUIDISTANT'
5656
model.root.input.model.unit_001.discretization.use_analytic_jacobian = 1
5757
model.root.input.model.unit_001.discretization.reconstruction = 'WENO'
5858
model.root.input.model.unit_001.discretization.gs_type = 1

doc/interface/unit_operations/2d_general_rate_model.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ For information on model equations, refer to :ref:`2d_general_rate_model_model`.
9393
**Type:** double **Range:** :math:`\geq 0`
9494
================ =========================
9595

96-
``INIT_Q``
96+
``INIT_CS``
9797

9898
Initial concentrations for each bound state of each component in the bead solid phase. If :math:`\texttt{ADSORPTION_MODEL_MULTIPLEX}` is 0, values for each particle type are required in type-component-major ordering (length is :math:`\texttt{NTOTALBND}`). If :math:`\texttt{ADSORPTION_MODEL_MULTIPLEX}` is 1, values for one particle type are required in component-major ordering (length is :math:`\sum_{i = 0}^{\texttt{NCOMP} - 1} \texttt{NBND}_i`). Alternatively, values for each radial zone can be supplied. If :math:`\texttt{ADSORPTION_MODEL_MULTIPLEX}` is 0, values for each radial zone and each particle type are required in radial-type-component-major ordering (length is :math:`\texttt{NRAD} \cdot \texttt{NTOTALBND}`). If :math:`\texttt{ADSORPTION_MODEL_MULTIPLEX}` is 1, values for each radial zone and all particle types are required in radial-component-major ordering (length is :math:`\texttt{NRAD} \cdot \sum_{i = 0}^{\texttt{NCOMP} - 1} \texttt{NBND}_i`). In the radial-inhomogeneous case, the :math:`\texttt{SENS_REACTION}` field is used for indexing the radial zone when specifying parameter sensitivities.
9999

@@ -105,7 +105,7 @@ For information on model equations, refer to :ref:`2d_general_rate_model_model`.
105105

106106
``INIT_STATE``
107107

108-
Full state vector for initialization (optional, :math:`\texttt{INIT_C}`, :math:`\texttt{INIT_CP}`, and :math:`\texttt{INIT_Q}` will be ignored; if length is :math:`2\texttt{NDOF}`, then the second half is used for time derivatives)
108+
Full state vector for initialization (optional, :math:`\texttt{INIT_C}`, :math:`\texttt{INIT_CP}`, and :math:`\texttt{INIT_CS}` will be ignored; if length is :math:`2\texttt{NDOF}`, then the second half is used for time derivatives)
109109

110110
**Unit:** :math:`various`
111111

@@ -430,21 +430,21 @@ Group /input/model/unit_XXX/discretization - UNIT_TYPE - GENERAL_RATE_MODEL_2D
430430

431431
``PAR_DISC_TYPE``
432432

433-
Specifies the discretization scheme inside the particles for all or each particle type. Valid values are :math:`\texttt{EQUIDISTANT_PAR}`, :math:`\texttt{EQUIVOLUME_PAR}`, and :math:`\texttt{USER_DEFINED_PAR}`.
433+
Specifies the discretization scheme inside the particles for all or each particle type. Valid values are :math:`\texttt{EQUIDISTANT}`, :math:`\texttt{EQUIVOLUME}`, and :math:`\texttt{USER_DEFINED}`.
434434

435435
================ =========================================
436436
**Type:** string **Length:** :math:`1 / \texttt{NPARTYPE}`
437437
================ =========================================
438438

439439
``PAR_DISC_VECTOR``
440440

441-
Node coordinates for the cell boundaries (ignored if :math:`\texttt{PAR_DISC_TYPE} \neq \texttt{USER_DEFINED_PAR}`). The coordinates are relative and have to include the endpoints 0 and 1. They are later linearly mapped to the true radial range :math:`[r_{c,j}, r_{p,j}]`. The coordinates for each particle type are appended to one long vector in type-major ordering.
441+
Node coordinates for the cell boundaries (ignored if :math:`\texttt{PAR_DISC_TYPE} \neq \texttt{USER_DEFINED}`). The coordinates are relative and have to include the endpoints 0 and 1. They are later linearly mapped to the true radial range :math:`[r_{c,j}, r_{p,j}]`. The coordinates for each particle type are appended to one long vector in type-major ordering.
442442

443443
================ ======================== ===============================================
444444
**Type:** double **Range:** :math:`[0,1]` **Length:** :math:`sum_i (\texttt{NPAR}_i + 1)`
445445
================ ======================== ===============================================
446446

447-
``PAR_BOUNDARY_ORDER``
447+
``FV_BOUNDARY_ORDER``
448448

449449
Order of accuracy of outer particle boundary condition. Optional, defaults to 2.
450450

doc/interface/unit_operations/cstr.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ For information on model equations, refer to :ref:`cstr_model`.
9393
**Type:** double **Range:** :math:`\geq 0` **Length:** 1
9494
================ ========================= =============
9595

96-
``INIT_Q``
96+
``INIT_CS``
9797

9898
Initial concentrations for each bound state of each component in the bead solid phase of each particle type in type-component-major ordering. This field is optional and defaults to all 0.
9999

@@ -105,7 +105,7 @@ For information on model equations, refer to :ref:`cstr_model`.
105105

106106
``INIT_STATE``
107107

108-
Full state vector for initialization (optional, :math:`\texttt{INIT_C}`, :math:`\texttt{INIT_Q}`, and :math:`\texttt{INIT_VOLUME}` will be ignored; if length is :math:`2\texttt{NDOF}`, then the second half is used for time derivatives)
108+
Full state vector for initialization (optional, :math:`\texttt{INIT_C}`, :math:`\texttt{INIT_CS}`, and :math:`\texttt{INIT_VOLUME}` will be ignored; if length is :math:`2\texttt{NDOF}`, then the second half is used for time derivatives)
109109

110110
**Unit:** :math:`various`
111111

doc/interface/unit_operations/general_rate_model.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ For information on model equations, refer to :ref:`general_rate_model_model`.
9393
**Type:** double **Range:** :math:`\geq 0` **Length:** :math:`\texttt{NCOMP} / \texttt{NPARTYPE} \cdot \texttt{NCOMP}`
9494
================ ========================= ===========================================================================
9595

96-
``INIT_Q``
96+
``INIT_CS``
9797

9898
Initial concentrations for each bound state of each component in the bead solid phase. If :math:`\texttt{ADSORPTION_MODEL_MULTIPLEX}` is :math:`0`, values for each particle type are required in type-component-major ordering (length is :math:`\texttt{NTOTALBND}`). If :math:`\texttt{ADSORPTION_MODEL_MULTIPLEX}` is :math:`1`, values for one particle type are required in component-major ordering (length is :math:`\sum_{i = 0}^{\texttt{NCOMP} - 1} \texttt{NBND}_i`).
9999

@@ -105,7 +105,7 @@ For information on model equations, refer to :ref:`general_rate_model_model`.
105105

106106
``INIT_STATE``
107107

108-
Full state vector for initialization (optional, :math:`\texttt{INIT_C}`, :math:`\texttt{INIT_CP}`, and :math:`\texttt{INIT_Q}` will be ignored; if length is :math:`2\texttt{NDOF}`, then the second half is used for time derivatives)
108+
Full state vector for initialization (optional, :math:`\texttt{INIT_C}`, :math:`\texttt{INIT_CP}`, and :math:`\texttt{INIT_CS}` will be ignored; if length is :math:`2\texttt{NDOF}`, then the second half is used for time derivatives)
109109

110110
**Unit:** :math:`various`
111111

@@ -333,15 +333,15 @@ Group /input/model/unit_XXX/discretization - UNIT_TYPE - GENERAL_RATE_MODEL
333333

334334
``PAR_DISC_TYPE``
335335

336-
Specifies the discretization scheme inside the particles for all or each particle type. Valid values are :math:`\texttt{EQUIDISTANT_PAR}`, :math:`\texttt{EQUIVOLUME_PAR}`, and :math:`\texttt{USER_DEFINED_PAR}`.
336+
Specifies the discretization scheme inside the particles for all or each particle type. Valid values are :math:`\texttt{EQUIDISTANT}`, :math:`\texttt{EQUIVOLUME}`, and :math:`\texttt{USER_DEFINED}`.
337337

338338
================ =================================================
339339
**Type:** string **Length:** :math:`1` / :math:`\texttt{NPARTYPE}`
340340
================ =================================================
341341

342342
``PAR_DISC_VECTOR``
343343

344-
Node coordinates for the cell boundaries (ignored if :math:`\texttt{PAR_DISC_TYPE} \neq \texttt{USER_DEFINED_PAR}`). The coordinates are relative and have to include the endpoints :math:`0` and :math:`1`. They are later linearly mapped to the true radial range :math:`[r_{c,j}, r_{p,j}]`. The coordinates for each particle type are appended to one long vector in type-major ordering.
344+
Node coordinates for the cell boundaries (ignored if :math:`\texttt{PAR_DISC_TYPE} \neq \texttt{USER_DEFINED}`). The coordinates are relative and have to include the endpoints :math:`0` and :math:`1`. They are later linearly mapped to the true radial range :math:`[r_{c,j}, r_{p,j}]`. The coordinates for each particle type are appended to one long vector in type-major ordering.
345345

346346
================ ======================== ================================================
347347
**Type:** double **Range:** :math:`[0,1]` **Length:** :math:`\sum_i (\texttt{NPAR}_i + 1)`
@@ -384,7 +384,7 @@ Finite Volumes (Default)
384384
**Type:** int **Range:** :math:`\geq 1` **Length:** :math:`1` / :math:`\texttt{NPARTYPE}`
385385
============= ========================= =================================================
386386

387-
``PAR_BOUNDARY_ORDER``
387+
``FV_BOUNDARY_ORDER``
388388

389389
Order of accuracy of outer particle boundary condition. Optional, defaults to :math:`2`.
390390

doc/interface/unit_operations/lumped_rate_model_with_pores.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ For information on model equations, refer to :ref:`lumped_rate_model_with_pores_
8484
**Type:** double **Range:** :math:`\geq 0` **Length:** :math:`\texttt{NCOMP} / \texttt{NPARTYPE} \cdot \texttt{NCOMP}`
8585
================ ========================= ===========================================================================
8686

87-
``INIT_Q``
87+
``INIT_CS``
8888
Initial concentrations for each bound state of each component in the bead solid phase. If :math:`\texttt{ADSORPTION_MODEL_MULTIPLEX}` is :math:`0`, values for each particle type are required in type-component-major ordering (length is :math:`\texttt{NTOTALBND}`). If :math:`\texttt{ADSORPTION_MODEL_MULTIPLEX}` is :math:`1`, values for one particle type are required in component-major ordering (length is :math:`\sum_{i = 0}^{\texttt{NCOMP} - 1} \texttt{NBND}_i`).
8989

9090
**Unit:** :math:`\mathrm{mol}\,\mathrm{m}_{\mathrm{SP}}^{-3}`
@@ -94,7 +94,7 @@ For information on model equations, refer to :ref:`lumped_rate_model_with_pores_
9494
================ =========================
9595

9696
``INIT_STATE``
97-
Full state vector for initialization (optional, :math:`\texttt{INIT_C}`, :math:`\texttt{INIT_CP}`, and :math:`\texttt{INIT_Q}` will be ignored; if length is :math:`2\texttt{NDOF}`, then the second half is used for time derivatives)
97+
Full state vector for initialization (optional, :math:`\texttt{INIT_C}`, :math:`\texttt{INIT_CP}`, and :math:`\texttt{INIT_CS}` will be ignored; if length is :math:`2\texttt{NDOF}`, then the second half is used for time derivatives)
9898

9999
**Unit:** :math:`various`
100100

doc/interface/unit_operations/lumped_rate_model_without_pores.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ For information on model equations, refer to :ref:`lumped_rate_model_without_por
5959
**Type:** double **Range:** :math:`\geq 0` **Length:** :math:`\texttt{NCOMP}`
6060
================ ========================= ===================================
6161

62-
``INIT_Q``
62+
``INIT_CS``
6363

6464
Initial concentrations for each bound state of each component in the bead solid phase in component-major ordering
6565

@@ -71,7 +71,7 @@ For information on model equations, refer to :ref:`lumped_rate_model_without_por
7171

7272
``INIT_STATE``
7373

74-
Full state vector for initialization (optional, :math:`\texttt{INIT_C}` and :math:`\texttt{INIT_Q}` will be ignored; if length is :math:`2\texttt{NDOF}`, then the second half is used for time derivatives)
74+
Full state vector for initialization (optional, :math:`\texttt{INIT_C}` and :math:`\texttt{INIT_CS}` will be ignored; if length is :math:`2\texttt{NDOF}`, then the second half is used for time derivatives)
7575

7676
**Unit:** :math:`various`
7777

src/libcadet/ParamReaderHelper.hpp

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "cadet/ParameterId.hpp"
2222
#include "cadet/ParameterProvider.hpp"
2323
#include "cadet/Exceptions.hpp"
24-
24+
#include "model/ParameterMultiplexing.hpp"
2525
#include "common/CompilerSpecific.hpp"
2626

2727
#include <string>
@@ -225,7 +225,6 @@ namespace cadet
225225
}
226226
}
227227

228-
229228
/**
230229
* @brief Selects an array of possible section dependent vectorial parameters from a list
231230
* @details The parameters may be section dependent, but do not have to. The function is given
@@ -254,6 +253,94 @@ namespace cadet
254253
return data.data();
255254
}
256255

256+
/**
257+
* @brief Selects an array of component dependent vectorial parameters from a list with potential further dependencies
258+
* @param [in] data Vector with all parameter values in parType-section-component major order
259+
* @param [in] mode multiplex mode of parameter
260+
* @param [in] nParType number of particle types
261+
* @param [in] nComp number of components
262+
* @param [in] parTypeIdx Index of the current particle type
263+
* @param [in] secIdx Index of the current section
264+
* @return Pointer to the first element of the correct vectorial parameter array
265+
*/
266+
template <typename T>
267+
inline T const* getPartypeSecDependentCompSlice(const std::vector<T>& data, model::MultiplexMode mode, unsigned int nParType, unsigned int nComp, unsigned int parTypeIdx, unsigned int secIdx)
268+
{
269+
switch (mode)
270+
{
271+
case model::MultiplexMode::Component:
272+
return data.data();
273+
break;
274+
case model::MultiplexMode::ComponentType:
275+
return data.data() + parTypeIdx * nComp;
276+
break;
277+
case model::MultiplexMode::ComponentSection:
278+
return data.data() + secIdx * nComp;
279+
break;
280+
case model::MultiplexMode::ComponentSectionType:
281+
{
282+
const unsigned int nSec = data.size() / nComp / nParType;
283+
return data.data() + parTypeIdx * nSec * nComp + secIdx * nComp;
284+
}
285+
break;
286+
case model::MultiplexMode::RadialSection:
287+
case model::MultiplexMode::Independent:
288+
case model::MultiplexMode::ComponentRadial:
289+
case model::MultiplexMode::ComponentRadialSection:
290+
case model::MultiplexMode::Axial:
291+
case model::MultiplexMode::Section:
292+
case model::MultiplexMode::Type:
293+
case model::MultiplexMode::Radial:
294+
case model::MultiplexMode::AxialRadial:
295+
cadet_assert(false);
296+
break;
297+
}
298+
}
299+
300+
/**
301+
* @brief Selects an array of bound state dependent vectorial parameters from a list with potential further dependencies
302+
* @param [in] data Vector with all parameter values in parType-section-bnd major order
303+
* @param [in] mode multiplex mode of parameter
304+
* @param [in] nParType number of particle types
305+
* @param [in] nBnd number of components per particle type
306+
* @param [in] parTypeIdx Index of the current particle type
307+
* @param [in] secIdx Index of the current section
308+
* @return Pointer to the first element of the correct vectorial parameter array
309+
*/
310+
template <typename T>
311+
inline T const* getPartypeSecDependentBndSlice(const std::vector<T>& data, model::MultiplexMode mode, unsigned int nParType, unsigned int* nBnd, unsigned int parTypeIdx, unsigned int secIdx)
312+
{
313+
switch (mode)
314+
{
315+
case model::MultiplexMode::Component:
316+
return data.data();
317+
break;
318+
case model::MultiplexMode::ComponentType:
319+
return data.data() + std::accumulate(nBnd, nBnd + parTypeIdx, 0);
320+
break;
321+
case model::MultiplexMode::ComponentSection:
322+
return data.data() + secIdx * std::accumulate(nBnd, nBnd + nParType, 0);
323+
break;
324+
case model::MultiplexMode::ComponentSectionType:
325+
{
326+
const unsigned int nBoundBeforeType = std::accumulate(nBnd, nBnd + parTypeIdx, 0);
327+
const unsigned int nSec = data.size() / std::accumulate(nBnd, nBnd + nParType, 0);
328+
return data.data() + nBoundBeforeType * nSec + secIdx * nBnd[parTypeIdx];
329+
}
330+
break;
331+
case model::MultiplexMode::RadialSection:
332+
case model::MultiplexMode::Independent:
333+
case model::MultiplexMode::ComponentRadial:
334+
case model::MultiplexMode::ComponentRadialSection:
335+
case model::MultiplexMode::Axial:
336+
case model::MultiplexMode::Section:
337+
case model::MultiplexMode::Type:
338+
case model::MultiplexMode::Radial:
339+
case model::MultiplexMode::AxialRadial:
340+
cadet_assert(false);
341+
break;
342+
}
343+
}
257344

258345
/**
259346
* @brief Selects a possibly section dependent scalar parameter from a list of parameters

0 commit comments

Comments
 (0)