https://mooseframework.inl.gov
Loading...
Searching...
No Matches
src
meshmodifiers
ActivateElementsByPath.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 "
ActivateElementsByPath.h
"
11
#include "libmesh/point.h"
12
13
registerMooseObject
(
"MooseApp"
,
ActivateElementsByPath
);
14
15
InputParameters
16
ActivateElementsByPath::validParams
()
17
{
18
InputParameters
params =
ActivateElementsUserObjectBase::validParams
();
19
20
params.
addParam
<FunctionName>(
21
"function_x"
,
"0"
,
"The x component of the heating spot travel path"
);
22
params.
addParam
<FunctionName>(
23
"function_y"
,
"0"
,
"The y component of the heating spot travel path"
);
24
params.
addParam
<FunctionName>(
25
"function_z"
,
"0"
,
"The z component of the heating spot travel path"
);
26
params.
addParam
<Real>(
"activate_distance"
,
27
1e-4,
28
"The maximum distance of the activated element to the point on the path."
);
29
return
params;
30
}
31
32
ActivateElementsByPath::ActivateElementsByPath
(
const
InputParameters
& parameters)
33
:
ActivateElementsUserObjectBase
(parameters),
34
_function_x(isParamValid(
"function_x"
) ? &getFunction(
"function_x"
) : nullptr),
35
_function_y(isParamValid(
"function_y"
) ? &getFunction(
"function_y"
) : nullptr),
36
_function_z(isParamValid(
"function_z"
) ? &getFunction(
"function_z"
) : nullptr),
37
_activate_distance(
38
declareRestartableData<Real>(
"activate_distance"
, getParam<Real>(
"activate_distance"
)))
39
{
40
}
41
42
bool
43
ActivateElementsByPath::isElementActivated
()
44
{
45
// activate center (assume position of the activate center is only time dependent)
46
const
static
Point dummy;
47
Real x_t =
_function_x
?
_function_x
->
value
(
_t
, dummy) : 0.0;
48
Real y_t =
_function_y
?
_function_y
->
value
(
_t
, dummy) : 0.0;
49
Real z_t =
_function_z
?
_function_z
->
value
(
_t
, dummy) : 0.0;
50
51
// activate element when element is close to the point
52
Real
distance
= (
_current_elem
->vertex_average() - Point(x_t, y_t, z_t)).norm();
53
if
(
distance
<
_activate_distance
)
54
return
true
;
55
else
56
return
false
;
57
}
registerMooseObject
registerMooseObject("MooseApp", ActivateElementsByPath)
ActivateElementsByPath.h
ActivateElementsByPath
Definition
ActivateElementsByPath.h:16
ActivateElementsByPath::_activate_distance
const Real _activate_distance
define the distance of the element to the point on the path, below which the element will be activate...
Definition
ActivateElementsByPath.h:31
ActivateElementsByPath::isElementActivated
virtual bool isElementActivated() override
Definition
ActivateElementsByPath.C:43
ActivateElementsByPath::_function_x
const Function * _function_x
path of the heat source, x, y, z components
Definition
ActivateElementsByPath.h:26
ActivateElementsByPath::_function_y
const Function * _function_y
Definition
ActivateElementsByPath.h:27
ActivateElementsByPath::validParams
static InputParameters validParams()
Definition
ActivateElementsByPath.C:16
ActivateElementsByPath::ActivateElementsByPath
ActivateElementsByPath(const InputParameters ¶meters)
Definition
ActivateElementsByPath.C:32
ActivateElementsByPath::_function_z
const Function * _function_z
Definition
ActivateElementsByPath.h:28
ActivateElementsUserObjectBase
Definition
ActivateElementsUserObjectBase.h:17
ActivateElementsUserObjectBase::validParams
static InputParameters validParams()
Definition
ActivateElementsUserObjectBase.C:23
ElementUserObject::_current_elem
const Elem *const & _current_elem
The current element pointer (available during execute())
Definition
ElementUserObject.h:44
Function::value
virtual Real value(Real t, const Point &p) const
Override this to evaluate the scalar function at point (t,x,y,z), by default this returns zero,...
Definition
Function.C:30
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition
InputParameters.h:68
InputParameters::addParam
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
Definition
InputParameters.h:1832
TransientInterface::_t
Real & _t
Time.
Definition
TransientInterface.h:70
distance
Real distance(const Point &p)
Generated on Mon Aug 24 2026 19:02:11 for https://mooseframework.inl.gov by
1.9.8