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 test and test object for coupledVectorDotDotDu
Refs idaholab#13913
- Loading branch information
1 parent
2aaa4c6
commit 0fd21e4
Showing
5 changed files
with
186 additions
and
0 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,43 @@ | ||
//* 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 | ||
|
||
#pragma once | ||
|
||
#include "Material.h" | ||
|
||
class VectorCoupledValuesMaterial; | ||
|
||
template <> | ||
InputParameters validParams<VectorCoupledValuesMaterial>(); | ||
|
||
/** | ||
* A material that couples vector variable values and stores them into material properties | ||
* This makes sure that everything is properly resized and can be indexed into. | ||
*/ | ||
class VectorCoupledValuesMaterial : public Material | ||
{ | ||
public: | ||
VectorCoupledValuesMaterial(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual void computeQpProperties() override; | ||
|
||
const VectorVariableValue & _value; | ||
const VectorVariableValue & _dot; | ||
const VectorVariableValue & _dot_dot; | ||
const VariableValue & _dot_du; | ||
const VariableValue & _dot_dot_du; | ||
|
||
const std::string & _var_name; | ||
MaterialProperty<RealVectorValue> & _value_prop; | ||
MaterialProperty<RealVectorValue> & _dot_prop; | ||
MaterialProperty<RealVectorValue> & _dot_dot_prop; | ||
MaterialProperty<Real> & _dot_du_prop; | ||
MaterialProperty<Real> & _dot_dot_du_prop; | ||
}; |
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,48 @@ | ||
//* 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 "VectorCoupledValuesMaterial.h" | ||
|
||
registerMooseObject("MooseTestApp", VectorCoupledValuesMaterial); | ||
|
||
template <> | ||
InputParameters | ||
validParams<VectorCoupledValuesMaterial>() | ||
{ | ||
InputParameters params = validParams<Material>(); | ||
params.addRequiredCoupledVar("variable", "Coupled variable"); | ||
return params; | ||
} | ||
|
||
VectorCoupledValuesMaterial::VectorCoupledValuesMaterial(const InputParameters & parameters) | ||
: Material(parameters), | ||
_value(coupledVectorValue("variable")), | ||
_dot(coupledVectorDot("variable")), | ||
_dot_dot(coupledVectorDotDot("variable")), | ||
_dot_du(coupledVectorDotDu("variable")), | ||
_dot_dot_du(coupledVectorDotDotDu("variable")), | ||
|
||
_var_name(getVectorVar("variable", 0)->name()), | ||
_value_prop(declareProperty<RealVectorValue>(_var_name + "_value")), | ||
_dot_prop(declareProperty<RealVectorValue>(_var_name + "_dot")), | ||
_dot_dot_prop(declareProperty<RealVectorValue>(_var_name + "_dot_dot")), | ||
_dot_du_prop(declareProperty<Real>(_var_name + "_dot_du")), | ||
_dot_dot_du_prop(declareProperty<Real>(_var_name + "_dot_dot_du")) | ||
{ | ||
} | ||
|
||
void | ||
VectorCoupledValuesMaterial::computeQpProperties() | ||
{ | ||
_value_prop[_qp] = _value[_qp]; | ||
_dot_prop[_qp] = _dot[_qp]; | ||
_dot_dot_prop[_qp] = _dot_dot[_qp]; | ||
_dot_du_prop[_qp] = _dot_du[_qp]; | ||
_dot_dot_du_prop[_qp] = _dot_dot_du[_qp]; | ||
} |
Binary file not shown.
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,10 @@ | ||
[Tests] | ||
[./test] | ||
type = 'Exodiff' | ||
input = 'vector_test.i' | ||
exodiff = 'vector_test_out.e' | ||
requirement = 'The system shall compute second-order time derivatives for vector variables' | ||
design = 'VectorMooseVariable.md' | ||
issues = '#13913' | ||
[../] | ||
[] |
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,85 @@ | ||
# Tests calculation of first and second time derivative | ||
# of a coupled vector variable in a material | ||
# a_vec(x,y,z,t) = [t*(t*x + y), t*y, 0] | ||
# a_vec_dot(x,y,z,t) = [2*t*x + y, y, 0] | ||
# a_vec_dot_dot(x,y,z,t) = [2*x, 0, 0] | ||
# | ||
# IMPORTANT NOTE: | ||
# Currently, this test produces a_vec_dot and a_vec_dot_dot that contains oscillations over time. | ||
# This is a known by-product of Newmark Beta time integration (see the Newmark Beta documentation), | ||
# but as of Summer 2019, there is no alternative time integrator in MOOSE that can contain these | ||
# oscillations. This test is used as coverage for the function call coupledVectorDotDot. | ||
|
||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 2 | ||
xmin = 0 | ||
xmax = 4 | ||
ymin = 0 | ||
ymax = 4 | ||
nx = 8 | ||
ny = 8 | ||
[] | ||
|
||
[Functions] | ||
[a_fn] | ||
type = ParsedVectorFunction | ||
value_x = 't * (t * x + y)' | ||
value_y = 't * y' | ||
value_z = 0 | ||
[] | ||
[] | ||
|
||
[AuxVariables] | ||
[a] | ||
family = LAGRANGE_VEC | ||
order = FIRST | ||
[] | ||
[] | ||
|
||
[AuxKernels] | ||
[a_ak] | ||
type = VectorFunctionAux | ||
variable = a | ||
function = a_fn | ||
[] | ||
[] | ||
|
||
[Materials] | ||
[cm] | ||
type = VectorCoupledValuesMaterial | ||
variable = a | ||
[] | ||
[] | ||
|
||
[Variables] | ||
[u] # u is zero | ||
family = LAGRANGE_VEC | ||
order = FIRST | ||
[] | ||
[] | ||
|
||
[Kernels] | ||
[td] | ||
type = VectorTimeDerivative | ||
variable = u | ||
[] | ||
[] | ||
|
||
[Executioner] | ||
type = Transient | ||
dt = 1 | ||
num_steps = 3 | ||
|
||
[TimeIntegrator] | ||
type = NewmarkBeta | ||
[] | ||
[] | ||
|
||
[Outputs] | ||
[./out] | ||
type = Exodus | ||
output_material_properties = true | ||
show_material_properties = 'a_value a_dot a_dot_dot a_dot_du a_dot_dot_du' | ||
[../] | ||
[] |