Commit e2d74306 authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

Implements FS#192 Clean up ...FVElementGeometry. In particular:

- deprecate numVertices, use numScv.

- deprecate numEdges, introduce and use numScvf.

- deprecate numFaces, edgeCoord and faceCoord, they are not used
  anywhere outside.

- deprecate numFap on the whole FVGeometry, introduce and use numFap on
  SubControlVolumeFaces.

- Get rid of the Vector typedef and use GlobalPosition.

Reviewed by Christoph.



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10744 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 81ba6e28
......@@ -93,7 +93,7 @@ protected:
// velocityDiv_ = Scalar(0);
for (int idx = 0;
idx < fvGeometry_.numVertices;
idx < fvGeometry_.numScv;
idx++) // loop over adjacent vertices
{
// phase density and viscosity at IP
......
......@@ -299,7 +299,7 @@ protected:
DimVector pressureGradAtSCVCenter(0.0);
DimVector grad(0.0);
for (int scvIdx2 = 0; scvIdx2 < this->fvGeometry_().numVertices; scvIdx2++)
for (int scvIdx2 = 0; scvIdx2 < this->fvGeometry_().numScv; scvIdx2++)
{
grad = this->fvGeometry_().subContVol[scvIdx].gradCenter[scvIdx2];
Valgrind::CheckDefined(grad);
......@@ -324,11 +324,11 @@ protected:
*/
void evalBoundary_()
{
assert(this->residual_.size() == this->fvGeometry_().numVertices);
assert(this->residual_.size() == this->fvGeometry_().numScv);
const ReferenceElement &refElement = ReferenceElements::general(this->element_().geometry().type());
// loop over sub-control volums of the element
for (int scvIdx = 0; scvIdx < this->fvGeometry_().numVertices; scvIdx++)
for (int scvIdx = 0; scvIdx < this->fvGeometry_().numScv; scvIdx++)
{
// consider only SCVs on the boundary
if (this->fvGeometry_().subContVol[scvIdx].inner)
......@@ -539,7 +539,7 @@ protected:
if (stabilizationAlpha_ != 0)
{
// loop over the edges of the element
for (int faceIdx = 0; faceIdx < this->fvGeometry_().numEdges; faceIdx++)
for (int faceIdx = 0; faceIdx < this->fvGeometry_().numScvf; faceIdx++)
{
const FluxVariables fluxVars(this->problem_(),
this->element_(),
......
......@@ -117,7 +117,7 @@ public:
bool hasLeft = false;
bool hasRight = false;
for (int i = 0; i < fvGeometry.numVertices; i++) {
for (int i = 0; i < fvGeometry.numScv; i++) {
const GlobalPosition &global = fvGeometry.subContVol[i].global;
if (globalI[axis] < coordVal)
hasLeft = true;
......@@ -127,7 +127,7 @@ public:
if (!hasLeft || !hasRight)
continue;
for (int i = 0; i < fvGeometry.numVertices; i++) {
for (int i = 0; i < fvGeometry.numScv; i++) {
const GlobalPosition &global = fvGeometry.subContVol[i].global;
if (globalI[axis] < coordVal)
flux += this->localResidual().residual(i);
......
......@@ -122,7 +122,7 @@ protected:
// calculate gradients and secondary variables at IPs
for (int idx = 0;
idx < this->fvGeometry_.numVertices;
idx < this->fvGeometry_.numScv;
idx++) // loop over vertices of the element
{
molarDensity_ += elemVolVars[idx].molarDensity()*
......
......@@ -101,7 +101,7 @@ protected:
// calculate gradients and secondary variables at IPs
DimVector tmp(0.0);
for (int idx = 0;
idx < this->fvGeometry_.numVertices;
idx < this->fvGeometry_.numScv;
idx++) // loop over vertices of the element
{
thermalConductivity_ += elemVolVars[idx].thermalConductivity() *
......
......@@ -284,7 +284,7 @@ protected:
// use finite-element gradients
tmp = 0.0;
for (int idx = 0;
idx < fvGeometry_.numFap;
idx < face().numFap;
idx++) // loop over adjacent vertices
{
// FE gradient at vertex idx
......
......@@ -108,7 +108,7 @@ protected:
// calculate densities at the integration points of the face
DimVector tmp(0.0);
for (int idx = 0;
idx < this->fvGeometry_.numFap;
idx < this->face().numFap;
idx++) // loop over adjacent vertices
{
// index for the element volume variables
......@@ -134,7 +134,7 @@ protected:
// calculate gradients
DimVector tmp(0.0);
for (int idx = 0;
idx < this->fvGeometry_.numFap;
idx < this->face().numFap;
idx++) // loop over adjacent vertices
{
// FE gradient at vertex idx
......
......@@ -120,7 +120,7 @@ protected:
// gradients
temperatureGrad_ = 0;
DimVector tmp(0.0);
for (int idx = 0; idx < this->fvGeometry_.numFap; idx++)
for (int idx = 0; idx < this->face().numFap; idx++)
{
tmp = this->face().grad[idx];
......
......@@ -198,7 +198,7 @@ private:
int faceIdx)
{
// calculate gradients, loop over adjacent vertices
for (int idx = 0; idx < this->fvGeometry_.numFap; idx++)
for (int idx = 0; idx < this->face().numFap; idx++)
{
int i = this->face().i;
int j = this->face().j;
......
......@@ -126,7 +126,7 @@ protected:
// gradients
temperatureGrad_ = 0;
DimVector tmp(0.0);
for (int idx = 0; idx < this->fvGeometry_.numFap; idx++)
for (int idx = 0; idx < this->face().numFap; idx++)
{
tmp = this->face().grad[idx];
......
......@@ -124,7 +124,7 @@ private:
// calculate gradients
DimVector tmp(0.0);
for (int idx = 0;
idx < this->fvGeometry_.numFap;
idx < this->face().numFap;
idx++) // loop over adjacent vertices
{
// FE gradient at vertex idx
......
......@@ -89,12 +89,12 @@ public:
// gradients
DimVector temperatureGrad(0);
DimVector tmp(0.0);
for (int vertIdx = 0; vertIdx < fvGeometry.numFap; vertIdx++)
for (int idx = 0; idx < this->face().numFap; idx++)
{
tmp = this->face().grad[vertIdx];
tmp = this->face().grad[idx];
// index for the element volume variables
int volVarsIdx = this->face().fapIndices[vertIdx];
int volVarsIdx = this->face().fapIndices[idx];
tmp *= elemVolVars[volVarsIdx].temperature();
temperatureGrad += tmp;
......
This diff is collapsed.
......@@ -81,7 +81,7 @@ protected:
void evalDirichlet_()
{
PrimaryVariables dirichletValues(0);
for (int scvIdx = 0; scvIdx < this->fvGeometry_().numVertices; ++scvIdx) {
for (int scvIdx = 0; scvIdx < this->fvGeometry_().numScv; ++scvIdx) {
const BoundaryTypes &bcTypes = this->bcTypes_(scvIdx);
if (bcTypes.hasDirichlet()) {
......@@ -227,7 +227,7 @@ protected:
{
// calculate the mass flux over the faces and subtract
// it from the local rates
for (int scvfIdx = 0; scvfIdx < this->fvGeometry_().numEdges; scvfIdx++)
for (int scvfIdx = 0; scvfIdx < this->fvGeometry_().numScvf; scvfIdx++)
{
int i = this->fvGeometry_().subContVolFace[scvfIdx].i;
int j = this->fvGeometry_().subContVolFace[scvfIdx].j;
......
......@@ -64,7 +64,6 @@ class CCFVElementGeometry
typedef typename GridView::Traits::template Codim<0>::Entity Element;
typedef typename GridView::Traits::template Codim<0>::EntityPointer ElementPointer;
typedef typename Element::Geometry Geometry;
typedef Dune::FieldVector<Scalar,dimWorld> Vector;
typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition;
typedef Dune::FieldVector<CoordScalar,dim> LocalPosition;
typedef typename GridView::IntersectionIterator IntersectionIterator;
......@@ -83,11 +82,12 @@ public:
int i,j; //!< scvf seperates corner i and j of elem
LocalPosition ipLocal; //!< integration point in local coords
GlobalPosition ipGlobal; //!< integration point in global coords
Vector normal; //!< normal on face pointing to CV j or outward of the domain with length equal to |scvf|
GlobalPosition normal; //!< normal on face pointing to CV j or outward of the domain with length equal to |scvf|
Scalar area; //!< area of face
Dune::FieldVector<Vector, maxNFAP> grad; //!< derivatives of shape functions at ip
Dune::FieldVector<GlobalPosition, maxNFAP> grad; //!< derivatives of shape functions at ip
Dune::FieldVector<Scalar, maxNFAP> shapeValue; //!< value of shape functions at ip
Dune::FieldVector<int, maxNFAP> fapIndices; //!< indices w.r.t.neighbors of the flux approximation points
unsigned numFap; //!< number of flux approximation points
unsigned faceIdx; //!< the index (w.r.t. the element) of the face (codim 1 entity) that the scvf is part of
};
......@@ -99,12 +99,13 @@ public:
SubControlVolume subContVol[1]; //!< data of the sub control volumes
SubControlVolumeFace subContVolFace[maxNE]; //!< data of the sub control volume faces
BoundaryFace boundaryFace[maxBF]; //!< data of the boundary faces
int numVertices; //!< number of verts
int numEdges; //!< number of edges
int numFaces; //!< number of faces (0 in < 3D)
int numVertices; //!< \deprecated number of verts
int numEdges; //!< \deprecated number of edges
int numFaces; //!< \deprecated number of faces (0 in < 3D)
int numScv; //!< number of subcontrol volumes
int numScvf; //!< number of inner-domain subcontrolvolume faces
int numNeighbors; //!< number of neighboring elements including the element itself
int numFap; //!< number of flux approximation points
int numFap; //!< \deprecated number of flux approximation points
std::vector<ElementPointer> neighbors; //!< stores pointers for the neighboring elements
void updateInner(const Element& element)
......@@ -115,11 +116,14 @@ public:
elementGlobal = geometry.center();
elementLocal = geometry.local(elementGlobal);
numScv = 1;
numScvf = 0;
numFap = 2;
// compatibility initializations of deprecated members
numVertices = element.template count<dim>();
numEdges = element.template count<dim-1>();
numFaces = (dim<3)? 0 : element.template count<1>();
numScv = 1;
numFap = 2;
subContVol[0].local = elementLocal;
subContVol[0].global = elementGlobal;
......@@ -169,7 +173,8 @@ public:
distVec /= distVec.two_norm2();
// gradients using a two-point flux approximation
for (int idx = 0; idx < 2; idx++)
subContVolFace[k].numFap = 2;
for (int idx = 0; idx < subContVolFace[k].numFap; idx++)
{
subContVolFace[k].grad[idx] = distVec;
subContVolFace[k].shapeValue[idx] = 0.5;
......@@ -200,7 +205,8 @@ public:
distVec /= distVec.two_norm2();
// gradients using a two-point flux approximation
for (int idx = 0; idx < 2; idx++)
boundaryFace[bfIdx].numFap = 2;
for (int idx = 0; idx < boundaryFace[bfIdx].numFap; idx++)
{
boundaryFace[bfIdx].grad[idx] = distVec;
boundaryFace[bfIdx].shapeValue[idx] = 0.5;
......@@ -212,6 +218,9 @@ public:
}
}
// set the number of inner-domain subcontrolvolume faces
numScvf = numNeighbors - 1;
// treat elements on the boundary
if (onBoundary)
{
......
......@@ -181,7 +181,7 @@ protected:
{
gradPotential_[phaseIdx]= 0.0 ;
for (int idx = 0;
idx < fvGeometry_.numFap;
idx < face().numFap;
idx++) // loop over adjacent vertices
{
// FE gradient at vertex idx
......
......@@ -190,7 +190,7 @@ public:
int numRows, numCols;
if (isBox)
{
numRows = numCols = fvElemGeom_.numVertices;
numRows = numCols = fvElemGeom_.numScv;
}
else
{
......
......@@ -138,7 +138,7 @@ public:
SCVVelocities scvVelocities(pow(2,dim));
scvVelocities = 0;
for (int faceIdx = 0; faceIdx < fvGeometry.numEdges; faceIdx++)
for (int faceIdx = 0; faceIdx < fvGeometry.numScvf; faceIdx++)
{
// local position of integration point
const Dune::FieldVector<Scalar, dim>& localPosIP = fvGeometry.subContVolFace[faceIdx].ipLocal;
......
......@@ -79,7 +79,7 @@ public:
DimVector tmp ;
for (int idx = 0;
idx < fvGeometry.numFap;
idx < face.numFap;
idx++) // loop over adjacent vertices
{
// FE gradient at vertex idx
......
......@@ -111,7 +111,7 @@ public:
// gradients
DimVector tmp(0.0);
DimVector temperatureGradient(0.);
for (int idx = 0; idx < fvGeometry.numFap; idx++)
for (int idx = 0; idx < face.numFap; idx++)
{
tmp = face.grad[idx];
......
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