Skip to content

Commit 16525ce

Browse files
committed
Make field SPATIAL_METHOD in particle discretization mandatory
1 parent ace16d2 commit 16525ce

File tree

5 files changed

+24
-25
lines changed

5 files changed

+24
-25
lines changed

src/libcadet/model/particle/GeneralRateParticle.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,11 @@ namespace model
116116

117117
paramProvider.pushScope("discretization");
118118

119-
if (paramProvider.exists("SPATIAL_METHOD"))
120-
{
121-
const std::string parSpatialMethod = paramProvider.getString("SPATIAL_METHOD");
122-
if (parSpatialMethod != "DG")
123-
throw InvalidParameterException("Unsupported SPATIAL_METHOD '" + parSpatialMethod + "' for GeneralRateParticle. Only 'DG' is supported for now.");
124-
119+
const std::string parSpatialMethod = paramProvider.getString("SPATIAL_METHOD");
120+
if (parSpatialMethod == "DG")
125121
_parDiffOp = new parts::ParticleDiffusionOperatorDG();
126-
}
127122
else
128-
_parDiffOp = new parts::ParticleDiffusionOperatorDG();
123+
throw InvalidParameterException("Unsupported SPATIAL_METHOD '" + parSpatialMethod + "' for GeneralRateParticle. Only 'DG' and 'FV' are supported.");
129124

130125
paramProvider.popScope();
131126

test/JsonTestModels.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ cadet::JsonParameterProvider createPulseInjectionColumn(const std::string& uoTyp
776776
json disc;
777777
json parDisc;
778778
disc["SPATIAL_METHOD"] = spatialMethod;
779+
parDisc["SPATIAL_METHOD"] = spatialMethod;
779780

780781
if (spatialMethod == "FV")
781782
{
@@ -787,6 +788,7 @@ cadet::JsonParameterProvider createPulseInjectionColumn(const std::string& uoTyp
787788

788789
disc["NCOL"] = 10;
789790
parDisc["NPAR"] = 4;
791+
parDisc["SPATIAL_METHOD"] = spatialMethod;
790792

791793
disc["MAX_KRYLOV"] = 0;
792794
disc["GS_TYPE"] = 1;
@@ -1078,6 +1080,7 @@ json createLinearBenchmarkColumnJson(bool dynamicBinding, bool nonBinding, const
10781080
json disc;
10791081
json parDisc;
10801082
disc["SPATIAL_METHOD"] = spatialMethod;
1083+
parDisc["SPATIAL_METHOD"] = spatialMethod;
10811084
if (model2D)
10821085
disc["RADIAL_DISC_TYPE"] = "EQUIDISTANT";
10831086

test/data/model_COL1D_GRM_dynLin_1comp_sensbenchmark2.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
"VELOCITY": 0.000575,
7373
"particle_type_000": {
7474
"PARTICLE_TYPE": "GENERAL_RATE_PARTICLE",
75+
"PAR_GEOM": [
76+
"SPHERE"
77+
],
7578
"INIT_CP": [
7679
0.0
7780
],
@@ -100,13 +103,9 @@
100103
]
101104
},
102105
"discretization": {
103-
"NPAR": 2,
104-
"PAR_BOUNDARY_ORDER": 2,
106+
"SPATIAL_METHOD": "DG",
105107
"PAR_DISC_TYPE": [
106108
"EQUIDISTANT_PAR"
107-
],
108-
"PAR_GEOM": [
109-
"SPHERE"
110109
]
111110
}
112111
},

test/data/model_COL2D_GRM2Zone_noRadVar_SMA_LWE.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,12 @@
235235
10.0
236236
]
237237
},
238-
"discretization": {
239-
"PAR_DISC_TYPE": "EQUIDISTANT_PAR",
240-
"PAR_NELEM": 1,
241-
"PAR_POLYDEG": 3
242-
}
238+
"discretization": {
239+
"SPATIAL_METHOD": "DG",
240+
"PAR_DISC_TYPE": "EQUIDISTANT_PAR",
241+
"PAR_NELEM": 1,
242+
"PAR_POLYDEG": 3
243+
}
243244
}
244245
},
245246
"unit_001": {

test/data/model_COL2D_GRMsd3Zone2ParType_dynLin_1Comp_benchmark1.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,14 @@
231231
"LIN_KA": 35.5,
232232
"LIN_KD": 1.0
233233
},
234-
"discretization": {
235-
"PAR_DISC_TYPE": [
236-
"EQUIDISTANT_PAR"
237-
],
238-
"PAR_NELEM": 1,
239-
"PAR_POLYDEG": 3
240-
}
234+
"discretization": {
235+
"SPATIAL_METHOD": "DG",
236+
"PAR_DISC_TYPE": [
237+
"EQUIDISTANT_PAR"
238+
],
239+
"PAR_NELEM": 1,
240+
"PAR_POLYDEG": 3
241+
}
241242
},
242243
"particle_type_001": {
243244
"ADSORPTION_MODEL": "LINEAR",

0 commit comments

Comments
 (0)