30int main(
int argc,
char**argv) {
33 Float eps = std::numeric_limits<Float>::epsilon();
34 string approx = (argc > 2) ? argv[2] :
"P1";
35 Float p = (argc > 3) ? atof(argv[3]) : 1.5;
36 Float w = (argc > 4) ? (
is_float(argv[4]) ? atof(argv[4]) :2/
p) :1;
37 Float tol = (argc > 5) ? atof(argv[5]) : 1e5*eps;
38 size_t max_it = (argc > 6) ? atoi(argv[6]) : 500;
39 derr <<
"# P-Laplacian problem by fixed-point:" << endl
40 <<
"# geo = " << omega.name() << endl
41 <<
"# approx = " << approx << endl
42 <<
"# p = " <<
p << endl
43 <<
"# w = " << w << endl
44 <<
"# tol = " << tol << endl;
45 space Xh (omega, approx);
46 Xh.block (
"boundary");
50 field uh (Xh), uh_star (Xh, 0.);
51 uh[
"boundary"] = uh_star[
"boundary"] = 0;
54 derr <<
"# n r v" << endl;
63 if (n == 0) { r0 = r; }
64 Float v = (n == 0) ? 0 : log10(r0/r)/n;
65 derr << n <<
" " << r <<
" " << v << endl;
66 if (r <= tol || n++ >= max_it)
break;
68 p.solve (
lh, uh_star);
69 uh = w*uh_star + (1-w)*uh;
73 return (r <= tol) ? 0 : 1;
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
The Poisson problem with homogeneous Dirichlet boundary condition – solver function.
void dirichlet(const field &lh, field &uh)
The p-Laplacian problem – the eta function.
This file is part of Rheolef.
std::enable_if< details::has_field_rdof_interface< Expr >::value, details::field_expr_v2_nonlinear_terminal_field< typenameExpr::scalar_type, typenameExpr::memory_type, details::differentiate_option::gradient > >::type grad(const Expr &expr)
grad(uh): see the expression page for the full documentation
T norm2(const vec< T, M > &x)
norm2(x): see the expression page for the full documentation
std::enable_if< details::is_field_expr_v2_nonlinear_arg< Expr >::value &&!is_undeterminated< Result >::value, Result >::type integrate(const geo_basic< T, M > &omega, const Expr &expr, const integrate_option &iopt, Result dummy=Result())
see the integrate page for the full documentation
rheolef::std enable_if ::type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
bool is_float(const string &s)
is_float: see the rheostream page for the full documentation
details::field_expr_v2_nonlinear_node_nary< typename details::function_traits< Function >::functor_type, typename details::field_expr_v2_nonlinear_terminal_wrapper_traits< Exprs >::type... > ::type compose(const Function &f, const Exprs &... exprs)
see the compose page for the full documentation
rheolef - reference manual