snappyHexMeshConfig: fix bounds of the background mesh without adjustment
when using the '-bounds' option
This commit is contained in:
@ -53,7 +53,10 @@ bool Foam::blockMeshCylindricalConfiguration::isBoundBoxOnZaxis()
|
|||||||
return mag(bbMidNorm.x()) < rootSmall && mag(bbMidNorm.y()) < rootSmall;
|
return mag(bbMidNorm.x()) < rootSmall && mag(bbMidNorm.y()) < rootSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Foam::blockMeshCylindricalConfiguration::calcBlockMeshDict()
|
void Foam::blockMeshCylindricalConfiguration::calcBlockMeshDict
|
||||||
|
(
|
||||||
|
const bool& boundsOpt
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// Set nCells as a vector: (boxCells radialCells zCells)
|
// Set nCells as a vector: (boxCells radialCells zCells)
|
||||||
label boxCells = nCells_.x();
|
label boxCells = nCells_.x();
|
||||||
@ -74,6 +77,9 @@ void Foam::blockMeshCylindricalConfiguration::calcBlockMeshDict()
|
|||||||
|
|
||||||
// Size the bounding box
|
// Size the bounding box
|
||||||
const scalar roundFactor = roundingScale(0.01*bb_.minDim());
|
const scalar roundFactor = roundingScale(0.01*bb_.minDim());
|
||||||
|
|
||||||
|
if(!boundsOpt)
|
||||||
|
{
|
||||||
const scalar expansion = 1.0/(Foam::cos(degToRad(45.0/nCells_.x())));
|
const scalar expansion = 1.0/(Foam::cos(degToRad(45.0/nCells_.x())));
|
||||||
|
|
||||||
const vector scaling(expansion, expansion, 1);
|
const vector scaling(expansion, expansion, 1);
|
||||||
@ -85,9 +91,9 @@ void Foam::blockMeshCylindricalConfiguration::calcBlockMeshDict()
|
|||||||
// Round the bounding box
|
// Round the bounding box
|
||||||
roundBoundingBox(bb_, roundFactor);
|
roundBoundingBox(bb_, roundFactor);
|
||||||
roundBoundingBox(rzbb_, roundFactor);
|
roundBoundingBox(rzbb_, roundFactor);
|
||||||
|
}
|
||||||
|
|
||||||
radBox_ = ceil(0.3*rzbb_.max().x()/roundFactor)*roundFactor;
|
radBox_ = ceil(0.3*rzbb_.max().x()/roundFactor)*roundFactor;
|
||||||
|
|
||||||
nCells_ *= refineFactor_;
|
nCells_ *= refineFactor_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,6 +409,7 @@ Foam::blockMeshCylindricalConfiguration::blockMeshCylindricalConfiguration
|
|||||||
const fileName& dir,
|
const fileName& dir,
|
||||||
const Time& time,
|
const Time& time,
|
||||||
const meshingSurfaceList& surfaces,
|
const meshingSurfaceList& surfaces,
|
||||||
|
const bool& boundsOpt,
|
||||||
const Vector<label>& nCells,
|
const Vector<label>& nCells,
|
||||||
const label refineFactor,
|
const label refineFactor,
|
||||||
const HashTable<Pair<word>>& patchOpts,
|
const HashTable<Pair<word>>& patchOpts,
|
||||||
@ -438,7 +445,7 @@ Foam::blockMeshCylindricalConfiguration::blockMeshCylindricalConfiguration
|
|||||||
rzbb_.max() = factor*bb_.max();
|
rzbb_.max() = factor*bb_.max();
|
||||||
}
|
}
|
||||||
|
|
||||||
calcBlockMeshDict();
|
calcBlockMeshDict(boundsOpt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -81,7 +81,7 @@ class blockMeshCylindricalConfiguration
|
|||||||
bool isBoundBoxOnZaxis();
|
bool isBoundBoxOnZaxis();
|
||||||
|
|
||||||
//- Calculate the parameters for the blockMeshDict file
|
//- Calculate the parameters for the blockMeshDict file
|
||||||
void calcBlockMeshDict();
|
void calcBlockMeshDict(const bool& boundsOpt);
|
||||||
|
|
||||||
//- Write backgroundMesh sub-dictionary
|
//- Write backgroundMesh sub-dictionary
|
||||||
void writeBackgroundMesh();
|
void writeBackgroundMesh();
|
||||||
@ -142,6 +142,7 @@ public:
|
|||||||
const fileName& dir,
|
const fileName& dir,
|
||||||
const Time& time,
|
const Time& time,
|
||||||
const meshingSurfaceList& surfaces,
|
const meshingSurfaceList& surfaces,
|
||||||
|
const bool& boundsOpt,
|
||||||
const Vector<label>& nCells,
|
const Vector<label>& nCells,
|
||||||
const label refineFactor,
|
const label refineFactor,
|
||||||
const HashTable<Pair<word>>& patchOpts,
|
const HashTable<Pair<word>>& patchOpts,
|
||||||
|
|||||||
@ -521,6 +521,7 @@ int main(int argc, char *argv[])
|
|||||||
runTime.system(),
|
runTime.system(),
|
||||||
runTime,
|
runTime,
|
||||||
surfaces,
|
surfaces,
|
||||||
|
args.optionFound("bounds"),
|
||||||
nCells,
|
nCells,
|
||||||
refineFactor,
|
refineFactor,
|
||||||
patchOpts,
|
patchOpts,
|
||||||
|
|||||||
Reference in New Issue
Block a user