GetFEM  5.4.2
getfem::model Class Reference

`‘Model’' variables store the variables, the data and the description of a model. More...

#include <getfem_models.h>

Inherits getfem::context_dependencies, and dal::static_stored_object.

Public Member Functions

void update_from_context () const
 this function has to be defined and should update the object when the context is modified.
 
void disable_brick (size_type ib)
 Disable a brick. More...
 
void enable_brick (size_type ib)
 Enable a brick. More...
 
void disable_variable (const std::string &name)
 Disable a variable (and its attached mutlipliers).
 
void enable_variable (const std::string &name, bool enabled=true)
 Enable a variable (and its attached mutlipliers).
 
bool variable_exists (const std::string &name) const
 States if a name corresponds to a declared variable.
 
bool is_disabled_variable (const std::string &name) const
 States if a variable is disabled (treated as data).
 
bool is_data (const std::string &name) const
 States if a name corresponds to a declared data or disabled variable.
 
bool is_true_data (const std::string &name) const
 States if a name corresponds to a declared data.
 
bool is_internal_variable (const std::string &name) const
 States if a variable is condensed out of the global system.
 
bool is_complex () const
 Boolean which says if the model deals with real or complex unknowns and data.
 
bool is_coercive () const
 Return true if all the model terms do not affect the coercivity of the whole tangent system.
 
bool has_internal_variables () const
 Return true if the model has at least one internal variable.
 
bool is_symmetric () const
 Return true if all the model terms do not affect the coercivity of the whole tangent system.
 
bool is_linear () const
 Return true if all the model terms are linear.
 
size_type nb_dof (bool with_internal=false) const
 Total number of degrees of freedom in the model.
 
size_type nb_internal_dof () const
 Number of internal degrees of freedom in the model.
 
size_type nb_primary_dof () const
 Number of primary degrees of freedom in the model.
 
dim_type leading_dimension () const
 Leading dimension of the meshes used in the model.
 
std::string new_name (const std::string &name)
 Gives a non already existing variable name begining by name.
 
const model_real_plain_vector & real_variable (const std::string &name, size_type niter) const
 Gives the access to the vector value of a variable. More...
 
const model_real_plain_vector & real_variable (const std::string &name) const
 The same as above, but either accessing the latest variable version, or the previous, if using "Old_" prefix.
 
const model_complex_plain_vector & complex_variable (const std::string &name, size_type niter) const
 Gives the access to the vector value of a variable. More...
 
const model_complex_plain_vector & complex_variable (const std::string &name) const
 The same as above, but either accessing the latest variable version, or the previous, if using "Old_" prefix.
 
model_real_plain_vector & set_real_variable (const std::string &name, size_type niter) const
 Gives the write access to the vector value of a variable. More...
 
model_real_plain_vector & set_real_variable (const std::string &name) const
 The same as above, but for either latest variable, or for the previous, if prefixed with "Old_".
 
model_complex_plain_vector & set_complex_variable (const std::string &name, size_type niter) const
 Gives the write access to the vector value of a variable. More...
 
model_complex_plain_vector & set_complex_variable (const std::string &name) const
 The same as above, but either accessing the latest variable version, or the previous, if using "Old_" prefix.
 
void add_fixed_size_variable (const std::string &name, size_type size, size_type niter=1)
 Add a fixed size variable to the model assumed to be a vector. More...
 
void add_fixed_size_variable (const std::string &name, const bgeot::multi_index &sizes, size_type niter=1)
 Add a fixed size variable to the model whith given tensor dimensions. More...
 
void add_fixed_size_data (const std::string &name, size_type size, size_type niter=1)
 Add a fixed size data to the model. More...
 
void add_fixed_size_data (const std::string &name, const bgeot::multi_index &sizes, size_type niter=1)
 Add a fixed size data to the model. More...
 
void resize_fixed_size_variable (const std::string &name, size_type size)
 Resize a fixed size variable (or data) of the model.
 
void resize_fixed_size_variable (const std::string &name, const bgeot::multi_index &sizes)
 Resize a fixed size variable (or data) of the model.
 
template<typename VECT >
void add_initialized_fixed_size_data (const std::string &name, const VECT &v)
 Add a fixed size data (assumed to be a vector) to the model and initialized with v.
 
template<typename VECT >
void add_initialized_fixed_size_data (const std::string &name, const VECT &v, const bgeot::multi_index &sizes)
 Add a fixed size data (assumed to be a vector) to the model and initialized with v.
 
void add_initialized_matrix_data (const std::string &name, const base_matrix &M)
 Add a fixed size data (assumed to be a matrix) to the model and initialized with M.
 
void add_initialized_tensor_data (const std::string &name, const base_tensor &t)
 Add a fixed size data (assumed to be a tensor) to the model and initialized with t.
 
template<typename T >
void add_initialized_scalar_data (const std::string &name, T e)
 Add a scalar data (i.e. More...
 
void add_im_variable (const std::string &name, const im_data &imd, size_type niter=1)
 Add variable defined at integration points.
 
void add_internal_im_variable (const std::string &name, const im_data &imd)
 Add internal variable, defined at integration points and condensed.
 
void add_im_data (const std::string &name, const im_data &imd, size_type niter=1)
 Add data defined at integration points.
 
void add_fem_variable (const std::string &name, const mesh_fem &mf, size_type niter=1)
 Add a variable being the dofs of a finite element method to the model. More...
 
void add_filtered_fem_variable (const std::string &name, const mesh_fem &mf, size_type region, size_type niter=1)
 Add a variable linked to a fem with the dof filtered with respect to a mesh region. More...
 
void add_affine_dependent_variable (const std::string &name, const std::string &org_name, scalar_type alpha=scalar_type(1))
 Add a "virtual" variable be an affine depedent variable with respect to another variable. More...
 
void add_fem_data (const std::string &name, const mesh_fem &mf, dim_type qdim=1, size_type niter=1)
 Add a data being the dofs of a finite element method to the model.
 
void add_fem_data (const std::string &name, const mesh_fem &mf, const bgeot::multi_index &sizes, size_type niter=1)
 Add a data being the dofs of a finite element method to the model.
 
template<typename VECT >
void add_initialized_fem_data (const std::string &name, const mesh_fem &mf, const VECT &v)
 Add an initialized fixed size data to the model, assumed to be a vector field if the size of the vector is a multiple of the dof number.
 
template<typename VECT >
void add_initialized_fem_data (const std::string &name, const mesh_fem &mf, const VECT &v, const bgeot::multi_index &sizes)
 Add a fixed size data to the model. More...
 
void add_multiplier (const std::string &name, const mesh_fem &mf, const std::string &primal_name, size_type niter=1)
 Add a particular variable linked to a fem being a multiplier with respect to a primal variable. More...
 
void add_multiplier (const std::string &name, const mesh_fem &mf, size_type region, const std::string &primal_name, size_type niter=1)
 Add a particular variable linked to a fem being a multiplier with respect to a primal variable and a region. More...
 
void add_multiplier (const std::string &name, const mesh_fem &mf, const std::string &primal_name, const mesh_im &mim, size_type region, size_type niter=1)
 Add a particular variable linked to a fem being a multiplier with respect to a primal variable. More...
 
const ga_macro_dictionary & macro_dictionary () const
 Dictonnary of user defined macros.
 
void add_macro (const std::string &name, const std::string &expr)
 Add a macro definition for the high generic assembly language. More...
 
void del_macro (const std::string &name)
 Delete a previously defined macro definition.
 
bool macro_exists (const std::string &name) const
 Says if a macro of that name has been defined.
 
void delete_variable (const std::string &varname)
 Delete a variable or data of the model.
 
const mesh_femmesh_fem_of_variable (const std::string &name) const
 Gives the access to the mesh_fem of a variable if any. More...
 
const mesh_fempmesh_fem_of_variable (const std::string &name) const
 Gives a pointer to the mesh_fem of a variable if any. More...
 
const model_real_sparse_matrix & real_tangent_matrix (bool internal=false) const
 Gives the access to the tangent matrix. More...
 
const model_complex_sparse_matrix & complex_tangent_matrix () const
 Gives the access to the tangent matrix. More...
 
const model_real_plain_vector & real_rhs (bool with_internal=false) const
 Gives access to the right hand side of the tangent linear system. More...
 
model_real_plain_vector & set_real_rhs (bool with_internal=false) const
 Gives write access to the right hand side of the tangent linear system. More...
 
const model_real_plain_vector & internal_solution () const
 Gives access to the partial solution for condensed internal variables. More...
 
const model_real_plain_vector & real_brick_term_rhs (size_type ib, size_type ind_term=0, bool sym=false, size_type ind_iter=0) const
 Gives access to the part of the right hand side of a term of a particular nonlinear brick. More...
 
const model_complex_plain_vector & complex_rhs () const
 Gives access to the right hand side of the tangent linear system. More...
 
model_complex_plain_vector & set_complex_rhs () const
 Gives write access to the right hand side of the tangent linear system. More...
 
const model_complex_plain_vector & complex_brick_term_rhs (size_type ib, size_type ind_term=0, bool sym=false, size_type ind_iter=0) const
 Gives access to the part of the right hand side of a term of a particular nonlinear brick. More...
 
void listvar (std::ostream &ost) const
 List the model variables and constant.
 
void listbricks (std::ostream &ost, size_type base_id=0) const
 List the model bricks.
 
const dal::bit_vector & get_active_bricks () const
 Return the model brick ids.
 
void touch_brick (size_type ib)
 Force the re-computation of a brick for the next assembly.
 
size_type add_brick (pbrick pbr, const varnamelist &varnames, const varnamelist &datanames, const termlist &terms, const mimlist &mims, size_type region)
 Add a brick to the model. More...
 
void delete_brick (size_type ib)
 Delete the brick of index ib from the model.
 
void add_mim_to_brick (size_type ib, const mesh_im &mim)
 Add an integration method to a brick.
 
void change_terms_of_brick (size_type ib, const termlist &terms)
 Change the term list of a brick. More...
 
void change_variables_of_brick (size_type ib, const varnamelist &vl)
 Change the variable list of a brick. More...
 
void change_data_of_brick (size_type ib, const varnamelist &vl)
 Change the data list of a brick. More...
 
void change_mims_of_brick (size_type ib, const mimlist &ml)
 Change the mim list of a brick. More...
 
void change_update_flag_of_brick (size_type ib, bool flag)
 Change the update flag of a brick. More...
 
void add_time_dispatcher (size_type ibrick, pdispatcher pdispatch)
 Add a time dispacther to a brick.
 
virtual void first_iter ()
 For transient problems. More...
 
virtual void next_iter ()
 For transient problems. More...
 
void add_interpolate_transformation (const std::string &name, pinterpolate_transformation ptrans)
 Add an interpolate transformation to the model to be used with the generic assembly.
 
pinterpolate_transformation interpolate_transformation (const std::string &name) const
 Get a pointer to the interpolate transformation name.
 
bool interpolate_transformation_exists (const std::string &name) const
 Tests if name corresponds to an interpolate transformation.
 
void add_elementary_transformation (const std::string &name, pelementary_transformation ptrans)
 Add an elementary transformation to the model to be used with the generic assembly.
 
pelementary_transformation elementary_transformation (const std::string &name) const
 Get a pointer to the elementary transformation name.
 
bool elementary_transformation_exists (const std::string &name) const
 Tests if name corresponds to an elementary transformation.
 
void add_secondary_domain (const std::string &name, psecondary_domain ptrans)
 Add a secondary domain to the model to be used with the generic assembly.
 
psecondary_domain secondary_domain (const std::string &name) const
 Get a pointer to the interpolate transformation name.
 
bool secondary_domain_exists (const std::string &name) const
 Tests if name corresponds to an interpolate transformation.
 
const std::string & varname_of_brick (size_type ind_brick, size_type ind_var)
 Gives the name of the variable of index ind_var of the brick of index ind_brick.
 
const std::string & dataname_of_brick (size_type ind_brick, size_type ind_data)
 Gives the name of the data of index ind_data of the brick of index ind_brick.
 
virtual void assembly (build_version version)
 Assembly of the tangent system taking into account the terms from all bricks.
 
std::string Neumann_term (const std::string &varname, size_type region)
 Gives the assembly string corresponding to the Neumann term of the fem variable varname on region. More...
 
void check_brick_stiffness_rhs (size_type ind_brick) const
 check consistency of RHS and Stiffness matrix for brick with More...
 
- Public Member Functions inherited from getfem::context_dependencies
bool context_check () const
 return true if update_from_context was called
 

Detailed Description

`‘Model’' variables store the variables, the data and the description of a model.

This includes the global tangent matrix, the right hand side and the constraints. There are two kinds of models, the real'' and thecomplex'' models.

Definition at line 114 of file getfem_models.h.

Member Function Documentation

◆ disable_brick()

void getfem::model::disable_brick ( size_type  ib)
inline

Disable a brick.


Definition at line 515 of file getfem_models.h.

◆ enable_brick()

void getfem::model::enable_brick ( size_type  ib)
inline

Enable a brick.


Definition at line 521 of file getfem_models.h.

◆ real_variable()

const model_real_plain_vector & getfem::model::real_variable ( const std::string &  name,
size_type  niter 
) const

Gives the access to the vector value of a variable.

For the real version.

Definition at line 2959 of file getfem_models.cc.

◆ complex_variable()

const model_complex_plain_vector & getfem::model::complex_variable ( const std::string &  name,
size_type  niter 
) const

Gives the access to the vector value of a variable.

For the complex version.

Definition at line 2985 of file getfem_models.cc.

◆ set_real_variable()

model_real_plain_vector & getfem::model::set_real_variable ( const std::string &  name,
size_type  niter 
) const

Gives the write access to the vector value of a variable.

Make a change flag of the variable set. For the real version.

Definition at line 3013 of file getfem_models.cc.

◆ set_complex_variable()

model_complex_plain_vector & getfem::model::set_complex_variable ( const std::string &  name,
size_type  niter 
) const

Gives the write access to the vector value of a variable.

Make a change flag of the variable set. For the complex version.

Definition at line 3041 of file getfem_models.cc.

◆ add_fixed_size_variable() [1/2]

void getfem::model::add_fixed_size_variable ( const std::string &  name,
size_type  size,
size_type  niter = 1 
)

Add a fixed size variable to the model assumed to be a vector.

niter is the number of version of the variable stored.

Definition at line 726 of file getfem_models.cc.

◆ add_fixed_size_variable() [2/2]

void getfem::model::add_fixed_size_variable ( const std::string &  name,
const bgeot::multi_index &  sizes,
size_type  niter = 1 
)

Add a fixed size variable to the model whith given tensor dimensions.

niter is the number of version of the variable stored.

Definition at line 733 of file getfem_models.cc.

◆ add_fixed_size_data() [1/2]

void getfem::model::add_fixed_size_data ( const std::string &  name,
size_type  size,
size_type  niter = 1 
)

Add a fixed size data to the model.

niter is the number of version of the data stored, for time integration schemes.

Definition at line 762 of file getfem_models.cc.

◆ add_fixed_size_data() [2/2]

void getfem::model::add_fixed_size_data ( const std::string &  name,
const bgeot::multi_index &  sizes,
size_type  niter = 1 
)

Add a fixed size data to the model.

niter is the number of version of the data stored, for time integration schemes.

Definition at line 769 of file getfem_models.cc.

◆ add_initialized_scalar_data()

template<typename T >
void getfem::model::add_initialized_scalar_data ( const std::string &  name,
e 
)
inline

Add a scalar data (i.e.

of size 1) to the model initialized with e.

Definition at line 782 of file getfem_models.h.

◆ add_fem_variable()

void getfem::model::add_fem_variable ( const std::string &  name,
const mesh_fem mf,
size_type  niter = 1 
)

Add a variable being the dofs of a finite element method to the model.

niter is the number of version of the variable stored, for time integration schemes.

Definition at line 834 of file getfem_models.cc.

◆ add_filtered_fem_variable()

void getfem::model::add_filtered_fem_variable ( const std::string &  name,
const mesh_fem mf,
size_type  region,
size_type  niter = 1 
)

Add a variable linked to a fem with the dof filtered with respect to a mesh region.

Only the dof returned by the dof_on_region method of mf will be kept. niter is the number of version of the data stored, for time integration schemes.

Definition at line 845 of file getfem_models.cc.

◆ add_affine_dependent_variable()

void getfem::model::add_affine_dependent_variable ( const std::string &  name,
const std::string &  org_name,
scalar_type  alpha = scalar_type(1) 
)

Add a "virtual" variable be an affine depedent variable with respect to another variable.

Mainly used for time integration scheme for instance to represent time derivative of variables. alpha is the multiplicative scalar of the dependency.

Definition at line 856 of file getfem_models.cc.

◆ add_initialized_fem_data()

template<typename VECT >
void getfem::model::add_initialized_fem_data ( const std::string &  name,
const mesh_fem mf,
const VECT &  v,
const bgeot::multi_index &  sizes 
)
inline

Add a fixed size data to the model.

The data is a tensor of given sizes on each dof of the finite element method.

Definition at line 848 of file getfem_models.h.

◆ add_multiplier() [1/3]

void getfem::model::add_multiplier ( const std::string &  name,
const mesh_fem mf,
const std::string &  primal_name,
size_type  niter = 1 
)

Add a particular variable linked to a fem being a multiplier with respect to a primal variable.

The dof will be filtered with the gmm::range_basis function applied on the terms of the model which link the multiplier and the primal variable. Optimized for boundary multipliers. niter is the number of version of the data stored, for time integration schemes.

Definition at line 888 of file getfem_models.cc.

◆ add_multiplier() [2/3]

void getfem::model::add_multiplier ( const std::string &  name,
const mesh_fem mf,
size_type  region,
const std::string &  primal_name,
size_type  niter = 1 
)

Add a particular variable linked to a fem being a multiplier with respect to a primal variable and a region.

The dof will be filtered both with the gmm::range_basis function applied on the terms of the model which link the multiplier and the primal variable and on the dof on the given region. Optimized for boundary multipliers. niter is the number of version of the data stored, for time integration schemes.

Definition at line 900 of file getfem_models.cc.

◆ add_multiplier() [3/3]

void getfem::model::add_multiplier ( const std::string &  name,
const mesh_fem mf,
const std::string &  primal_name,
const mesh_im mim,
size_type  region,
size_type  niter = 1 
)

Add a particular variable linked to a fem being a multiplier with respect to a primal variable.

The dof will be filtered with the gmm::range_basis function applied on the mass matrix between the fem of the multiplier and the one of the primal variable. Optimized for boundary multipliers. niter is the number of version of the data stored, for time integration schemes.

Definition at line 912 of file getfem_models.cc.

◆ add_macro()

void getfem::model::add_macro ( const std::string &  name,
const std::string &  expr 
)

Add a macro definition for the high generic assembly language.

This macro can be used for the definition of generic assembly bricks. The name of a macro cannot coincide with a variable name.

Definition at line 951 of file getfem_models.cc.

◆ mesh_fem_of_variable()

const mesh_fem & getfem::model::mesh_fem_of_variable ( const std::string &  name) const

Gives the access to the mesh_fem of a variable if any.

Throw an exception otherwise.

Definition at line 2891 of file getfem_models.cc.

◆ pmesh_fem_of_variable()

const mesh_fem * getfem::model::pmesh_fem_of_variable ( const std::string &  name) const

Gives a pointer to the mesh_fem of a variable if any.

0 otherwise.

Definition at line 2897 of file getfem_models.cc.

◆ real_tangent_matrix()

const model_real_sparse_matrix& getfem::model::real_tangent_matrix ( bool  internal = false) const
inline

Gives the access to the tangent matrix.

For the real version.

Definition at line 920 of file getfem_models.h.

◆ complex_tangent_matrix()

const model_complex_sparse_matrix& getfem::model::complex_tangent_matrix ( ) const
inline

Gives the access to the tangent matrix.

For the complex version.

Definition at line 927 of file getfem_models.h.

◆ real_rhs()

const model_real_plain_vector& getfem::model::real_rhs ( bool  with_internal = false) const
inline

Gives access to the right hand side of the tangent linear system.

For the real version. An assembly of the rhs has to be done first.

Definition at line 935 of file getfem_models.h.

◆ set_real_rhs()

model_real_plain_vector& getfem::model::set_real_rhs ( bool  with_internal = false) const
inline

Gives write access to the right hand side of the tangent linear system.

Some solvers need to manipulate the model rhs directly so that for example internal condensed variables can be treated properly.

Definition at line 944 of file getfem_models.h.

◆ internal_solution()

const model_real_plain_vector& getfem::model::internal_solution ( ) const
inline

Gives access to the partial solution for condensed internal variables.

A matrix assembly with condensation has to be done first.

Definition at line 952 of file getfem_models.h.

◆ real_brick_term_rhs()

const model_real_plain_vector& getfem::model::real_brick_term_rhs ( size_type  ib,
size_type  ind_term = 0,
bool  sym = false,
size_type  ind_iter = 0 
) const
inline

Gives access to the part of the right hand side of a term of a particular nonlinear brick.

Does not account of the eventual time dispatcher. An assembly of the rhs has to be done first. For the real version.

Definition at line 963 of file getfem_models.h.

◆ complex_rhs()

const model_complex_plain_vector& getfem::model::complex_rhs ( ) const
inline

Gives access to the right hand side of the tangent linear system.

For the complex version.

Definition at line 981 of file getfem_models.h.

◆ set_complex_rhs()

model_complex_plain_vector& getfem::model::set_complex_rhs ( ) const
inline

Gives write access to the right hand side of the tangent linear system.

Some solvers need to manipulate the model rhs directly so that for example internal condensed variables can be treated properly.

Definition at line 990 of file getfem_models.h.

◆ complex_brick_term_rhs()

const model_complex_plain_vector& getfem::model::complex_brick_term_rhs ( size_type  ib,
size_type  ind_term = 0,
bool  sym = false,
size_type  ind_iter = 0 
) const
inline

Gives access to the part of the right hand side of a term of a particular nonlinear brick.

Does not account of the eventual time dispatcher. An assembly of the rhs has to be done first. For the complex version.

Definition at line 1001 of file getfem_models.h.

◆ add_brick()

size_type getfem::model::add_brick ( pbrick  pbr,
const varnamelist &  varnames,
const varnamelist &  datanames,
const termlist &  terms,
const mimlist &  mims,
size_type  region 
)

Add a brick to the model.

varname is the list of variable used and datanames the data used. If a variable is used as a data, it should be declared in the datanames (it will depend on the value of the variable not only on the fem). Returns the brick index.

Definition at line 1033 of file getfem_models.cc.

◆ change_terms_of_brick()

void getfem::model::change_terms_of_brick ( size_type  ib,
const termlist &  terms 
)

Change the term list of a brick.

Used for very special bricks only.

Definition at line 1089 of file getfem_models.cc.

◆ change_variables_of_brick()

void getfem::model::change_variables_of_brick ( size_type  ib,
const varnamelist &  vl 
)

Change the variable list of a brick.

Used for very special bricks only.

Definition at line 1104 of file getfem_models.cc.

◆ change_data_of_brick()

void getfem::model::change_data_of_brick ( size_type  ib,
const varnamelist &  vl 
)

Change the data list of a brick.

Used for very special bricks only.

Definition at line 1112 of file getfem_models.cc.

◆ change_mims_of_brick()

void getfem::model::change_mims_of_brick ( size_type  ib,
const mimlist &  ml 
)

Change the mim list of a brick.

Used for very special bricks only.

Definition at line 1120 of file getfem_models.cc.

◆ change_update_flag_of_brick()

void getfem::model::change_update_flag_of_brick ( size_type  ib,
bool  flag 
)

Change the update flag of a brick.

Used for very special bricks only.

Definition at line 1127 of file getfem_models.cc.

◆ first_iter()

void getfem::model::first_iter ( )
virtual

For transient problems.

Initialisation of iterations.

Definition at line 1949 of file getfem_models.cc.

◆ next_iter()

void getfem::model::next_iter ( )
virtual

For transient problems.

Prepare the next iterations. In particular shift the version of the variables.

Definition at line 1971 of file getfem_models.cc.

◆ Neumann_term()

std::string getfem::model::Neumann_term ( const std::string &  varname,
size_type  region 
)

Gives the assembly string corresponding to the Neumann term of the fem variable varname on region.

It is deduced from the assembly string declared by the model bricks. region should be the index of a boundary region on the mesh where varname is defined. Care to call this function only after all the volumic bricks have been declared. Complains, if a brick omit to declare an assembly string.

Definition at line 2283 of file getfem_models.cc.

◆ check_brick_stiffness_rhs()

void getfem::model::check_brick_stiffness_rhs ( size_type  ind_brick) const

check consistency of RHS and Stiffness matrix for brick with

Parameters
ind_brick- index of the brick

Definition at line 3096 of file getfem_models.cc.


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