forked from idaholab/moose
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add array variable action and array initial condition and a simple test
- Loading branch information
Showing
14 changed files
with
512 additions
and
82 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
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,36 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#ifndef ARRAYCONSTANTIC_H | ||
#define ARRAYCONSTANTIC_H | ||
|
||
#include "ArrayInitialCondition.h" | ||
|
||
// Forward Declarations | ||
class ArrayConstantIC; | ||
namespace libMesh | ||
{ | ||
class Point; | ||
} | ||
|
||
template <> | ||
InputParameters validParams<ArrayConstantIC>(); | ||
|
||
class ArrayConstantIC : public ArrayInitialCondition | ||
{ | ||
public: | ||
ArrayConstantIC(const InputParameters & parameters); | ||
|
||
virtual RealArrayValue value(const Point & p) override; | ||
|
||
protected: | ||
const RealArrayValue _value; | ||
}; | ||
|
||
#endif // VECTORCONSTANTIC_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,15 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#ifndef ARRAYINITIALCONDITION_H | ||
#define ARRAYINITIALCONDITION_H | ||
|
||
#include "InitialConditionTempl.h" | ||
|
||
#endif // ARRAYINITIALCONDITION_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
45 changes: 45 additions & 0 deletions
45
framework/include/postprocessors/ElementIntegralArrayVariablePostprocessor.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,45 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#ifndef ELEMENTINTEGRALVARIABLEARRAYPOSTPROCESSOR_H | ||
#define ELEMENTINTEGRALVARIABLEARRAYPOSTPROCESSOR_H | ||
|
||
#include "ElementIntegralPostprocessor.h" | ||
#include "MooseVariableInterface.h" | ||
|
||
// Forward Declarations | ||
class ElementIntegralArrayVariablePostprocessor; | ||
|
||
template <> | ||
InputParameters validParams<ElementIntegralArrayVariablePostprocessor>(); | ||
|
||
/** | ||
* This postprocessor computes a volume integral of the specified variable. | ||
* | ||
* Note that specializations of this integral are possible by deriving from this | ||
* class and overriding computeQpIntegral(). | ||
*/ | ||
class ElementIntegralArrayVariablePostprocessor : public ElementIntegralPostprocessor, | ||
public MooseVariableInterface<RealArrayValue> | ||
{ | ||
public: | ||
ElementIntegralArrayVariablePostprocessor(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual Real computeQpIntegral() override; | ||
|
||
/// Holds the solution at current quadrature points | ||
const ArrayVariableValue & _u; | ||
/// Holds the solution gradient at the current quadrature points | ||
const ArrayVariableGradient & _grad_u; | ||
/// The component | ||
const unsigned int _component; | ||
}; | ||
|
||
#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
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,37 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#include "ArrayConstantIC.h" | ||
|
||
#include "libmesh/point.h" | ||
|
||
registerMooseObject("MooseApp", ArrayConstantIC); | ||
|
||
template <> | ||
InputParameters | ||
validParams<ArrayConstantIC>() | ||
{ | ||
InputParameters params = validParams<ArrayInitialCondition>(); | ||
params.addRequiredParam<RealArrayValue>("value", "The values to be set in IC"); | ||
params.addClassDescription("Sets constant component values for an array field variable."); | ||
return params; | ||
} | ||
|
||
ArrayConstantIC::ArrayConstantIC(const InputParameters & parameters) | ||
: ArrayInitialCondition(parameters), _value(getParam<RealArrayValue>("value")) | ||
{ | ||
if (_var.count() != _value.size()) | ||
mooseError("'value' size is inconsistent to the number of components of the array variable"); | ||
} | ||
|
||
RealArrayValue | ||
ArrayConstantIC::value(const Point & /*p*/) | ||
{ | ||
return _value; | ||
} |
Oops, something went wrong.