18 #include "libmesh/equation_systems.h" 19 #include "libmesh/enum_quadrature_type.h" 48 virtual EquationSystems &
es()
override {
return _eq; }
51 const MooseMesh &
mesh(
bool libmesh_dbg_var(use_displaced))
const override 53 mooseAssert(use_displaced,
"An undisplaced mesh was queried from the displaced problem");
81 bool allow_negative_qweights =
true);
86 virtual void init()
override;
88 virtual unsigned int nlSysNum(
const NonlinearSystemName & nl_sys_name)
const override;
89 virtual unsigned int linearSysNum(
const LinearSystemName & sys_name)
const override;
90 virtual unsigned int solverSysNum(
const SolverSystemName & sys_name)
const override;
134 virtual void updateMesh(
bool mesh_changing =
false);
152 virtual const std::vector<VectorTag> &
168 virtual bool hasVariable(
const std::string & var_name)
const override;
172 const std::string & var_name,
177 const std::string & var_name)
override;
179 const std::string & var_name)
override;
181 const std::string & var_name)
override;
183 const std::string & var_name)
override;
186 const std::string & var_name)
override;
187 virtual System &
getSystem(
const std::string & var_name)
override;
189 virtual void addVariable(
const std::string & var_type,
190 const std::string &
name,
192 unsigned int nl_system_number);
194 const std::string &
name,
199 void meshChanged(
bool contract_mesh,
bool clean_refinement_flags);
205 virtual void prepare(
const Elem * elem,
208 const std::vector<dof_id_type> & dof_indices,
215 const std::vector<dof_id_type> & idof_indices,
216 const std::vector<dof_id_type> & jdof_indices,
225 const std::vector<Point> & phys_points_in_elem,
247 const std::vector<Point> * neighbor_reference_points);
250 unsigned int neighbor_side,
251 const std::vector<Point> & physical_points,
254 const std::vector<Point> & physical_points,
259 bool reinit_for_derivative_reordering =
false)
override;
284 std::vector<dof_id_type> & dof_indices,
285 const std::set<TagID> & tags,
291 const std::vector<dof_id_type> & idof_indices,
292 const std::vector<dof_id_type> & jdof_indices,
293 const std::set<TagID> & tags,
299 std::vector<dof_id_type> & dof_indices,
300 std::vector<dof_id_type> & neighbor_dof_indices,
301 const std::set<TagID> & tags,
327 virtual std::set<dof_id_type> &
ghostedElems()
override;
353 virtual const CouplingMatrix *
couplingMatrix(
const unsigned int nl_sys_num)
const override;
382 virtual
void needFV() override;
383 virtual
bool haveFV() const override;
422 _has_displacement =
true;
430 mooseAssert(!Threads::in_threads,
431 "This function requires a MPI all-gathering operation that cannot be in a " 434 return _has_displacement;
445 const std::vector<const NumericVector<Number> *> &
_nl_soln;
452 std::map<
unsigned int,
453 std::pair<const NumericVector<Number> *, std::shared_ptr<NumericVector<Number>>>>
458 std::map<unsigned int, std::pair<std::vector<unsigned int>, std::vector<unsigned int>>>
467 virtual std::pair<bool, unsigned int>
469 bool error_if_not_found =
false)
const override;
479 "System number greater than the number of nonlinear systems");
487 "System number greater than the number of nonlinear systems");
495 "System number greater than the number of nonlinear systems");
502 mooseError(
"Linear systems are not supported for displaced problems yet.");
508 mooseError(
"Linear systems are not supported for displaced problems yet.");
515 "System number greater than the number of solver systems");
523 "System number greater than the number of solver systems");
virtual LineSearch * getLineSearch() override
virtual MooseMesh & mesh() override
GeometricSearchData _geometric_search_data
const NumericVector< Number > & _aux_soln
Solution vector of the auxliary system on the displaced problem.
virtual void reinitNodesNeighbor(const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
virtual void addGhostedElem(dof_id_type elem_id) override
Will make sure that all dofs connected to elem_id are ghosted to this processor.
friend class UpdateDisplacedMeshThread
virtual System & getSystem(const std::string &var_name) override
Returns the equation system containing the variable provided.
virtual void reinitNode(const Node *node, const THREAD_ID tid) override
A class for creating restricted objects.
virtual GeometricSearchData & geomSearchData() override
virtual void saveOldSolutions()
Allocate vectors and save old solutions into them.
void undisplaceMesh()
Resets the displaced mesh to the reference mesh.
std::shared_ptr< DisplacedProblem > displaced_problem
Keeps track of stuff related to assembling.
virtual void addAuxVariable(const std::string &var_type, const std::string &name, InputParameters ¶meters)
MooseMesh & _ref_mesh
Original mesh.
virtual MooseVariableFieldBase & getActualFieldVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested MooseVariableField which may be in any system...
virtual void residualSetup() override
virtual void initAdaptivity()
virtual const SystemBase & systemBaseLinear(const unsigned int sys_num) const override
Return the linear system object as a base class reference given the system number.
void bumpAllQRuleOrder(Order order, SubdomainID block)
virtual void initialSetup() override
virtual bool computingPreSMOResidual(const unsigned int nl_sys_num) const override
Returns true if the problem is in the process of computing it's initial residual. ...
virtual void addJacobianNeighborLowerD(const THREAD_ID tid) override
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL) override
Create a Tag.
virtual void prepareShapes(unsigned int var, const THREAD_ID tid) override
FEProblemBase & _mproblem
virtual const SystemBase & systemBaseSolver(const unsigned int sys_num) const override
Return the solver system object as a base class reference given the system number.
virtual unsigned int currentLinearSysNum() const override
virtual void prepareNeighborShapes(unsigned int var, const THREAD_ID tid) override
virtual void createQRules(QuadratureType type, Order order, Order volume_order, Order face_order, SubdomainID block, bool allow_negative_qweights=true)
virtual void reinitNodes(const std::vector< dof_id_type > &nodes, const THREAD_ID tid) override
virtual EquationSystems & es() override
virtual bool haveFV() const override
returns true if this problem includes/needs finite volume functionality.
virtual bool safeAccessTaggedMatrices() const override
Is it safe to access the tagged matrices.
virtual bool hasScalarVariable(const std::string &var_name) const override
Returns a Boolean indicating whether any system contains a variable with the name provided...
virtual void prepareAssemblyNeighbor(const THREAD_ID tid)
virtual void addGhostedBoundary(BoundaryID boundary_id) override
Will make sure that all necessary elements from boundary_id are ghosted to this processor.
std::map< unsigned int, std::pair< std::vector< unsigned int >, std::vector< unsigned int > > > _sys_to_var_num_and_direction
To locate the system numbers, variable numbers of all displacement variables.
const Parallel::Communicator & comm() const
std::map< unsigned int, std::pair< const NumericVector< Number > *, std::shared_ptr< NumericVector< Number > > > > _sys_to_nonghost_and_ghost_soln
bool hasDisplacement()
Whether the displaced mesh is modified by the latest call to operator()
virtual TagName vectorTagName(const TagID tag_id) const override
Retrieve the name associated with a TagID.
This class provides an interface for common operations on field variables of both FE and FV types wit...
virtual void addJacobianLowerD(const THREAD_ID tid) override
virtual TagID getMatrixTagID(const TagName &tag_name) const override
Get a TagID from a TagName.
virtual void timestepSetup() override
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Base class for a system (of equations)
const MooseMesh & mesh(bool libmesh_dbg_var(use_displaced)) const override
virtual unsigned int numVectorTags(const Moose::VectorTagType type=Moose::VECTOR_TAG_ANY) const override
The total number of tags, which can be limited to the tag type.
virtual const MooseMesh & mesh() const override
virtual unsigned int nlSysNum(const NonlinearSystemName &nl_sys_name) const override
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual std::size_t numSolverSystems() const override
virtual void onTimestepBegin() override
virtual const std::string & name() const
Get the name of the class.
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
std::vector< std::unique_ptr< DisplacedSystem > > _displaced_solver_systems
void syncSolutions()
Copy the solutions on the undisplaced systems to the displaced systems.
bool _has_displacement
A flag to be set by operator() for indicating whether the displaced mesh is indeed modified...
virtual void prepareBlockNonlocal(unsigned int ivar, unsigned int jvar, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices, const THREAD_ID tid)
virtual std::set< dof_id_type > & ghostedElems() override
Return the list of elements that should have their DoFs ghosted to this processor.
virtual void reinitElemPhys(const Elem *elem, const std::vector< Point > &phys_points_in_elem, const THREAD_ID tid) override
virtual void reinitNeighbor(const Elem *elem, unsigned int side, const THREAD_ID tid) override
virtual MooseVariable & getStandardVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested MooseVariable which may be in any system.
virtual MooseVariableScalar & getScalarVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the scalar variable reference from whichever system contains it.
std::vector< std::vector< std::unique_ptr< Assembly > > > _assembly
DisplacedProblem(DisplacedProblem &&)=delete
virtual bool solverSystemConverged(const unsigned int solver_sys_num) override
virtual const SystemBase & systemBaseAuxiliary() const override
Return the auxiliary system object as a base class reference.
virtual const SystemBase & systemBaseNonlinear(const unsigned int sys_num) const override
Return the nonlinear system object as a base class reference given the system number.
virtual unsigned int currentNlSysNum() const override
std::vector< const NumericVector< Number > * > _nl_solution
The nonlinear system solutions.
virtual std::pair< bool, unsigned int > determineSolverSystem(const std::string &var_name, bool error_if_not_found=false) const override
MooseMesh & _ref_mesh
reference mesh
virtual bool computingScalingResidual() const override final
Getter for whether we're computing the scaling residual.
virtual void reinitElemFace(const Elem *elem, unsigned int side, const THREAD_ID tid) override
std::unique_ptr< DisplacedSystem > _displaced_aux
virtual void addJacobian(const THREAD_ID tid) override
virtual void setResidual(NumericVector< Number > &residual, const THREAD_ID tid) override
boundary_id_type BoundaryID
virtual void clearDiracInfo() override
Gets called before Dirac Kernels are asked to add the points they are supposed to be evaluated in...
VarKindType
Framework-wide stuff.
virtual void restoreOldSolutions()
Restore old solutions from the backup vectors and deallocate them.
virtual const std::vector< VectorTag > & getVectorTags(const Moose::VectorTagType type=Moose::VECTOR_TAG_ANY) const override
Return all vector tags, where a tag is represented by a map from name to ID.
virtual void setResidualNeighbor(NumericVector< Number > &residual, const THREAD_ID tid) override
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
virtual unsigned int solverSysNum(const SolverSystemName &sys_name) const override
virtual void reinitNeighborPhys(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, const THREAD_ID tid) override
const std::string & type() const
Get the type of this class.
virtual bool hasVariable(const std::string &var_name) const override
Whether or not this problem has the variable.
virtual void addVariable(const std::string &var_type, const std::string &name, InputParameters ¶meters, unsigned int nl_system_number)
void join(const UpdateDisplacedMeshThread &y)
virtual Moose::VectorTagType vectorTagType(const TagID tag_id) const override
virtual void reinitOffDiagScalars(const THREAD_ID tid) override
virtual void addJacobianBlockTags(SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const libMesh::DofMap &dof_map, std::vector< dof_id_type > &dof_indices, const std::set< TagID > &tags, const THREAD_ID tid)
std::vector< std::string > _displacements
virtual const VectorTag & getVectorTag(const TagID tag_id) const override
Get a VectorTag from a TagID.
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const =0
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
const NumericVector< Number > * _aux_solution
The auxiliary system solution.
virtual void addResidualLower(const THREAD_ID tid) override
bool haveADObjects() const
Method for reading wehther we have any ad objects.
virtual bool isTransient() const override
DisplacedSystem & solverSys(const unsigned int sys_num)
GeometricSearchType
Used to select groups of geometric search objects to update.
DisplacedProblem & _displaced_problem
Diplaced problem.
virtual void onTimestepEnd() override
virtual std::size_t numNonlinearSystems() const override
virtual const libMesh::CouplingMatrix & nonlocalCouplingMatrix(const unsigned i) const override
virtual void reinitElem(const Elem *elem, const THREAD_ID tid) override
virtual void addCachedResidualDirectly(NumericVector< Number > &residual, const THREAD_ID tid)
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
virtual void customSetup(const ExecFlagType &exec_type) override
virtual TagName matrixTagName(TagID tag) override
Retrieve the name associated with a TagID.
const std::vector< std::string > & getDisplacementVarNames() const
virtual void reinitNodeFace(const Node *node, BoundaryID bnd_id, const THREAD_ID tid) override
void syncAuxSolution(const NumericVector< Number > &aux_soln)
Copy the provided solution into the displaced auxiliary system.
virtual void prepareAssembly(const THREAD_ID tid) override
virtual void prepare(const Elem *elem, const THREAD_ID tid) override
Generic class for solving transient nonlinear problems.
virtual VectorMooseVariable & getVectorVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested VectorMooseVariable which may be in any system...
Class for containing MooseEnum item information.
void max(const T &r, T &o, Request &req) const
vec_type::const_iterator const_iterator
virtual SystemBase & systemBaseAuxiliary() override
virtual bool matrixTagExists(const TagName &tag_name) const override
Check to see if a particular Tag exists.
virtual bool haveDisplaced() const override final
Whether we have a displaced problem in our simulation.
virtual bool computingScalingJacobian() const override final
Getter for whether we're computing the scaling jacobian.
virtual TagID addMatrixTag(TagName tag_name) override
Create a Tag.
virtual void addResidualNeighbor(const THREAD_ID tid) override
void addJacobianBlockNonlocal(SparseMatrix< Number > &jacobian, unsigned int ivar, unsigned int jvar, const libMesh::DofMap &dof_map, const std::vector< dof_id_type > &idof_indices, const std::vector< dof_id_type > &jdof_indices, const std::set< TagID > &tags, const THREAD_ID tid)
virtual void addResidual(const THREAD_ID tid) override
virtual const std::vector< VectorTag > & currentResidualVectorTags() const override
Return the residual vector tags we are currently computing.
DisplacedSystem & auxSys()
virtual void cacheJacobianNonlocal(const THREAD_ID tid)
Class for scalar variables (they are different).
virtual unsigned int linearSysNum(const LinearSystemName &sys_name) const override
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
virtual std::size_t numLinearSystems() const override
virtual void setCurrentSubdomainID(const Elem *elem, const THREAD_ID tid) override
const InputParameters & parameters() const
Get the parameters of the object.
virtual void prepareFaceShapes(unsigned int var, const THREAD_ID tid) override
virtual unsigned int numMatrixTags() const override
The total number of tags.
virtual void updateGeomSearch(GeometricSearchData::GeometricSearchType type=GeometricSearchData::ALL) override
virtual void reinitElemNeighborAndLowerD(const Elem *elem, unsigned int side, const THREAD_ID tid) override
virtual bool reinitDirac(const Elem *elem, const THREAD_ID tid) override
Returns true if the Problem has Dirac kernels it needs to compute on elem.
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override
virtual ArrayMooseVariable & getArrayVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested ArrayMooseVariable which may be in any system...
virtual void addJacobianNonlocal(const THREAD_ID tid)
virtual void reinitScalars(const THREAD_ID tid, bool reinit_for_derivative_reordering=false) override
fills the VariableValue arrays for scalar variables from the solution vector
virtual void updateMesh(bool mesh_changing=false)
Copy the solutions on the undisplaced systems to the displaced systems and reinitialize the geometry ...
virtual bool safeAccessTaggedVectors() const override
Is it safe to access the tagged vectors.
virtual void getDiracElements(std::set< const Elem *> &elems) override
Fills "elems" with the elements that should be looped over for Dirac Kernels.
virtual bool checkNonlocalCouplingRequirement() const override
void meshChanged(bool contract_mesh, bool clean_refinement_flags)
Storage for all of the information pretaining to a vector tag.
virtual void jacobianSetup() override
DisplacedProblem & operator=(DisplacedProblem &&)=delete
virtual void prepareNonlocal(const THREAD_ID tid)
virtual void needFV() override
marks this problem as including/needing finite volume functionality.
virtual void prepareFace(const Elem *elem, const THREAD_ID tid) override
virtual TagID getVectorTagID(const TagName &tag_name) const override
Get a TagID from a TagName.
void addTimeIntegrator()
Get the time integrators from the problem.
const std::vector< const NumericVector< Number > * > & _nl_soln
Solution vectors of the nonlinear systems on the displaced problem.
void ErrorVector unsigned int
virtual bool hasNonlocalCoupling() const override
Whether the simulation has active nonlocal coupling which should be accounted for in the Jacobian...
virtual const CouplingMatrix * couplingMatrix(const unsigned int nl_sys_num) const override
The coupling matrix defining what blocks exist in the preconditioning matrix.
virtual bool vectorTagExists(const TagID tag_id) const override
Check to see if a particular Tag exists.
static InputParameters validParams()
void bumpVolumeQRuleOrder(Order order, SubdomainID block)
virtual void init() override
virtual void addJacobianNeighbor(const THREAD_ID tid) override
virtual void ghostGhostedBoundaries() override
Causes the boundaries added using addGhostedBoundary to actually be ghosted.