38 constexpr auto Lambda = [](
const real_t E,
const real_t nu)
40 return E * nu / (1.0 + nu) / (1.0 - 2.0 * nu);
42 return Lambda(EE, nn);
65 constexpr auto Schear = [](
const real_t E,
const real_t nu)
67 return E / (2.0 * (1.0 + nu));
69 return Schear(EE, nn);
85 bool pa =
false,
bool dfem =
false);
119 if (spaceDim == 3) { vec[2] = fz; }
121 if (load_coeff.find(
id) != load_coeff.end()) {
delete load_coeff[id]; }
128 surf_loads[id] = &ff;
187 delete bf; bf=
nullptr;
217 const int dim, spaceDim;
247 std::unique_ptr<mfem::Solver> lor_pa_prec;
248 std::unique_ptr<mfem::ParLORDiscretization> lor_disc;
249 std::unique_ptr<mfem::ElasticityIntegrator> lor_integrator;
250 std::unique_ptr<mfem::ParFiniteElementSpace> lor_scalar_fespace;
251 std::unique_ptr<mfem::BlockDiagonalPreconditioner> lor_blockDiag;
252 std::vector<std::unique_ptr<mfem::ParBilinearForm>> lor_bilinear_forms;
253 std::vector<std::unique_ptr<mfem::HypreParMatrix>> lor_block;
254 std::vector<std::unique_ptr<mfem::HypreBoomerAMG>> lor_amg_blocks;
263 using VectorCoefficientPtrMap = std::map<int, mfem::VectorCoefficient *>;
264 VectorCoefficientPtrMap load_coeff;
265 VectorCoefficientPtrMap surf_loads;
268 std::unique_ptr<SurfaceLoad> lcsurf_load;
269 std::unique_ptr<SurfaceLoad> glsurf_load;
272 using ConstantCoefficientMap = std::map<int, mfem::ConstantCoefficient>;
273 ConstantCoefficientMap bcx, bcy, bcz;
276 using CoefficientPtrMap = std::map<int, mfem::Coefficient*>;
277 CoefficientPtrMap bccx, bccy, bccz;
287 std::unique_ptr<mfem::OperatorHandle> Kh;
288 std::unique_ptr<mfem::HypreParMatrix> K, Ke;
294 static constexpr int U = 0, Coords = 1, LCoeff = 2, MuCoeff = 3;
301 NqptUniformParameterSpace Lambda_ps, Mu_ps;
302 std::unique_ptr<mfem::CoefficientVector> Lambda_cv, Mu_cv;
303 std::unique_ptr<mfem::future::DifferentiableOperator> dop;
310 VectorCoefficientPtrMap *map;
312 SurfaceLoad(
int dim, VectorCoefficientPtrMap &cmap):
325 if (it != map->end()) { it->second->Eval(V, T, ip); }
The IsoElasticyLambdaCoeff class converts E modulus of elasticity and Poisson's ratio to Lame's lambd...
real_t Eval(mfem::ElementTransformation &T, const mfem::IntegrationPoint &ip) override
Evaluates the Lame's lambda coefficient.
IsoElasticyLambdaCoeff(mfem::Coefficient *E, mfem::Coefficient *nu)
Constructor - takes as inputs E modulus and Poisson's ratio.
The IsoElasticySchearCoeff class converts E modulus of elasticity and Poisson's ratio to Shear coeffi...
real_t Eval(mfem::ElementTransformation &T, const mfem::IntegrationPoint &ip) override
Evaluates the shear coefficient coefficient.
IsoElasticySchearCoeff(mfem::Coefficient *E_, mfem::Coefficient *nu_)
Constructor - takes as inputs E modulus and Poisson's ratio.
The IsoLinElasticSolver class provides a solver for linear isotropic elasticity. The solver provides ...
void SetEssTDofs(mfem::Vector &bsol, mfem::Array< int > &ess_dofs)
void AddDispBC(int id, int dir, real_t val)
Adds displacement BC in direction 0(x), 1(y), 2(z), or -1(all).
mfem::Vector & GetAdjointSolutionVector()
Returns the adjoint solution vector.
void FSolve()
Solves the forward problem.
void SetVolForce(real_t fx, real_t fy, real_t fz=0.0)
Set the values of the volumetric force.
void Mult(const mfem::Vector &x, mfem::Vector &y) const override
Forward solve with given RHS. x is the RHS vector.
void SetMaterial(mfem::Coefficient &E_, mfem::Coefficient &nu_)
Set material.
void GetAdj(mfem::ParGridFunction &agf)
Returns the adjoint displacements.
mfem::ParGridFunction & GetDisplacements()
Returns the displacements.
void GetSol(mfem::ParGridFunction &sgf)
Returns the displacements.
void SetLinearSolver(real_t rtol=1e-8, real_t atol=1e-12, int miter=200)
void AddSurfLoad(int id, real_t fx, real_t fy, real_t fz=0.0)
Add surface load.
IsoLinElasticSolver(mfem::ParMesh *mesh, int vorder=1, bool pa=false, bool dfem=false)
mfem::Vector & GetSolutionVector()
Returns the solution vector.
~IsoLinElasticSolver()
Destructor of the solver.
mfem::ParGridFunction & GetADisplacements()
Returns the adjoint displacements.
void AddSurfLoad(int id, mfem::VectorCoefficient &ff)
Add surface load.
void MultTranspose(const mfem::Vector &x, mfem::Vector &y) const override
void DelDispBC()
Clear all displacement BC.
Conjugate gradient method.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
Square Operator for imposing essential boundary conditions using only the action, Mult(),...
int nqpt
Number of quadrature points. When mode is TENSOR, this is the 1D number.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
Abstract class for all finite elements.
The BoomerAMG solver in hypre.
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract parallel finite element space.
Class for parallel grid function.
void SetFromTrueDofs(const Vector &tv) override
Set the GridFunction from the given true-dof vector.
void SetSpace(FiniteElementSpace *f) override
Associate a new FiniteElementSpace with the ParGridFunction.
Class for parallel meshes.
Class representing the storage layout of a QuadratureFunction.
Base class for vector Coefficients that optionally depend on time and space.
int GetVDim()
Returns dimension of the vector.
VectorCoefficient(int vd)
Initialize the VectorCoefficient with vector dimension vd.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
Vector coefficient that is constant in space and time.
void SetSize(int s)
Resize the vector to size s.
std::array< int, NCMesh::MaxFaceNodes > nodes