Commit 851f5ecb authored by Kilian Weishaupt's avatar Kilian Weishaupt Committed by Timo Koch
Browse files

[staggeredGrid] Add cellCenter and face specific init and dirichlet functions

parent 13ebe79d
......@@ -94,7 +94,7 @@ public:
{
const auto insideScvIdx = scvf.insideScvIdx();
const auto& insideScv = fvGeometry.scv(insideScvIdx);
const auto dirichletPriVars = problem.dirichlet(element, scvf);
const auto dirichletPriVars = problem.ccDirichlet(element, scvf);
volumeVariables_[scvf.outsideScvIdx()].update(dirichletPriVars, problem, element, insideScv);
}
......
......@@ -52,6 +52,8 @@ class NavierStokesProblem : public StaggeredProblem<TypeTag>
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
using FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables);
enum {
dim = Grid::dimension,
dimWorld = Grid::dimensionworld
......@@ -116,6 +118,22 @@ public:
const int boundaryFaceIdx) const
{ DUNE_THROW(Dune::NotImplemented, "permeability()"); }
/*!
* \brief Evaluate the boundary conditions for a dirichlet
* control volume.
*
* \param globalPos The position of the center of the finite volume
* for which the dirichlet condition ought to be
* set in global coordinates
*
* For this method, the \a values parameter stores primary variables.
*/
FacePrimaryVariables faceDirichletAtPos(const GlobalPosition &globalPos, const int direction) const
{
return asImp_().dirichletVelocityAtPos(globalPos)[direction];
}
// \}
private:
......
......@@ -267,7 +267,11 @@ protected:
{
if (scvf.boundary())
{
// auto test = this->problem().faceDirichletAtPos(scvf.center(), scvf.directionIndex());
// std::cout << " face: " << scvf.center() << ", normal: " << scvf.unitOuterNormal() << ", value: " << test << std::endl;
// auto bcTypes = this->problem().boundaryTypes(element, scvf);
// this->residual_[0] += evalBoundaryFluxes_(element, fvGeometry, elemVolVars, scvf, bcTypes, elemFluxVarsCache[scvf]);
}
}
......
......@@ -256,7 +256,7 @@ public:
{
// let the problem do the dirty work of nailing down
// the initial solution.
auto initPriVars = this->problem_().initial(scv);
auto initPriVars = this->problem_().initialCCValuesAtPos(scv.dofPosition());
auto dofIdxGlobal = scv.dofIndex();
this->uCur_[cellCenterIdx][dofIdxGlobal] += initPriVars;
......@@ -265,7 +265,7 @@ public:
// loop over faces
for(auto&& scvf : scvfs(fvGeometry))
{
auto initPriVars = this->problem_().initialFaceValues(scvf);
auto initPriVars = this->problem_().initialFaceValueAtPos(scvf.center());
this->uCur_[faceIdx][scvf.dofIndexSelf()] = initPriVars;
}
}
......
......@@ -103,7 +103,7 @@ public:
*
* The method returns the boundary types information.
*/
CellCenterPrimaryVariables dirichlet(const Element &element, const SubControlVolumeFace &scvf) const
CellCenterPrimaryVariables ccDirichlet(const Element &element, const SubControlVolumeFace &scvf) const
{
// forward it to the method which only takes the global coordinate
if (isBox)
......@@ -114,7 +114,7 @@ public:
return asImp_().dirichletAtPos(scvf.center());
}
CellCenterPrimaryVariables dirichlet(const Element &element, const SubControlVolume &scv) const
CellCenterPrimaryVariables ccDirichlet(const Element &element, const SubControlVolume &scv) const
{
// forward it to the method which only takes the global coordinate
if (!isBox)
......@@ -135,7 +135,27 @@ public:
*
* For this method, the \a values parameter stores primary variables.
*/
CellCenterPrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
CellCenterPrimaryVariables ccDirichletAtPos(const GlobalPosition &globalPos) const
{
// Throw an exception (there is no reasonable default value
// for Dirichlet conditions)
DUNE_THROW(Dune::InvalidStateException,
"The problem specifies that some boundary "
"segments are dirichlet, but does not provide "
"a dirichlet() method.");
}
/*!
* \brief Evaluate the boundary conditions for a dirichlet
* control volume.
*
* \param globalPos The position of the center of the finite volume
* for which the dirichlet condition ought to be
* set in global coordinates
*
* For this method, the \a values parameter stores primary variables.
*/
FacePrimaryVariables faceDirichletAtPos(const GlobalPosition &globalPos, const int direction) const
{
// Throw an exception (there is no reasonable default value
// for Dirichlet conditions)
......@@ -249,25 +269,6 @@ public:
}
/*!
* \brief Evaluate the initial value for a control volume.
*
* \param values The initial values for the primary variables
* \param element The finite element
* \param fvGeometry The finite-volume geometry
* \param scvIdx The local subcontrolvolume index
*
* For this method, the \a values parameter stores primary
* variables.
*/
CellCenterPrimaryVariables initial(const SubControlVolume &scv) const
{
// forward to generic interface
return asImp_().initialAtPos(scv.dofPosition());
}
/*!
* \brief Evaluate the initial value for a control volume.
*
......@@ -278,7 +279,7 @@ public:
*
* For this method, the \a values parameter stores primary variables.
*/
CellCenterPrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
CellCenterPrimaryVariables initialCCValuesAtPos(const GlobalPosition &globalPos) const
{
// Throw an exception (there is no reasonable default value
// for initial values)
......@@ -287,22 +288,6 @@ public:
"a initialAtPos() method.");
}
/*!
* \brief Evaluate the initial value for a facet.
*
* \param values The initial values for the primary variables
* \param element The finite element
* \param fvGeometry The finite-volume geometry
* \param scvIdx The local subcontrolvolume index
*
* For this method, the \a values parameter stores primary
* variables.
*/
FacePrimaryVariables initialFaceValues(const SubControlVolumeFace &scvf) const
{
// forward to generic interface
return asImp_().initialFaceValueAtPos(scvf.center());
}
/*!
* \brief Evaluate the initial value for a facet.
......
......@@ -246,7 +246,7 @@ public:
* For this method, the \a priVars parameter stores primary
* variables.
*/
CellCenterPrimaryVariables initial(const SubControlVolume& scv) const
CellCenterPrimaryVariables initialCCValuesAtPos(const GlobalPosition &globalPos) const
{
CellCenterPrimaryVariables priVars(0);
priVars[pressureIdx] = 1.0e+5;
......@@ -273,6 +273,14 @@ public:
}
GlobalPosition dirichletVelocityAtPos(const GlobalPosition &pos) const
{
GlobalPosition velocity;
velocity[0] = 1.0;
velocity[1] = 0.0;
return velocity;
}
// \}
private:
......
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