PolyFEM
Loading...
Searching...
No Matches
polyfem::assembler::LinearElasticity Class Reference

#include <LinearElasticity.hpp>

Inheritance diagram for polyfem::assembler::LinearElasticity:
[legend]
Collaboration diagram for polyfem::assembler::LinearElasticity:
[legend]

Public Member Functions

Eigen::Matrix< double, Eigen::Dynamic, 1, 0, 9, 1 > assemble (const LinearAssemblerData &data) const override
 computes local stiffness matrix is R^{dimĀ²} for bases i,j
 
double compute_energy (const NonLinearAssemblerData &data) const override
 
Eigen::MatrixXd assemble_hessian (const NonLinearAssemblerData &data) const override
 
Eigen::VectorXd assemble_gradient (const NonLinearAssemblerData &data) const override
 
Eigen::Matrix< AutodiffScalarGrad, Eigen::Dynamic, 1, 0, 3, 1 > kernel (const int dim, const AutodiffGradPt &r, const AutodiffScalarGrad &) const override
 
VectorNd compute_rhs (const AutodiffHessianPt &pt) const override
 
void compute_stiffness_value (const double t, const assembler::ElementAssemblyValues &vals, const Eigen::MatrixXd &local_pts, const Eigen::MatrixXd &displacement, Eigen::MatrixXd &tensor) const override
 
void compute_stress_grad_multiply_mat (const OptAssemblerData &data, const Eigen::MatrixXd &mat, Eigen::MatrixXd &stress, Eigen::MatrixXd &result) const override
 
void compute_stress_grad_multiply_stress (const OptAssemblerData &data, Eigen::MatrixXd &stress, Eigen::MatrixXd &result) const override
 
void compute_dstress_dmu_dlambda (const OptAssemblerData &data, Eigen::MatrixXd &dstress_dmu, Eigen::MatrixXd &dstress_dlambda) const override
 
void add_multimaterial (const int index, const json &params, const Units &units) override
 
const LameParameterslame_params () const
 
void set_params (const LameParameters &params)
 
void update_lame_params (const Eigen::MatrixXd &lambdas, const Eigen::MatrixXd &mus) override
 
virtual bool is_linear () const override
 
std::string name () const override
 
bool allow_inversion () const override
 
std::map< std::string, ParamFuncparameters () const override
 
void assign_stress_tensor (const OutputData &data, const int all_size, const ElasticityTensorType &type, Eigen::MatrixXd &all, const std::function< Eigen::MatrixXd(const Eigen::MatrixXd &)> &fun) const override
 
void assemble (const bool is_volume, const int n_basis, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const AssemblyValsCache &cache, const double t, StiffnessMatrix &stiffness, const bool is_mass=false) const override
 assembles the stiffness matrix for the given basis the bilinear form (local assembler) is encoded by the overloaded assemble (see below) function that the subclass (eg Laplacian) defines sets stiffness and modifies cache if it has not already been computed
 
virtual Eigen::Matrix< double, Eigen::Dynamic, 1, 0, 9, 1 > assemble (const LinearAssemblerData &data) const=0
 local assembly function that defines the bilinear form (LHS) computes and returns a single local stiffness value
 
double assemble_energy (const bool is_volume, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const AssemblyValsCache &cache, const double t, const double dt, const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &displacement_prev) const override
 
void assemble_gradient (const bool is_volume, const int n_basis, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const AssemblyValsCache &cache, const double t, const double dt, const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &displacement_prev, Eigen::MatrixXd &rhs) const override
 
virtual Eigen::VectorXd assemble_gradient (const NonLinearAssemblerData &data) const=0
 
void assemble_hessian (const bool is_volume, const int n_basis, const bool project_to_psd, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const AssemblyValsCache &cache, const double t, const double dt, const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &displacement_prev, utils::MatrixCache &mat_cache, StiffnessMatrix &grad) const override
 
virtual Eigen::MatrixXd assemble_hessian (const NonLinearAssemblerData &data) const=0
 
- Public Member Functions inherited from polyfem::assembler::LinearAssembler
 LinearAssembler ()
 
virtual ~LinearAssembler ()=default
 
- Public Member Functions inherited from polyfem::assembler::Assembler
virtual ~Assembler ()=default
 
int size () const
 
virtual void set_size (const int size)
 
virtual void compute_stress_grad_multiply_vect (const OptAssemblerData &data, const Eigen::MatrixXd &vect, Eigen::MatrixXd &stress, Eigen::MatrixXd &result) const
 
virtual void compute_stress_grad (const OptAssemblerData &data, const Eigen::MatrixXd &prev_grad_u_i, Eigen::MatrixXd &stress, Eigen::MatrixXd &result) const
 
virtual void compute_stress_prev_grad (const OptAssemblerData &data, const Eigen::MatrixXd &prev_grad_u_i, Eigen::MatrixXd &result) const
 
void set_materials (const std::vector< int > &body_ids, const json &body_params, const Units &units)
 
virtual bool is_fluid () const
 

Private Member Functions

template<typename T >
compute_energy_aux (const NonLinearAssemblerData &data) const
 
- Private Member Functions inherited from polyfem::assembler::NLAssembler
virtual ~NLAssembler ()=default
 
double assemble_energy (const bool is_volume, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const AssemblyValsCache &cache, const double t, const double dt, const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &displacement_prev) const override
 
Eigen::VectorXd assemble_energy_per_element (const bool is_volume, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const AssemblyValsCache &cache, const double t, const double dt, const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &displacement_prev) const override
 
void assemble_gradient (const bool is_volume, const int n_basis, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const AssemblyValsCache &cache, const double t, const double dt, const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &displacement_prev, Eigen::MatrixXd &rhs) const override
 
void assemble_hessian (const bool is_volume, const int n_basis, const bool project_to_psd, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const AssemblyValsCache &cache, const double t, const double dt, const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &displacement_prev, utils::MatrixCache &mat_cache, StiffnessMatrix &grad) const override
 
- Private Member Functions inherited from polyfem::assembler::Assembler
virtual ~Assembler ()=default
 
int size () const
 
virtual void set_size (const int size)
 
virtual void compute_stress_grad_multiply_vect (const OptAssemblerData &data, const Eigen::MatrixXd &vect, Eigen::MatrixXd &stress, Eigen::MatrixXd &result) const
 
virtual void compute_stress_grad (const OptAssemblerData &data, const Eigen::MatrixXd &prev_grad_u_i, Eigen::MatrixXd &stress, Eigen::MatrixXd &result) const
 
virtual void compute_stress_prev_grad (const OptAssemblerData &data, const Eigen::MatrixXd &prev_grad_u_i, Eigen::MatrixXd &result) const
 
void set_materials (const std::vector< int > &body_ids, const json &body_params, const Units &units)
 
virtual bool is_fluid () const
 
- Private Member Functions inherited from polyfem::assembler::ElasticityAssembler
 ElasticityAssembler ()
 
virtual ~ElasticityAssembler ()=default
 
void set_use_robust_jacobian ()
 
void compute_scalar_value (const OutputData &data, std::vector< NamedMatrix > &result) const override
 
void compute_tensor_value (const OutputData &data, std::vector< NamedMatrix > &result) const override
 
void compute_stress_tensor (const OutputData &data, const ElasticityTensorType &type, Eigen::MatrixXd &stresses) const
 
void compute_von_mises_stresses (const OutputData &data, Eigen::MatrixXd &stresses) const
 
bool is_solution_displacement () const override
 
bool is_tensor () const override
 

Private Attributes

LameParameters params_
 
- Private Attributes inherited from polyfem::assembler::Assembler
int size_ = -1
 
- Private Attributes inherited from polyfem::assembler::ElasticityAssembler
bool use_robust_jacobian = false
 

Additional Inherited Members

- Public Types inherited from polyfem::assembler::Assembler
typedef std::pair< std::string, Eigen::MatrixXd > NamedMatrix
 
typedef std::function< double(const RowVectorNd &, const RowVectorNd &, double, int)> ParamFunc
 
- Protected Attributes inherited from polyfem::assembler::Assembler
int size_ = -1
 
- Private Types inherited from polyfem::assembler::Assembler
typedef std::pair< std::string, Eigen::MatrixXd > NamedMatrix
 
typedef std::function< double(const RowVectorNd &, const RowVectorNd &, double, int)> ParamFunc
 

Detailed Description

Definition at line 11 of file LinearElasticity.hpp.

Member Function Documentation

◆ add_multimaterial()

void polyfem::assembler::LinearElasticity::add_multimaterial ( const int  index,
const json params,
const Units units 
)
overridevirtual

Reimplemented from polyfem::assembler::Assembler.

Definition at line 23 of file LinearElasticity.cpp.

References polyfem::assembler::LameParameters::add_multimaterial(), params_, polyfem::assembler::Assembler::size(), and polyfem::Units::stress().

Referenced by polyfem::assembler::MultiModel::add_multimaterial().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allow_inversion()

bool polyfem::assembler::LinearElasticity::allow_inversion ( ) const
inlineoverridevirtual

Implements polyfem::assembler::ElasticityAssembler.

Definition at line 75 of file LinearElasticity.hpp.

◆ assemble() [1/3]

void polyfem::assembler::LinearAssembler::assemble ( const bool  is_volume,
const int  n_basis,
const std::vector< basis::ElementBases > &  bases,
const std::vector< basis::ElementBases > &  gbases,
const AssemblyValsCache cache,
const double  t,
StiffnessMatrix stiffness,
const bool  is_mass = false 
) const
overridevirtual

assembles the stiffness matrix for the given basis the bilinear form (local assembler) is encoded by the overloaded assemble (see below) function that the subclass (eg Laplacian) defines sets stiffness and modifies cache if it has not already been computed

Reimplemented from polyfem::assembler::LinearAssembler.

◆ assemble() [2/3]

Eigen::Matrix< double, Eigen::Dynamic, 1, 0, 9, 1 > polyfem::assembler::LinearElasticity::assemble ( const LinearAssemblerData data) const
overridevirtual

◆ assemble() [3/3]

virtual Eigen::Matrix< double, Eigen::Dynamic, 1, 0, 9, 1 > polyfem::assembler::LinearAssembler::assemble ( const LinearAssemblerData data) const
virtual

local assembly function that defines the bilinear form (LHS) computes and returns a single local stiffness value

Implements polyfem::assembler::LinearAssembler.

◆ assemble_energy()

double polyfem::assembler::NLAssembler::assemble_energy ( const bool  is_volume,
const std::vector< basis::ElementBases > &  bases,
const std::vector< basis::ElementBases > &  gbases,
const AssemblyValsCache cache,
const double  t,
const double  dt,
const Eigen::MatrixXd &  displacement,
const Eigen::MatrixXd &  displacement_prev 
) const
overridevirtual

Reimplemented from polyfem::assembler::Assembler.

Definition at line 244 of file Assembler.cpp.

◆ assemble_gradient() [1/3]

void polyfem::assembler::NLAssembler::assemble_gradient ( const bool  is_volume,
const int  n_basis,
const std::vector< basis::ElementBases > &  bases,
const std::vector< basis::ElementBases > &  gbases,
const AssemblyValsCache cache,
const double  t,
const double  dt,
const Eigen::MatrixXd &  displacement,
const Eigen::MatrixXd &  displacement_prev,
Eigen::MatrixXd &  rhs 
) const
overridevirtual

Reimplemented from polyfem::assembler::Assembler.

◆ assemble_gradient() [2/3]

Eigen::VectorXd polyfem::assembler::LinearElasticity::assemble_gradient ( const NonLinearAssemblerData data) const
overridevirtual

Implements polyfem::assembler::NLAssembler.

Definition at line 70 of file LinearElasticity.cpp.

References polyfem::assembler::ElementAssemblyValues::basis_values, polyfem::gradient_from_energy(), polyfem::assembler::Assembler::size(), and polyfem::assembler::NonLinearAssemblerData::vals.

Referenced by polyfem::assembler::MultiModel::assemble_gradient().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assemble_gradient() [3/3]

virtual Eigen::VectorXd polyfem::assembler::NLAssembler::assemble_gradient ( const NonLinearAssemblerData data) const
virtual

◆ assemble_hessian() [1/3]

void polyfem::assembler::NLAssembler::assemble_hessian ( const bool  is_volume,
const int  n_basis,
const bool  project_to_psd,
const std::vector< basis::ElementBases > &  bases,
const std::vector< basis::ElementBases > &  gbases,
const AssemblyValsCache cache,
const double  t,
const double  dt,
const Eigen::MatrixXd &  displacement,
const Eigen::MatrixXd &  displacement_prev,
utils::MatrixCache mat_cache,
StiffnessMatrix grad 
) const
overridevirtual

Reimplemented from polyfem::assembler::Assembler.

◆ assemble_hessian() [2/3]

Eigen::MatrixXd polyfem::assembler::LinearElasticity::assemble_hessian ( const NonLinearAssemblerData data) const
overridevirtual

Implements polyfem::assembler::NLAssembler.

Definition at line 88 of file LinearElasticity.cpp.

References polyfem::assembler::ElementAssemblyValues::basis_values, polyfem::hessian_from_energy(), polyfem::assembler::Assembler::size(), and polyfem::assembler::NonLinearAssemblerData::vals.

Referenced by polyfem::assembler::MultiModel::assemble_hessian().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assemble_hessian() [3/3]

virtual Eigen::MatrixXd polyfem::assembler::NLAssembler::assemble_hessian ( const NonLinearAssemblerData data) const
virtual

◆ assign_stress_tensor()

void polyfem::assembler::LinearElasticity::assign_stress_tensor ( const OutputData data,
const int  all_size,
const ElasticityTensorType type,
Eigen::MatrixXd &  all,
const std::function< Eigen::MatrixXd(const Eigen::MatrixXd &)> &  fun 
) const
overridevirtual

◆ compute_dstress_dmu_dlambda()

void polyfem::assembler::LinearElasticity::compute_dstress_dmu_dlambda ( const OptAssemblerData data,
Eigen::MatrixXd &  dstress_dmu,
Eigen::MatrixXd &  dstress_dlambda 
) const
overridevirtual

◆ compute_energy()

double polyfem::assembler::LinearElasticity::compute_energy ( const NonLinearAssemblerData data) const
overridevirtual

Implements polyfem::assembler::NLAssembler.

Definition at line 65 of file LinearElasticity.cpp.

Referenced by polyfem::assembler::MultiModel::compute_energy().

Here is the caller graph for this function:

◆ compute_energy_aux()

◆ compute_rhs()

Eigen::Matrix< double, Eigen::Dynamic, 1, 0, 3, 1 > polyfem::assembler::LinearElasticity::compute_rhs ( const AutodiffHessianPt pt) const
overridevirtual

Reimplemented from polyfem::assembler::Assembler.

Definition at line 137 of file LinearElasticity.cpp.

References polyfem::assembler::LameParameters::lambda_mu(), polyfem::autogen::linear_elasticity_2d_function(), polyfem::autogen::linear_elasticity_3d_function(), params_, and polyfem::assembler::Assembler::size().

Here is the call graph for this function:

◆ compute_stiffness_value()

void polyfem::assembler::LinearElasticity::compute_stiffness_value ( const double  t,
const assembler::ElementAssemblyValues vals,
const Eigen::MatrixXd &  local_pts,
const Eigen::MatrixXd &  displacement,
Eigen::MatrixXd &  tensor 
) const
overridevirtual

Reimplemented from polyfem::assembler::Assembler.

Definition at line 156 of file LinearElasticity.cpp.

References polyfem::assembler::LameParameters::lambda_mu(), params_, polyfem::assembler::Assembler::size(), and vals.

Here is the call graph for this function:

◆ compute_stress_grad_multiply_mat()

void polyfem::assembler::LinearElasticity::compute_stress_grad_multiply_mat ( const OptAssemblerData data,
const Eigen::MatrixXd &  mat,
Eigen::MatrixXd &  stress,
Eigen::MatrixXd &  result 
) const
overridevirtual

◆ compute_stress_grad_multiply_stress()

void polyfem::assembler::LinearElasticity::compute_stress_grad_multiply_stress ( const OptAssemblerData data,
Eigen::MatrixXd &  stress,
Eigen::MatrixXd &  result 
) const
overridevirtual

◆ is_linear()

virtual bool polyfem::assembler::LinearElasticity::is_linear ( ) const
inlineoverridevirtual

Reimplemented from polyfem::assembler::LinearAssembler.

Definition at line 72 of file LinearElasticity.hpp.

◆ kernel()

Eigen::Matrix< AutodiffScalarGrad, Eigen::Dynamic, 1, 0, 3, 1 > polyfem::assembler::LinearElasticity::kernel ( const int  dim,
const AutodiffGradPt r,
const AutodiffScalarGrad  
) const
overridevirtual

Reimplemented from polyfem::assembler::Assembler.

Definition at line 224 of file LinearElasticity.cpp.

References polyfem::assembler::LameParameters::lambda_mu(), and params_.

Here is the call graph for this function:

◆ lame_params()

const LameParameters & polyfem::assembler::LinearElasticity::lame_params ( ) const
inline

Definition at line 63 of file LinearElasticity.hpp.

References params_.

Referenced by parameters().

Here is the caller graph for this function:

◆ name()

std::string polyfem::assembler::LinearElasticity::name ( ) const
inlineoverridevirtual

Implements polyfem::assembler::Assembler.

Definition at line 74 of file LinearElasticity.hpp.

◆ parameters()

std::map< std::string, Assembler::ParamFunc > polyfem::assembler::LinearElasticity::parameters ( ) const
overridevirtual

Implements polyfem::assembler::Assembler.

Definition at line 301 of file LinearElasticity.cpp.

References lame_params(), and polyfem::assembler::Assembler::size().

Here is the call graph for this function:

◆ set_params()

void polyfem::assembler::LinearElasticity::set_params ( const LameParameters params)
inline

Definition at line 64 of file LinearElasticity.hpp.

References params_.

◆ update_lame_params()

void polyfem::assembler::LinearElasticity::update_lame_params ( const Eigen::MatrixXd &  lambdas,
const Eigen::MatrixXd &  mus 
)
inlineoverridevirtual

Member Data Documentation

◆ params_


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