Skip to content

Commit 57809e4

Browse files
committed
Add FV particle diffusion operator (#465)
Also makes field `SPATIAL_METHOD` in particle discretization mandatory
1 parent 1d047ca commit 57809e4

12 files changed

+1196
-12
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ jobs:
228228
${BUILD_DIR}/test/testRunner [CI_sens22]
229229
${BUILD_DIR}/test/testRunner [CI_sens23]
230230
${BUILD_DIR}/test/testRunner [CI_sens24]
231+
${BUILD_DIR}/test/testRunner [CI_sens25]
231232
- name: Run CI test set III - crystallization
232233
run: |
233234
set -e

.github/workflows/coverage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ jobs:
8787
${BUILD_DIR}/test/testRunner [CI_sens22]
8888
${BUILD_DIR}/test/testRunner [CI_sens23]
8989
${BUILD_DIR}/test/testRunner [CI_sens24]
90+
${BUILD_DIR}/test/testRunner [CI_sens25]
9091
- name: Run CI test set III - crystallization
9192
run: |
9293
${BUILD_DIR}/test/testRunner [CI_cry1]

src/libcadet/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ list (APPEND LIBCADET_SOURCES
215215
${CMAKE_SOURCE_DIR}/src/libcadet/model/particle/HomogeneousParticle.cpp
216216
${CMAKE_SOURCE_DIR}/src/libcadet/model/parts/ParticleDiffusionOperatorBase.cpp
217217
${CMAKE_SOURCE_DIR}/src/libcadet/model/parts/ParticleDiffusionOperatorDG.cpp
218+
${CMAKE_SOURCE_DIR}/src/libcadet/model/parts/ParticleDiffusionOperatorFV.cpp
218219
${CMAKE_SOURCE_DIR}/src/libcadet/model/LumpedRateModelWithoutPoresDG.cpp
219220
${CMAKE_SOURCE_DIR}/src/libcadet/model/ColumnModel1D.cpp
220221
)

src/libcadet/model/particle/GeneralRateParticle.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "model/particle/GeneralRateParticle.hpp"
1414
#include "model/parts/ParticleDiffusionOperatorDG.hpp"
15+
#include "model/parts/ParticleDiffusionOperatorFV.hpp"
1516

1617
#include "cadet/Exceptions.hpp"
1718
#include "BindingModelFactory.hpp"
@@ -92,16 +93,13 @@ namespace model
9293

9394
paramProvider.pushScope("discretization");
9495

95-
if (paramProvider.exists("SPATIAL_METHOD"))
96-
{
97-
const std::string parSpatialMethod = paramProvider.getString("SPATIAL_METHOD");
98-
if (parSpatialMethod != "DG")
99-
throw InvalidParameterException("Unsupported SPATIAL_METHOD '" + parSpatialMethod + "' for GeneralRateParticle. Only 'DG' is supported for now.");
100-
96+
const std::string parSpatialMethod = paramProvider.getString("SPATIAL_METHOD");
97+
if (parSpatialMethod == "DG")
10198
_parDiffOp = new parts::ParticleDiffusionOperatorDG();
102-
}
99+
else if (parSpatialMethod == "FV")
100+
_parDiffOp = new parts::ParticleDiffusionOperatorFV();
103101
else
104-
_parDiffOp = new parts::ParticleDiffusionOperatorDG();
102+
throw InvalidParameterException("Unsupported SPATIAL_METHOD '" + parSpatialMethod + "' for GeneralRateParticle. Only 'DG' and 'FV' are supported.");
105103

106104
paramProvider.popScope();
107105

src/libcadet/model/parts/ParticleDiffusionOperatorDG.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ namespace parts
16031603
jacCl[0] += static_cast<double>(filmDiff[comp]) * (1.0 - colPorosity) / colPorosity
16041604
* _parGeomSurfToVol / static_cast<double>(_parRadius)
16051605
* static_cast<double>(parTypeVolFrac[_parTypeIdx + blk * nParType]);
1606-
// add Cl on Cp entries (added since these entries are also touched by bulk jacobian)
1606+
// add Cl on Cp entries
16071607
// row: already at bulk phase. already at current node and component.
16081608
// col: go to current particle phase entry.
16091609
jacCl[jacCp.row() - jacCl.row()] = -static_cast<double>(filmDiff[comp]) * (1.0 - colPorosity) / colPorosity
@@ -1615,7 +1615,7 @@ namespace parts
16151615
for (int node = _parPolyDeg; node >= 0; node--, jacCp -= strideParNode()) {
16161616
// row: already at particle. Already at current node and liquid state.
16171617
// col: original entry at outer node.
1618-
if (!outliersOnly) // Cp on Cb
1618+
if (!outliersOnly) // Cp on Cp
16191619
jacCp[entry - jacCp.row()]
16201620
+= static_cast<double>(filmDiff[comp]) * 2.0 / static_cast<double>(_deltaR[0]) * _parInvMM[_nParElem - 1](node, _nParNode - 1) * exIntLiftContribution / static_cast<double>(_parPorosity) / static_cast<double>(_poreAccessFactor[comp]);
16211621
// row: already at particle. Already at current node and liquid state.

src/libcadet/model/parts/ParticleDiffusionOperatorDG.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ namespace parts
200200

201201
/* DG specific operators */
202202

203-
active* _deltaR; //!< equidistant particle element spacing
203+
active* _deltaR; //!< particle element spacing
204204
Eigen::VectorXd _parNodes; //!< Array with positions of nodes in radial reference element for each particle
205205
Eigen::MatrixXd _parPolyDerM; //!< Array with polynomial derivative Matrix for each particle
206206
Eigen::MatrixXd* _minus_InvMM_ST; //!< equals minus inverse mass matrix times transposed stiffness matrix.

0 commit comments

Comments
 (0)