Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Laplacian< Dim > Class Template Reference

Detailed Description

template<int Dim>
class Laplacian< Dim >

Laplacian Solver using continuous approximation spaces solve $ -\Delta u = f$ on $\Omega$ and $u= g$ on $\Gamma$

Template Parameters
Dimthe geometric dimension of the problem (e.g. Dim=1, 2 or 3)
+ Inheritance diagram for Laplacian< Dim >:

Public Types

typedef boost::shared_ptr
< backend_type
backend_ptrtype
 linear algebra backend factory shared_ptr<> type
 
typedef Backend< value_typebackend_type
 linear algebra backend factory
 
typedef bases< Lagrange< Order,
Scalar > > 
basis_type
 the basis type of our approximation space
 
typedef bases< Lagrange< Order,
Scalar > > 
basis_type
 the basis type of our approximation space
 
typedef Simplex< Dim > convex_type
 geometry entities type composing the mesh, here Simplex in Dimension Dim of Order 1
 
typedef Simplex< Dim > convex_type
 geometry entities type composing the mesh, here Simplex in Dimension Dim of Order 1
 
typedef space_type::element_type element_type
 an element type of the approximation function space
 
typedef space_type::element_type element_type
 an element type of the approximation function space
 
typedef boost::shared_ptr
< export_type
export_ptrtype
 the exporter factory (shared_ptr<> type)
 
typedef boost::shared_ptr
< export_type
export_ptrtype
 the exporter factory (shared_ptr<> type)
 
typedef Exporter< mesh_typeexport_type
 the exporter factory type
 
typedef Exporter< mesh_typeexport_type
 the exporter factory type
 
typedef boost::shared_ptr
< mesh_type
mesh_ptrtype
 mesh shared_ptr<> type
 
typedef boost::shared_ptr
< mesh_type
mesh_ptrtype
 mesh shared_ptr<> type
 
typedef Mesh< convex_typemesh_type
 mesh type
 
typedef Mesh< convex_typemesh_type
 mesh type
 
typedef p0_space_type::element_type p0_element_type
 an element type of the $P_0$ discontinuous function space
 
typedef FunctionSpace
< mesh_type, bases< Lagrange
< 0, Scalar, Discontinuous > > > 
p0_space_type
 function space that holds piecewise constant ( $P_0$) functions (e.g. to store material properties or partitioning
 
typedef boost::shared_ptr
< space_type
space_ptrtype
 the approximation function space type (shared_ptr<> type)
 
typedef boost::shared_ptr
< space_type
space_ptrtype
 the approximation function space type (shared_ptr<> type)
 
typedef FunctionSpace
< mesh_type, basis_type
space_type
 the approximation function space type
 
typedef FunctionSpace
< mesh_type, basis_type
space_type
 the approximation function space type
 
typedef
backend_type::sparse_matrix_ptrtype 
sparse_matrix_ptrtype
 sparse matrix type associated with backend (shared_ptr<> type)
 
typedef
backend_type::sparse_matrix_type 
sparse_matrix_type
 sparse matrix type associated with backend
 
typedef double value_type
 numerical type is double
 
typedef double value_type
 numerical type is double
 
typedef
backend_type::vector_ptrtype 
vector_ptrtype
 vector type associated with backend (shared_ptr<> type)
 
typedef backend_type::vector_type vector_type
 vector type associated with backend
 

Public Member Functions

 Laplacian ()
 
 Laplacian (po::variables_map const &vm, AboutData const &about)
 
void run ()
 
void run ()
 
void run (const double *X, unsigned long P, double *Y, unsigned long N)
 
- Public Member Functions inherited from Feel::Simget
 Simget ()
 
virtual ~Simget ()
 destructor
 
Simgetoperator= (Simget const &o)
 copy operator
 
virtual std::string name () const
 return the name of the simget
 
mpi::communicator comm () const
 
po::variables_map const & vm () const
 
AboutData const & about () const
 
double meshSize () const
 return the mesh size
 
double meshSizeInit () const
 return the mesh size
 
int level () const
 return the refinement level
 
ptree::ptree const & stats () const
 return the statistics associated to the simget after calling run
 
ptree::ptree & stats ()
 return the statistics associated to the simget after calling run
 
void setMeshSize (double h)
 set the mesh size
 
void setMeshSizeInit (double h)
 set the initial mesh size
 
void setLevel (int level)
 set the refinment level if applicable
 
void print (std::ostream &out, std::vector< ptree::ptree > &stats)
 

Static Public Attributes

static const uint16_type Order = 2
 Polynomial order $P_2$.
 

Additional Inherited Members

- Protected Member Functions inherited from Feel::Simget
SimgetchangeRepository (boost::format fmt)
 
- Protected Attributes inherited from Feel::Simget
int M_level
 
double M_meshSize
 
double M_meshSizeInit
 
ptree::ptree M_stats
 

Constructor & Destructor Documentation

template<int Dim>
Laplacian< Dim >::Laplacian ( po::variables_map const &  vm,
AboutData const &  about 
)
inline

Constructor

template<int Dim>
Laplacian< Dim >::Laplacian ( )
inline

Constructor

Member Function Documentation

template<int Dim>
void Laplacian< Dim >::run ( )
virtual

simply execute the simget

Implements Feel::Simget.

template<int Dim>
void Laplacian< Dim >::run ( )
virtual

simply execute the simget

Implements Feel::Simget.

template<int Dim>
void Laplacian< Dim >::run ( const double *  X,
unsigned long  P,
double *  Y,
unsigned long  N 
)
virtual

models the input/output relation $ Y=F(X) $

The function space and some associated elements(functions) are then defined

*/
element_type u( Xh, "u" );
element_type v( Xh, "v" );
element_type gproj( Xh, "v" );

define $g$ the expression of the exact solution and $f$ the expression of the right hand side such that $g$ is the exact solution

*/
//# marker1 #
value_type pi = M_PI;
auto g = cst( 0. );
gproj = vf::project( Xh, elements( mesh ), g );
auto f = cst( 0. );
//# endmarker1 #

Construction of the right hand side. F is the vector that holds the algebraic representation of the right habd side of the problem

*/
//# marker2 #
vector_ptrtype F( M_backend->newVector( Xh ) );
form1( _test=Xh, _vector=F, _init=true ) =
integrate( elements( mesh ), f*id( v ) )+
integrate( markedfaces( mesh, "Mur" ), nu*gradv( gproj )*vf::N()*id( v ) );
//# endmarker2 #
/* if ( this->comm().size() != 1 || weakdir )
{
//# marker41 #
form1( _test=Xh, _vector=F ) +=
integrate( markedfaces(mesh,mesh->markerName("Dirichlet")), g*(-grad(v)*vf::N()+penaldir*id(v)/hFace()) );
//# endmarker41 #
}
F->close();*/

create the matrix that will hold the algebraic representation of the left hand side

*/
sparse_matrix_ptrtype D( M_backend->newMatrix( Xh, Xh ) );

assemble $ u v$

*/
form2( Xh, Xh, D, _init=true ) =
integrate( elements( mesh ), nu*gradt( u )*trans( grad( v ) ) );
*/
//# marker10 #
/* form2( Xh, Xh, D ) +=
integrate( markedfaces(mesh,mesh->markerName("Dirichlet")),
-(gradt(u)*vf::N())*id(v)
-(grad(v)*vf::N())*idt(u)
+penaldir*id(v)*idt(u)/hFace());
D->close();*/
//# endmarker10 #
*/
//# marker5 #
D->close();
form2( Xh, Xh, D ) +=
on( markedfaces( mesh, "Poele" ), u, F, cst( 45 ) )+
on( markedfaces( mesh, "Fenetre" ), u, F, cst( 5 ) );
//# endmarker5 #

solve the system

*/
this->solve( D, u, F );

compute the

*/
//# marker7 #
double L2error2 =integrate( elements( mesh ),
( idv( u )-g )*( idv( u )-g ) ).evaluate()( 0,0 );
double L2error = math::sqrt( L2error2 );
LOG(INFO) << "||error||_L2=" << L2error << "\n";
//# endmarker7 #

save the results

*/
element_type e( Xh, "e" );
e = vf::project( Xh, elements( mesh ), g );
export_ptrtype exporter( export_type::New( this->vm(),
( boost::format( "%1%-%2%-%3%" )
% this->about().appName()
% shape
% Dim ).str() ) );
if ( exporter->doExport() )
{
LOG(INFO) << "exportResults starts\n";
exporter->step( 0 )->setMesh( mesh );
exporter->step( 0 )->add( "u", u );
exporter->step( 0 )->add( "g", e );
exporter->save();
LOG(INFO) << "exportResults done\n";
}

Reimplemented from Feel::Simget.

References Feel::elements(), Feel::integrate(), Feel::markedfaces(), and Feel::project().


The documentation for this class was generated from the following files:

Generated on Sun Dec 22 2013 13:11:16 for Feel++ by doxygen 1.8.5