Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
dirichlet_hdg.cc

The Poisson problem by the hybrid discontinuous Galerkin method.

The Poisson problem by the hybrid discontinuous Galerkin method

#include "rheolef.h"
using namespace rheolef;
using namespace std;
int main(int argc, char**argv) {
environment rheolef (argc, argv);
geo omega (argv[1]);
string approx = (argc > 2) ? argv[2] : "P1d";
Float n = (argc > 3) ? atof(argv[3]) : 1;
Float beta = (argc > 4) ? atof(argv[4]) : 1;
space Th (omega, approx, "vector"),
Xh (omega, approx),
Yh = Th*Xh,
Mh (omega["sides"], approx);
Mh.block("boundary");
space Wh(Mh.get_geo()["boundary"],approx);
size_t d = omega.dimension();
size_t k = Xh.degree();
trial x(Yh), lambda(Mh);
test y(Yh), mu(Mh);
auto sigma = x[0], u = x[1];
auto tau = y[0], v = y[1];
iopt.invert = true;
auto coef = beta*pow(h_local(),n);
form inv_a = integrate(dot(sigma,tau) + u*div_h(tau) + v*div_h(sigma)
- on_local_sides(coef*u*v), iopt);
form b = integrate("internal_sides",
(-dot(jump(sigma),normal()) + 2*coef*average(u))*mu)
+ integrate("boundary", (-dot(sigma,normal()) + coef*u)*mu);
form c = integrate("internal_sides", 2*coef*lambda*mu)
+ integrate("boundary", coef*lambda*mu);
field lh = integrate (-f(d)*v);
field kh(Mh,0), lambda_h(Mh,0);
lambda_h ["boundary"] = lazy_interpolate (Wh, g(d));
form s = c + b*inv_a*trans(b);
field rh = b*(inv_a*lh) - kh;
problem p (s);
p.solve (rh, lambda_h);
field xh = inv_a*(lh - b.trans_mult(lambda_h));
dout << catchmark("n") << n << endl
<< catchmark("beta") << beta << endl
<< catchmark("u") << xh[1]
<< catchmark("lambda") << lambda_h
<< catchmark("sigma") << xh[0];
}
field lh(Float epsilon, Float t, const test &v)
see the Float page for the full documentation
see the field page for the full documentation
see the form page for the full documentation
see the geo page for the full documentation
see the problem page for the full documentation
see the catchmark page for the full documentation
Definition catchmark.h:67
see the environment page for the full documentation
see the integrate_option page for the full documentation
see the space page for the full documentation
see the test page for the full documentation
see the test page for the full documentation
int main()
Definition field2bb.cc:58
This file is part of Rheolef.
STL namespace.
rheolef - reference manual
The sinus product function – right-hand-side and boundary condition for the Poisson problem.
Definition cavity_dg.h:29
Definition cavity_dg.h:25
Definition sphere.icc:25
Definition leveque.h:25