The Poisson problem by the hybrid high order method.
int main(
int argc,
char**argv) {
string Pkd = (argc > 2) ? argv[2] : "P1d",
Pld = (argc > 3) ? argv[3] : Pkd;
Mh (omega["sides"], Pkd);
Mh.block("boundary");
size_t k = Mh.degree(), l = Xh.degree(), dim = omega.dimension();
Float beta = (argc > 4) ? atof(argv[4]) : 10*(k+1)*(k+dim)/
Float(dim);
check_macro(l == k-1 || l == k || l == k+1,
"invalid (k,l)");
space Xhs(omega,
"P"+to_string(k+1)+
"d"),
Zh (omega, "P0"),
Mht(omega, "trace_n(RT"+to_string(max(k,l))+"d)");
test ws(Xhs), w(Xh), xi(Zh), phit(Mht), mu(Mh);
auto lh = lazy_integrate (
f(dim)*w);
auto m = lazy_integrate (
u*w);
auto as = lazy_integrate (dot(grad_h(us),
A(dim)*grad_h(ws)));
auto cs = lazy_integrate (pow(h_local(),2)*zeta*xi);
auto mt = lazy_integrate (on_local_sides(deltat*phit));
auto ct = lazy_integrate (on_local_sides(beta*pow(h_local(),-1)*deltat*phit));
auto bs = lazy_integrate (us*xi);
auto d = lazy_integrate (
u*xi);
auto ds = lazy_integrate (us*w);
auto dt = lazy_integrate (on_local_sides(
u*phit));
auto dst= lazy_integrate (on_local_sides(us*phit));
auto ac = lazy_integrate (dot(grad_h(
u),
A(dim)*grad_h(ws))
- on_local_sides(
u*dot(
A(dim)*grad_h(ws),normal())));
auto et = lazy_integrate (on_local_sides(mu*deltat));
auto es = lazy_integrate (on_local_sides(mu*dot(
A(dim)*grad_h(us),normal())));
auto inv_cs = inv(cs);
auto inv_Ss = inv(as + trans(bs)*inv_cs*bs);
auto inv_T = inv(as*inv_Ss*as + trans(bs)*inv_cs*bs);
auto R = as*inv_Ss*trans(bs)*inv_cs*
d - ac;
auto Ac = trans(R)*inv_T*R;
auto D = ct*inv(mt)*(dst - dt*inv(m)*ds);
auto M0 = inv_Ss - inv_Ss*as*inv_T*as*inv_Ss;
auto inv_M = inv(ct + D*M0*trans(D));
auto E = trans(dt)*inv(mt)*ct
+ trans(ac)*inv_T*as*inv_Ss*trans(D)
+ trans(
d)*inv_cs*bs*M0*trans(D);
auto As = E*inv_M*trans(E);
auto inv_A = inv(Ac + As);
auto F = es*inv_T*as*inv_Ss*trans(D)
- et*inv(mt)*ct;
auto C = es*inv_T*trans(es) + F*inv_M*trans(F);
auto B = F*inv_M*trans(E) - es*inv_T*R;
form S = C - B*inv_A*trans(B);
pS.solve (rhs, lambda_h);
auto uh = inv_A*(
lh - B.trans_mult(lambda_h));
auto deltat_h = inv_M*(E.trans_mult(uh) + F.trans_mult(lambda_h));
auto vs_h = inv_T*(-as*inv_Ss*D.trans_mult(deltat_h) + R*uh - es.trans_mult(lambda_h));
field us_h = inv_Ss*(-as*vs_h - D.trans_mult(deltat_h) + trans(bs)*inv_cs*
d*uh);
}
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 geo page for the full documentation
see the problem page for the full documentation
see the catchmark page for the full documentation
see the environment 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
Tensor diffusion – isotropic case.
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
rheolef - reference manual
The sinus product function – right-hand-side and boundary condition for the Poisson problem.