PolyFEM
Loading...
Searching...
No Matches
BCLagrangianForm.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Form.hpp"
5
8
9namespace polyfem::solver
10{
12 class BCLagrangianForm : public Form
13 {
14 public:
26 BCLagrangianForm(const int ndof,
27 const std::vector<int> &boundary_nodes,
28 const std::vector<mesh::LocalBoundary> &local_boundary,
29 const std::vector<mesh::LocalBoundary> &local_neumann_boundary,
30 const int n_boundary_samples,
31 const StiffnessMatrix &mass,
32 const assembler::RhsAssembler &rhs_assembler,
33 const size_t obstacle_ndof,
34 const bool is_time_dependent,
35 const double t);
36
37 std::string name() const override { return "bc-lagrangian"; }
38
45 BCLagrangianForm(const int ndof,
46 const std::vector<int> &boundary_nodes,
47 const StiffnessMatrix &mass,
48 const size_t obstacle_ndof,
49 const Eigen::MatrixXd &target_x);
50
54 double value_unweighted(const Eigen::VectorXd &x) const override;
55
59 void first_derivative_unweighted(const Eigen::VectorXd &x, Eigen::VectorXd &gradv) const override;
60
64 void second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const override;
65
66 public:
70 void update_quantities(const double t, const Eigen::VectorXd &x) override;
71
72 void update_lagrangian(const Eigen::VectorXd &x, const double k_al);
73
74 private:
75 const std::vector<int> &boundary_nodes_;
76 const std::vector<mesh::LocalBoundary> *local_boundary_;
77 const std::vector<mesh::LocalBoundary> *local_neumann_boundary_;
79
82
84 Eigen::MatrixXd target_x_;
85 Eigen::VectorXd lagr_mults_;
86
92 const int ndof,
93 const StiffnessMatrix &mass,
94 const size_t obstacle_ndof);
95
98 void update_target(const double t);
99 };
100} // namespace polyfem::solver
int x
Form of the lagrangian in augmented lagrangian.
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
Eigen::VectorXd lagr_mults_
vector of lagrange multipliers
void update_quantities(const double t, const Eigen::VectorXd &x) override
Update time dependent quantities.
void update_target(const double t)
Update target x to the Dirichlet boundary values at time t.
const assembler::RhsAssembler * rhs_assembler_
Reference to the RHS assembler.
void second_derivative_unweighted(const Eigen::VectorXd &x, StiffnessMatrix &hessian) const override
Compute the second derivative of the value wrt x.
Eigen::MatrixXd target_x_
actually a vector with the same size as x with target nodal positions
const std::vector< mesh::LocalBoundary > * local_neumann_boundary_
const std::vector< mesh::LocalBoundary > * local_boundary_
StiffnessMatrix masked_lumped_mass_sqrt_
sqrt mass matrix masked by the AL dofs
double value_unweighted(const Eigen::VectorXd &x) const override
Compute the value of the form.
void update_lagrangian(const Eigen::VectorXd &x, const double k_al)
void init_masked_lumped_mass(const int ndof, const StiffnessMatrix &mass, const size_t obstacle_ndof)
Initialize the masked lumped mass matrix.
const std::vector< int > & boundary_nodes_
Eigen::SparseMatrix< double, Eigen::ColMajor > StiffnessMatrix
Definition Types.hpp:22