Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
b6c5fc0a
Commit
b6c5fc0a
authored
Feb 05, 2019
by
Andrew Heather
Browse files
ENH: Added checks for input Reynolds stresses based on Lund coefficient constraints. Fixes
#1124
parent
edfd27f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.C
View file @
b6c5fc0a
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-201
7
OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-201
9
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -854,6 +854,8 @@ turbulentDFSEMInletFvPatchVectorField
{
eddy
::
debug
=
debug
;
checkStresses
(
R_
);
// Set UMean as patch area average value
UMean_
=
gSum
(
U_
*
patch
().
magSf
())
/
(
gSum
(
patch
().
magSf
())
+
ROOTVSMALL
);
}
...
...
@@ -946,14 +948,74 @@ turbulentDFSEMInletFvPatchVectorField
{}
// * * * * * * * * * * * * * * *
* Destructor * *
* * * * * * * * * * * * * //
// * * * * * * * * * * * * * * *
Member Functions
* * * * * * * * * * * * * //
Foam
::
turbulentDFSEMInletFvPatchVectorField
::~
turbulentDFSEMInletFvPatchVectorField
()
{}
bool
Foam
::
turbulentDFSEMInletFvPatchVectorField
::
checkStresses
(
const
symmTensorField
&
Rf
)
{
// Perform checks based on constraints imposed by Lund coefficients
// a11..a33
for
(
const
symmTensor
&
R
:
Rf
)
{
if
(
R
.
xx
()
<=
0
)
{
FatalErrorInFunction
<<
"Reynold stress "
<<
R
<<
" does not obey the Lund coefficient constraint: "
<<
"R.xx() > 0"
<<
exit
(
FatalError
);
}
scalar
a11
=
sqrt
(
R
.
xx
());
scalar
a21
=
R
.
xy
()
/
a11
;
scalar
a22_2
=
R
.
yy
()
-
sqr
(
a21
);
if
(
a22_2
<
0
)
{
FatalErrorInFunction
<<
"Reynold stress "
<<
R
<<
" does not obey the Lund coefficient constraint: "
<<
"R.yy() - sqr(a21) >= 0"
<<
exit
(
FatalError
);
}
scalar
a22
=
Foam
::
sqrt
(
a22_2
);
scalar
a31
=
R
.
xz
()
/
a11
;
scalar
a32
=
(
R
.
yz
()
-
a21
*
a31
)
*
a22
;
scalar
a33_2
=
R
.
zz
()
-
sqr
(
a31
)
-
sqr
(
a32
);
if
(
a33_2
<
0
)
{
FatalErrorInFunction
<<
"Reynold stress "
<<
R
<<
" does not obey the Lund coefficient constraint: "
<<
"R.zz() - sqr(a31) - sqr(a32) >= 0"
<<
exit
(
FatalError
);
}
scalar
a33
=
Foam
::
sqrt
(
a33_2
);
if
(
debug
)
{
Pout
<<
"R: "
<<
R
<<
" a11:"
<<
a11
<<
" a21:"
<<
a21
<<
" a31:"
<<
a31
<<
" a21:"
<<
a22
<<
" a32:"
<<
a32
<<
" a33:"
<<
a33
<<
endl
;
}
}
return
true
;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void
Foam
::
turbulentDFSEMInletFvPatchVectorField
::
autoMap
(
...
...
src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/turbulentDFSEMInletFvPatchVectorField.H
View file @
b6c5fc0a
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016
-2019
OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -329,11 +329,16 @@ public:
);
}
virtual
~
turbulentDFSEMInletFvPatchVectorField
();
//- Destructor
virtual
~
turbulentDFSEMInletFvPatchVectorField
()
=
default
;
// Member functions
//- Helper function to check that Reynold stresses are valid
static
bool
checkStresses
(
const
symmTensorField
&
Rf
);
// Mapping functions
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment