https://mooseframework.inl.gov
Loading...
Searching...
No Matches
peridynamics
src
postprocessors
NodalDisplacementDifferenceL2NormPD.C
Go to the documentation of this file.
1
//* This file is part of the MOOSE framework
2
//* https://mooseframework.inl.gov
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
InputParameters
17
NodalDisplacementDifferenceL2NormPD::validParams
()
18
{
19
InputParameters
params =
NodalIntegralPostprocessorBasePD::validParams
();
20
params.
addClassDescription
(
"Class for computing the L2 norm of the difference between "
21
"displacements and their analytic solutions"
);
22
23
params.
addRequiredParam
<std::vector<FunctionName>>(
24
"analytic_functions"
,
"The known analytic functions for displacements"
);
25
params.
addRequiredParam
<std::vector<NonlinearVariableName>>(
26
"displacements"
,
"Nonlinear variable name for the displacements"
);
27
28
return
params;
29
}
30
31
NodalDisplacementDifferenceL2NormPD::NodalDisplacementDifferenceL2NormPD
(
32
const
InputParameters
& parameters)
33
:
NodalIntegralPostprocessorBasePD
(parameters)
34
{
35
const
std::vector<NonlinearVariableName> & nl_vnames(
36
getParam
<std::vector<NonlinearVariableName>>(
"displacements"
));
37
38
const
std::vector<FunctionName> & func_names(
39
getParam
<std::vector<FunctionName>>(
"analytic_functions"
));
40
41
_n_disps
= nl_vnames.size();
42
if
(
_n_disps
>
_dim
)
43
mooseError
(
"Number of displacements components should not greater than problem dimension!"
);
44
45
if
(
_n_disps
!= func_names.size())
46
mooseError
(
"Number of analytic_functions components should be the same as the number of "
47
"displacements components!"
);
48
49
for
(
unsigned
int
i = 0; i <
_n_disps
; ++i)
50
{
51
_disp_var
.push_back(&
_subproblem
.
getStandardVariable
(
_tid
, nl_vnames[i]));
52
_funcs
.push_back(&
getFunctionByName
(func_names[i]));
53
}
54
}
55
56
Real
57
NodalDisplacementDifferenceL2NormPD::getValue
()
const
58
{
59
return
std::sqrt(
NodalIntegralPostprocessorBasePD::getValue
());
60
}
61
62
Real
63
NodalDisplacementDifferenceL2NormPD::computeNodalValue
()
64
{
65
Real diff = 0;
66
for
(
unsigned
int
i = 0; i <
_n_disps
; ++i)
67
diff += (
_disp_var
[i]->getNodalValue(*
_current_node
) -
_funcs
[i]->value(
_t
, *
_current_node
)) *
68
(
_disp_var
[i]->getNodalValue(*
_current_node
) -
_funcs
[i]->value(
_t
, *
_current_node
));
69
70
return
diff;
71
}
Function.h
MooseVariable.h
registerMooseObject
registerMooseObject("PeridynamicsApp", NodalDisplacementDifferenceL2NormPD)
NodalDisplacementDifferenceL2NormPD.h
NodalPostprocessor::getFunctionByName
const Function & getFunctionByName(const FunctionName &name) const
InputParameters::addRequiredParam
void addRequiredParam(const std::string &name, const std::string &doc_string)
InputParameters::addClassDescription
void addClassDescription(const std::string &doc_string)
NodalPostprocessor::mooseError
void mooseError(Args &&... args) const
NodalPostprocessor::getParam
const T & getParam(const std::string &name) const
NodalDisplacementDifferenceL2NormPD
Postprocessor class to compute L2 norm of displacements difference between prediction and analytical ...
Definition
NodalDisplacementDifferenceL2NormPD.h:19
NodalDisplacementDifferenceL2NormPD::computeNodalValue
virtual Real computeNodalValue() override
Function to evaluate the given function at each material point.
Definition
NodalDisplacementDifferenceL2NormPD.C:63
NodalDisplacementDifferenceL2NormPD::getValue
virtual Real getValue() const override
Definition
NodalDisplacementDifferenceL2NormPD.C:57
NodalDisplacementDifferenceL2NormPD::NodalDisplacementDifferenceL2NormPD
NodalDisplacementDifferenceL2NormPD(const InputParameters ¶meters)
Definition
NodalDisplacementDifferenceL2NormPD.C:31
NodalDisplacementDifferenceL2NormPD::_n_disps
unsigned int _n_disps
Displacement variables.
Definition
NodalDisplacementDifferenceL2NormPD.h:31
NodalDisplacementDifferenceL2NormPD::_funcs
std::vector< const Function * > _funcs
Known analytic displacement functions.
Definition
NodalDisplacementDifferenceL2NormPD.h:35
NodalDisplacementDifferenceL2NormPD::validParams
static InputParameters validParams()
Definition
NodalDisplacementDifferenceL2NormPD.C:17
NodalDisplacementDifferenceL2NormPD::_disp_var
std::vector< MooseVariable * > _disp_var
Definition
NodalDisplacementDifferenceL2NormPD.h:32
NodalIntegralPostprocessorBasePD
Postprocessor class to compute a volume integral of the specified variable Note that specializations ...
Definition
NodalIntegralPostprocessorBasePD.h:20
NodalIntegralPostprocessorBasePD::getValue
virtual Real getValue() const override
Definition
NodalIntegralPostprocessorBasePD.C:40
NodalIntegralPostprocessorBasePD::validParams
static InputParameters validParams()
Definition
NodalIntegralPostprocessorBasePD.C:13
NodalPostprocessorBasePD::_dim
const unsigned int _dim
Mesh dimension.
Definition
NodalPostprocessorBasePD.h:32
NodalPostprocessor::_current_node
const Node *const & _current_node
SubProblem::getStandardVariable
virtual MooseVariable & getStandardVariable(const THREAD_ID tid, const std::string &var_name)=0
NodalPostprocessor::_t
Real & _t
NodalPostprocessor::_subproblem
SubProblem & _subproblem
NodalPostprocessor::_tid
const THREAD_ID _tid
InputParameters
Generated on Fri Aug 21 2026 13:41:19 for https://mooseframework.inl.gov by
1.9.8