Skip to content
Snippets Groups Projects
Commit ea322e3a authored by mattijs's avatar mattijs Committed by Andrew Heather
Browse files

ENH: nearWallDist: handle changing numbers of patches

parent af1f95b0
Branches
Tags
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -31,7 +31,7 @@ License ...@@ -31,7 +31,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::nearWallDist::doAll() void Foam::nearWallDist::calculate()
{ {
cellDistFuncs wallUtils(mesh_); cellDistFuncs wallUtils(mesh_);
...@@ -101,7 +101,7 @@ Foam::nearWallDist::nearWallDist(const Foam::fvMesh& mesh) ...@@ -101,7 +101,7 @@ Foam::nearWallDist::nearWallDist(const Foam::fvMesh& mesh)
), ),
mesh_(mesh) mesh_(mesh)
{ {
doAll(); calculate();
} }
...@@ -115,16 +115,28 @@ Foam::nearWallDist::~nearWallDist() ...@@ -115,16 +115,28 @@ Foam::nearWallDist::~nearWallDist()
void Foam::nearWallDist::correct() void Foam::nearWallDist::correct()
{ {
if (mesh_.changing()) if (mesh_.topoChanging())
{ {
// Update size of GeometricBoundaryField const DimensionedField<scalar, volMesh>& V = mesh_.V();
forAll(mesh_.boundary(), patchI) const fvBoundaryMesh& bnd = mesh_.boundary();
this->setSize(bnd.size());
forAll(*this, patchI)
{ {
operator[](patchI).setSize(mesh_.boundary()[patchI].size()); this->set
(
patchI,
fvPatchField<scalar>::New
(
calculatedFvPatchScalarField::typeName,
bnd[patchI],
V
)
);
} }
} }
doAll(); calculate();
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -38,7 +38,6 @@ SourceFiles ...@@ -38,7 +38,6 @@ SourceFiles
#include "volFields.H" #include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
...@@ -47,7 +46,7 @@ namespace Foam ...@@ -47,7 +46,7 @@ namespace Foam
class fvMesh; class fvMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class nearWallDist Declaration Class nearWallDist Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class nearWallDist class nearWallDist
...@@ -62,8 +61,8 @@ class nearWallDist ...@@ -62,8 +61,8 @@ class nearWallDist
// Private Member Functions // Private Member Functions
//- Do all calculations. //- Do all calculations
void doAll(); void calculate();
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
nearWallDist(const nearWallDist&); nearWallDist(const nearWallDist&);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment