Skip to content

Commit 2ff6a3c

Browse files
sleweke-bayerschmoelder
authored andcommitted
Support radial flow and param deps in createLWE
Adds support for radial flow models and parameter dependence (i.e., dispersion and film diffusion coefficients) to createLWE.
1 parent cff991c commit 2ff6a3c

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

src/tools/ToolsHelper.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ inline void parseUnitType(std::string& unitType)
7575
unitType = "GENERAL_RATE_MODEL_2D";
7676
}
7777

78+
inline void parseUnitType(std::string& unitType, bool radialFlow)
79+
{
80+
parseUnitType(unitType);
81+
82+
if (radialFlow)
83+
unitType = "RADIAL_" + unitType;
84+
}
85+
7886
inline void addSensitivitiyParserToCmdLine(TCLAP::CmdLine& cmd, std::vector<std::string>& sensitivities)
7987
{
8088
cmd >> (new TCLAP::MultiArg<std::string>("S", "sens",

src/tools/createLWE.cpp

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ struct ProgramOptions
3333
double endTime;
3434
double constAlg;
3535
double stddevAlg;
36+
bool radialFlow;
37+
bool velocityDependence;
3638
bool reverseFlow;
3739
bool adJacobian;
3840
int nPar;
@@ -63,6 +65,8 @@ int main(int argc, char** argv)
6365
cmd >> (new TCLAP::ValueArg<double>("c", "constAlg", "Set all algebraic variables to constant value", false, nanVal, "Value"))->storeIn(&opts.constAlg);
6466
cmd >> (new TCLAP::ValueArg<double>("s", "stddevAlg", "Perturb algebraic variables with normal variates", false, nanVal, "Value"))->storeIn(&opts.stddevAlg);
6567
cmd >> (new TCLAP::SwitchArg("", "reverseFlow", "Reverse the flow for column"))->storeIn(&opts.reverseFlow);
68+
cmd >> (new TCLAP::SwitchArg("", "radialFlow", "Use radial flow column"))->storeIn(&opts.radialFlow);
69+
cmd >> (new TCLAP::SwitchArg("", "velDep", "Use velocity dependent dispersion and film diffusion"))->storeIn(&opts.velocityDependence);
6670
cmd >> (new TCLAP::ValueArg<int>("", "rad", "Number of radial cells (default: 3)", false, 3, "Value"))->storeIn(&opts.nRad);
6771
addMiscToCmdLine(cmd, opts);
6872
addUnitTypeToCmdLine(cmd, opts.unitType);
@@ -81,7 +85,7 @@ int main(int argc, char** argv)
8185
writer.openFile(opts.fileName, "co");
8286
writer.pushGroup("input");
8387

84-
parseUnitType(opts.unitType);
88+
parseUnitType(opts.unitType, opts.radialFlow);
8589
const bool isGRM2D = (opts.unitType == "GENERAL_RATE_MODEL_2D");
8690

8791
// Model
@@ -98,9 +102,9 @@ int main(int argc, char** argv)
98102

99103
// Transport
100104
if (!opts.reverseFlow)
101-
writer.scalar<double>("VELOCITY", 5.75e-4);
105+
writer.scalar<double>("VELOCITY", 1.0);
102106
else
103-
writer.scalar<double>("VELOCITY", -5.75e-4);
107+
writer.scalar<double>("VELOCITY", -1.0);
104108
writer.scalar<double>("COL_DISPERSION", 5.75e-8);
105109
writer.scalar<double>("COL_DISPERSION_RADIAL", 1e-6);
106110

@@ -112,9 +116,26 @@ int main(int argc, char** argv)
112116
writer.vector<double>("PAR_DIFFUSION", 4, parDiff);
113117
writer.vector<double>("PAR_SURFDIFFUSION", 4, parSurfDiff);
114118

119+
if (opts.velocityDependence)
120+
{
121+
writer.scalar<std::string>("COL_DISPERSION_DEP", "POWER_LAW");
122+
writer.scalar<double>("COL_DISPERSION_DEP_BASE", 1.25);
123+
writer.scalar<double>("COL_DISPERSION_DEP_EXPONENT", 1.0);
124+
125+
writer.scalar<std::string>("FILM_DIFFUSION_DEP", "POWER_LAW");
126+
writer.scalar<double>("FILM_DIFFUSION_DEP_BASE", 1.25);
127+
writer.scalar<double>("FILM_DIFFUSION_DEP_EXPONENT", 1.0);
128+
}
129+
115130
// Geometry
116-
writer.scalar<double>("COL_LENGTH", 0.014);
131+
if (opts.radialFlow)
132+
writer.scalar<double>("COL_LENGTH", 0.0014);
133+
else
134+
writer.scalar<double>("COL_LENGTH", 0.014);
117135
writer.scalar<double>("COL_RADIUS", 0.01);
136+
writer.scalar<double>("COL_RADIUS_INNER", 0.01);
137+
writer.scalar<double>("COL_RADIUS_OUTER", 0.04);
138+
writer.scalar<double>("CROSS_SECTION_AREA", 0.0003141592653589793);
118139
writer.scalar<double>("PAR_RADIUS", 4.5e-5);
119140
writer.scalar<double>("PAR_CORERADIUS", 0.0);
120141
writer.scalar<double>("COL_POROSITY", 0.37);
@@ -332,12 +353,12 @@ int main(int argc, char** argv)
332353
{
333354
// Connection list is 1x7 since we have 1 connection between
334355
// the two unit operations (and we need to have 7 columns)
335-
const double connMatrix[] = {1, 0, -1, -1, -1, -1, 1.0};
356+
const double connMatrix[] = {1, 0, -1, -1, -1, -1, 6.683738370512285e-8};
336357
// Connections: From unit operation 1 port -1 (i.e., all ports)
337358
// to unit operation 0 port -1 (i.e., all ports),
338359
// connect component -1 (i.e., all components)
339360
// to component -1 (i.e., all components) with
340-
// a flow rate of 1.0
361+
// a flow rate of 6.683738370512285e-8 m^3/s
341362

342363
writer.vector<double>("CONNECTIONS", 7, connMatrix);
343364
}

0 commit comments

Comments
 (0)