www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
AuxiliarySystem Class Reference

A system that holds auxiliary variables. More...

#include <AuxiliarySystem.h>

Inheritance diagram for AuxiliarySystem:
[legend]

Public Member Functions

 AuxiliarySystem (FEProblemBase &subproblem, const std::string &name)
 
virtual ~AuxiliarySystem ()
 
virtual void init () override
 Initialize the system. More...
 
virtual void addExtraVectors () override
 Method called during initialSetup to add extra system vector if they are required by the simulation. More...
 
virtual void initialSetup ()
 
virtual void timestepSetup ()
 
virtual void subdomainSetup ()
 
virtual void residualSetup ()
 
virtual void jacobianSetup ()
 
virtual void updateActive (THREAD_ID tid)
 
virtual void addVariable (const std::string &var_name, const FEType &type, Real scale_factor, const std::set< SubdomainID > *const active_subdomains=NULL) override
 Adds a variable to the system. More...
 
void addTimeIntegrator (const std::string &type, const std::string &name, InputParameters parameters)
 Add a time integrator. More...
 
void addKernel (const std::string &kernel_name, const std::string &name, InputParameters parameters)
 Adds an auxiliary kernel. More...
 
void addScalarKernel (const std::string &kernel_name, const std::string &name, InputParameters parameters)
 Adds a scalar kernel. More...
 
virtual void reinitElem (const Elem *elem, THREAD_ID tid) override
 Reinit an element assembly info. More...
 
virtual void reinitElemFace (const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid) override
 Reinit assembly info for a side of an element. More...
 
virtual const NumericVector< Number > *& currentSolution () override
 The solution vector that is currently being operated on. More...
 
virtual NumericVector< Number > & solutionUDot () override
 
virtual void serializeSolution ()
 
virtual NumericVector< Number > & serializedSolution () override
 Returns a reference to a serialized version of the solution vector for this subproblem. More...
 
virtual void augmentSparsity (SparsityPattern::Graph &, std::vector< dof_id_type > &, std::vector< dof_id_type > &) override
 Will modify the sparsity pattern to add logical geometric connections. More...
 
virtual void compute (ExecFlagType type)
 Compute auxiliary variables. More...
 
std::set< std::string > getDependObjects (ExecFlagType type)
 Get a list of dependent UserObjects for this exec type. More...
 
std::set< std::string > getDependObjects ()
 
NumericVector< Number > & addVector (const std::string &vector_name, const bool project, const ParallelType type) override
 Adds a solution length vector to the system. More...
 
virtual Order getMinQuadratureOrder () override
 Get the minimum quadrature order for evaluating elemental auxiliary variables. More...
 
bool needMaterialOnSide (BoundaryID bnd_id)
 Indicated whether this system needs material properties on boundaries. More...
 
virtual NumericVector< Number > & solution () override
 
virtual NumericVector< Number > & solutionOld () override
 
virtual NumericVector< Number > & solutionOlder () override
 
virtual TransientExplicitSystem & sys ()
 
virtual System & system () override
 Get the reference to the libMesh system. More...
 
virtual const System & system () const override
 
virtual NumericVector< Number > * solutionPreviousNewton () override
 
virtual void setPreviousNewtonSolution ()
 
virtual unsigned int number ()
 Gets the number of this system. More...
 
virtual MooseMeshmesh ()
 
virtual SubProblemsubproblem ()
 
virtual DofMap & dofMap ()
 Gets the dof map. More...
 
virtual void initializeObjects ()
 Called only once, just before the solve begins so objects can do some precalculations. More...
 
virtual void update ()
 Update the system (doing libMesh magic) More...
 
virtual void solve ()
 Solve the system (using libMesh magic) More...
 
virtual void copyOldSolutions ()
 Shifts the solutions backwards in time. More...
 
virtual void restoreSolutions ()
 Restore current solutions (call after your solve failed) More...
 
virtual Number & duDotDu ()
 
virtual NumericVector< Number > & residualVector (Moose::KernelType)
 
virtual bool hasResidualVector (Moose::KernelType) const
 
virtual void saveOldSolutions ()
 Save the old and older solutions. More...
 
virtual void restoreOldSolutions ()
 Restore the old and older solutions when the saved solutions present. More...
 
virtual bool hasVector (const std::string &name)
 Check if the named vector exists in the system. More...
 
virtual NumericVector< Number > & getVector (const std::string &name)
 Get a raw NumericVector. More...
 
virtual NumericVector< Number > & residualCopy ()
 
virtual NumericVector< Number > & residualGhosted ()
 
virtual void augmentSendList (std::vector< dof_id_type > &send_list)
 Will modify the send_list to add all of the extra ghosted dofs for this system. More...
 
virtual bool hasVariable (const std::string &var_name)
 Query a system for a variable. More...
 
virtual bool hasScalarVariable (const std::string &var_name)
 
virtual bool isScalarVariable (unsigned int var_name)
 
virtual MooseVariablegetVariable (THREAD_ID tid, const std::string &var_name)
 Gets a reference to a variable of with specified name. More...
 
virtual MooseVariablegetVariable (THREAD_ID tid, unsigned int var_number)
 Gets a reference to a variable with specified number. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, const std::string &var_name)
 Gets a reference to a scalar variable with specified number. More...
 
virtual MooseVariableScalargetScalarVariable (THREAD_ID tid, unsigned int var_number)
 Gets a reference to a variable with specified number. More...
 
virtual const std::set< SubdomainID > * getVariableBlocks (unsigned int var_number)
 Get the block where a variable of this system is defined. More...
 
virtual unsigned int nVariables ()
 Get the number of variables in this system. More...
 
virtual void addVariableToZeroOnResidual (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each residual evaluation. More...
 
virtual void addVariableToZeroOnJacobian (std::string var_name)
 Adds this variable to the list of variables to be zeroed during each Jacobian evaluation. More...
 
virtual void zeroVariables (std::vector< std::string > &vars_to_be_zeroed)
 Zero out the solution for the list of variables passed in. More...
 
virtual void zeroVariablesForResidual ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on residual evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual void zeroVariablesForJacobian ()
 Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on Jacobian evaluation by a call to addVariableToZeroOnResidual() More...
 
virtual void prepare (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void prepareFace (THREAD_ID tid, bool resize_data)
 Prepare the system for use on sides. More...
 
virtual void prepareNeighbor (THREAD_ID tid)
 Prepare the system for use. More...
 
virtual void reinitNeighborFace (const Elem *elem, unsigned int side, BoundaryID bnd_id, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitNeighbor (const Elem *elem, THREAD_ID tid)
 Compute the values of the variables at all the current points. More...
 
virtual void reinitNode (const Node *node, THREAD_ID tid)
 Reinit nodal assembly info. More...
 
virtual void reinitNodeFace (const Node *node, BoundaryID bnd_id, THREAD_ID tid)
 Reinit nodal assembly info on a face. More...
 
virtual void reinitNodeNeighbor (const Node *node, THREAD_ID tid)
 Reinit nodal assembly info for neighbor node. More...
 
virtual void reinitNodes (const std::vector< dof_id_type > &nodes, THREAD_ID tid)
 Reinit variables at a set of nodes. More...
 
virtual void reinitNodesNeighbor (const std::vector< dof_id_type > &nodes, THREAD_ID tid)
 Reinit variables at a set of neighbor nodes. More...
 
virtual void reinitScalars (THREAD_ID tid)
 Reinit scalar varaibles. More...
 
virtual void addVariableToCopy (const std::string &dest_name, const std::string &source_name, const std::string &timestep)
 Add info about variable that will be copied. More...
 
const std::vector< MooseVariable * > & getVariables (THREAD_ID tid)
 
const std::vector< MooseVariableScalar * > & getScalarVariables (THREAD_ID tid)
 
const std::set< SubdomainID > & getSubdomainsForVar (unsigned int var_number) const
 
virtual void removeVector (const std::string &name)
 Remove a vector from the system with the given name. More...
 
virtual const std::string & name ()
 
virtual void addScalarVariable (const std::string &var_name, Order order, Real scale_factor, const std::set< SubdomainID > *const active_subdomains=NULL)
 Adds a scalar variable. More...
 
const std::vector< VariableName > & getVariableNames () const
 
virtual void computeVariables (const NumericVector< Number > &)
 
void copyVars (ExodusII_IO &io)
 
virtual void copySolutionsBackwards ()
 Copy current solution into old and older. More...
 

Protected Member Functions

void computeScalarVars (ExecFlagType type)
 
void computeNodalVars (ExecFlagType type)
 
void computeElementalVars (ExecFlagType type)
 

Protected Attributes

FEProblemBase_fe_problem
 
TransientExplicitSystem & _sys
 
const NumericVector< Number > * _current_solution
 solution vector from nonlinear solver More...
 
NumericVector< Number > & _serialized_solution
 Serialized version of the solution vector. More...
 
NumericVector< Number > * _solution_previous_nl
 Solution vector of the previous nonlinear iterate. More...
 
std::shared_ptr< TimeIntegrator_time_integrator
 Time integrator. More...
 
NumericVector< Number > & _u_dot
 solution vector for u^dot More...
 
bool _need_serialized_solution
 Whether or not a copy of the residual needs to be made. More...
 
std::vector< std::map< std::string, MooseVariable * > > _nodal_vars
 
std::vector< std::map< std::string, MooseVariable * > > _elem_vars
 
ExecuteMooseObjectWarehouse< AuxScalarKernel_aux_scalar_storage
 
ExecuteMooseObjectWarehouse< AuxKernel_nodal_aux_storage
 
ExecuteMooseObjectWarehouse< AuxKernel_elemental_aux_storage
 
SubProblem_subproblem
 
MooseApp_app
 
Factory_factory
 
MooseMesh_mesh
 
std::string _name
 The name of this system. More...
 
std::vector< VariableWarehouse_vars
 Variable warehouses (one for each thread) More...
 
std::map< unsigned int, std::set< SubdomainID > > _var_map
 Map of variables (variable id -> array of subdomains where it lives) More...
 
std::vector< std::string > _vars_to_be_zeroed_on_residual
 
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
 
Real _du_dot_du
 
NumericVector< Number > * _dummy_vec
 
NumericVector< Real > * _saved_old
 
NumericVector< Real > * _saved_older
 
Moose::VarKindType _var_kind
 default kind of variables in this system More...
 
std::vector< VarCopyInfo_var_to_copy
 

Friends

class AuxKernel
 
class ComputeNodalAuxVarsThread
 
class ComputeNodalAuxBcsThread
 
class ComputeElemAuxVarsThread
 
class ComputeElemAuxBcsThread
 
class ComputeIndicatorThread
 
class ComputeMarkerThread
 
class FlagElementsThread
 
class ComputeNodalKernelsThread
 
class ComputeNodalKernelBcsThread
 
class ComputeNodalKernelJacobiansThread
 
class ComputeNodalKernelBCJacobiansThread
 

Detailed Description

A system that holds auxiliary variables.

Definition at line 43 of file AuxiliarySystem.h.

Constructor & Destructor Documentation

AuxiliarySystem::AuxiliarySystem ( FEProblemBase subproblem,
const std::string &  name 
)

Definition at line 37 of file AuxiliarySystem.C.

38  : SystemBase(subproblem, name, Moose::VAR_AUXILIARY),
39  _fe_problem(subproblem),
40  _sys(subproblem.es().add_system<TransientExplicitSystem>(name)),
41  _current_solution(NULL),
42  _serialized_solution(*NumericVector<Number>::build(_fe_problem.comm()).release()),
44  _u_dot(addVector("u_dot", true, GHOSTED)),
46 {
47  _nodal_vars.resize(libMesh::n_threads());
48  _elem_vars.resize(libMesh::n_threads());
49 }
NumericVector< Number > & _serialized_solution
Serialized version of the solution vector.
std::vector< std::map< std::string, MooseVariable * > > _nodal_vars
virtual const std::string & name()
Definition: SystemBase.h:453
NumericVector< Number > & _u_dot
solution vector for u^dot
const NumericVector< Number > * _current_solution
solution vector from nonlinear solver
virtual EquationSystems & es() override
std::vector< std::map< std::string, MooseVariable * > > _elem_vars
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type) override
Adds a solution length vector to the system.
FEProblemBase & _fe_problem
TransientExplicitSystem & _sys
bool _need_serialized_solution
Whether or not a copy of the residual needs to be made.
SystemBase(SubProblem &subproblem, const std::string &name, Moose::VarKindType var_kind)
Definition: SystemBase.C:84
NumericVector< Number > * _solution_previous_nl
Solution vector of the previous nonlinear iterate.
AuxiliarySystem::~AuxiliarySystem ( )
virtual

Definition at line 51 of file AuxiliarySystem.C.

51 { delete &_serialized_solution; }
NumericVector< Number > & _serialized_solution
Serialized version of the solution vector.

Member Function Documentation

void AuxiliarySystem::addExtraVectors ( )
overridevirtual

Method called during initialSetup to add extra system vector if they are required by the simulation.

Reimplemented from SystemBase.

Definition at line 59 of file AuxiliarySystem.C.

60 {
62  _solution_previous_nl = &addVector("u_previous_newton", true, GHOSTED);
63 }
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type) override
Adds a solution length vector to the system.
FEProblemBase & _fe_problem
void needsPreviousNewtonIteration(bool state)
Set a flag that indicated that user required values for the previous Newton iterate.
NumericVector< Number > * _solution_previous_nl
Solution vector of the previous nonlinear iterate.
void AuxiliarySystem::addKernel ( const std::string &  kernel_name,
const std::string &  name,
InputParameters  parameters 
)

Adds an auxiliary kernel.

Parameters
kernel_nameThe type of the kernel
nameThe name of the kernel
parametersParameters for this kernel

Definition at line 163 of file AuxiliarySystem.C.

166 {
167  parameters.set<AuxiliarySystem *>("_aux_sys") = this;
168 
169  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
170  {
171  std::shared_ptr<AuxKernel> kernel =
172  _factory.create<AuxKernel>(kernel_name, name, parameters, tid);
173  if (kernel->isNodal())
174  _nodal_aux_storage.addObject(kernel, tid);
175  else
176  _elemental_aux_storage.addObject(kernel, tid);
177  }
178 }
ExecuteMooseObjectWarehouse< AuxKernel > _nodal_aux_storage
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, InputParameters parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>()) ...
Definition: Factory.C:46
virtual const std::string & name()
Definition: SystemBase.h:453
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Factory & _factory
Definition: SystemBase.h:481
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0)
Adds an object to the storage structure.
Base class for creating new auxiliary kernels and auxiliary boundary conditions.
Definition: AuxKernel.h:51
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
A system that holds auxiliary variables.
unsigned int THREAD_ID
Definition: MooseTypes.h:79
void AuxiliarySystem::addScalarKernel ( const std::string &  kernel_name,
const std::string &  name,
InputParameters  parameters 
)

Adds a scalar kernel.

Parameters
kernel_nameThe type of the kernel
nameThe name of the kernel
parametersKernel parameters

Definition at line 181 of file AuxiliarySystem.C.

184 {
185  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
186  {
187  std::shared_ptr<AuxScalarKernel> kernel =
188  _factory.create<AuxScalarKernel>(kernel_name, name, parameters, tid);
189  _aux_scalar_storage.addObject(kernel, tid);
190  }
191 }
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, InputParameters parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>()) ...
Definition: Factory.C:46
virtual const std::string & name()
Definition: SystemBase.h:453
Factory & _factory
Definition: SystemBase.h:481
ExecuteMooseObjectWarehouse< AuxScalarKernel > _aux_scalar_storage
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0)
Adds an object to the storage structure.
Base class for making kernels that work on auxiliary scalar variables.
unsigned int THREAD_ID
Definition: MooseTypes.h:79
void SystemBase::addScalarVariable ( const std::string &  var_name,
Order  order,
Real  scale_factor,
const std::set< SubdomainID > *const  active_subdomains = NULL 
)
virtualinherited

Adds a scalar variable.

Parameters
var_nameThe name of the variable
orderThe order of the variable
scale_factorThe scaling factor to be used with this scalar variable

Definition at line 530 of file SystemBase.C.

Referenced by DisplacedProblem::addAuxScalarVariable(), and DisplacedProblem::addScalarVariable().

534 {
535  FEType type(order, SCALAR);
536  unsigned int var_num = system().add_variable(var_name, type, active_subdomains);
537  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
538  {
539  // FIXME: we cannot refer fetype in libMesh at this point, so we will just make a copy in
540  // MooseVariableBase.
541  MooseVariableScalar * var =
542  new MooseVariableScalar(var_num, type, *this, _subproblem.assembly(tid), _var_kind);
543  var->scalingFactor(scale_factor);
544  _vars[tid].add(var_name, var);
545  }
546  if (active_subdomains == NULL)
547  _var_map[var_num] = std::set<SubdomainID>();
548  else
549  for (std::set<SubdomainID>::iterator it = active_subdomains->begin();
550  it != active_subdomains->end();
551  ++it)
552  _var_map[var_num].insert(*it);
553 }
virtual Assembly & assembly(THREAD_ID tid)=0
SubProblem & _subproblem
Definition: SystemBase.h:478
Moose::VarKindType _var_kind
default kind of variables in this system
Definition: SystemBase.h:504
virtual System & system()=0
Get the reference to the libMesh system.
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:490
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
MatType type
Class for scalar variables (they are different).
unsigned int THREAD_ID
Definition: MooseTypes.h:79
void scalingFactor(Real factor)
Set the scaling factor for this variable.
void AuxiliarySystem::addTimeIntegrator ( const std::string &  type,
const std::string &  name,
InputParameters  parameters 
)

Add a time integrator.

Parameters
typeType of the integrator
nameThe name of the integrator
parametersIntegrator params

Definition at line 154 of file AuxiliarySystem.C.

157 {
158  parameters.set<SystemBase *>("_sys") = this;
160 }
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, InputParameters parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>()) ...
Definition: Factory.C:46
virtual const std::string & name()
Definition: SystemBase.h:453
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Factory & _factory
Definition: SystemBase.h:481
Base class for a system (of equations)
Definition: SystemBase.h:91
MatType type
Base class for time integrators.
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
void AuxiliarySystem::addVariable ( const std::string &  var_name,
const FEType &  type,
Real  scale_factor,
const std::set< SubdomainID > *const  active_subdomains = NULL 
)
overridevirtual

Adds a variable to the system.

Parameters
var_namename of the variable
typeFE type of the variable
scale_factorthe scaling factor for the variable
active_subdomainsa list of subdomain ids this variable is active on

Reimplemented from SystemBase.

Definition at line 134 of file AuxiliarySystem.C.

138 {
139  SystemBase::addVariable(var_name, type, scale_factor, active_subdomains);
140  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
141  {
142  MooseVariable * var = dynamic_cast<MooseVariable *>(_vars[tid].getVariable(var_name));
143  if (var != NULL)
144  {
145  if (var->feType().family == LAGRANGE)
146  _nodal_vars[tid][var_name] = var;
147  else
148  _elem_vars[tid][var_name] = var;
149  }
150  }
151 }
const FEType & feType() const
Get the type of finite element object.
Class for stuff related to variables.
Definition: MooseVariable.h:43
std::vector< std::map< std::string, MooseVariable * > > _nodal_vars
virtual void addVariable(const std::string &var_name, const FEType &type, Real scale_factor, const std::set< SubdomainID > *const active_subdomains=NULL)
Adds a variable to the system.
Definition: SystemBase.C:500
std::vector< std::map< std::string, MooseVariable * > > _elem_vars
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
MatType type
unsigned int THREAD_ID
Definition: MooseTypes.h:79
void SystemBase::addVariableToCopy ( const std::string &  dest_name,
const std::string &  source_name,
const std::string &  timestep 
)
virtualinherited

Add info about variable that will be copied.

Parameters
dest_nameName of the nodal variable being used for copying into (name is from the exodusII file)
source_nameName of the nodal variable being used for copying from (name is from the exodusII file)
timestepTimestep in the file being used

Definition at line 616 of file SystemBase.C.

Referenced by CopyNodalVarsAction::act().

619 {
620  _var_to_copy.push_back(VarCopyInfo(dest_name, source_name, timestep));
621 }
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:506
Information about variables that will be copied.
Definition: SystemBase.h:73
void SystemBase::addVariableToZeroOnJacobian ( std::string  var_name)
virtualinherited

Adds this variable to the list of variables to be zeroed during each Jacobian evaluation.

Parameters
var_nameThe name of the variable to be zeroed.

Reimplemented in DisplacedSystem.

Definition at line 156 of file SystemBase.C.

Referenced by DisplacedSystem::addVariableToZeroOnJacobian(), DGKernel::DGKernel(), IntegratedBC::IntegratedBC(), InterfaceKernel::InterfaceKernel(), KernelBase::KernelBase(), NodalBC::NodalBC(), and NodalKernel::NodalKernel().

157 {
158  _vars_to_be_zeroed_on_jacobian.push_back(var_name);
159 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:493
void SystemBase::addVariableToZeroOnResidual ( std::string  var_name)
virtualinherited

Adds this variable to the list of variables to be zeroed during each residual evaluation.

Parameters
var_nameThe name of the variable to be zeroed.

Reimplemented in DisplacedSystem.

Definition at line 150 of file SystemBase.C.

Referenced by DisplacedSystem::addVariableToZeroOnResidual(), DGKernel::DGKernel(), IntegratedBC::IntegratedBC(), InterfaceKernel::InterfaceKernel(), KernelBase::KernelBase(), NodalBC::NodalBC(), and NodalKernel::NodalKernel().

151 {
152  _vars_to_be_zeroed_on_residual.push_back(var_name);
153 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:492
NumericVector< Number > & AuxiliarySystem::addVector ( const std::string &  vector_name,
const bool  project,
const ParallelType  type 
)
overridevirtual

Adds a solution length vector to the system.

Parameters
vector_nameThe name of the vector.
projectWhether or not to project this vector when doing mesh refinement. If the vector is just going to be recomputed then there is no need to project it.
typeWhat type of parallel vector. This is usually either PARALLEL or GHOSTED. GHOSTED is needed if you are going to be accessing off-processor entries. The ghosting pattern is the same as the solution vector.

Reimplemented from SystemBase.

Definition at line 363 of file AuxiliarySystem.C.

Referenced by addExtraVectors().

366 {
367  if (hasVector(vector_name))
368  return getVector(vector_name);
369 
370  NumericVector<Number> * vec = &_sys.add_vector(vector_name, project, type);
371 
372  return *vec;
373 }
virtual bool hasVector(const std::string &name)
Check if the named vector exists in the system.
Definition: SystemBase.C:589
TransientExplicitSystem & _sys
MatType type
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector.
Definition: SystemBase.C:598
void SystemBase::augmentSendList ( std::vector< dof_id_type > &  send_list)
virtualinherited

Will modify the send_list to add all of the extra ghosted dofs for this system.

Reimplemented in DisplacedSystem.

Definition at line 401 of file SystemBase.C.

Referenced by DisplacedSystem::augmentSendList(), and extraSendList().

402 {
403  std::set<dof_id_type> & ghosted_elems = _subproblem.ghostedElems();
404 
405  DofMap & dof_map = dofMap();
406 
407  std::vector<dof_id_type> dof_indices;
408 
409  System & sys = system();
410 
411  unsigned int sys_num = sys.number();
412 
413  unsigned int n_vars = sys.n_vars();
414 
415  for (const auto & elem_id : ghosted_elems)
416  {
417  Elem * elem = _mesh.elemPtr(elem_id);
418 
419  if (elem->active())
420  {
421  dof_map.dof_indices(elem, dof_indices);
422 
423  // Only need to ghost it if it's actually not on this processor
424  for (const auto & dof : dof_indices)
425  if (dof < dof_map.first_dof() || dof >= dof_map.end_dof())
426  send_list.push_back(dof);
427 
428  // Now add the DoFs from all of the nodes. This is necessary because of block
429  // restricted variables. A variable might not live _on_ this element but it
430  // might live on nodes connected to this element.
431  for (unsigned int n = 0; n < elem->n_nodes(); n++)
432  {
433  Node * node = elem->node_ptr(n);
434 
435  // Have to get each variable's dofs
436  for (unsigned int v = 0; v < n_vars; v++)
437  {
438  const Variable & var = sys.variable(v);
439  unsigned int var_num = var.number();
440  unsigned int n_comp = var.n_components();
441 
442  // See if this variable has any dofs at this node
443  if (node->n_dofs(sys_num, var_num) > 0)
444  {
445  // Loop over components of the variable
446  for (unsigned int c = 0; c < n_comp; c++)
447  send_list.push_back(node->dof_number(sys_num, var_num, c));
448  }
449  }
450  }
451  }
452  }
453 }
virtual Elem * elemPtr(const dof_id_type i)
Definition: MooseMesh.C:2115
virtual DofMap & dofMap()
Gets the dof map.
Definition: SystemBase.C:610
DofMap & dof_map
SubProblem & _subproblem
Definition: SystemBase.h:478
virtual std::set< dof_id_type > & ghostedElems()
Return the list of elements that should have their DoFs ghosted to this processor.
Definition: SubProblem.h:400
virtual System & system()=0
Get the reference to the libMesh system.
MooseMesh & _mesh
Definition: SystemBase.h:483
PetscInt n
void AuxiliarySystem::augmentSparsity ( SparsityPattern::Graph &  sparsity,
std::vector< dof_id_type > &  n_nz,
std::vector< dof_id_type > &  n_oz 
)
overridevirtual

Will modify the sparsity pattern to add logical geometric connections.

Implements SystemBase.

Definition at line 505 of file AuxiliarySystem.C.

508 {
509 }
void AuxiliarySystem::compute ( ExecFlagType  type)
virtual

Compute auxiliary variables.

Parameters
typeTime flag of which variables should be computed

Definition at line 261 of file AuxiliarySystem.C.

Referenced by setPreviousNewtonSolution().

262 {
263  // avoid division by dt which might be zero.
264  if (_fe_problem.dt() > 0. && _time_integrator)
265  _time_integrator->preStep();
266 
267  // We need to compute time derivatives every time each kind of the variables is finished, because:
268  //
269  // a) the user might want to use the aux variable value somewhere, thus we need to provide the
270  // up-to-date value
271  // b) time integration system works with the whole vectors of solutions, thus we cannot update
272  // only a part of the vector
273  //
274 
275  if (_vars[0].scalars().size() > 0)
276  {
278  // compute time derivatives of scalar aux variables _after_ the values were updated
279  if (_fe_problem.dt() > 0. && _time_integrator)
280  _time_integrator->computeTimeDerivatives();
281  }
282 
283  if (_vars[0].variables().size() > 0)
284  {
286  // compute time derivatives of nodal aux variables _after_ the values were updated
287  if (_fe_problem.dt() > 0. && _time_integrator)
288  _time_integrator->computeTimeDerivatives();
289  }
290 
291  if (_vars[0].variables().size() > 0)
292  {
294  // compute time derivatives of elemental aux variables _after_ the values were updated
295  if (_fe_problem.dt() > 0. && _time_integrator)
296  _time_integrator->computeTimeDerivatives();
297  }
298 
301 }
void computeScalarVars(ExecFlagType type)
void computeElementalVars(ExecFlagType type)
FEProblemBase & _fe_problem
virtual Real & dt() const
bool _need_serialized_solution
Whether or not a copy of the residual needs to be made.
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
MatType type
void computeNodalVars(ExecFlagType type)
virtual void serializeSolution()
std::shared_ptr< TimeIntegrator > _time_integrator
Time integrator.
void AuxiliarySystem::computeElementalVars ( ExecFlagType  type)
protected

Definition at line 460 of file AuxiliarySystem.C.

Referenced by compute().

461 {
462  // Reference to the Nodal AuxKernel storage
464 
465  if (elemental.hasActiveBlockObjects())
466  {
467  std::string compute_aux_tag = "computeElemAux(" + Moose::stringify(type) + ")";
468  Moose::perf_log.push(compute_aux_tag, "Execution");
469 
470  // Block Elemental AuxKernels
471  PARALLEL_TRY
472  {
473  ConstElemRange & range = *_mesh.getActiveLocalElementRange();
474  ComputeElemAuxVarsThread eavt(_fe_problem, elemental, true);
475  Threads::parallel_reduce(range, eavt);
476 
477  solution().close();
478  _sys.update();
479  }
480  PARALLEL_CATCH;
481  Moose::perf_log.pop(compute_aux_tag, "Execution");
482  }
483 
484  // Boundary Elemental AuxKernels
485  if (elemental.hasActiveBoundaryObjects())
486  {
487  std::string compute_aux_tag = "computeElemAuxBCs(" + Moose::stringify(type) + ")";
488  Moose::perf_log.push(compute_aux_tag, "Execution");
489 
490  PARALLEL_TRY
491  {
493  ComputeElemAuxBcsThread eabt(_fe_problem, elemental, true);
494  Threads::parallel_reduce(bnd_elems, eabt);
495 
496  solution().close();
497  _sys.update();
498  }
499  PARALLEL_CATCH;
500  Moose::perf_log.pop(compute_aux_tag, "Execution");
501  }
502 }
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:724
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > ConstBndElemRange
Definition: MooseMesh.h:1214
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
FEProblemBase & _fe_problem
PerfLog perf_log
Perflog to be used by applications.
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:66
TransientExplicitSystem & _sys
virtual NumericVector< Number > & solution() override
MatType type
MooseMesh & _mesh
Definition: SystemBase.h:483
bool hasActiveBlockObjects(THREAD_ID tid=0) const
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > * getBoundaryElementRange()
Definition: MooseMesh.C:773
void AuxiliarySystem::computeNodalVars ( ExecFlagType  type)
protected

Definition at line 415 of file AuxiliarySystem.C.

Referenced by compute().

416 {
417  // Reference to the Nodal AuxKernel storage
419 
420  if (nodal.hasActiveBlockObjects())
421  {
422  std::string compute_aux_tag = "computeNodalAux(" + Moose::stringify(type) + ")";
423  Moose::perf_log.push(compute_aux_tag, "Execution");
424 
425  // Block Nodal AuxKernels
426  PARALLEL_TRY
427  {
428  ConstNodeRange & range = *_mesh.getLocalNodeRange();
430  Threads::parallel_reduce(range, navt);
431 
432  solution().close();
433  _sys.update();
434  }
435  PARALLEL_CATCH;
436  Moose::perf_log.pop(compute_aux_tag, "Execution");
437  }
438 
439  if (nodal.hasActiveBoundaryObjects())
440  {
441  std::string compute_aux_tag = "computeNodalAuxBCs(" + Moose::stringify(type) + ")";
442  Moose::perf_log.push(compute_aux_tag, "Execution");
443 
444  // Boundary Nodal AuxKernels
445  PARALLEL_TRY
446  {
449  Threads::parallel_reduce(bnd_nodes, nabt);
450 
451  solution().close();
452  _sys.update();
453  }
454  PARALLEL_CATCH;
455  Moose::perf_log.pop(compute_aux_tag, "Execution");
456  }
457 }
ExecuteMooseObjectWarehouse< AuxKernel > _nodal_aux_storage
ConstNodeRange * getLocalNodeRange()
Definition: MooseMesh.C:753
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
FEProblemBase & _fe_problem
PerfLog perf_log
Perflog to be used by applications.
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:66
TransientExplicitSystem & _sys
virtual NumericVector< Number > & solution() override
MatType type
MooseMesh & _mesh
Definition: SystemBase.h:483
bool hasActiveBlockObjects(THREAD_ID tid=0) const
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > ConstBndNodeRange
Some useful StoredRange typedefs.
Definition: MooseMesh.h:1213
StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
Definition: MooseMesh.C:763
void AuxiliarySystem::computeScalarVars ( ExecFlagType  type)
protected

Definition at line 376 of file AuxiliarySystem.C.

Referenced by compute().

377 {
378  // Reference to the current storage container
380 
381  if (storage.hasActiveObjects())
382  {
383  std::string compute_aux_tag = "computeScalarAux(" + Moose::stringify(type) + ")";
384  Moose::perf_log.push(compute_aux_tag, "Execution");
385 
386  PARALLEL_TRY
387  {
388  // FIXME: run multi-threaded
389  THREAD_ID tid = 0;
390  if (storage.hasActiveObjects())
391  {
393 
394  // Call compute() method on all active AuxScalarKernel objects
395  const std::vector<std::shared_ptr<AuxScalarKernel>> & objects =
396  storage.getActiveObjects(tid);
397  for (const auto & obj : objects)
398  obj->compute();
399 
400  const std::vector<MooseVariableScalar *> & scalar_vars = getScalarVariables(tid);
401  for (const auto & var : scalar_vars)
402  var->insert(solution());
403  }
404  }
405  PARALLEL_CATCH;
406 
407  Moose::perf_log.pop(compute_aux_tag, "Execution");
408 
409  solution().close();
410  _sys.update();
411  }
412 }
const std::vector< MooseVariableScalar * > & getScalarVariables(THREAD_ID tid)
Definition: SystemBase.h:422
ExecuteMooseObjectWarehouse< AuxScalarKernel > _aux_scalar_storage
FEProblemBase & _fe_problem
PerfLog perf_log
Perflog to be used by applications.
bool hasActiveObjects(THREAD_ID tid=0) const
Convenience functions for determining if objects exist.
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:66
TransientExplicitSystem & _sys
virtual NumericVector< Number > & solution() override
MatType type
virtual void reinitScalars(THREAD_ID tid) override
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...
unsigned int THREAD_ID
Definition: MooseTypes.h:79
virtual void SystemBase::computeVariables ( const NumericVector< Number > &  )
inlinevirtualinherited

Definition at line 468 of file SystemBase.h.

468 {};
void SystemBase::copyOldSolutions ( )
virtualinherited

Shifts the solutions backwards in time.

Definition at line 693 of file SystemBase.C.

Referenced by EigenExecutionerBase::inversePowerIteration().

694 {
699 }
virtual NumericVector< Number > & solutionOld()=0
virtual NumericVector< Number > * solutionPreviousNewton()=0
virtual NumericVector< Number > & solutionOlder()=0
virtual const NumericVector< Number > *& currentSolution()=0
The solution vector that is currently being operated on.
void SystemBase::copySolutionsBackwards ( )
virtualinherited

Copy current solution into old and older.

Definition at line 680 of file SystemBase.C.

681 {
682  system().update();
687 }
virtual NumericVector< Number > & solutionOld()=0
virtual NumericVector< Number > * solutionPreviousNewton()=0
virtual System & system()=0
Get the reference to the libMesh system.
virtual NumericVector< Number > & solutionOlder()=0
virtual const NumericVector< Number > *& currentSolution()=0
The solution vector that is currently being operated on.
void SystemBase::copyVars ( ExodusII_IO &  io)
inherited

Definition at line 624 of file SystemBase.C.

625 {
626  int n_steps = io.get_num_time_steps();
627 
628  bool did_copy = false;
629  for (std::vector<VarCopyInfo>::iterator it = _var_to_copy.begin(); it != _var_to_copy.end(); ++it)
630  {
631  VarCopyInfo & vci = *it;
632  int timestep = -1;
633 
634  if (vci._timestep == "LATEST")
635  // Use the last time step in the file from which to retrieve the solution
636  timestep = n_steps;
637  else
638  {
639  std::istringstream ss(vci._timestep);
640  if (!((ss >> timestep) && ss.eof()) || timestep > n_steps)
641  mooseError("Invalid value passed as \"initial_from_file_timestep\". Expected \"LATEST\" or "
642  "a valid integer between 1 and ",
643  n_steps,
644  " inclusive, received ",
645  vci._timestep);
646  }
647 
648  did_copy = true;
649  if (getVariable(0, vci._dest_name).isNodal())
650  io.copy_nodal_solution(system(), vci._dest_name, vci._source_name, timestep);
651  else
652  io.copy_elemental_solution(system(), vci._dest_name, vci._source_name, timestep);
653  }
654 
655  if (did_copy)
656  solution().close();
657 }
std::string _source_name
Definition: SystemBase.h:83
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
virtual bool isNodal() const override
Is this variable nodal.
std::vector< VarCopyInfo > _var_to_copy
Definition: SystemBase.h:506
virtual MooseVariable & getVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:103
Information about variables that will be copied.
Definition: SystemBase.h:73
std::string _dest_name
Definition: SystemBase.h:82
virtual System & system()=0
Get the reference to the libMesh system.
std::string _timestep
Definition: SystemBase.h:84
virtual NumericVector< Number > & solution()=0
virtual const NumericVector<Number>*& AuxiliarySystem::currentSolution ( )
inlineoverridevirtual

The solution vector that is currently being operated on.

This is typically a ghosted vector that comes in from the Nonlinear solver.

Implements SystemBase.

Definition at line 96 of file AuxiliarySystem.h.

Referenced by AB2PredictorCorrector::step(), DisplacedProblem::syncSolutions(), and DisplacedProblem::updateMesh().

97  {
98  _current_solution = _sys.current_local_solution.get();
99  return _current_solution;
100  }
const NumericVector< Number > * _current_solution
solution vector from nonlinear solver
TransientExplicitSystem & _sys
DofMap & SystemBase::dofMap ( )
virtualinherited
virtual Number& SystemBase::duDotDu ( )
inlinevirtualinherited
std::set< std::string > AuxiliarySystem::getDependObjects ( ExecFlagType  type)

Get a list of dependent UserObjects for this exec type.

Parameters
typeExecution flag type
Returns
a set of dependent user objects

Definition at line 304 of file AuxiliarySystem.C.

305 {
306  std::set<std::string> depend_objects;
307 
308  // Elemental AuxKernels
309  {
310  const std::vector<std::shared_ptr<AuxKernel>> & auxs =
312  for (const auto & aux : auxs)
313  {
314  const std::set<std::string> & uo = aux->getDependObjects();
315  depend_objects.insert(uo.begin(), uo.end());
316  }
317  }
318 
319  // Nodal AuxKernels
320  {
321  const std::vector<std::shared_ptr<AuxKernel>> & auxs =
323  for (const auto & aux : auxs)
324  {
325  const std::set<std::string> & uo = aux->getDependObjects();
326  depend_objects.insert(uo.begin(), uo.end());
327  }
328  }
329 
330  return depend_objects;
331 }
ExecuteMooseObjectWarehouse< AuxKernel > _nodal_aux_storage
MatType type
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...
std::set< std::string > AuxiliarySystem::getDependObjects ( )

Definition at line 334 of file AuxiliarySystem.C.

335 {
336  std::set<std::string> depend_objects;
337 
338  // Elemental AuxKernels
339  {
340  const std::vector<std::shared_ptr<AuxKernel>> & auxs =
342  for (const auto & aux : auxs)
343  {
344  const std::set<std::string> & uo = aux->getDependObjects();
345  depend_objects.insert(uo.begin(), uo.end());
346  }
347  }
348 
349  // Nodal AuxKernels
350  {
351  const std::vector<std::shared_ptr<AuxKernel>> & auxs = _nodal_aux_storage.getActiveObjects();
352  for (const auto & aux : auxs)
353  {
354  const std::set<std::string> & uo = aux->getDependObjects();
355  depend_objects.insert(uo.begin(), uo.end());
356  }
357  }
358 
359  return depend_objects;
360 }
ExecuteMooseObjectWarehouse< AuxKernel > _nodal_aux_storage
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
const std::vector< std::shared_ptr< T > > & getActiveObjects(THREAD_ID tid=0) const
Retrieve complete vector to the active all/block/boundary restricted objects for a given thread...
Order AuxiliarySystem::getMinQuadratureOrder ( )
overridevirtual

Get the minimum quadrature order for evaluating elemental auxiliary variables.

Reimplemented from SystemBase.

Definition at line 512 of file AuxiliarySystem.C.

513 {
514  Order order = CONSTANT;
515  std::vector<MooseVariable *> vars = _vars[0].variables();
516  for (const auto & var : vars)
517  {
518  if (!var->isNodal()) // nodal aux variables do not need quadrature
519  {
520  FEType fe_type = var->feType();
521  if (fe_type.default_quadrature_order() > order)
522  order = fe_type.default_quadrature_order();
523  }
524  }
525 
526  return order;
527 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
MooseVariableScalar & SystemBase::getScalarVariable ( THREAD_ID  tid,
const std::string &  var_name 
)
virtualinherited

Gets a reference to a scalar variable with specified number.

Parameters
tidThread id
var_nameA string which is the name of the variable to get.
Returns
reference the variable (class)

Definition at line 121 of file SystemBase.C.

Referenced by Assembly::addJacobianOffDiagScalar(), IntegratedBC::computeJacobianBlockScalar(), ODEKernel::computeOffDiagJacobian(), Kernel::computeOffDiagJacobianScalar(), and DisplacedProblem::getScalarVariable().

122 {
123  MooseVariableScalar * var = dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_name));
124  if (var == NULL)
125  mooseError("Scalar variable '" + var_name + "' does not exist in this system");
126  return *var;
127 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
Class for scalar variables (they are different).
MooseVariableScalar & SystemBase::getScalarVariable ( THREAD_ID  tid,
unsigned int  var_number 
)
virtualinherited

Gets a reference to a variable with specified number.

Parameters
tidThread id
var_numberlibMesh variable number
Returns
reference the variable (class)

Definition at line 130 of file SystemBase.C.

131 {
132  MooseVariableScalar * var =
133  dynamic_cast<MooseVariableScalar *>(_vars[tid].getVariable(var_number));
134  if (var == NULL)
135  mooseError("variable #" + Moose::stringify(var_number) + " does not exist in this system");
136  return *var;
137 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:66
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
Class for scalar variables (they are different).
const std::vector<MooseVariableScalar *>& SystemBase::getScalarVariables ( THREAD_ID  tid)
inlineinherited
const std::set<SubdomainID>& SystemBase::getSubdomainsForVar ( unsigned int  var_number) const
inlineinherited

Definition at line 427 of file SystemBase.h.

428  {
429  return _var_map.at(var_number);
430  }
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:490
MooseVariable & SystemBase::getVariable ( THREAD_ID  tid,
const std::string &  var_name 
)
virtualinherited

Gets a reference to a variable of with specified name.

Parameters
tidThread id
var_namevariable name
Returns
reference the variable (class)

Definition at line 103 of file SystemBase.C.

Referenced by AdaptivityAction::act(), Assembly::addJacobianBlock(), Assembly::addJacobianBlockNonlocal(), Assembly::addJacobianNeighbor(), NonlocalIntegratedBC::computeJacobianBlock(), NonlocalKernel::computeNonlocalOffDiagJacobian(), NonlocalIntegratedBC::computeNonlocalOffDiagJacobian(), NonlocalKernel::computeOffDiagJacobian(), Assembly::copyFaceShapes(), Assembly::copyNeighborShapes(), Assembly::copyShapes(), SystemBase::copyVars(), FieldSplitPreconditioner::FieldSplitPreconditioner(), FiniteDifferencePreconditioner::FiniteDifferencePreconditioner(), NodeFaceConstraint::getConnectedDofIndices(), Marker::getMarkerValue(), DisplacedProblem::getVariable(), NodalNormalsPreprocessor::initialize(), FDKernel::perturbedResidual(), PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), AddPeriodicBCAction::setPeriodicVars(), SingleMatrixPreconditioner::SingleMatrixPreconditioner(), and UpdateErrorVectorsThread::UpdateErrorVectorsThread().

104 {
105  MooseVariable * var = dynamic_cast<MooseVariable *>(_vars[tid].getVariable(var_name));
106  if (var == NULL)
107  mooseError("Variable '" + var_name + "' does not exist in this system");
108  return *var;
109 }
Class for stuff related to variables.
Definition: MooseVariable.h:43
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
MooseVariable & SystemBase::getVariable ( THREAD_ID  tid,
unsigned int  var_number 
)
virtualinherited

Gets a reference to a variable with specified number.

Parameters
tidThread id
var_numberlibMesh variable number
Returns
reference the variable (class)

Definition at line 112 of file SystemBase.C.

113 {
114  MooseVariable * var = dynamic_cast<MooseVariable *>(_vars[tid].getVariable(var_number));
115  if (var == NULL)
116  mooseError("variable #" + Moose::stringify(var_number) + " does not exist in this system");
117  return *var;
118 }
Class for stuff related to variables.
Definition: MooseVariable.h:43
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:66
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
const std::set< SubdomainID > * SystemBase::getVariableBlocks ( unsigned int  var_number)
virtualinherited

Get the block where a variable of this system is defined.

Parameters
var_numberThe number of the variable
Returns
the set of subdomain ids where the variable is active (defined)

Definition at line 140 of file SystemBase.C.

Referenced by PhysicsBasedPreconditioner::addSystem().

141 {
142  mooseAssert(_var_map.find(var_number) != _var_map.end(), "Variable does not exist.");
143  if (_var_map[var_number].empty())
144  return NULL;
145  else
146  return &_var_map[var_number];
147 }
std::map< unsigned int, std::set< SubdomainID > > _var_map
Map of variables (variable id -> array of subdomains where it lives)
Definition: SystemBase.h:490
const std::vector<VariableName>& SystemBase::getVariableNames ( ) const
inlineinherited

Definition at line 466 of file SystemBase.h.

Referenced by MooseEigenSystem::buildSystemDoFIndices(), NonlinearSystemBase::checkKernelCoverage(), and AddPeriodicBCAction::setPeriodicVars().

466 { return _vars[0].names(); };
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
const std::vector<MooseVariable *>& SystemBase::getVariables ( THREAD_ID  tid)
inlineinherited
NumericVector< Number > & SystemBase::getVector ( const std::string &  name)
virtualinherited

Get a raw NumericVector.

Get a raw NumericVector with the given name.

Reimplemented in DisplacedSystem.

Definition at line 598 of file SystemBase.C.

Referenced by addVector(), SystemBase::addVector(), NonlinearSystemBase::computeResidual(), DisplacedSystem::getVector(), and Transient::solveStep().

599 {
600  return system().get_vector(name);
601 }
virtual const std::string & name()
Definition: SystemBase.h:453
virtual System & system()=0
Get the reference to the libMesh system.
virtual bool SystemBase::hasResidualVector ( Moose::KernelType  ) const
inlinevirtualinherited
bool SystemBase::hasScalarVariable ( const std::string &  var_name)
virtualinherited

Definition at line 565 of file SystemBase.C.

Referenced by ComputeFullJacobianThread::computeFaceJacobian(), ComputeFullJacobianThread::computeJacobian(), DisplacedProblem::getScalarVariable(), and DisplacedProblem::hasScalarVariable().

566 {
567  if (system().has_variable(var_name))
568  return system().variable_type(var_name).family == SCALAR;
569  else
570  return false;
571 }
virtual System & system()=0
Get the reference to the libMesh system.
bool SystemBase::hasVariable ( const std::string &  var_name)
virtualinherited

Query a system for a variable.

Parameters
var_namename of the variable
Returns
true if the variable exists

Definition at line 556 of file SystemBase.C.

Referenced by DGKernel::DGKernel(), FEProblemBase::duplicateVariableCheck(), DisplacedProblem::getSystem(), DisplacedProblem::getVariable(), DisplacedProblem::hasVariable(), InterfaceKernel::InterfaceKernel(), and KernelBase::KernelBase().

557 {
558  if (system().has_variable(var_name))
559  return system().variable_type(var_name).family != SCALAR;
560  else
561  return false;
562 }
virtual System & system()=0
Get the reference to the libMesh system.
bool SystemBase::hasVector ( const std::string &  name)
virtualinherited

Check if the named vector exists in the system.

Definition at line 589 of file SystemBase.C.

Referenced by addVector(), SystemBase::addVector(), and NonlinearSystemBase::computeResidual().

590 {
591  return system().have_vector(name);
592 }
virtual const std::string & name()
Definition: SystemBase.h:453
virtual System & system()=0
Get the reference to the libMesh system.
void AuxiliarySystem::init ( )
overridevirtual

Initialize the system.

Reimplemented from SystemBase.

Definition at line 54 of file AuxiliarySystem.C.

55 {
56 }
virtual void SystemBase::initializeObjects ( )
inlinevirtualinherited

Called only once, just before the solve begins so objects can do some precalculations.

Definition at line 124 of file SystemBase.h.

124 {};
void AuxiliarySystem::initialSetup ( )
virtual

Definition at line 66 of file AuxiliarySystem.C.

67 {
68  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
69  {
72 
75 
78  }
79 }
ExecuteMooseObjectWarehouse< AuxKernel > _nodal_aux_storage
void sort(THREAD_ID tid=0)
Performs a sort using the DependencyResolver.
ExecuteMooseObjectWarehouse< AuxScalarKernel > _aux_scalar_storage
virtual void initialSetup(THREAD_ID tid=0) const
Convenience methods for calling object setup methods.
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
bool SystemBase::isScalarVariable ( unsigned int  var_name)
virtualinherited

Definition at line 574 of file SystemBase.C.

Referenced by ODEKernel::computeOffDiagJacobian().

575 {
576  return (system().variable(var_num).type().family == SCALAR);
577 }
virtual System & system()=0
Get the reference to the libMesh system.
MatType type
void AuxiliarySystem::jacobianSetup ( )
virtual

Definition at line 104 of file AuxiliarySystem.C.

105 {
106  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
107  {
111  }
112 }
ExecuteMooseObjectWarehouse< AuxKernel > _nodal_aux_storage
void jacobianSetup(THREAD_ID tid=0) const
Convenience methods for calling object setup methods.
ExecuteMooseObjectWarehouse< AuxScalarKernel > _aux_scalar_storage
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
virtual MooseMesh& SystemBase::mesh ( )
inlinevirtualinherited
virtual const std::string& SystemBase::name ( )
inlinevirtualinherited
bool AuxiliarySystem::needMaterialOnSide ( BoundaryID  bnd_id)

Indicated whether this system needs material properties on boundaries.

Returns
Boolean if IntegratedBCs are active

Definition at line 530 of file AuxiliarySystem.C.

531 {
533 }
bool hasActiveBoundaryObjects(THREAD_ID tid=0) const
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
unsigned int SystemBase::number ( )
virtualinherited
unsigned int SystemBase::nVariables ( )
virtualinherited

Get the number of variables in this system.

Returns
the number of variables

Definition at line 580 of file SystemBase.C.

Referenced by AdaptivityAction::act(), FieldSplitPreconditioner::FieldSplitPreconditioner(), FiniteDifferencePreconditioner::FiniteDifferencePreconditioner(), NonlinearSystemBase::getNodeDofs(), Assembly::init(), PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), and SingleMatrixPreconditioner::SingleMatrixPreconditioner().

581 {
582  return _vars[0].names().size();
583 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::prepare ( THREAD_ID  tid)
virtualinherited

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 214 of file SystemBase.C.

Referenced by DisplacedProblem::prepare(), DisplacedProblem::reinitDirac(), and DisplacedProblem::reinitElemPhys().

215 {
217  {
218  const std::set<MooseVariable *> & active_elemental_moose_variables =
220  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
221  for (const auto & var : vars)
222  var->clearDofIndices();
223 
224  for (const auto & var : active_elemental_moose_variables)
225  if (&(var->sys()) == this)
226  var->prepare();
227  }
228  else
229  {
230  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
231  for (const auto & var : vars)
232  var->prepare();
233  }
234 }
virtual bool hasActiveElementalMooseVariables(THREAD_ID tid)
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:67
SubProblem & _subproblem
Definition: SystemBase.h:478
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
virtual const std::set< MooseVariable * > & getActiveElementalMooseVariables(THREAD_ID tid)
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:61
void SystemBase::prepareFace ( THREAD_ID  tid,
bool  resize_data 
)
virtualinherited

Prepare the system for use on sides.

This will try to reuse the preparation done on the element.

Parameters
tidID of the thread
resize_dataPass True if this system needs to resize residual and jacobian datastructures based on preparing this face

Definition at line 237 of file SystemBase.C.

Referenced by DisplacedProblem::prepareFace().

238 {
240  tid)) // We only need to do something if the element prepare was restricted
241  {
242  const std::set<MooseVariable *> & active_elemental_moose_variables =
244 
245  std::vector<MooseVariable *> newly_prepared_vars;
246 
247  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
248  for (const auto & var : vars)
249  {
250  if (&(var->sys()) == this &&
251  !active_elemental_moose_variables.count(
252  var)) // If it wasnt in the active list we need to prepare it
253  {
254  var->prepare();
255  newly_prepared_vars.push_back(var);
256  }
257  }
258 
259  // Make sure to resize the residual and jacobian datastructures for all the new variables
260  if (resize_data)
261  for (unsigned int i = 0; i < newly_prepared_vars.size(); i++)
262  {
263  _subproblem.assembly(tid).prepareVariable(newly_prepared_vars[i]);
265  _subproblem.assembly(tid).prepareVariableNonlocal(newly_prepared_vars[i]);
266  }
267  }
268 }
virtual Assembly & assembly(THREAD_ID tid)=0
virtual bool hasActiveElementalMooseVariables(THREAD_ID tid)
Whether or not a list of active elemental moose variables has been set.
Definition: SubProblem.C:67
void prepareVariable(MooseVariable *var)
Used for preparing the dense residual and jacobian blocks for one particular variable.
Definition: Assembly.C:1076
SubProblem & _subproblem
Definition: SystemBase.h:478
virtual bool checkNonlocalCouplingRequirement()
Definition: SubProblem.h:62
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void prepareVariableNonlocal(MooseVariable *var)
Definition: Assembly.C:1098
virtual const std::set< MooseVariable * > & getActiveElementalMooseVariables(THREAD_ID tid)
Get the MOOSE variables to be reinited on each element.
Definition: SubProblem.C:61
void SystemBase::prepareNeighbor ( THREAD_ID  tid)
virtualinherited

Prepare the system for use.

Parameters
tidID of the thread

Definition at line 271 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNeighbor(), and DisplacedProblem::reinitNeighborPhys().

272 {
273  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
274  for (const auto & var : vars)
275  var->prepareNeighbor();
276 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void AuxiliarySystem::reinitElem ( const Elem *  elem,
THREAD_ID  tid 
)
overridevirtual

Reinit an element assembly info.

Parameters
elemWhich element we are reinitializing for
tidID of the thread

Reimplemented from SystemBase.

Definition at line 194 of file AuxiliarySystem.C.

195 {
196  for (const auto & it : _nodal_vars[tid])
197  {
198  MooseVariable * var = it.second;
199  var->computeElemValues();
200  }
201 
202  for (const auto & it : _elem_vars[tid])
203  {
204  MooseVariable * var = it.second;
205  var->reinitAux();
206  var->computeElemValues();
207  }
208 }
Class for stuff related to variables.
Definition: MooseVariable.h:43
std::vector< std::map< std::string, MooseVariable * > > _nodal_vars
std::vector< std::map< std::string, MooseVariable * > > _elem_vars
virtual void computeElemValues()
Compute values at interior quadrature points.
void AuxiliarySystem::reinitElemFace ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id,
THREAD_ID  tid 
)
overridevirtual

Reinit assembly info for a side of an element.

Parameters
elemThe element
sideSide of of the element
bnd_idBoundary id on that side
tidThread ID

Reimplemented from SystemBase.

Definition at line 211 of file AuxiliarySystem.C.

215 {
216  for (const auto & it : _nodal_vars[tid])
217  {
218  MooseVariable * var = it.second;
219  var->computeElemValuesFace();
220  }
221 
222  for (const auto & it : _elem_vars[tid])
223  {
224  MooseVariable * var = it.second;
225  var->reinitAux();
226  var->reinitAuxNeighbor();
227  var->computeElemValuesFace();
228  }
229 }
Class for stuff related to variables.
Definition: MooseVariable.h:43
std::vector< std::map< std::string, MooseVariable * > > _nodal_vars
virtual void computeElemValuesFace()
Compute values at facial quadrature points.
void reinitAuxNeighbor()
std::vector< std::map< std::string, MooseVariable * > > _elem_vars
void SystemBase::reinitNeighbor ( const Elem *  elem,
THREAD_ID  tid 
)
virtualinherited

Compute the values of the variables at all the current points.

Definition at line 321 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNeighborPhys().

322 {
323  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
324  for (const auto & var : vars)
325  var->computeNeighborValues();
326 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNeighborFace ( const Elem *  elem,
unsigned int  side,
BoundaryID  bnd_id,
THREAD_ID  tid 
)
virtualinherited

Compute the values of the variables at all the current points.

Definition at line 310 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNeighbor(), and DisplacedProblem::reinitNeighborPhys().

314 {
315  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
316  for (const auto & var : vars)
317  var->computeNeighborValuesFace();
318 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNode ( const Node *  node,
THREAD_ID  tid 
)
virtualinherited

Reinit nodal assembly info.

Parameters
nodeNode to reinit for
tidThread ID

Definition at line 329 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNode().

330 {
331  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
332  for (const auto & var : vars)
333  {
334  if (var->isNodal())
335  {
336  var->reinitNode();
337  var->computeNodalValues();
338  }
339  }
340 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNodeFace ( const Node *  node,
BoundaryID  bnd_id,
THREAD_ID  tid 
)
virtualinherited

Reinit nodal assembly info on a face.

Parameters
nodeNode to reinit
bnd_idBoundary ID
tidThread ID

Definition at line 343 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNodeFace().

344 {
345  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
346  for (const auto & var : vars)
347  {
348  if (var->isNodal())
349  {
350  var->reinitNode();
351  var->computeNodalValues();
352  }
353  }
354 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNodeNeighbor ( const Node *  node,
THREAD_ID  tid 
)
virtualinherited

Reinit nodal assembly info for neighbor node.

Parameters
nodeNode to reinit for
tidThread ID

Definition at line 357 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNodeNeighbor().

358 {
359  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
360  for (const auto & var : vars)
361  {
362  if (var->isNodal())
363  {
364  var->reinitNodeNeighbor();
365  var->computeNodalNeighborValues();
366  }
367  }
368 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNodes ( const std::vector< dof_id_type > &  nodes,
THREAD_ID  tid 
)
virtualinherited

Reinit variables at a set of nodes.

Parameters
nodesList of node ids to reinit
tidThread ID

Definition at line 371 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNodes().

372 {
373  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
374  for (const auto & var : vars)
375  {
376  var->reinitNodes(nodes);
377  var->computeNodalValues();
378  }
379 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitNodesNeighbor ( const std::vector< dof_id_type > &  nodes,
THREAD_ID  tid 
)
virtualinherited

Reinit variables at a set of neighbor nodes.

Parameters
nodesList of node ids to reinit
tidThread ID

Definition at line 382 of file SystemBase.C.

Referenced by DisplacedProblem::reinitNodesNeighbor().

383 {
384  const std::vector<MooseVariable *> & vars = _vars[tid].variables();
385  for (const auto & var : vars)
386  {
387  var->reinitNodesNeighbor(nodes);
388  var->computeNodalNeighborValues();
389  }
390 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
void SystemBase::reinitScalars ( THREAD_ID  tid)
virtualinherited

Reinit scalar varaibles.

Parameters
tidThread ID

Definition at line 393 of file SystemBase.C.

Referenced by DisplacedProblem::reinitScalars().

394 {
395  const std::vector<MooseVariableScalar *> & vars = _vars[tid].scalars();
396  for (const auto & var : vars)
397  var->reinit();
398 }
std::vector< VariableWarehouse > _vars
Variable warehouses (one for each thread)
Definition: SystemBase.h:488
virtual void SystemBase::removeVector ( const std::string &  name)
inlinevirtualinherited

Remove a vector from the system with the given name.

Definition at line 435 of file SystemBase.h.

Referenced by SystemBase::restoreOldSolutions().

435 { system().remove_vector(name); }
virtual const std::string & name()
Definition: SystemBase.h:453
virtual System & system()=0
Get the reference to the libMesh system.
virtual NumericVector<Number>& SystemBase::residualCopy ( )
inlinevirtualinherited

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 179 of file SystemBase.h.

Referenced by DisplacedSystem::residualCopy().

180  {
181  mooseError("This system does not support getting a copy of the residual");
182  }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
virtual NumericVector<Number>& SystemBase::residualGhosted ( )
inlinevirtualinherited

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 183 of file SystemBase.h.

Referenced by DisplacedSystem::residualGhosted().

184  {
185  mooseError("This system does not support getting a ghosted copy of the residual");
186  }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
void AuxiliarySystem::residualSetup ( )
virtual

Definition at line 115 of file AuxiliarySystem.C.

116 {
117  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
118  {
122  }
123 }
ExecuteMooseObjectWarehouse< AuxKernel > _nodal_aux_storage
ExecuteMooseObjectWarehouse< AuxScalarKernel > _aux_scalar_storage
void residualSetup(THREAD_ID tid=0) const
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
virtual NumericVector<Number>& SystemBase::residualVector ( Moose::KernelType  )
inlinevirtualinherited

Reimplemented in NonlinearSystemBase, and DisplacedSystem.

Definition at line 158 of file SystemBase.h.

Referenced by Assembly::addCachedResiduals(), and DisplacedSystem::residualVector().

158 { return *_dummy_vec; }
NumericVector< Number > * _dummy_vec
Definition: SystemBase.h:497
void SystemBase::restoreOldSolutions ( )
virtualinherited

Restore the old and older solutions when the saved solutions present.

Definition at line 473 of file SystemBase.C.

Referenced by DisplacedProblem::restoreOldSolutions().

474 {
475  if (_saved_old)
476  {
477  solutionOld() = *_saved_old;
478  removeVector("save_solution_old");
479  _saved_old = NULL;
480  }
481  if (_saved_older)
482  {
484  removeVector("save_solution_older");
485  _saved_older = NULL;
486  }
487 }
virtual NumericVector< Number > & solutionOld()=0
virtual void removeVector(const std::string &name)
Remove a vector from the system with the given name.
Definition: SystemBase.h:435
NumericVector< Real > * _saved_older
Definition: SystemBase.h:501
NumericVector< Real > * _saved_old
Definition: SystemBase.h:500
virtual NumericVector< Number > & solutionOlder()=0
void SystemBase::restoreSolutions ( )
virtualinherited

Restore current solutions (call after your solve failed)

Reimplemented in NonlinearSystemBase.

Definition at line 705 of file SystemBase.C.

Referenced by NonlinearSystemBase::restoreSolutions().

706 {
707  *(const_cast<NumericVector<Number> *&>(currentSolution())) = solutionOld();
708  solution() = solutionOld();
711  system().update();
712 }
virtual NumericVector< Number > & solutionOld()=0
virtual NumericVector< Number > * solutionPreviousNewton()=0
virtual System & system()=0
Get the reference to the libMesh system.
virtual NumericVector< Number > & solution()=0
virtual const NumericVector< Number > *& currentSolution()=0
The solution vector that is currently being operated on.
void SystemBase::saveOldSolutions ( )
virtualinherited

Save the old and older solutions.

Definition at line 459 of file SystemBase.C.

Referenced by DisplacedProblem::saveOldSolutions().

460 {
461  if (!_saved_old)
462  _saved_old = &addVector("save_solution_old", false, PARALLEL);
463  if (!_saved_older)
464  _saved_older = &addVector("save_solution_older", false, PARALLEL);
465  *_saved_old = solutionOld();
467 }
virtual NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const ParallelType type)
Adds a solution length vector to the system.
Definition: SystemBase.C:490
virtual NumericVector< Number > & solutionOld()=0
NumericVector< Real > * _saved_older
Definition: SystemBase.h:501
NumericVector< Real > * _saved_old
Definition: SystemBase.h:500
virtual NumericVector< Number > & solutionOlder()=0
NumericVector< Number > & AuxiliarySystem::serializedSolution ( )
overridevirtual

Returns a reference to a serialized version of the solution vector for this subproblem.

Implements SystemBase.

Definition at line 238 of file AuxiliarySystem.C.

239 {
241  return _serialized_solution;
242 }
NumericVector< Number > & _serialized_solution
Serialized version of the solution vector.
bool _need_serialized_solution
Whether or not a copy of the residual needs to be made.
void AuxiliarySystem::serializeSolution ( )
virtual

Definition at line 245 of file AuxiliarySystem.C.

Referenced by compute().

246 {
248  _sys.n_dofs() > 0) // libMesh does not like serializing of empty vectors
249  {
250  if (!_serialized_solution.initialized() || _serialized_solution.size() != _sys.n_dofs())
251  {
252  _serialized_solution.clear();
253  _serialized_solution.init(_sys.n_dofs(), false, SERIAL);
254  }
255 
256  solution().localize(_serialized_solution);
257  }
258 }
NumericVector< Number > & _serialized_solution
Serialized version of the solution vector.
TransientExplicitSystem & _sys
bool _need_serialized_solution
Whether or not a copy of the residual needs to be made.
virtual NumericVector< Number > & solution() override
void AuxiliarySystem::setPreviousNewtonSolution ( )
virtual

Definition at line 536 of file AuxiliarySystem.C.

537 {
538  // Evaluate aux variables to get the solution vector
540 }
Object is evaluated in every residual computation.
Definition: MooseTypes.h:96
virtual void compute(ExecFlagType type)
Compute auxiliary variables.
virtual NumericVector<Number>& AuxiliarySystem::solution ( )
inlineoverridevirtual
virtual NumericVector<Number>& AuxiliarySystem::solutionOld ( )
inlineoverridevirtual

Implements SystemBase.

Definition at line 152 of file AuxiliarySystem.h.

152 { return *_sys.old_local_solution; }
TransientExplicitSystem & _sys
virtual NumericVector<Number>& AuxiliarySystem::solutionOlder ( )
inlineoverridevirtual

Implements SystemBase.

Definition at line 154 of file AuxiliarySystem.h.

154 { return *_sys.older_local_solution; }
TransientExplicitSystem & _sys
virtual NumericVector<Number>* AuxiliarySystem::solutionPreviousNewton ( )
inlineoverridevirtual

Implements SystemBase.

Definition at line 161 of file AuxiliarySystem.h.

162  {
163  return _solution_previous_nl;
164  }
NumericVector< Number > * _solution_previous_nl
Solution vector of the previous nonlinear iterate.
NumericVector< Number > & AuxiliarySystem::solutionUDot ( )
overridevirtual

Reimplemented from SystemBase.

Definition at line 232 of file AuxiliarySystem.C.

233 {
234  return _u_dot;
235 }
NumericVector< Number > & _u_dot
solution vector for u^dot
void SystemBase::solve ( )
virtualinherited

Solve the system (using libMesh magic)

Reimplemented in NonlinearSystemBase, NonlinearEigenSystem, and NonlinearSystem.

Definition at line 671 of file SystemBase.C.

672 {
673  system().solve();
674 }
virtual System & system()=0
Get the reference to the libMesh system.
void AuxiliarySystem::subdomainSetup ( )
virtual

Definition at line 93 of file AuxiliarySystem.C.

94 {
95  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
96  {
100  }
101 }
ExecuteMooseObjectWarehouse< AuxKernel > _nodal_aux_storage
virtual void subdomainSetup(THREAD_ID tid=0) const
ExecuteMooseObjectWarehouse< AuxScalarKernel > _aux_scalar_storage
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
virtual SubProblem& SystemBase::subproblem ( )
inlinevirtualinherited
virtual TransientExplicitSystem& AuxiliarySystem::sys ( )
inlinevirtual

Definition at line 156 of file AuxiliarySystem.h.

Referenced by NumVars::getValue(), DT2::preExecute(), DT2::preSolve(), DT2::rejectStep(), and DT2::step().

156 { return _sys; }
TransientExplicitSystem & _sys
virtual System& AuxiliarySystem::system ( )
inlineoverridevirtual
virtual const System& AuxiliarySystem::system ( ) const
inlineoverridevirtual

Implements SystemBase.

Definition at line 159 of file AuxiliarySystem.h.

159 { return _sys; }
TransientExplicitSystem & _sys
void AuxiliarySystem::timestepSetup ( )
virtual

Definition at line 82 of file AuxiliarySystem.C.

83 {
84  for (unsigned int tid = 0; tid < libMesh::n_threads(); tid++)
85  {
89  }
90 }
ExecuteMooseObjectWarehouse< AuxKernel > _nodal_aux_storage
ExecuteMooseObjectWarehouse< AuxScalarKernel > _aux_scalar_storage
virtual void timestepSetup(THREAD_ID tid=0) const
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
void SystemBase::update ( )
virtualinherited
void AuxiliarySystem::updateActive ( THREAD_ID  tid)
virtual

Definition at line 126 of file AuxiliarySystem.C.

127 {
131 }
ExecuteMooseObjectWarehouse< AuxKernel > _nodal_aux_storage
ExecuteMooseObjectWarehouse< AuxScalarKernel > _aux_scalar_storage
ExecuteMooseObjectWarehouse< AuxKernel > _elemental_aux_storage
virtual void updateActive(THREAD_ID tid=0)
Updates the active objects storage.
void SystemBase::zeroVariables ( std::vector< std::string > &  vars_to_be_zeroed)
virtualinherited

Zero out the solution for the list of variables passed in.

@ param vars_to_be_zeroed The variable names in this vector will have their solutions set to zero after this call

Reimplemented in DisplacedSystem.

Definition at line 162 of file SystemBase.C.

Referenced by DisplacedSystem::zeroVariables(), SystemBase::zeroVariablesForJacobian(), and SystemBase::zeroVariablesForResidual().

163 {
164  if (vars_to_be_zeroed.size() > 0)
165  {
166  NumericVector<Number> & solution = this->solution();
167 
168  AllLocalDofIndicesThread aldit(system(), vars_to_be_zeroed);
169  ConstElemRange & elem_range = *_mesh.getActiveLocalElementRange();
170  Threads::parallel_reduce(elem_range, aldit);
171 
172  std::set<dof_id_type> dof_indices_to_zero = aldit._all_dof_indices;
173 
174  solution.close();
175 
176  for (const auto & dof : dof_indices_to_zero)
177  solution.set(dof, 0);
178 
179  solution.close();
180 
181  // Call update to update the current_local_solution for this system
182  system().update();
183  }
184 }
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
Definition: MooseMesh.C:724
Grab all the local dof indices for the variables passed in, in the system passed in.
virtual System & system()=0
Get the reference to the libMesh system.
MooseMesh & _mesh
Definition: SystemBase.h:483
virtual NumericVector< Number > & solution()=0
void SystemBase::zeroVariablesForJacobian ( )
virtualinherited

Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on Jacobian evaluation by a call to addVariableToZeroOnResidual()

Definition at line 193 of file SystemBase.C.

194 {
196 }
std::vector< std::string > _vars_to_be_zeroed_on_jacobian
Definition: SystemBase.h:493
virtual void zeroVariables(std::vector< std::string > &vars_to_be_zeroed)
Zero out the solution for the list of variables passed in.
Definition: SystemBase.C:162
void SystemBase::zeroVariablesForResidual ( )
virtualinherited

Zero out the solution for the variables that were registered as needing to have their solutions zeroed on out on residual evaluation by a call to addVariableToZeroOnResidual()

Definition at line 187 of file SystemBase.C.

188 {
190 }
std::vector< std::string > _vars_to_be_zeroed_on_residual
Definition: SystemBase.h:492
virtual void zeroVariables(std::vector< std::string > &vars_to_be_zeroed)
Zero out the solution for the list of variables passed in.
Definition: SystemBase.C:162

Friends And Related Function Documentation

friend class AuxKernel
friend

Definition at line 204 of file AuxiliarySystem.h.

friend class ComputeElemAuxBcsThread
friend

Definition at line 208 of file AuxiliarySystem.h.

friend class ComputeElemAuxVarsThread
friend

Definition at line 207 of file AuxiliarySystem.h.

friend class ComputeIndicatorThread
friend

Definition at line 209 of file AuxiliarySystem.h.

friend class ComputeMarkerThread
friend

Definition at line 210 of file AuxiliarySystem.h.

friend class ComputeNodalAuxBcsThread
friend

Definition at line 206 of file AuxiliarySystem.h.

friend class ComputeNodalAuxVarsThread
friend

Definition at line 205 of file AuxiliarySystem.h.

Definition at line 215 of file AuxiliarySystem.h.

friend class ComputeNodalKernelBcsThread
friend

Definition at line 213 of file AuxiliarySystem.h.

friend class ComputeNodalKernelJacobiansThread
friend

Definition at line 214 of file AuxiliarySystem.h.

friend class ComputeNodalKernelsThread
friend

Definition at line 212 of file AuxiliarySystem.h.

friend class FlagElementsThread
friend

Definition at line 211 of file AuxiliarySystem.h.

Member Data Documentation

MooseApp& SystemBase::_app
protectedinherited

Definition at line 480 of file SystemBase.h.

ExecuteMooseObjectWarehouse<AuxScalarKernel> AuxiliarySystem::_aux_scalar_storage
protected
const NumericVector<Number>* AuxiliarySystem::_current_solution
protected

solution vector from nonlinear solver

Definition at line 178 of file AuxiliarySystem.h.

Real SystemBase::_du_dot_du
protectedinherited

Definition at line 495 of file SystemBase.h.

NumericVector<Number>* SystemBase::_dummy_vec
protectedinherited

Definition at line 497 of file SystemBase.h.

std::vector<std::map<std::string, MooseVariable *> > AuxiliarySystem::_elem_vars
protected
ExecuteMooseObjectWarehouse<AuxKernel> AuxiliarySystem::_elemental_aux_storage
protected
Factory& SystemBase::_factory
protectedinherited
FEProblemBase& AuxiliarySystem::_fe_problem
protected
MooseMesh& SystemBase::_mesh
protectedinherited
std::string SystemBase::_name
protectedinherited

The name of this system.

Definition at line 485 of file SystemBase.h.

bool AuxiliarySystem::_need_serialized_solution
protected

Whether or not a copy of the residual needs to be made.

Definition at line 189 of file AuxiliarySystem.h.

Referenced by compute(), serializedSolution(), and serializeSolution().

ExecuteMooseObjectWarehouse<AuxKernel> AuxiliarySystem::_nodal_aux_storage
protected
std::vector<std::map<std::string, MooseVariable *> > AuxiliarySystem::_nodal_vars
protected
NumericVector<Real>* SystemBase::_saved_old
protectedinherited

Definition at line 500 of file SystemBase.h.

Referenced by SystemBase::restoreOldSolutions(), and SystemBase::saveOldSolutions().

NumericVector<Real>* SystemBase::_saved_older
protectedinherited

Definition at line 501 of file SystemBase.h.

Referenced by SystemBase::restoreOldSolutions(), and SystemBase::saveOldSolutions().

NumericVector<Number>& AuxiliarySystem::_serialized_solution
protected

Serialized version of the solution vector.

Definition at line 180 of file AuxiliarySystem.h.

Referenced by serializedSolution(), serializeSolution(), and ~AuxiliarySystem().

NumericVector<Number>* AuxiliarySystem::_solution_previous_nl
protected

Solution vector of the previous nonlinear iterate.

Definition at line 182 of file AuxiliarySystem.h.

Referenced by addExtraVectors().

SubProblem& SystemBase::_subproblem
protectedinherited
TransientExplicitSystem& AuxiliarySystem::_sys
protected
std::shared_ptr<TimeIntegrator> AuxiliarySystem::_time_integrator
protected

Time integrator.

Definition at line 184 of file AuxiliarySystem.h.

Referenced by addTimeIntegrator(), and compute().

NumericVector<Number>& AuxiliarySystem::_u_dot
protected

solution vector for u^dot

Definition at line 186 of file AuxiliarySystem.h.

Referenced by solutionUDot().

Moose::VarKindType SystemBase::_var_kind
protectedinherited

default kind of variables in this system

Definition at line 504 of file SystemBase.h.

Referenced by SystemBase::addScalarVariable(), and SystemBase::addVariable().

std::map<unsigned int, std::set<SubdomainID> > SystemBase::_var_map
protectedinherited

Map of variables (variable id -> array of subdomains where it lives)

Definition at line 490 of file SystemBase.h.

Referenced by SystemBase::addScalarVariable(), SystemBase::addVariable(), and SystemBase::getVariableBlocks().

std::vector<VarCopyInfo> SystemBase::_var_to_copy
protectedinherited

Definition at line 506 of file SystemBase.h.

Referenced by SystemBase::addVariableToCopy(), and SystemBase::copyVars().

std::vector<VariableWarehouse> SystemBase::_vars
protectedinherited
std::vector<std::string> SystemBase::_vars_to_be_zeroed_on_jacobian
protectedinherited
std::vector<std::string> SystemBase::_vars_to_be_zeroed_on_residual
protectedinherited

The documentation for this class was generated from the following files: