OpenFOAM: API Guide
v2006
The open source CFD toolbox
exprDriverOps.H
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | www.openfoam.com
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
Copyright (C) 2019 OpenCFD Ltd.
9
-------------------------------------------------------------------------------
10
License
11
This file is part of OpenFOAM.
12
13
OpenFOAM is free software: you can redistribute it and/or modify it
14
under the terms of the GNU General Public License as published by
15
the Free Software Foundation, either version 3 of the License, or
16
(at your option) any later version.
17
18
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21
for more details.
22
23
You should have received a copy of the GNU General Public License
24
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26
Namespace
27
Foam::expressions::exprDriverOps
28
29
Description
30
Miscellaneous operations used in combination with the
31
expressions::exprDriver
32
33
SourceFiles
34
exprDriverOps.H
35
36
\*---------------------------------------------------------------------------*/
37
38
#ifndef expressions_exprDriverOps_H
39
#define expressions_exprDriverOps_H
40
41
#include "
scalarOps.H
"
42
#include "
FieldOps.H
"
43
44
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46
namespace
Foam
47
{
48
namespace
expressions
49
{
50
namespace
exprDriverOps
51
{
52
53
/*---------------------------------------------------------------------------*\
54
Namespace exprDriverOps Declarations
55
\*---------------------------------------------------------------------------*/
56
57
//- A modulo operation similar to that used in swak4foam
58
// This operation produces values in the -1/2 to +1/2 range.
59
struct
swakModuloOp
60
{
61
scalar
operator()
(
const
scalar& a,
const
scalar&
b
)
const
62
{
63
if
(
Foam::mag
(
b
) < ROOTVSMALL)
64
{
65
return
0;
66
}
67
68
const
scalar val = std::fmod(a,
b
);
69
70
if
(
Foam::mag
(val) > (0.5*
b
))
71
{
72
if
(val > 0)
73
{
74
return
(val -
b
);
75
}
76
else
77
{
78
return
(val +
b
);
79
}
80
}
81
82
return
val;
83
}
84
};
85
86
87
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88
89
}
// End namespace exprDriverOps
90
}
// End namespace expressions
91
}
// End namespace Foam
92
93
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94
95
#endif
96
97
// ************************************************************************* //
FieldOps.H
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition:
createFields.H:27
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:33
scalarOps.H
Functors that are scalar-specific.
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::expressions::exprDriverOps::swakModuloOp::operator()
scalar operator()(const scalar &a, const scalar &b) const
Definition:
exprDriverOps.H:61
Foam::expressions::exprDriverOps::swakModuloOp
A modulo operation similar to that used in swak4foam.
Definition:
exprDriverOps.H:59
src
OpenFOAM
expressions
exprDriver
exprDriverOps.H
Generated by
1.8.17
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.