Commit 4133c8ed authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

[boundary conditions] setDirichlet: improve documentation and usage

The general setDirichlet function takes two parameters (pvIdx, eqIdx)
corresponding to the index of the primary variable and the index of the
balance equation. A convenience function that only takes one parameter
exists which calls the general version with two equal parameters. So
far, this one parameter has been documented as equation index. However,
it is better to refer to the parameter as a primary variable index.

This commit changes the parameter name and improves the documentation.
Furthermore, it replaces calls in the tests, whenever the general
version was called with two parameters of different name but equal value
or whenever the simplified version was called with an equation index
instead of a primary variable index.

See FS#270 for details.

Reviewed by Timo.



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@15115 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 39e8e074
......@@ -317,16 +317,15 @@ public:
* \brief Set a dirichlet boundary condition for a single primary
* variable.
*
* WARNING: This method assumes that the equation with the same
* index as the primary variable to be set is used to specify the
* Dirichlet condition. USE WITH _GREAT_ CARE!
* Depending on the discretization, setting the Dirichlet condition
* will replace the balance equation with index equal to pvIdx.
*
* \param eqIdx The index of the equation which is assumed to be
* equal to the index of the primary variable
* \param pvIdx The index of the primary variable inside a
* PrimaryVariables object.
*/
void setDirichlet(int eqIdx)
void setDirichlet(int pvIdx)
{
setDirichlet(eqIdx, eqIdx);
setDirichlet(pvIdx, pvIdx);
}
/*!
......
......@@ -337,7 +337,7 @@ void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition& globalPos)
if (isInlet(globalPos))
{
bcTypes.setNeumann(eqIdxPress);
bcTypes.setDirichlet(eqIdxSat);
bcTypes.setDirichlet(swIdx);
}
else if (isBottom(globalPos) || isTop(globalPos))
{
......@@ -345,7 +345,7 @@ void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition& globalPos)
}
else
{
bcTypes.setDirichlet(eqIdxPress);
bcTypes.setDirichlet(pwIdx);
bcTypes.setOutflow(eqIdxSat);
}
#elif PROBLEM == 0
......
......@@ -113,8 +113,9 @@ namespace Dumux
// copy some indices for convenience
massBalanceIdx = Indices::massBalanceIdx, //!< Index of the mass balance
momentumXIdx = Indices::momentumXIdx, //!< Index of the x-component of the momentum balance
momentumYIdx = Indices::momentumYIdx //!< Index of the y-component of the momentum balance
pressureIdx = Indices::pressureIdx, //!< Index of the pressure
velocityXIdx = Indices::velocityXIdx, //!< Index of the x-component of the velocity
velocityYIdx = Indices::velocityYIdx //!< Index of the y-component of the velocity
};
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
......@@ -181,13 +182,13 @@ namespace Dumux
const GlobalPosition &globalPos) const
{
values.setOutflow(massBalanceIdx);
values.setDirichlet(momentumXIdx);
values.setDirichlet(momentumYIdx);
values.setDirichlet(velocityXIdx);
values.setDirichlet(velocityYIdx);
// set pressure for all vertices at the bottom
if (onLowerBoundary_(globalPos))
{
values.setDirichlet(massBalanceIdx);
values.setDirichlet(pressureIdx);
}
}
......@@ -276,10 +277,10 @@ namespace Dumux
const GlobalPosition &globalPos) const
{
// pressure
values[massBalanceIdx] = 1e5;
values[pressureIdx] = 1e5;
// velocity in x- and y-direction
values[momentumXIdx] = 0.0;
values[momentumYIdx] = 0.0;
values[velocityXIdx] = 0.0;
values[velocityYIdx] = 0.0;
}
bool onLeftBoundary_(const GlobalPosition &globalPos) const
......
......@@ -165,7 +165,7 @@ public:
const Scalar middle = (this->bBoxMax()[1] - this->bBoxMin()[1])/2;
if (onRightBoundary_(globalPos) &&
globalPos[1] > middle - eps_ && globalPos[1] < middle + eps_)
values.setDirichlet(massBalanceIdx);
values.setDirichlet(pressureIdx);
}
//! \copydoc ImplicitProblem::dirichletAtPos()
......
......@@ -165,7 +165,7 @@ public:
const Scalar middle = (this->bBoxMax()[0] - this->bBoxMin()[0])/2;
if (onLowerBoundary_(globalPos) &&
globalPos[0] > middle - eps_ && globalPos[0] < middle + eps_)
values.setDirichlet(massBalanceIdx);
values.setDirichlet(pressureIdx);
}
//! \copydoc ImplicitProblem::dirichletAtPos()
......
......@@ -178,7 +178,7 @@ public:
// set pressure at the upper boundary
if (onUpperBoundary_(globalPos) &&
!onLeftBoundary_(globalPos) && !onRightBoundary_(globalPos))
values.setDirichlet(massBalanceIdx);
values.setDirichlet(pressureIdx);
}
//! \copydoc ImplicitProblem::dirichletAtPos()
......
......@@ -173,7 +173,7 @@ public:
if (onUpperBoundary_(globalPos))
{
values.setNeumann(momentumXIdx);
values.setDirichlet(velocityYIdx, momentumYIdx);
values.setDirichlet(velocityYIdx);
}
if (onRightBoundary_(globalPos))
......@@ -187,7 +187,7 @@ public:
// set pressure on left boundary (at least at one point)
if (onRightBoundary_(globalPos))
values.setDirichlet(pressureIdx, massBalanceIdx);
values.setDirichlet(pressureIdx);
}
//! \copydoc ImplicitProblem::dirichletAtPos()
......
......@@ -178,7 +178,7 @@ public:
// set pressure on left boundary (at least at one point)
if (onRightBoundary_(globalPos))
values.setDirichlet(pressureIdx, massBalanceIdx);
values.setDirichlet(pressureIdx);
}
//! \copydoc ImplicitProblem::dirichletAtPos()
......
......@@ -176,7 +176,7 @@ public:
// set pressure on left boundary (at least at one point)
if (onRightBoundary_(globalPos))
values.setDirichlet(massBalanceIdx);
values.setDirichlet(pressureIdx);
}
//! \copydoc ImplicitProblem::dirichletAtPos()
......
......@@ -168,7 +168,7 @@ public:
// set pressure on left boundary (at least at one point)
if (onRightBoundary_(globalPos))
values.setDirichlet(pressureIdx, massBalanceIdx);
values.setDirichlet(pressureIdx);
}
//! \copydoc ImplicitProblem::dirichletAtPos()
......
......@@ -489,8 +489,8 @@ public:
values.setDirichlet(uxIdx);
if(initializationRun_ == false)
{
values.setDirichlet(pressureIdx, contiWEqIdx);
values.setDirichlet(saturationIdx, contiNEqIdx);
values.setDirichlet(pressureIdx);
values.setDirichlet(saturationIdx);
}
}
// The solid displacement normal to the lateral boundaries is fixed.
......@@ -499,8 +499,8 @@ public:
values.setDirichlet(uyIdx);
if(initializationRun_ == false)
{
values.setDirichlet(pressureIdx, contiWEqIdx);
values.setDirichlet(saturationIdx, contiNEqIdx);
values.setDirichlet(pressureIdx);
values.setDirichlet(saturationIdx);
}
}
......@@ -514,8 +514,8 @@ public:
// values are only given at the top boundary.
if(globalPos[2] > this->bBoxMax()[2]-eps_)
{
values.setDirichlet(pressureIdx, contiWEqIdx);
values.setDirichlet(saturationIdx, contiNEqIdx);
values.setDirichlet(pressureIdx);
values.setDirichlet(saturationIdx);
}
}
......
......@@ -150,13 +150,13 @@ public:
const GlobalPosition &globalPos) const
{
values.setAllNeumann();
values.setDirichlet(uyIdx, momentumYEqIdx);
values.setDirichlet(uyIdx);
if(globalPos[0] < eps_)
{
values.setDirichlet(uxIdx, momentumXEqIdx);
values.setDirichlet(uxIdx);
if(globalPos[2] < eps_)
values.setDirichlet(uzIdx, momentumZEqIdx);
values.setDirichlet(uzIdx);
}
}
......
......@@ -253,7 +253,7 @@ public:
#if !ISOTHERMAL
// set a dirichlet value for the temperature, use the energy
// equation to set the value
values.setDirichlet(temperatureIdx, energyEqIdx);
values.setDirichlet(temperatureIdx);
#endif
}
......
......@@ -243,7 +243,7 @@ public:
values.setAllNeumann();
#if !ISOTHERMAL
values.setDirichlet(temperatureIdx, energyEqIdx);
values.setDirichlet(temperatureIdx);
#endif
}
......
......@@ -254,9 +254,7 @@ public:
if (onLowerBoundary_(globalPos))
{
// values.setAllDirichlet();
// values.setDirichlet(pressureIdx, contiTotalMassIdx);
values.setDirichlet(temperatureIdx, energyEqIdx);
values.setDirichlet(temperatureIdx);
}
if (onUpperBoundary_(globalPos))
......@@ -272,7 +270,6 @@ public:
}
else
{
// values.setAllDirichlet();
values.setAllNeumann();
}
}
......
......@@ -219,7 +219,7 @@ public:
if (useDirichletBC_)
{
values.setNeumann(transportEqIdx);
values.setDirichlet(temperatureIdx, energyEqIdx);
values.setDirichlet(temperatureIdx);
}
else
{
......@@ -234,8 +234,8 @@ public:
{
if (useDirichletBC_)
{
values.setDirichlet(massOrMoleFracIdx, transportEqIdx);
values.setDirichlet(temperatureIdx, energyEqIdx);
values.setDirichlet(massOrMoleFracIdx);
values.setDirichlet(temperatureIdx);
}
else
{
......@@ -260,7 +260,7 @@ public:
if (useDirichletBC_)
{
values.setNeumann(transportEqIdx);
values.setDirichlet(temperatureIdx, energyEqIdx);
values.setDirichlet(temperatureIdx);
}
else
{
......@@ -273,7 +273,6 @@ public:
if (globalPos[0] > runUpDistanceX_-eps_ && time > initializationTime_)
{
values.setAllCouplingOutflow();
// values.setCouplingInflow(energyEqIdx);
}
}
......@@ -286,10 +285,10 @@ public:
if (onRightBoundary_(globalPos))
{
if (time > initializationTime_)
values.setDirichlet(pressureIdx, massBalanceIdx);
values.setDirichlet(pressureIdx);
else
if (!onLowerBoundary_(globalPos) && !onUpperBoundary_(globalPos))
values.setDirichlet(pressureIdx, massBalanceIdx);
values.setDirichlet(pressureIdx);
}
}
......
......@@ -225,7 +225,7 @@ public:
if (onLowerBoundary_(globalPos))
{
values.setDirichlet(temperatureIdx, energyEqIdx);
values.setDirichlet(temperatureIdx);
}
if (onUpperBoundary_(globalPos))
......
......@@ -212,13 +212,13 @@ public:
if (onUpperBoundary_(globalPos))
{
values.setNeumann(transportEqIdx);
values.setDirichlet(temperatureIdx, energyEqIdx);
values.setDirichlet(temperatureIdx);
}
if (onLowerBoundary_(globalPos))
{
values.setNeumann(transportEqIdx);
values.setDirichlet(temperatureIdx, energyEqIdx);
values.setDirichlet(temperatureIdx);
if (globalPos[0] > runUpDistanceX1_ - eps_
&& globalPos[0] < runUpDistanceX2_ + eps_)
......@@ -247,7 +247,7 @@ public:
if (onRightBoundary_(globalPos))
{
values.setAllOutflow();
values.setDirichlet(pressureIdx, massBalanceIdx);
values.setDirichlet(pressureIdx);
}
}
......
......@@ -259,10 +259,10 @@ public:
if (onRightBoundary_(globalPos))
{
if (time > initializationTime_)
values.setDirichlet(pressureIdx, massBalanceIdx);
values.setDirichlet(pressureIdx);
else
if (!onLowerBoundary_(globalPos) && !onUpperBoundary_(globalPos))
values.setDirichlet(pressureIdx, massBalanceIdx);
values.setDirichlet(pressureIdx);
}
}
......
......@@ -250,7 +250,7 @@ public:
values.setOutflow(massBalanceIdx);
if (onRightBoundary_(globalPos))
values.setDirichlet(pressureIdx, massBalanceIdx);
values.setDirichlet(pressureIdx);
}
//! \copydoc ImplicitProblem::dirichletAtPos()
......
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