Skip to content

Commit b2b8fdb

Browse files
Fix MCT sensitivities for CHANNEL_CROSS_SECTION_AREAS (#549)
1 parent 606f1a9 commit b2b8fdb

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/libcadet/model/exchange/LangumirExchange.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,25 @@ class LangumirExchangeBase : public IExchangeModel
6767
{
6868
_parameters.clear();
6969
readParameterMatrix(_exchangeMatrix, paramProvider, "EXCHANGE_MATRIX", _nChannel * _nChannel * _nComp, 1); // include parameterPeaderHelp in exchange modul
70-
_crossSections = paramProvider.getDoubleArray("CHANNEL_CROSS_SECTION_AREAS");
70+
readScalarParameterOrArray(_crossSections, paramProvider,"CHANNEL_CROSS_SECTION_AREAS", 1);
7171
readParameterMatrix(_saturationMatrix, paramProvider, "SATURATION_MATRIX", _nChannel * _nComp, 1);
7272

73+
registerParam3DArray(parameters, _exchangeMatrix, [=](bool multi, unsigned int channelSrc, unsigned int channelDest, unsigned comp)
74+
{
75+
return makeParamId(hashString("EXCHANGE_MATRIX"), unitOpIdx, multi ? comp : CompIndep, channelDest, channelSrc, ReactionIndep, SectionIndep);
76+
}, _nComp, _nChannel); // particleType -> channelDest, BoundState -> channelSrc
77+
78+
registerParam1DArray(parameters, _crossSections, [=](bool multi, unsigned int channel)
79+
{
80+
return makeParamId(hashString("CHANNEL_CROSS_SECTION_AREAS"), unitOpIdx, CompIndep, channel, BoundStateIndep, ReactionIndep, SectionIndep); // particleType -> Channel
81+
});
82+
83+
registerParam2DArray(parameters, _saturationMatrix, [=](bool multi, unsigned int channel, unsigned int comp)
84+
{
85+
return makeParamId(hashString("SATURATION_MATRIX"), unitOpIdx, multi ? comp : CompIndep, channel, BoundStateIndep, ReactionIndep, SectionIndep);
86+
}, _nComp); // particleType -> channel
87+
88+
7389
return true;
7490
}
7591

@@ -176,7 +192,7 @@ class LangumirExchangeBase : public IExchangeModel
176192
unsigned int _nCol; //!< Number of columns
177193

178194
std::vector<active> _exchangeMatrix; //!< Matrix of exchange coeffs for the langmuir inter-channel transport
179-
std::vector<double> _crossSections; //!< Cross sections of the channels
195+
std::vector<active> _crossSections; //!< Cross sections of the channels
180196
std::vector<active> _saturationMatrix; //!< Capacity of the channels -> double ncomp x nchannel
181197
//parts::MultiChannelConvectionDispersionOperator _conDis; //!< Convection dispersion operator
182198

src/libcadet/model/exchange/LinearExchange.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,18 @@ class LinearExchangeBase : public IExchangeModel
6565
{
6666
_parameters.clear();
6767
readParameterMatrix(_exchangeMatrix, paramProvider, "EXCHANGE_MATRIX", _nChannel * _nChannel * _nComp, 1); // TODO include parameterPeaderHelp in exchange modul
68-
_crossSections = paramProvider.getDoubleArray("CHANNEL_CROSS_SECTION_AREAS");
68+
readScalarParameterOrArray(_crossSections, paramProvider,"CHANNEL_CROSS_SECTION_AREAS", 1);
6969

7070
registerParam3DArray(parameters, _exchangeMatrix, [=](bool multi, unsigned int channelSrc, unsigned int channelDest, unsigned comp)
7171
{
7272
return makeParamId(hashString("EXCHANGE_MATRIX"), unitOpIdx, multi ? comp : CompIndep, channelDest, channelSrc, ReactionIndep, SectionIndep);
7373
}, _nComp, _nChannel);
7474

75+
registerParam1DArray(parameters, _crossSections, [=](bool multi, unsigned int channel)
76+
{
77+
return makeParamId(hashString("CHANNEL_CROSS_SECTION_AREAS"), unitOpIdx, CompIndep, channel, BoundStateIndep, ReactionIndep, SectionIndep); // particleType -> Channel
78+
});
79+
7580
return true;
7681
}
7782

@@ -174,7 +179,7 @@ class LinearExchangeBase : public IExchangeModel
174179
std::vector<int> _reactionQuasistationarity; //!< Determines whether each bound state is quasi-stationary (@c true) or not (@c false)
175180

176181
std::vector<active> _exchangeMatrix; //!< Matrix of exchange coeffs for the linear inter-channel transport
177-
std::vector<double> _crossSections; //!< Cross sections of the channels
182+
std::vector<active> _crossSections; //!< Cross sections of the channels
178183

179184
std::unordered_map<ParameterId, active*> _parameters; //!< Map used to translate ParameterIds to actual variables
180185

0 commit comments

Comments
 (0)