Commit 12bf275e authored by Thomas Fetzer's avatar Thomas Fetzer
Browse files

[zeroeq] Update method set walls

* functions bBoxMaxIsWall() and bBoxMaxIsWall() in the problem are now used instead of a property
* wall array is now a std::vector
parent 6474d6ba
......@@ -17,6 +17,9 @@ Differences Between DuMuX 2.10 and DuMuX 2.11
* IMPROVEMENTS and ENHANCEMENTS:
* IMMEDIATE INTERFACE CHANGES not allowing/requiring a deprecation period:
- In the ZeroEq models, the properties BBoxMinIsWall and BBoxMaxIsWall have
been replaced by the functions bBoxMaxIsWall() and bBoxMaxIsWall() in the
problem file.
* Deprecated PROPERTY and PARAMETER NAMES, to be removed after 2.11: BEWARE: The
compiler will not print any warning if a deprecated property or parameter name
......
......@@ -75,9 +75,6 @@ class ZeroEqModel : public GET_PROP_TYPE(TypeTag, BaseStokesModel)
dim = GridView::dimension,
dimWorld = GridView::dimensionworld,
intervals = GET_PROP_VALUE(TypeTag, NumberOfIntervals),
bboxMinIsWall = GET_PROP_VALUE(TypeTag, BBoxMinIsWall),
bboxMaxIsWall = GET_PROP_VALUE(TypeTag, BBoxMaxIsWall),
walls = (bboxMinIsWall ? 1 : 0) + (bboxMaxIsWall ? 1 : 0)
};
typedef Dune::ReferenceElements<Scalar, dim> ReferenceElements;
......@@ -110,6 +107,9 @@ public:
<< GET_PARAM_FROM_GROUP(TypeTag, int, ZeroEq, EddyViscosityModel)
<< "." << std::endl;
}
wall.resize((this->problem_().bBoxMinIsWall() ? 1 : 0)
+ (this->problem_().bBoxMaxIsWall() ? 1 : 0));
}
/*!
......@@ -364,7 +364,7 @@ public:
bool headerWritten[intervals]; //!< Header of scv-data file was already written.
WallProperties() {} //!< Constructor for wall properties.
};
WallProperties wall[walls];
std::vector<WallProperties> wall;
/*!
* \brief Initializes the wall structure with values.
......@@ -375,20 +375,20 @@ public:
*/
void resetWallProperties()
{
for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
for (int wallIdx = 0; wallIdx < wall.size(); ++wallIdx)
{
for (int posIdx = 0; posIdx < intervals; ++posIdx)
{
if (walls == 1)
if (wall.size() == 1)
{
if (bboxMinIsWall)
if (this->problem_().bBoxMinIsWall())
{
wall[wallIdx].wallPos[posIdx] = this->problem_().bBoxMin()[wallNormal_];
wall[wallIdx].boundaryLayerThickness[posIdx] = this->problem_().bBoxMax()[wallNormal_] - this->problem_().bBoxMin()[wallNormal_] + eps_;
wall[wallIdx].isBBoxMinWall = true;
wall[wallIdx].sandGrainRoughness[posIdx] = GET_PARAM_FROM_GROUP(TypeTag, Scalar, ZeroEq, BBoxMinSandGrainRoughness);
}
if (bboxMaxIsWall)
if (this->problem_().bBoxMaxIsWall())
{
wall[wallIdx].wallPos[posIdx] = this->problem_().bBoxMax()[wallNormal_];
wall[wallIdx].boundaryLayerThickness[posIdx] = this->problem_().bBoxMin()[wallNormal_] - this->problem_().bBoxMax()[wallNormal_] - eps_;
......@@ -396,7 +396,7 @@ public:
wall[wallIdx].sandGrainRoughness[posIdx] = GET_PARAM_FROM_GROUP(TypeTag, Scalar, ZeroEq, BBoxMaxSandGrainRoughness);
}
}
if (walls == 2 && wallIdx == 0)
if (wall.size() == 2 && wallIdx == 0)
{
wall[0].wallPos[posIdx] = this->problem_().bBoxMin()[wallNormal_];
wall[1].wallPos[posIdx] = this->problem_().bBoxMax()[wallNormal_];
......@@ -431,7 +431,7 @@ public:
*/
void resetWallFluidProperties()
{
for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
for (int wallIdx = 0; wallIdx < wall.size(); ++wallIdx)
for (int posIdx = 0; posIdx < intervals; ++posIdx)
{
wall[wallIdx].wallDensity[posIdx] = 0.0;
......@@ -453,7 +453,7 @@ public:
asImp_().updateCrossLength();
asImp_().resetWallFluidProperties();
asImp_().updateWallFluidProperties();
for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
for (int wallIdx = 0; wallIdx < wall.size(); ++wallIdx)
{
for (int posIdx = 0; posIdx < intervals; ++posIdx)
if (wall[wallIdx].viscousSublayerThicknessCalculated[posIdx] > wall[wallIdx].boundaryLayerThicknessCalculated[posIdx])
......@@ -484,10 +484,10 @@ public:
*/
int getWallIdx(const GlobalPosition &globalPos, const int posIdx) const
{
if (walls == 0)
if (wall.size() == 0)
DUNE_THROW(Dune::NotImplemented, "Eddy viscosity models are not implemented for use without walls.");
for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
for (int wallIdx = 0; wallIdx < wall.size(); ++wallIdx)
if ((wall[wallIdx].isBBoxMinWall && globalPos[wallNormal_] < wall[wallIdx].wallPos[posIdx] + wall[wallIdx].boundaryLayerThickness[posIdx])
|| (!wall[wallIdx].isBBoxMinWall && globalPos[wallNormal_] > wall[wallIdx].wallPos[posIdx] + wall[wallIdx].boundaryLayerThickness[posIdx]))
{
......@@ -576,7 +576,7 @@ public:
*/
bool useViscosityInner(const GlobalPosition &globalPos, const int posIdx) const
{
for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
for (int wallIdx = 0; wallIdx < wall.size(); ++wallIdx)
if ((wall[wallIdx].isBBoxMinWall && globalPos[wallNormal_] < wall[wallIdx].wallPos[posIdx] + wall[wallIdx].crossLength[posIdx])
|| (!wall[wallIdx].isBBoxMinWall && globalPos[wallNormal_] > wall[wallIdx].wallPos[posIdx] + wall[wallIdx].crossLength[posIdx]))
return true;
......@@ -635,12 +635,12 @@ public:
{
wall[wallIdx].maxVelocity[posIdx][dimIdx] = fluxVars.velocity()[dimIdx];
// // if the values in the middle should be set on both wall
// for (int wIdx = 0; wIdx < walls; ++wIdx)
// for (int wIdx = 0; wIdx < wall.size(); ++wIdx)
// if (std::abs(distanceToWallReal(globalPos, wallIdx, posIdx)) < std::abs(wall[wIdx].boundaryLayerThickness[posIdx] + 1e-5))
// wall[wIdx].maxVelocity[posIdx][dimIdx] = fluxVars.velocity()[dimIdx];
// set it as maxVelocityAbs
if (std::abs(wall[wallIdx].maxVelocityAbs[posIdx][dimIdx]) < std::abs(fluxVars.velocity()[dimIdx]))
for (int wIdx = 0; wIdx < walls; ++wIdx)
for (int wIdx = 0; wIdx < wall.size(); ++wIdx)
wall[wIdx].maxVelocityAbs[posIdx][dimIdx] = fluxVars.velocity()[dimIdx];
wall[wallIdx].fluxValuesCount[posIdx]++;
}
......@@ -654,7 +654,7 @@ public:
wall[wallIdx].fMax[posIdx] = fluxVars.fz();
wall[wallIdx].yMax[posIdx] = distanceToWallRough(globalPos, wallIdx, posIdx);
// // if the values in the middle should be set on both wall
// for (int wIdx = 0; wIdx < walls; ++wIdx)
// for (int wIdx = 0; wIdx < wall.size(); ++wIdx)
// if (std::abs(distanceToWall(globalPos, wIdx, posIdx)) < std::abs(wall[wIdx].boundaryLayerThickness[posIdx] + 1e-4))
// {
// wall[wIdx].fMax[posIdx] = fluxVars.fz();
......@@ -988,7 +988,6 @@ public:
}
}
protected:
//! Current implementation.
Implementation &asImp_()
......
......@@ -75,6 +75,22 @@ public:
{
this->model().updateWallProperties();
}
/*!
* \brief The left/lower boundary in ZeroEqWallNormal direction is a wall
*/
bool bBoxMinIsWall()
{
return true;
}
/*!
* \brief The right/upper boundary in ZeroEqWallNormal direction is a wall
*/
bool bBoxMaxIsWall()
{
return true;
}
};
}
......
......@@ -50,8 +50,6 @@ NEW_TYPE_TAG(BoxZeroEq, INHERITS_FROM(BoxStokes));
//////////////////////////////////////////////////////////////////
NEW_PROP_TAG(KarmanConstant); //!< The Karman constant
NEW_PROP_TAG(BBoxMinIsWall); //!< Sets BBoxMin as a wall
NEW_PROP_TAG(BBoxMaxIsWall); //!< Sets BBoxMax as a wall
NEW_PROP_TAG(ZeroEqFlowNormal); //!< Indicates the main flow direction
NEW_PROP_TAG(ZeroEqWallNormal); //!< Indicates the wall normal direction
NEW_PROP_TAG(ZeroEqBBoxMinSandGrainRoughness); //!< Sets a sand grain roughness at BBoxMin
......
......@@ -58,12 +58,6 @@ SET_BOOL_PROP(BoxZeroEq, EnableNavierStokes, true);
//! Set the Karman constant \f$[-]\f$
SET_SCALAR_PROP(BoxZeroEq, KarmanConstant, 0.41);
//! Set BBoxMin of wall normal direction as a wall
SET_BOOL_PROP(BoxZeroEq, BBoxMinIsWall, true);
//! Set BBoxMax of wall normal direction as a wall
SET_BOOL_PROP(BoxZeroEq, BBoxMaxIsWall, true);
//! Set main flow direction
SET_INT_PROP(BoxZeroEq, ZeroEqFlowNormal, 0);
......
......@@ -85,9 +85,7 @@ class ZeroEqncModel : public ZeroEqModel<TypeTag>
enum {
dim = GridView::dimension,
dimWorld = GridView::dimensionworld,
intervals = GET_PROP_VALUE(TypeTag, NumberOfIntervals),
walls = (GET_PROP_VALUE(TypeTag, BBoxMinIsWall) ? 1 : 0)
+ (GET_PROP_VALUE(TypeTag, BBoxMaxIsWall) ? 1 : 0)
intervals = GET_PROP_VALUE(TypeTag, NumberOfIntervals)
};
enum { transportCompIdx = Indices::transportCompIdx,
numComponents = Indices::numComponents };
......@@ -311,7 +309,7 @@ public:
{
ParentType::resetWallProperties();
for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
for (int wallIdx = 0; wallIdx < this->wall.size(); ++wallIdx)
for (int posIdx = 0; posIdx < intervals; ++posIdx)
{
this->wall[wallIdx].maxMassFraction[posIdx] = 0.0;
......@@ -328,11 +326,11 @@ public:
int wallIdx = this->getWallIdx(globalPos, posIdx);
// mass fraction
if (this->wall[wallIdx].maxMassFraction[posIdx] < fluxVars.massFraction(transportCompIdx))
for (int wIdx = 0; wIdx < walls; ++wIdx)
for (int wIdx = 0; wIdx < this->wall.size(); ++wIdx)
this->wall[wIdx].maxMassFraction[posIdx] = fluxVars.massFraction(transportCompIdx);
// mole fraction
if (this->wall[wallIdx].maxMoleFraction[posIdx] < fluxVars.moleFraction(transportCompIdx))
for (int wIdx = 0; wIdx < walls; ++wIdx)
for (int wIdx = 0; wIdx < this->wall.size(); ++wIdx)
this->wall[wIdx].maxMoleFraction[posIdx] = fluxVars.moleFraction(transportCompIdx);
}
......
......@@ -96,9 +96,7 @@ class ZeroEqncniModel : public ZeroEqncModel<TypeTag>
enum {
dim = GridView::dimension,
dimWorld = GridView::dimensionworld,
intervals = GET_PROP_VALUE(TypeTag, NumberOfIntervals),
walls = (GET_PROP_VALUE(TypeTag, BBoxMinIsWall) ? 1 : 0)
+ (GET_PROP_VALUE(TypeTag, BBoxMaxIsWall) ? 1 : 0)
intervals = GET_PROP_VALUE(TypeTag, NumberOfIntervals)
};
enum { transportCompIdx = Indices::transportCompIdx,
numComponents = Indices::numComponents };
......@@ -331,7 +329,7 @@ public:
{
ParentType::resetWallProperties();
for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
for (int wallIdx = 0; wallIdx < this->wall.size(); ++wallIdx)
for (int posIdx = 0; posIdx < intervals; ++posIdx)
{
this->wall[wallIdx].maxTemperature[posIdx] = 0.0;
......@@ -346,7 +344,7 @@ public:
int posIdx = this->getPosIdx(globalPos);
int wallIdx = this->getWallIdx(globalPos, posIdx);
if (this->wall[wallIdx].maxTemperature[posIdx] < fluxVars.temperature())
for (int wIdx = 0; wIdx < walls; ++wIdx)
for (int wIdx = 0; wIdx < this->wall.size(); ++wIdx)
this->wall[wIdx].maxTemperature[posIdx] = fluxVars.temperature();
}
......
......@@ -53,9 +53,6 @@ SET_TYPE_PROP(ZeroEqChannelTestProblem, Fluid,
// Disable gravity
SET_BOOL_PROP(ZeroEqChannelTestProblem, ProblemEnableGravity, false);
// Set only bottom as wall
SET_BOOL_PROP(ZeroEqChannelTestProblem, BBoxMaxIsWall, false);
#if HAVE_UMFPACK
// Use UMFPack as linear solver
SET_TYPE_PROP(ZeroEqChannelTestProblem, LinearSolver, UMFPackBackend<TypeTag>);
......@@ -147,6 +144,14 @@ public:
return 273.15 + 10; // -> 10 °C
}
/*!
* \brief The right/upper boundary in ZeroEqWallNormal direction is a wall
*/
bool bBoxMaxIsWall()
{
return false;
}
// \}
/*!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment