https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NEML2CentralDifference.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "MooseTypes.h"
11#include "IntegratedBCBase.h"
12
13#ifdef NEML2_ENABLED
14
15// MOOSE includes
17
19
22{
25 "Central difference time integrator using NEML2 material models and kernels.");
26 params.addRequiredParam<UserObjectName>(
27 "assembly", "The NEML2Assembly object to use to provide assembly information");
28 params.addRequiredParam<UserObjectName>(
29 "fe", "The NEML2FEInterpolation object to use to couple variables");
30 return params;
31}
32
37
38void
40{
41 if (!_nl)
42 return;
43
44 _boundary_elems.clear();
45
46 // build boundary element list by iterating over all integrated BCs
47 const auto & ibcs = _nl->getIntegratedBCWarehouse();
48 std::unordered_set<BoundaryID> bnds;
49 for (const auto & ibc : ibcs.getObjects())
50 bnds.insert(ibc->boundaryIDs().begin(), ibc->boundaryIDs().end());
51
52 if (!bnds.empty())
53 {
54 mooseInfo("Dectected BCs on ", bnds.size(), " boundaries.");
55
56 // deduplicate elements that have multiple boundaries
57 std::unordered_set<const Elem *> unique_elems;
58 const auto end = _fe_problem.mesh().bndElemsEnd();
59 for (auto it = _fe_problem.mesh().bndElemsBegin(); it != end; ++it)
60 if (bnds.find((*it)->_bnd_id) != bnds.end())
61 unique_elems.insert((*it)->_elem);
62
63 _boundary_elems.assign(unique_elems.begin(), unique_elems.end());
64 mooseInfo("Adding ", _boundary_elems.size(), " elements to the algebraic range.");
65 }
66
68}
69
70void
78
79void
85
86void
92
93void
114
115#endif // NEML2_ENABLED
registerMooseObject("SolidMechanicsApp", NEML2CentralDifference)
Implements a form of the central difference time integrator that calculates acceleration directly fro...
virtual void postSolve() override
virtual void meshChanged() override
virtual void evaluateRHSResidual()
Evaluate the RHS residual.
static InputParameters validParams()
virtual void initialSetup() override
T & getUserObject(const std::string &name, unsigned int tid=0) const
void setCurrentAlgebraicNodeRange(libMesh::ConstNodeRange *range)
void setCurrentAlgebraicElementRange(libMesh::ConstElemRange *range)
virtual MooseMesh & mesh() override
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void mooseInfo(Args &&... args) const
virtual bnd_elem_iterator bndElemsBegin()
virtual bnd_elem_iterator bndElemsEnd()
bool upToDate() const
NEML2Assembly * _neml2_assembly
The assembly object with cached assembly information.
NEML2FEInterpolation * _fe
The FE interface for getting variable values/gradients interpolated onto the finite element space.
void evaluateRHSResidual() override
Evaluate the RHS residual.
static InputParameters validParams()
NEML2CentralDifference(const InputParameters &parameters)
std::vector< const Node * > _no_node
Empty node vector to help zero out the algebraic range.
bool _boundary_elems_dirty
Whether the cached boundary element list needs rebuilding.
std::vector< const Elem * > _boundary_elems
Empty element vector to help zero out the algebraic range.
void invalidateInterpolations()
bool contextUpToDate() const
MooseObjectTagWarehouse< IntegratedBCBase > & getIntegratedBCWarehouse()
NonlinearSystemBase * _nl
FEProblemBase & _fe_problem