Skip to content
Snippets Groups Projects
Commit 122b1965 authored by Oliver Sander's avatar Oliver Sander Committed by sander@FU-BERLIN.DE
Browse files

bugfix in computeAveragePressure: use the proper embedding of intersections...

bugfix in computeAveragePressure: use the proper embedding of intersections into elements when integrating over the boundary

[[Imported from SVN: r7105]]
parent 9e8df513
No related branches found
No related tags found
No related merge requests found
...@@ -519,7 +519,7 @@ void computeAveragePressure(const typename RigidBodyMotion<GridView::dimension>: ...@@ -519,7 +519,7 @@ void computeAveragePressure(const typename RigidBodyMotion<GridView::dimension>:
typedef typename GridView::ctype ctype; typedef typename GridView::ctype ctype;
typedef double field_type; typedef double field_type;
Dune::PQkLocalFiniteElementCache<double,double, dim-1, 1> finiteElementCache; Dune::PQkLocalFiniteElementCache<double,double, dim, 1> finiteElementCache;
typedef typename GridView::template Codim<dim>::Iterator VertexIterator; typedef typename GridView::template Codim<dim>::Iterator VertexIterator;
...@@ -564,8 +564,8 @@ void computeAveragePressure(const typename RigidBodyMotion<GridView::dimension>: ...@@ -564,8 +564,8 @@ void computeAveragePressure(const typename RigidBodyMotion<GridView::dimension>:
for (; it!=endIt; ++it) { for (; it!=endIt; ++it) {
// Get shape functions // Get shape functions
const typename Dune::PQkLocalFiniteElementCache<double,double, dim-1, 1>::FiniteElementType& const typename Dune::PQkLocalFiniteElementCache<double,double, dim, 1>::FiniteElementType&
localFiniteElement = finiteElementCache.get(it->type()); localFiniteElement = finiteElementCache.get(it->inside()->type());
const Dune::GenericReferenceElement<double,dim>& refElement = Dune::GenericReferenceElements<double, dim>::general(it->inside()->type()); const Dune::GenericReferenceElement<double,dim>& refElement = Dune::GenericReferenceElements<double, dim>::general(it->inside()->type());
...@@ -585,24 +585,25 @@ void computeAveragePressure(const typename RigidBodyMotion<GridView::dimension>: ...@@ -585,24 +585,25 @@ void computeAveragePressure(const typename RigidBodyMotion<GridView::dimension>:
for (size_t qp=0; qp<quad.size(); qp++) { for (size_t qp=0; qp<quad.size(); qp++) {
// Local position of the quadrature point // Local position of the quadrature point
const Dune::FieldVector<double,dim-1>& quadPos = quad[qp].position(); const Dune::FieldVector<double,dim>& quadPos = it->geometryInInside().global(quad[qp].position());
const double integrationElement = it->geometry().integrationElement(quadPos); const double integrationElement = it->geometry().integrationElement(quad[qp].position());
std::vector<Dune::FieldVector<double,1> > shapeFunctionValues; std::vector<Dune::FieldVector<double,1> > shapeFunctionValues;
localFiniteElement.localBasis().evaluateFunction(quadPos, shapeFunctionValues); localFiniteElement.localBasis().evaluateFunction(quadPos, shapeFunctionValues);
// \mu_i = \int_t \varphi_i \ds // \mu_i = \int_t \varphi_i \ds
mu[i] += quad[qp].weight() * integrationElement * shapeFunctionValues[i]; int indexInFace = refElement.subEntity(it->indexInInside(), 1, i, dim);
mu[i] += quad[qp].weight() * integrationElement * shapeFunctionValues[indexInFace];
// \tilde{\mu}_i^j = \int_t \varphi_i \times (x - x_0) \ds // \tilde{\mu}_i^j = \int_t \varphi_i \times (x - x_0) \ds
Dune::FieldVector<double,dim> worldPos = it->geometry().global(quadPos); Dune::FieldVector<double,dim> worldPos = it->geometry().global(quad[qp].position());
for (int j=0; j<dim; j++) { for (int j=0; j<dim; j++) {
// Vector-valued basis function // Vector-valued basis function
Dune::FieldVector<double,dim> phi_i(0); Dune::FieldVector<double,dim> phi_i(0);
phi_i[j] = shapeFunctionValues[i]; phi_i[j] = shapeFunctionValues[indexInFace];
mu_tilde[i][j].axpy(quad[qp].weight() * integrationElement, mu_tilde[i][j].axpy(quad[qp].weight() * integrationElement,
crossProduct(Dune::FieldVector<double,dim>(worldPos-centerOfTorque), phi_i)); crossProduct(Dune::FieldVector<double,dim>(worldPos-centerOfTorque), phi_i));
...@@ -614,7 +615,7 @@ void computeAveragePressure(const typename RigidBodyMotion<GridView::dimension>: ...@@ -614,7 +615,7 @@ void computeAveragePressure(const typename RigidBodyMotion<GridView::dimension>:
} }
// Set up matrix // Set up matrix
for (int i=0; i<localFiniteElement.localCoefficients().size(); i++) { for (int i=0; i<refElement.size(it->indexInInside(),1,dim); i++) {
int faceIdxi = refElement.subEntity(it->indexInInside(), 1, i, dim); int faceIdxi = refElement.subEntity(it->indexInInside(), 1, i, dim);
int subIndex = globalToLocal[indexSet.subIndex(*it->inside(), faceIdxi, dim)]; int subIndex = globalToLocal[indexSet.subIndex(*it->inside(), faceIdxi, dim)];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment