mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
Refinement:
-----------
// Optionally avoid patch merging - keeps hexahedral cells
// (to be used with automatic refinement/unrefinement)
//mergePatchFaces off;
// Optional multiple locationsInMesh with corresponding optional cellZone
// (automatically generates faceZones inbetween)
locationsInMesh
(
((-0.09 -0.039 -0.049) bottomAir) // cellZone bottomAir
((-0.09 0.009 -0.049) topAir) // cellZone topAir
);
// Optional faceType and patchType specification for these faceZones
faceZoneControls
{
bottomAir_to_topAir
{
faceType baffle;
}
}
/ Optional checking of 'bleeding' of mesh through a specifying a locations
// outside the mesh
locationsOutsideMesh ((0 0 0)(12.3 101.17 3.98));
// Improved refinement: refine all cells with all (or all but one) sides refined
// Improved refinement: refine all cells with opposing faces with different
// refinement level. These cells can happen on multiply curved surfaces.
// Default on, can be switched off with
//interfaceRefine false;
Snapping
--------
// Optional smoothing of points at refinement interfaces. This will reduce
// the non-orthogonality at refinement interfaces.
//nSmoothInternal $nSmoothPatch;
Layering
--------
// Layers can be added to patches or to any side of a faceZone.
// (Any faceZone internally gets represented as two patches)
// The angle to merge patch faces can be set independently of the
// featureAngle. This is especially useful for large feature angles
// Default is the same as the featureAngle.
//mergePatchFacesAngle 45;
// Optional mesh shrinking type 'displacementMotionSolver'. It uses any
// displacementMotionSolver, e.g. displacementSBRStress
// (default is the medial-axis algorithm, 'displacementMedialAxis')
//meshShrinker displacementMotionSolver;
104 lines
3.2 KiB
C
104 lines
3.2 KiB
C
/*---------------------------------------------------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration |
|
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
|
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
|
-------------------------------------------------------------------------------
|
|
License
|
|
This file is part of OpenFOAM.
|
|
|
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
|
|
|
template <class Type>
|
|
void Foam::fieldSmoother::minSmoothField
|
|
(
|
|
const label nIter,
|
|
const PackedBoolList& isPatchMasterPoint,
|
|
const PackedBoolList& isPatchMasterEdge,
|
|
const indirectPrimitivePatch& adaptPatch,
|
|
const scalarField& fieldMinMag,
|
|
Field<Type>& field
|
|
) const
|
|
{
|
|
const edgeList& edges = adaptPatch.edges();
|
|
const labelList& meshPoints = adaptPatch.meshPoints();
|
|
|
|
scalarField edgeWeights(edges.size());
|
|
scalarField invSumWeight(meshPoints.size());
|
|
meshRefinement::calculateEdgeWeights
|
|
(
|
|
mesh_,
|
|
isPatchMasterEdge,
|
|
meshPoints,
|
|
edges,
|
|
edgeWeights,
|
|
invSumWeight
|
|
);
|
|
|
|
// Get smoothly varying patch field.
|
|
Info<< typeName << " : Smoothing field ..." << endl;
|
|
|
|
for (label iter = 0; iter < nIter; iter++)
|
|
{
|
|
Field<Type> average(adaptPatch.nPoints());
|
|
meshRefinement::weightedSum
|
|
(
|
|
mesh_,
|
|
isPatchMasterEdge,
|
|
meshPoints,
|
|
edges,
|
|
edgeWeights,
|
|
field,
|
|
average
|
|
);
|
|
average *= invSumWeight;
|
|
|
|
// Transfer to field
|
|
forAll(field, pointI)
|
|
{
|
|
//full smoothing neighbours + point value
|
|
average[pointI] = 0.5*(field[pointI]+average[pointI]);
|
|
|
|
// perform monotonic smoothing
|
|
if
|
|
(
|
|
mag(average[pointI]) < mag(field[pointI])
|
|
&& mag(average[pointI]) >= mag(fieldMinMag[pointI])
|
|
)
|
|
{
|
|
field[pointI] = average[pointI];
|
|
}
|
|
}
|
|
|
|
// Do residual calculation every so often.
|
|
if ((iter % 10) == 0)
|
|
{
|
|
scalar resid = meshRefinement::gAverage
|
|
(
|
|
isPatchMasterPoint,
|
|
mag(field-average)()
|
|
);
|
|
Info<< " Iteration " << iter << " residual " << resid << endl;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// ************************************************************************* //
|