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
14e6b198
Commit
14e6b198
authored
Jan 31, 2019
by
mattijs
Browse files
ENH: checkMesh: write correct faceWeights. Fixes
#1099
.
parent
1370060d
Changes
1
Hide whitespace changes
Inline
Side-by-side
applications/utilities/mesh/manipulation/checkMesh/writeFields.C
View file @
14e6b198
#include
"writeFields.H"
#include
"volFields.H"
#include
"surfaceFields.H"
#include
"polyMeshTools.H"
#include
"zeroGradientFvPatchFields.H"
#include
"syncTools.H"
...
...
@@ -68,6 +69,52 @@ void minFaceToCell
}
void
minFaceToCell
(
const
surfaceScalarField
&
faceData
,
volScalarField
&
cellData
,
const
bool
correctBoundaryConditions
)
{
scalarField
&
cellFld
=
cellData
.
ref
();
cellFld
=
GREAT
;
const
labelUList
&
own
=
cellData
.
mesh
().
owner
();
const
labelUList
&
nei
=
cellData
.
mesh
().
neighbour
();
// Internal faces
forAll
(
own
,
facei
)
{
cellFld
[
own
[
facei
]]
=
min
(
cellFld
[
own
[
facei
]],
faceData
[
facei
]);
cellFld
[
nei
[
facei
]]
=
min
(
cellFld
[
nei
[
facei
]],
faceData
[
facei
]);
}
// Patch faces
forAll
(
faceData
.
boundaryField
(),
patchi
)
{
const
fvsPatchScalarField
&
fvp
=
faceData
.
boundaryField
()[
patchi
];
const
labelUList
&
fc
=
fvp
.
patch
().
faceCells
();
forAll
(
fc
,
i
)
{
cellFld
[
fc
[
i
]]
=
min
(
cellFld
[
fc
[
i
]],
fvp
[
i
]);
}
}
volScalarField
::
Boundary
&
bfld
=
cellData
.
boundaryFieldRef
();
forAll
(
bfld
,
patchi
)
{
bfld
[
patchi
]
=
faceData
.
boundaryField
()[
patchi
];
}
if
(
correctBoundaryConditions
)
{
cellData
.
correctBoundaryConditions
();
}
}
void
Foam
::
writeFields
(
const
fvMesh
&
mesh
,
...
...
@@ -112,7 +159,8 @@ void Foam::writeFields
mesh
.
time
().
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
IOobject
::
AUTO_WRITE
,
false
),
mesh
,
dimensionedScalar
(
dimless
,
Zero
),
...
...
@@ -127,17 +175,6 @@ void Foam::writeFields
if
(
selectedFields
.
found
(
"faceWeight"
))
{
const
scalarField
faceWeights
(
polyMeshTools
::
faceWeights
(
mesh
,
mesh
.
faceCentres
(),
mesh
.
faceAreas
(),
mesh
.
cellCentres
()
)
);
volScalarField
cellWeights
(
IOobject
...
...
@@ -146,14 +183,20 @@ void Foam::writeFields
mesh
.
time
().
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
IOobject
::
AUTO_WRITE
,
false
),
mesh
,
dimensionedScalar
(
dimless
,
Zero
),
calculatedFvPatchScalarField
::
typeName
wordList
// wanted bc types
(
mesh
.
boundary
().
size
(),
calculatedFvPatchScalarField
::
typeName
),
mesh
.
weights
().
boundaryField
().
types
()
// current bc types
);
//- Take min
minFaceToCell
(
faceW
eights
,
cellWeights
);
minFaceToCell
(
mesh
.
w
eights
()
,
cellWeights
,
false
);
Info
<<
" Writing face interpolation weights (0..0.5) to "
<<
cellWeights
.
name
()
<<
endl
;
cellWeights
.
write
();
...
...
@@ -187,7 +230,8 @@ void Foam::writeFields
mesh
.
time
().
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
IOobject
::
AUTO_WRITE
,
false
),
mesh
,
dimensionedScalar
(
dimless
,
Zero
),
...
...
@@ -346,7 +390,8 @@ void Foam::writeFields
mesh
.
time
().
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
IOobject
::
AUTO_WRITE
,
false
),
mesh
,
dimensionedScalar
(
dimless
,
Zero
),
...
...
@@ -435,7 +480,8 @@ void Foam::writeFields
mesh
.
time
().
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
IOobject
::
AUTO_WRITE
,
false
),
mesh
,
dimensionedScalar
(
dimless
,
Zero
),
...
...
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