PolyFEM
Loading...
Searching...
No Matches
InertiaForm.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Form.hpp"
4
7
8namespace polyfem
9{
10 namespace assembler
11 {
12 class Mass;
13 class AssemblyValsCache;
14 } // namespace assembler
15
16 namespace basis
17 {
18 class ElementBases;
19 }
20} // namespace polyfem
21
22namespace polyfem::solver
23{
25 class InertiaForm : public Form
26 {
27 public:
31 InertiaForm(const StiffnessMatrix &mass,
32 const time_integrator::ImplicitTimeIntegrator &time_integrator);
33
34 std::string name() const override { return "inertia"; }
35
36 static void force_shape_derivative(
37 bool is_volume,
38 const int n_geom_bases,
39 const double t,
40 const std::vector<basis::ElementBases> &bases,
41 const std::vector<basis::ElementBases> &geom_bases,
42 const assembler::Mass &assembler,
43 const assembler::AssemblyValsCache &ass_vals_cache,
44 const Eigen::MatrixXd &velocity,
45 const Eigen::MatrixXd &adjoint,
46 Eigen::VectorXd &term);
47
48 protected:
52 double value_unweighted(const Eigen::VectorXd &x) const override;
53
57 void first_derivative_unweighted(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override;
58
62 void second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const override;
63
64 private:
65 // TODO mass might be time dependent
68 };
69} // namespace polyfem::solver
int x
Caches basis evaluation and geometric mapping at every element.
Form of the inertia.
double value_unweighted(const Eigen::VectorXd &x) const override
Compute the value of the form.
void first_derivative_unweighted(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override
Compute the first derivative of the value wrt x.
std::string name() const override
void second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const override
Compute the second derivative of the value wrt x.
static void force_shape_derivative(bool is_volume, const int n_geom_bases, const double t, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &geom_bases, const assembler::Mass &assembler, const assembler::AssemblyValsCache &ass_vals_cache, const Eigen::MatrixXd &velocity, const Eigen::MatrixXd &adjoint, Eigen::VectorXd &term)
const time_integrator::ImplicitTimeIntegrator & time_integrator_
Time integrator.
const StiffnessMatrix & mass_
Mass matrix.
Implicit time integrator of a second order ODE (equivently a system of coupled first order ODEs).
Eigen::SparseMatrix< double, Eigen::ColMajor > StiffnessMatrix
Definition Types.hpp:22