Feel++ 0.91.0
Public Types | Public Member Functions | Static Public Attributes
Laplacian< Dim > Class Template Reference
Inheritance diagram for Laplacian< Dim >:
Feel::Simget Feel::Simget

List of all members.

Public Types

typedef double value_type
 numerical type is double
typedef Backend< value_typebackend_type
 linear algebra backend factory
typedef boost::shared_ptr
< backend_type
backend_ptrtype
 linear algebra backend factory shared_ptr<> type
typedef
backend_type::sparse_matrix_type 
sparse_matrix_type
 sparse matrix type associated with backend
typedef
backend_type::sparse_matrix_ptrtype 
sparse_matrix_ptrtype
 sparse matrix type associated with backend (shared_ptr<> type)
typedef backend_type::vector_type vector_type
 vector type associated with backend
typedef
backend_type::vector_ptrtype 
vector_ptrtype
 vector type associated with backend (shared_ptr<> type)
typedef Simplex< Dim > convex_type
 geometry entities type composing the mesh, here Simplex in Dimension Dim of Order 1
typedef Mesh< convex_typemesh_type
 mesh type
typedef boost::shared_ptr
< mesh_type
mesh_ptrtype
 mesh shared_ptr<> type
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 p0_space_type::element_type p0_element_type
 an element type of the $P_0$ discontinuous function space
typedef bases< Lagrange< Order,
Scalar > > 
basis_type
 the basis type of our approximation space
typedef FunctionSpace
< mesh_type, basis_type
space_type
 the approximation function space type
typedef boost::shared_ptr
< space_type
space_ptrtype
 the approximation function space type (shared_ptr<> type)
typedef space_type::element_type element_type
 an element type of the approximation function space
typedef Exporter< mesh_typeexport_type
 the exporter factory type
typedef boost::shared_ptr
< export_type
export_ptrtype
 the exporter factory (shared_ptr<> type)
typedef double value_type
 numerical type is double
typedef Backend< value_typebackend_type
 linear algebra backend factory
typedef boost::shared_ptr
< backend_type
backend_ptrtype
 linear algebra backend factory shared_ptr<> type
typedef
backend_type::sparse_matrix_type 
sparse_matrix_type
 sparse matrix type associated with backend
typedef
backend_type::sparse_matrix_ptrtype 
sparse_matrix_ptrtype
 sparse matrix type associated with backend (shared_ptr<> type)
typedef backend_type::vector_type vector_type
 vector type associated with backend
typedef
backend_type::vector_ptrtype 
vector_ptrtype
 vector type associated with backend (shared_ptr<> type)
typedef Simplex< Dim > convex_type
 geometry entities type composing the mesh, here Simplex in Dimension Dim of Order 1
typedef Mesh< convex_typemesh_type
 mesh type
typedef boost::shared_ptr
< mesh_type
mesh_ptrtype
 mesh shared_ptr<> type
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 p0_space_type::element_type p0_element_type
 an element type of the $P_0$ discontinuous function space
typedef bases< Lagrange< Order,
Scalar > > 
basis_type
 the basis type of our approximation space
typedef FunctionSpace
< mesh_type, basis_type
space_type
 the approximation function space type
typedef boost::shared_ptr
< space_type
space_ptrtype
 the approximation function space type (shared_ptr<> type)
typedef space_type::element_type element_type
 an element type of the approximation function space
typedef Exporter< mesh_typeexport_type
 the exporter factory type
typedef boost::shared_ptr
< export_type
export_ptrtype
 the exporter factory (shared_ptr<> type)

Public Member Functions

 Laplacian (po::variables_map const &vm, AboutData const &about)
void run ()
void run (const double *X, unsigned long P, double *Y, unsigned long N)
 Laplacian (po::variables_map const &vm, AboutData const &about)
void run ()
void run (const double *X, unsigned long P, double *Y, unsigned long N)

Static Public Attributes

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

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)

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 ( po::variables_map const &  vm,
AboutData const &  about 
) [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 ( const double *  X,
unsigned long  P,
double *  Y,
unsigned long  N 
) [virtual]

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

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

 */
    space_ptrtype Xh = space_type::New( mesh );
    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() << "||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() << "exportResults starts\n";

        exporter->step(0)->setMesh( mesh );

        exporter->step(0)->add( "u", u );
        exporter->step(0)->add( "g", e );

        exporter->save();
        Log() << "exportResults done\n";
    }

Implements Feel::Simget.

References Feel::Environment::changeRepository(), Feel::elements(), and Feel::markedfaces().