Rheolef  7.1
an efficient C++ finite element environment
stress.cc

The stress tensor for the linear elasticity and Stokes problems

#include "rheolef.h"
using namespace rheolef;
using namespace std;
int main(int argc, char** argv) {
environment rheolef (argc,argv);
Float inv_lambda;
field uh;
din >> catchmark("inv_lambda") >> inv_lambda
>> catchmark("u") >> uh;
const geo& omega = uh.get_geo();
const space& Xh = uh.get_space();
string grad_approx = "P" + itos(Xh.degree()-1) + "d";
space Th (omega, grad_approx, "tensor");
size_t d = omega.dimension();
field sigma_h = (inv_lambda == 0) ?
interpolate (Th, 2*D(uh)) :
interpolate (Th, 2*D(uh) + (1/inv_lambda)*div(uh)*I);
dout << catchmark("s") << sigma_h;
}
rheolef::div
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::divergence >>::type div(const Expr &expr)
div(uh): see the expression page for the full documentation
Definition: field_expr_terminal.h:1031
tensor
see the tensor page for the full documentation
main
int main(int argc, char **argv)
Definition: stress.cc:28
rheolef::catchmark
see the catchmark page for the full documentation
Definition: catchmark.h:67
field
see the field page for the full documentation
mkgeo_ball.d
int d
Definition: mkgeo_ball.sh:154
space
see the space page for the full documentation
rheolef.h
rheolef - reference manual
rheolef::interpolate
field_basic< T, M > interpolate(const space_basic< T, M > &V2h, const field_basic< T, M > &u1h)
see the interpolate page for the full documentation
Definition: interpolate.cc:233
rheolef::din
idiststream din
see the diststream page for the full documentation
Definition: diststream.h:427
rheolef::environment
see the environment page for the full documentation
Definition: environment.h:115
rheolef
This file is part of Rheolef.
Definition: compiler_eigen.h:37
rheolef::eye
solver_basic< Float > eye()
see the eye page for the full documentation
Definition: eye.h:74
Float
see the Float page for the full documentation
rheolef::D
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::gradient >>::type D(const Expr &expr)
D(uh): see the expression page for the full documentation.
Definition: field_expr_terminal.h:969
rheolef::dout
odiststream dout(cout)
see the diststream page for the full documentation
Definition: diststream.h:430
rheolef::itos
std::string itos(std::string::size_type i)
itos: see the rheostream page for the full documentation
rheolef::std
Definition: vec_expr_v2.h:402
geo
see the geo page for the full documentation