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