www.mooseframework.org
peridynamics
src
postprocessors
NodalDisplacementDifferenceL2NormPD.C
Go to the documentation of this file.
1
//* This file is part of the MOOSE framework
2
//* https://www.mooseframework.org
3
//*
4
//* All rights reserved, see COPYRIGHT for full restrictions
5
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6
//*
7
//* Licensed under LGPL 2.1, please see LICENSE for details
8
//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10
#include "
NodalDisplacementDifferenceL2NormPD.h
"
11
#include "MooseVariable.h"
12
#include "Function.h"
13
14
registerMooseObject
(
"PeridynamicsApp"
,
NodalDisplacementDifferenceL2NormPD
);
15
16
template
<>
17
InputParameters
18
validParams<NodalDisplacementDifferenceL2NormPD>
()
19
{
20
InputParameters params =
validParams<NodalIntegralPostprocessorBasePD>
();
21
params.addClassDescription(
"Class for computing the L2 norm of the difference between "
22
"displacements and their analytic solutions"
);
23
24
params.addRequiredParam<std::vector<FunctionName>>(
25
"analytic_functions"
,
"The known analytic functions for displacements"
);
26
params.addRequiredParam<std::vector<NonlinearVariableName>>(
27
"displacements"
,
"Nonlinear variable name for the displacements"
);
28
29
return
params;
30
}
31
32
NodalDisplacementDifferenceL2NormPD::NodalDisplacementDifferenceL2NormPD
(
33
const
InputParameters & parameters)
34
:
NodalIntegralPostprocessorBasePD
(parameters)
35
{
36
const
std::vector<NonlinearVariableName> & nl_vnames(
37
getParam<std::vector<NonlinearVariableName>>(
"displacements"
));
38
39
const
std::vector<FunctionName> & func_names(
40
getParam<std::vector<FunctionName>>(
"analytic_functions"
));
41
42
_n_disps
= nl_vnames.size();
43
if
(
_n_disps
>
_dim
)
44
mooseError(
"Number of displacements components should not greater than problem dimension!"
);
45
46
if
(
_n_disps
!= func_names.size())
47
mooseError(
"Number of analytic_functions components should be the same as the number of "
48
"displacements components!"
);
49
50
for
(
unsigned
int
i = 0; i <
_n_disps
; ++i)
51
{
52
_disp_var
.push_back(&_subproblem.getStandardVariable(_tid, nl_vnames[i]));
53
_funcs
.push_back(&getFunctionByName(func_names[i]));
54
}
55
}
56
57
Real
58
NodalDisplacementDifferenceL2NormPD::getValue
()
59
{
60
return
std::sqrt(
NodalIntegralPostprocessorBasePD::getValue
());
61
}
62
63
Real
64
NodalDisplacementDifferenceL2NormPD::computeNodalValue
()
65
{
66
Real diff = 0;
67
for
(
unsigned
int
i = 0; i <
_n_disps
; ++i)
68
diff += (
_disp_var
[i]->getNodalValue(*_current_node) -
_funcs
[i]->value(_t, *_current_node)) *
69
(
_disp_var
[i]->getNodalValue(*_current_node) -
_funcs
[i]->value(_t, *_current_node));
70
71
return
diff;
72
}
NodalDisplacementDifferenceL2NormPD::_disp_var
std::vector< MooseVariable * > _disp_var
Definition:
NodalDisplacementDifferenceL2NormPD.h:35
NodalDisplacementDifferenceL2NormPD::_funcs
std::vector< const Function * > _funcs
Known analytic displacement functions.
Definition:
NodalDisplacementDifferenceL2NormPD.h:38
NodalDisplacementDifferenceL2NormPD::computeNodalValue
virtual Real computeNodalValue() override
Function to evaluate the given function at each material point.
Definition:
NodalDisplacementDifferenceL2NormPD.C:64
NodalDisplacementDifferenceL2NormPD::getValue
virtual Real getValue() override
Definition:
NodalDisplacementDifferenceL2NormPD.C:58
NodalDisplacementDifferenceL2NormPD
Postprocessor class to compute L2 norm of displacements difference between prediction and analytical ...
Definition:
NodalDisplacementDifferenceL2NormPD.h:23
validParams< NodalDisplacementDifferenceL2NormPD >
InputParameters validParams< NodalDisplacementDifferenceL2NormPD >()
Definition:
NodalDisplacementDifferenceL2NormPD.C:18
NodalIntegralPostprocessorBasePD::getValue
virtual Real getValue() override
Definition:
NodalIntegralPostprocessorBasePD.C:41
validParams< NodalIntegralPostprocessorBasePD >
InputParameters validParams< NodalIntegralPostprocessorBasePD >()
Definition:
NodalIntegralPostprocessorBasePD.C:14
registerMooseObject
registerMooseObject("PeridynamicsApp", NodalDisplacementDifferenceL2NormPD)
NodalPostprocessorBasePD::_dim
const unsigned int _dim
Mesh dimension.
Definition:
NodalPostprocessorBasePD.h:34
NodalDisplacementDifferenceL2NormPD::NodalDisplacementDifferenceL2NormPD
NodalDisplacementDifferenceL2NormPD(const InputParameters ¶meters)
Definition:
NodalDisplacementDifferenceL2NormPD.C:32
NodalDisplacementDifferenceL2NormPD.h
NodalIntegralPostprocessorBasePD
Postprocessor class to compute a volume integral of the specified variable Note that specializations ...
Definition:
NodalIntegralPostprocessorBasePD.h:24
NodalDisplacementDifferenceL2NormPD::_n_disps
unsigned int _n_disps
Displacement variables.
Definition:
NodalDisplacementDifferenceL2NormPD.h:34
Generated on Sat Jan 25 2020 12:04:38 for www.mooseframework.org by
1.8.16