Skip to content

Commit

Permalink
Throw at the test machines
Browse files Browse the repository at this point in the history
  • Loading branch information
loganharbour committed Apr 11, 2020
1 parent f18fc21 commit cabd404
Show file tree
Hide file tree
Showing 40 changed files with 382 additions and 830 deletions.
45 changes: 11 additions & 34 deletions framework/include/interfaces/Coupleable.h
Expand Up @@ -195,6 +195,16 @@ class Coupleable
virtual const VariableValue &
coupledVectorTagValue(const std::string & var_name, TagID tag, unsigned int comp = 0);

/**
* Returns dof value of a coupled variable for a given tag
* @param var_name Name of coupled variable
* @param tag vector tag ID
* @param comp Component number for vector of coupled variables
* @return Reference to a DofValue for the coupled variable
*/
virtual const VariableValue &
coupledVectorTagDofValue(const std::string & var_name, TagID tag, unsigned int comp = 0);

/**
* Returns value of a coupled variable for a given tag. This couples the diag vector of matrix
* @param var_name Name of coupled variable
Expand Down Expand Up @@ -547,17 +557,6 @@ class Coupleable
*/
virtual const VariableValue & coupledDot(const std::string & var_name, unsigned int comp = 0);

/**
* Residual corresponding to the time derivative of a coupled variable
* Different from time derivative of a coupled variable for explicit solvers
* @param var_name Name of coupled variable
* @param comp Component number for vector of coupled variables
* @return Reference to a VariableValue containing the residual corresponding
* to the time derivative of the coupled variable
*/
virtual const VariableValue & coupledDotResidual(const std::string & var_name,
unsigned int comp = 0);

/**
* Second time derivative of a coupled variable
* @param var_name Name of coupled variable
Expand All @@ -567,17 +566,6 @@ class Coupleable
*/
virtual const VariableValue & coupledDotDot(const std::string & var_name, unsigned int comp = 0);

/**
* Residual corresponding to the second time derivative of a coupled variable
* Different from second time derivative of a coupled variable for explicit solvers
* @param var_name Name of coupled variable
* @param comp Component number for vector of coupled variables
* @ return Reference to a VariableValue containing the residual corresponding
* to the second time derivative of the coupled variable.
*/
virtual const VariableValue & coupledDotDotResidual(const std::string & var_name,
unsigned int comp = 0);

/**
* Old time derivative of a coupled variable
* @param var_name Name of coupled variable
Expand Down Expand Up @@ -627,8 +615,6 @@ class Coupleable
*/
virtual const VectorVariableValue & coupledVectorDot(const std::string & var_name,
unsigned int comp = 0);
virtual const VectorVariableValue & coupledVectorDotResidual(const std::string & var_name,
unsigned int comp = 0);
/**
* Second time derivative of a coupled vector variable
* @param var_name Name of coupled vector variable
Expand All @@ -638,8 +624,7 @@ class Coupleable
*/
virtual const VectorVariableValue & coupledVectorDotDot(const std::string & var_name,
unsigned int comp = 0);
virtual const VectorVariableValue & coupledVectorDotDotResidual(const std::string & var_name,
unsigned int comp = 0);

/**
* Old time derivative of a coupled vector variable
* @param var_name Name of coupled vector variable
Expand Down Expand Up @@ -689,8 +674,6 @@ class Coupleable
*/
virtual const ArrayVariableValue & coupledArrayDot(const std::string & var_name,
unsigned int comp = 0);
virtual const ArrayVariableValue & coupledArrayDotResidual(const std::string & var_name,
unsigned int comp = 0);

/**
* Second time derivative of a coupled array variable
Expand All @@ -701,8 +684,6 @@ class Coupleable
*/
virtual const ArrayVariableValue & coupledArrayDotDot(const std::string & var_name,
unsigned int comp = 0);
virtual const ArrayVariableValue & coupledArrayDotDotResidual(const std::string & var_name,
unsigned int comp = 0);

/**
* Old time derivative of a coupled array variable
Expand Down Expand Up @@ -798,8 +779,6 @@ class Coupleable
*/
template <typename T>
const T & coupledNodalDot(const std::string & var_name, unsigned int comp = 0);
template <typename T>
const T & coupledNodalDotResidual(const std::string & var_name, unsigned int comp = 0);
/**
* Nodal values of second time derivative of a coupled variable
* @param var_name Name of coupled variable
Expand All @@ -809,8 +788,6 @@ class Coupleable
*/
virtual const VariableValue & coupledNodalDotDot(const std::string & var_name,
unsigned int comp = 0);
virtual const VariableValue & coupledNodalDotDotResidual(const std::string & var_name,
unsigned int comp = 0);
/**
* Nodal values of old time derivative of a coupled variable
* @param var_name Name of coupled variable
Expand Down
2 changes: 0 additions & 2 deletions framework/include/interfaces/NeighborCoupleable.h
Expand Up @@ -33,8 +33,6 @@ class NeighborCoupleable : public Coupleable
unsigned int comp = 0);
virtual const VariableValue & coupledNeighborValueDot(const std::string & var_name,
unsigned int comp = 0);
virtual const VariableValue & coupledNeighborValueDotResidual(const std::string & var_name,
unsigned int comp = 0);
virtual const VariableValue & coupledNeighborValueDotDu(const std::string & var_name,
unsigned int comp = 0);
virtual const VariableValue & coupledNeighborValueOld(const std::string & var_name,
Expand Down
22 changes: 0 additions & 22 deletions framework/include/interfaces/ScalarCoupleable.h
Expand Up @@ -157,17 +157,6 @@ class ScalarCoupleable
*/
virtual VariableValue & coupledScalarDot(const std::string & var_name, unsigned int comp = 0);

/**
* Returns the residual corresponding to the time derivative of a scalar coupled variable
* Different from the time derivative of the scalar variable for explicit solvers
* @param var_name Name of coupled variable
* @param comp Component number for vector of coupled variables
* @return Reference to a VariableValue containing the residual corresponding
* to the time derivative for the coupled variable
*/
virtual VariableValue & coupledScalarDotResidual(const std::string & var_name,
unsigned int comp = 0);

/**
* Returns the second time derivative of a scalar coupled variable
* @param var_name Name of coupled variable
Expand All @@ -176,17 +165,6 @@ class ScalarCoupleable
*/
virtual VariableValue & coupledScalarDotDot(const std::string & var_name, unsigned int comp = 0);

/**
* Returns the residual corresponding to the second time derivative of a scalar coupled variable
* Different from the second time derivative of the scalar coupled variable for explicit solvers
* @param var_name Name of coupled variable
* @param comp Component number for vector of coupled variables
* @return Reference to a VariableValue containing the residual corresponding
* to the second time derivative of the coupled variable
*/
virtual VariableValue & coupledScalarDotDotResidual(const std::string & var_name,
unsigned int comp = 0);

/**
* Returns the old time derivative of a scalar coupled variable
* @param var_name Name of coupled variable
Expand Down
9 changes: 8 additions & 1 deletion framework/include/kernels/TimeKernel.h
Expand Up @@ -30,11 +30,18 @@ class TimeKernel : public Kernel

virtual void computeResidual() override;

/**
* Entry point for additional contribution to the local residual
*
* NOTE: This is an advanced interface and in nearly all cases you should just override
* computeQpResidual()!
*/
virtual void computeAdditionalResidual() {}

protected:
/// Time derivative of u
const VariableValue & _u_dot;

/// Derivative of u_dot with respect to u
const VariableValue & _du_dot_du;
};

12 changes: 8 additions & 4 deletions framework/include/problems/DisplacedProblem.h
Expand Up @@ -107,12 +107,16 @@ class DisplacedProblem : public SubProblem
virtual void updateMesh(const NumericVector<Number> & soln,
const NumericVector<Number> & aux_soln);

virtual TagID addVectorTag(TagName tag_name) override;
virtual TagID getVectorTagID(const TagName & tag_name) override;
virtual TagName vectorTagName(TagID tag) override;
virtual bool vectorTagExists(TagID tag) override;
virtual TagID addVectorTag(TagName tag_name, const bool read_only = false) override;
virtual TagID getVectorTagID(const TagName & tag_name) const override;
virtual TagName vectorTagName(TagID tag) const override;
virtual bool vectorTagExists(TagID tag) const override;
virtual unsigned int numVectorTags() const override;
virtual std::map<TagName, TagID> & getVectorTags() override;
virtual void registerVectorTagReadOnly(const TagName & tag_name) override;
virtual void registerVectorTagReadOnly(TagID tag) override;
virtual bool vectorTagReadOnly(const TagName & tag_name) const override;
virtual bool vectorTagReadOnly(TagID tag) const override;

virtual TagID addMatrixTag(TagName tag_name) override;
virtual TagID getMatrixTagID(const TagName & tag_name) override;
Expand Down
44 changes: 39 additions & 5 deletions framework/include/problems/SubProblem.h
Expand Up @@ -93,18 +93,20 @@ class SubProblem : public Problem
* Note: If the tag is already present then this will simply return the TagID of that Tag
*
* @param tag_name The name of the tag to create, the TagID will get automatically generated
* @param read_only Whether or not the tag is be read only by the residual/Jacobian systems
* (setting this true is an advanced interface - it should usually base false!)
*/
virtual TagID addVectorTag(TagName tag_name);
virtual TagID addVectorTag(TagName tag_name, const bool read_only = false);

/**
* Get a TagID from a TagName.
*/
virtual TagID getVectorTagID(const TagName & tag_name);
virtual TagID getVectorTagID(const TagName & tag_name) const;

/**
* Retrieve the name associated with a TagID
*/
virtual TagName vectorTagName(TagID tag);
virtual TagName vectorTagName(TagID tag) const;

/**
* Return all vector tags, where a tag is represented by a map from name to ID
Expand All @@ -114,18 +116,47 @@ class SubProblem : public Problem
/**
* Check to see if a particular Tag exists
*/
virtual bool vectorTagExists(TagID tag) { return tag < _vector_tag_name_to_tag_id.size(); }
virtual bool vectorTagExists(TagID tag) const { return tag < _vector_tag_name_to_tag_id.size(); }

/**
* Check to see if a particular Tag exists by using Tag name
*/
bool vectorTagExists(const TagName & tag_name);
bool vectorTagExists(const TagName & tag_name) const;

/**
* The total number of tags
*/
virtual unsigned int numVectorTags() const { return _vector_tag_name_to_tag_id.size(); }

/**
* Register a vector tag as read only to the system
*
* This an advanced interface that requires the user to fill/zero/change the underlying vector
* manually.
*/
virtual void registerVectorTagReadOnly(const TagName & tag_name);
/**
* Register a vector tag as read only to the system
*
* This an advanced interface that requires the user to fill/zero/change the underlying vector
* manually.
*/
virtual void registerVectorTagReadOnly(TagID tag);

/**
* Whether or not a vector tag is a registered as read only
*/
virtual bool vectorTagReadOnly(const TagName & tag_name) const;
/**
* Whether or not a vector tag is a registered as read only
*/
virtual bool vectorTagReadOnly(TagID tag) const;

/**
* Whether or not the problem has tagged vectors that are read only
*/
virtual bool hasReadOnlyVectorTags() const { return !_read_only_vector_tags.empty(); }

/**
* Create a Tag. Tags can be associated with Vectors and Matrices and allow objects
* (such as Kernels) to arbitrarily contribute values to any set of vectors/matrics
Expand Down Expand Up @@ -696,6 +727,9 @@ class SubProblem : public Problem
/// Reverse map
std::map<TagID, TagName> _vector_tag_id_to_tag_name;

/// The read-only vector tags
std::set<TagID> _read_only_vector_tags;

/// The currently declared tags
std::map<TagName, TagID> _matrix_tag_name_to_tag_id;

Expand Down
8 changes: 7 additions & 1 deletion framework/include/systems/SystemBase.h
Expand Up @@ -305,7 +305,13 @@ class SystemBase : public libMesh::ParallelObject, public ConsoleStreamInterface
virtual void associateVectorToTag(NumericVector<Number> & vec, TagID tag);

/**
* Associate a vector for a given tag
* Disassociate the vector associated with a given tag
*/
virtual void disassociateVectorFromTag(TagID tag);

/**
* Disassociate the vector associated with a given tag
* Has additional error checking for which vector is assocaited with said tag
*/
virtual void disassociateVectorFromTag(NumericVector<Number> & vec, TagID tag);

Expand Down
1 change: 0 additions & 1 deletion framework/include/timeintegrators/BDF2.h
Expand Up @@ -68,4 +68,3 @@ BDF2::computeTimeDerivativeHelper(T & u_dot,
u_dot *= 1. / _dt;
}
}

10 changes: 2 additions & 8 deletions framework/include/timeintegrators/CentralDifference.h
Expand Up @@ -26,22 +26,16 @@ class CentralDifference : public ActuallyExplicitEuler
public:
CentralDifference(const InputParameters & parameters);

virtual void initialSetup() override;

virtual int order() override { return 2; }
virtual void computeTimeDerivatives() override;
void computeADTimeDerivatives(DualReal & ad_u_dot, const dof_id_type & dof) const override;
virtual NumericVector<Number> & uDotDotResidual() const override;
virtual NumericVector<Number> & uDotResidual() const override;

protected:
/// solution vector for \f$ {du^dotdot}\over{du} \f$
Real & _du_dotdot_du;

/// vector storing residual corresponding to the second time derivative
NumericVector<Number> & _u_dotdot_residual;

/// vector storing residual corresponding to the first time derivative
NumericVector<Number> & _u_dot_residual;

/**
* Helper function that actually does the math for computing the time derivative
*/
Expand Down
31 changes: 17 additions & 14 deletions framework/include/timeintegrators/TimeIntegrator.h
Expand Up @@ -67,7 +67,7 @@ class TimeIntegrator : public MooseObject, public Restartable
*/
virtual void init() {}
virtual void preSolve() {}
virtual void preStep() {}
virtual void preStep();

/**
* Solves the time step and sets the number of nonlinear and linear iterations.
Expand Down Expand Up @@ -126,28 +126,28 @@ class TimeIntegrator : public MooseObject, public Restartable
virtual unsigned int getNumLinearIterations() const { return _n_linear_iterations; }

/**
* Returns the residual corresponding to the second time derivative
* Same as the second time derivative by default.
* Different from the second time derivative for explicit solvers.
* Returns whether the explicit solvers are used
*/
virtual NumericVector<Number> & uDotDotResidual() const;
virtual const bool & isExplicit() const { return _is_explicit; }

/**
* Returns the residual corresponding to the time derivative
* Same as the time derivative by default.
* Different from the time derivative for explicit solvers.
* Returns whether mass matrix is lumped
*/
virtual NumericVector<Number> & uDotResidual() const;
virtual const bool & isLumped() const { return _is_lumped; }

/**
* Returns whether the explicit solvers are used
* Returns tag for the nodal multiplication factor for the residual calculation of the udot term.
*
* Defaults to udot.
*/
virtual const bool & isExplicit() const { return _is_explicit; }

TagID uDotFactorTag() const { return _u_dot_factor_tag; }
/**
* Returns whether mass matrix is lumped
* Returns tag for the nodal multiplication factor for the residual calculation of the udotdot
* term.
*
* Defaults to udotdot.
*/
virtual const bool & isLumped() const { return _is_lumped; }
TagID uDotDotFactorTag() const { return _u_dotdot_factor_tag; }

protected:
/**
Expand Down Expand Up @@ -195,4 +195,7 @@ class TimeIntegrator : public MooseObject, public Restartable

/// Boolean flag that is set to true if lumped mass matrix is used
bool _is_lumped;

const TagID _u_dot_factor_tag;
const TagID _u_dotdot_factor_tag;
};

0 comments on commit cabd404

Please sign in to comment.