mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-wallDistanceCalcInterval' into 'develop'
ENH: wallDist - added option to evaluate every XXX steps
Added functionality to update the wall distance every XXX steps
Note: only applies to movePoints() - topology change bypasses the update interval and triggers a re-calculation
Syntax:
```
wallDist
{
method ...
updateInterval 5; // optional - default is 1
}
```
Test case: [mixerVesselAMI2D.tgz](/uploads/c0bee1decc0337018272f3566b6a4416/mixerVesselAMI2D.tgz)
See merge request !62
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -98,7 +98,13 @@ Foam::wallDist::wallDist(const fvMesh& mesh, const word& patchTypeName)
|
|||||||
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
|
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
|
||||||
.lookupOrDefault<Switch>("nRequired", false)
|
.lookupOrDefault<Switch>("nRequired", false)
|
||||||
),
|
),
|
||||||
n_(volVectorField::null())
|
n_(volVectorField::null()),
|
||||||
|
updateInterval_
|
||||||
|
(
|
||||||
|
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
|
||||||
|
.lookupOrDefault<label>("updateInterval", 1)
|
||||||
|
),
|
||||||
|
requireUpdate_(true)
|
||||||
{
|
{
|
||||||
if (nRequired_)
|
if (nRequired_)
|
||||||
{
|
{
|
||||||
@ -146,7 +152,13 @@ Foam::wallDist::wallDist
|
|||||||
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
|
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
|
||||||
.lookupOrDefault<Switch>("nRequired", false)
|
.lookupOrDefault<Switch>("nRequired", false)
|
||||||
),
|
),
|
||||||
n_(volVectorField::null())
|
n_(volVectorField::null()),
|
||||||
|
updateInterval_
|
||||||
|
(
|
||||||
|
static_cast<const fvSchemes&>(mesh).subDict(patchTypeName_ & "Dist")
|
||||||
|
.lookupOrDefault<label>("updateInterval", 1)
|
||||||
|
),
|
||||||
|
requireUpdate_(true)
|
||||||
{
|
{
|
||||||
if (nRequired_)
|
if (nRequired_)
|
||||||
{
|
{
|
||||||
@ -185,8 +197,21 @@ const Foam::volVectorField& Foam::wallDist::n() const
|
|||||||
|
|
||||||
bool Foam::wallDist::movePoints()
|
bool Foam::wallDist::movePoints()
|
||||||
{
|
{
|
||||||
if (pdm_->movePoints())
|
if
|
||||||
|
(
|
||||||
|
(updateInterval_ != 0)
|
||||||
|
&& ((mesh_.time().timeIndex() % updateInterval_) == 0)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
requireUpdate_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requireUpdate_ && pdm_->movePoints())
|
||||||
|
{
|
||||||
|
DebugInfo<< "Updating wall distance" << endl;
|
||||||
|
|
||||||
|
requireUpdate_ = false;
|
||||||
|
|
||||||
if (nRequired_)
|
if (nRequired_)
|
||||||
{
|
{
|
||||||
return pdm_->correct(y_, n_.ref());
|
return pdm_->correct(y_, n_.ref());
|
||||||
@ -206,6 +231,12 @@ bool Foam::wallDist::movePoints()
|
|||||||
void Foam::wallDist::updateMesh(const mapPolyMesh& mpm)
|
void Foam::wallDist::updateMesh(const mapPolyMesh& mpm)
|
||||||
{
|
{
|
||||||
pdm_->updateMesh(mpm);
|
pdm_->updateMesh(mpm);
|
||||||
|
|
||||||
|
// Force update if performing topology change
|
||||||
|
// Note: needed?
|
||||||
|
// - field would have been mapped, so if using updateInterval option (!= 1)
|
||||||
|
// live with error associated of not updating and use mapped values?
|
||||||
|
requireUpdate_ = true;
|
||||||
movePoints();
|
movePoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,6 +37,10 @@ Description
|
|||||||
// Optional entry enabling the calculation
|
// Optional entry enabling the calculation
|
||||||
// of the normal-to-wall field
|
// of the normal-to-wall field
|
||||||
nRequired false;
|
nRequired false;
|
||||||
|
|
||||||
|
// Optional entry delaying wall distance update to every n steps
|
||||||
|
// Default is 1 (update every step)
|
||||||
|
updateInterval 5;
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
@ -90,6 +94,12 @@ class wallDist
|
|||||||
//- Normal-to-wall field
|
//- Normal-to-wall field
|
||||||
mutable tmp<volVectorField> n_;
|
mutable tmp<volVectorField> n_;
|
||||||
|
|
||||||
|
//- Update wall distance every updateInterval_ steps
|
||||||
|
const label updateInterval_;
|
||||||
|
|
||||||
|
//- Flag to indicate whether the wall distance requires updating
|
||||||
|
bool requireUpdate_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user