Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r2291
- Loading branch information
Showing
26 changed files
with
908 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#ifndef COMPUTEPOSTPROCESSORS_H | ||
#define COMPUTEPOSTPROCESSORS_H | ||
|
||
#endif //COMPUTEPOSTPROCESSORS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef CONSTANTDAMPER_H | ||
#define CONSTANTDAMPER_H | ||
|
||
// Moose Includes | ||
#include "Damper.h" | ||
|
||
//Forward Declarations | ||
class ConstantDamper; | ||
|
||
template<> | ||
InputParameters validParams<ConstantDamper>(); | ||
|
||
class ConstantDamper : public Damper | ||
{ | ||
public: | ||
ConstantDamper(std::string name, MooseSystem & moose_system, InputParameters parameters); | ||
|
||
protected: | ||
/** | ||
* This MUST be overriden by a child ConstantDamper. | ||
* | ||
* This is where they actually compute a number between 0 and 1. | ||
*/ | ||
virtual Real computeQpDamping(); | ||
|
||
/** | ||
* The constant amount of the newton update to take. | ||
*/ | ||
Real _damping; | ||
}; | ||
|
||
#endif //CONSTANTDAMPER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#ifndef DAMPER_H | ||
#define DAMPER_H | ||
|
||
// Moose Includes | ||
#include "DamperData.h" | ||
#include "PDEBase.h" | ||
#include "MaterialPropertyInterface.h" | ||
|
||
//Forward Declarations | ||
class Damper; | ||
|
||
template<> | ||
InputParameters validParams<Damper>(); | ||
|
||
class Damper : protected PDEBase, protected MaterialPropertyInterface | ||
{ | ||
public: | ||
Damper(std::string name, MooseSystem & moose_system, InputParameters parameters); | ||
|
||
/** | ||
* Computes this Damper's damping for one element. | ||
*/ | ||
Real computeDamping(); | ||
|
||
protected: | ||
/** | ||
* This MUST be overriden by a child damper. | ||
* | ||
* This is where they actually compute a number between 0 and 1. | ||
*/ | ||
virtual Real computeQpDamping() = 0; | ||
|
||
/** | ||
* Data associated just with dampers (ie the newton update). | ||
*/ | ||
DamperData & _damper_data; | ||
|
||
/** | ||
* Convenience reference to the ElementData object inside of MooseSystem | ||
*/ | ||
ElementData & _element_data; | ||
|
||
/** | ||
* The current newton increment. | ||
*/ | ||
MooseArray<Real> & _u_increment; | ||
|
||
/** | ||
* Holds the current solution at the current quadrature point. | ||
*/ | ||
MooseArray<Real> & _u; | ||
|
||
/** | ||
* Holds the current solution gradient at the current quadrature point. | ||
*/ | ||
MooseArray<RealGradient> & _grad_u; | ||
|
||
/** | ||
* Holds the current solution second derivative at the current quadrature point. | ||
*/ | ||
MooseArray<RealTensor> & _second_u; | ||
|
||
/** | ||
* Holds the previous solution at the current quadrature point. | ||
*/ | ||
MooseArray<Real> & _u_old; | ||
|
||
/** | ||
* Holds the t-2 solution at the current quadrature point. | ||
*/ | ||
MooseArray<Real> & _u_older; | ||
|
||
/** | ||
* Holds the previous solution gradient at the current quadrature point. | ||
*/ | ||
MooseArray<RealGradient> & _grad_u_old; | ||
|
||
/** | ||
* Holds the t-2 solution gradient at the current quadrature point. | ||
*/ | ||
MooseArray<RealGradient> & _grad_u_older; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#ifndef DAMPERDATA_H | ||
#define DAMPERDATA_H | ||
|
||
//MOOSE includes | ||
#include "Moose.h" | ||
#include "MooseArray.h" | ||
#include "ElementData.h" | ||
|
||
//Forward Declarations | ||
class MooseSystem; | ||
|
||
namespace libMesh | ||
{ | ||
class QGauss; | ||
class DofMap; | ||
class FEBase; | ||
template<class T> class NumericVector; | ||
template<class T> class DenseVector; | ||
template<class T> class DenseSubVector; | ||
template<class T> class DenseMatrix; | ||
} | ||
|
||
/** | ||
* One stop shop for all the data a Kernel class needs. | ||
* | ||
* _One_ of these will get built for each MooseSystem. | ||
*/ | ||
class DamperData | ||
{ | ||
public: | ||
DamperData(MooseSystem & moose_system, ElementData & element_data); | ||
|
||
~DamperData(); | ||
|
||
void init(); | ||
|
||
/** | ||
* Computes the value of the increment for each variable at the quadrature points. | ||
*/ | ||
void reinit(const NumericVector<Number>& increment_vec); | ||
|
||
/** | ||
* The MooseSystem | ||
*/ | ||
MooseSystem & _moose_system; | ||
|
||
MooseArray<MooseArray<Real> > _var_increments; | ||
|
||
/** | ||
* A reference to the element data class... so we can reuse that data. | ||
* | ||
* This also means that the element data needs to get reinit BEFORE damper data! | ||
*/ | ||
ElementData & _element_data; | ||
|
||
/** | ||
* Dof Maps for all the variables. | ||
*/ | ||
std::vector<std::vector<unsigned int> > & _var_dof_indices; | ||
|
||
/** | ||
* quadrature rule. | ||
*/ | ||
QGauss * & _qrule; | ||
|
||
/** | ||
* number of quadrature points for current element | ||
*/ | ||
unsigned int & _n_qpoints; | ||
|
||
/** | ||
* Map to vector of variable numbers that need to be evaluated | ||
* at the quadrature points | ||
* | ||
* NOTE: This variable is used differently in ElementData and FaceData | ||
* In ElementData, the mapping uses only index zero (0), since all variables lives | ||
* inside the whole domain. | ||
* In FaceData, the mapping goes from boundary id to list of variables active | ||
* on this boundary (not all variables are needed on all boundaries) | ||
*/ | ||
std::map<unsigned int, std::set<unsigned int> > & _var_nums; | ||
|
||
/** | ||
* Shape function. | ||
*/ | ||
std::map<FEType, const std::vector<std::vector<Real> > *> & _phi; | ||
}; | ||
|
||
#endif //DAMPERDATA_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#ifndef DAMPERFACTORY_H | ||
#define DAMPERFACTORY_H | ||
|
||
#include "Damper.h" | ||
|
||
// System includes | ||
#include <map> | ||
#include <string> | ||
#include <vector> | ||
#include <typeinfo> | ||
|
||
// LibMesh includes | ||
#include <parameters.h> | ||
|
||
// forward declarations | ||
class MooseSystem; | ||
|
||
/** | ||
* Typedef to make things easier. | ||
*/ | ||
typedef Damper * (*damperBuildPtr)(std::string name, MooseSystem & moose_system, InputParameters parameters); | ||
|
||
/** | ||
* Typedef to hide implementation details | ||
*/ | ||
typedef std::vector<std::string>::iterator DamperNamesIterator; | ||
|
||
/** | ||
* Typedef to make things easier. | ||
*/ | ||
typedef InputParameters (*damperParamsPtr)(); | ||
|
||
/** | ||
* Templated build function used for generating function pointers to build classes on demand. | ||
*/ | ||
template<typename DamperType> | ||
Damper * buildDamper(std::string name, MooseSystem & moose_system, InputParameters parameters) | ||
{ | ||
return new DamperType(name, moose_system, parameters); | ||
} | ||
|
||
/** | ||
* Responsible for building Dampers on demand and storing them for retrieval | ||
*/ | ||
class DamperFactory | ||
{ | ||
public: | ||
static DamperFactory * instance(); | ||
|
||
template<typename DamperType> | ||
void registerDamper(std::string name) | ||
{ | ||
if (_name_to_build_pointer.find(name) == _name_to_build_pointer.end()) | ||
{ | ||
_name_to_build_pointer[name] = &buildDamper<DamperType>; | ||
_name_to_params_pointer[name] = &validParams<DamperType>; | ||
} | ||
else | ||
mooseError("Damper '" + name + "' already registered."); | ||
} | ||
|
||
Damper *create(std::string damper_name, std::string name, MooseSystem & moose_system, InputParameters parameters) | ||
{ | ||
return (*_name_to_build_pointer[damper_name])(name, moose_system, parameters); | ||
} | ||
|
||
DamperNamesIterator registeredDampersBegin(); | ||
DamperNamesIterator registeredDampersEnd(); | ||
|
||
InputParameters getValidParams(std::string name); | ||
|
||
private: | ||
DamperFactory(); | ||
|
||
virtual ~DamperFactory(); | ||
|
||
std::map<std::string, damperBuildPtr> _name_to_build_pointer; | ||
std::map<std::string, damperParamsPtr> _name_to_params_pointer; | ||
|
||
std::vector<std::string> _registered_damper_names; | ||
}; | ||
|
||
#endif //DAMPERFACTORY_H |
Oops, something went wrong.