PolyFEM
Loading...
Searching...
No Matches
PressureForm.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Form.hpp"
4
8
10
11namespace polyfem::solver
12{
14 class PressureForm : public Form
15 {
16 public:
20 PressureForm(const int ndof,
21 const std::vector<mesh::LocalBoundary> &local_pressure_boundary,
22 const std::unordered_map<int, std::vector<mesh::LocalBoundary>> &local_pressure_cavity,
23 const std::vector<int> &dirichlet_nodes,
24 const int n_boundary_samples,
25 const assembler::PressureAssembler &pressure_assembler,
26 const bool is_time_dependent);
27
28 std::string name() const override { return "pressure"; }
29
30 protected:
34 double value_unweighted(const Eigen::VectorXd &x) const override;
35
39 void first_derivative_unweighted(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override;
40
44 void second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const override;
45
46 public:
50 void update_quantities(const double t, const Eigen::VectorXd &x) override;
51
58 const int n_verts,
59 const double t,
60 const Eigen::MatrixXd &x,
61 const Eigen::MatrixXd &adjoint,
62 Eigen::VectorXd &term);
63
70 const int n_verts,
71 const double t,
72 const int pressure_boundary_id,
73 const Eigen::MatrixXd &x,
74 const Eigen::MatrixXd &adjoint);
75
76 private:
77 double t_;
78 const int ndof_;
79
80 const std::vector<mesh::LocalBoundary> &local_pressure_boundary_;
81 const std::unordered_map<int, std::vector<mesh::LocalBoundary>> &local_pressure_cavity_;
82 const std::vector<int> &dirichlet_nodes_;
84
86 };
87} // namespace polyfem::solver
int x
Form representing body forces.
void second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const override
Compute the second derivative of the value wrt x.
void update_quantities(const double t, const Eigen::VectorXd &x) override
Update time dependent quantities.
double value_unweighted(const Eigen::VectorXd &x) const override
Compute the value of the body force form.
const assembler::PressureAssembler & pressure_assembler_
Reference to the pressure assembler.
double force_pressure_derivative(const int n_verts, const double t, const int pressure_boundary_id, const Eigen::MatrixXd &x, const Eigen::MatrixXd &adjoint)
Compute the derivative of the force wrt vertex positions, then multiply the resulting matrix with adj...
const std::vector< mesh::LocalBoundary > & local_pressure_boundary_
const int ndof_
Number of degrees of freedom.
const std::vector< int > & dirichlet_nodes_
void force_shape_derivative(const int n_verts, const double t, const Eigen::MatrixXd &x, const Eigen::MatrixXd &adjoint, Eigen::VectorXd &term)
Compute the derivative of the force wrt vertex positions, then multiply the resulting matrix with adj...
void first_derivative_unweighted(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override
Compute the first derivative of the value wrt x.
const std::unordered_map< int, std::vector< mesh::LocalBoundary > > & local_pressure_cavity_
std::string name() const override
Eigen::SparseMatrix< double, Eigen::ColMajor > StiffnessMatrix
Definition Types.hpp:22