Skip to content
Snippets Groups Projects
Commit e1f94d76 authored by Hörl, Maximilian's avatar Hörl, Maximilian
Browse files

add quadrature order to problem, change gitignore

parent d74c68d2
No related branches found
No related tags found
No related merge requests found
build-cmake build-cmake
.fuse_hidden*
...@@ -57,9 +57,6 @@ private: ...@@ -57,9 +57,6 @@ private:
//assemble stiffness matrix A and load vector b //assemble stiffness matrix A and load vector b
void assembleSLE (const Scalar K, const Scalar mu) void assembleSLE (const Scalar K, const Scalar mu)
{ {
//NOTE:
//const int order = 3; //order of the quadrature rule
//we use the basis //we use the basis
// phi_elem,0 (x) = indicator(elem); // phi_elem,0 (x) = indicator(elem);
// phi_elem,i (x) = x[i]*indicator(elem); // phi_elem,i (x) = x[i]*indicator(elem);
...@@ -77,29 +74,29 @@ private: ...@@ -77,29 +74,29 @@ private:
//basis function phi_elem,i //basis function phi_elem,i
const int elemIdxSLE = (dim + 1)*elemIdx; const int elemIdxSLE = (dim + 1)*elemIdx;
/* //TODO: can be done outside of the loop? /* //TODO: can be done outside of the loop?
const Dune::QuadratureRule<double,dim>& rule = const Dune::QuadratureRule<double,dim>& rule =
Dune::QuadratureRules<double,dim>::rule(geo.type(),order); Dune::QuadratureRules<double,dim>::rule(geo.type(), problem_.quadratureOrder());
Dune::FieldVector<double, dim+1> update(0.0);
//NOTE: how are quadrature rules in Dune applied correctly? //NOTE: how are quadrature rules in Dune applied correctly?
for (const auto& ip : rule) for (const auto& ip : rule)
{ {
const auto qp = ip.position(); const auto& qp = ip.position();
//NOTE: is the volume of the element taken into account //NOTE: is the volume of the element taken into account
//automatically? //automatically?
const auto weight = ip.weight(); const double weight = ip.weight();
//quadrature for int_elem q*phi_elem,0 dV //quadrature for int_elem q*phi_elem,0 dV
b[elemIdxSLE] += weight * q(qp); b[elemIdxSLE] += weight * problem_.q(qp);
//quadrature for int_elem q*phi_elem,i dV //quadrature for int_elem q*phi_elem,i dV
for (int i = 0; i < dim; i++) for (int i = 0; i < dim; i++)
{ {
b[elemIdxSLE + i + 1] += weight * qp[i] * q(qp); b[elemIdxSLE + i + 1] += weight * qp[i] * problem_.q(qp);
} }
} }
*/ */
//NOTE: makeshift solution for source term q = -1 //NOTE: makeshift solution for source term q = -1
b[elemIdxSLE] += -elemVol; b[elemIdxSLE] += -elemVol;
for (int i = 0; i < dim; i++) for (int i = 0; i < dim; i++)
......
...@@ -17,7 +17,7 @@ class DGProblem ...@@ -17,7 +17,7 @@ class DGProblem
} }
//indicates whether an exact solution is implemented for the problem //indicates whether an exact solution is implemented for the problem
virtual bool hasExactSolution() const virtual bool hasExactSolution () const
{ {
return false; return false;
}; };
...@@ -33,6 +33,13 @@ class DGProblem ...@@ -33,6 +33,13 @@ class DGProblem
{ {
return Scalar(0.0); return Scalar(0.0);
} }
//returns the recommended quadrature order to compute an integral
//over x * q(x)
virtual int quadratureOrder () const
{
return 1;
}
}; };
#endif #endif
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
#include <dune/mmdg/problems/dgproblem.hh> #include <dune/mmdg/problems/dgproblem.hh>
#include <dune/mmdg/problems/poisson.hh> #include <dune/mmdg/problems/poisson.hh>
//TODO: specify K in problem? exact solution depends on K!
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
try try
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment