mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: createBaffles : set added patch faces to value 0
This commit is contained in:
@ -0,0 +1,47 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SetPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class GeoField>
|
||||
void Foam::SetPatchFields
|
||||
(
|
||||
PtrList<GeoField>& fields,
|
||||
const label patchI,
|
||||
const typename GeoField::value_type& initVal
|
||||
)
|
||||
{
|
||||
forAll(fields, i)
|
||||
{
|
||||
typename GeoField::PatchFieldType& pfld =
|
||||
fields[i].boundaryField()[patchI];
|
||||
pfld == initVal;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,66 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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/>.
|
||||
|
||||
Global
|
||||
Foam::SetPatchFields
|
||||
|
||||
Description
|
||||
Helper routine to initialise a patch field to a constant value
|
||||
|
||||
SourceFiles
|
||||
SetPatchFields.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SetPatchFields_H
|
||||
#define SetPatchFields_H
|
||||
|
||||
#include "PtrList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
//- Helper routine to read fields
|
||||
template<class GeoField>
|
||||
void SetPatchFields
|
||||
(
|
||||
PtrList<GeoField>& fields,
|
||||
const label patchI,
|
||||
const typename GeoField::value_type& initVal
|
||||
);
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "SetPatchFields.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -43,6 +43,8 @@ Description
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "ZoneIDs.H"
|
||||
#include "fvMeshMapper.H"
|
||||
#include "SetPatchFields.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -241,8 +243,6 @@ int main(int argc, char *argv[])
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
// Read vol fields.
|
||||
if (args.optionFound("updateFields"))
|
||||
{
|
||||
Info<< "Reading geometric fields" << nl << endl;
|
||||
PtrList<volScalarField> vsFlds;
|
||||
ReadFields(mesh, objects, vsFlds);
|
||||
@ -275,11 +275,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
PtrList<surfaceTensorField> stFlds;
|
||||
ReadFields(mesh, objects, stFlds);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Not updating geometric fields" << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
// Mesh change container
|
||||
polyTopoChange meshMod(mesh);
|
||||
@ -484,6 +480,58 @@ int main(int argc, char *argv[])
|
||||
// Update fields
|
||||
mesh.updateMesh(map);
|
||||
|
||||
// Correct boundary faces mapped-out-of-nothing.
|
||||
{
|
||||
fvMeshMapper mapper(mesh, map);
|
||||
bool hasWarned = false;
|
||||
forAll(newMasterPatches, i)
|
||||
{
|
||||
label patchI = newMasterPatches[i];
|
||||
const fvPatchMapper& pm = mapper.boundaryMap()[patchI];
|
||||
if (pm.sizeBeforeMapping() == 0)
|
||||
{
|
||||
if (!hasWarned)
|
||||
{
|
||||
hasWarned = true;
|
||||
WarningIn(args.executable())
|
||||
<< "Setting field on boundary faces to zero." << endl
|
||||
<< "You might have to edit these fields." << endl;
|
||||
}
|
||||
|
||||
SetPatchFields(vsFlds, patchI, pTraits<scalar>::zero);
|
||||
SetPatchFields(vvFlds, patchI, pTraits<vector>::zero);
|
||||
SetPatchFields(vstFlds, patchI, pTraits<sphericalTensor>::zero);
|
||||
SetPatchFields(vsymtFlds, patchI, pTraits<symmTensor>::zero);
|
||||
SetPatchFields(vtFlds, patchI, pTraits<tensor>::zero);
|
||||
|
||||
SetPatchFields(ssFlds, patchI, pTraits<scalar>::zero);
|
||||
SetPatchFields(svFlds, patchI, pTraits<vector>::zero);
|
||||
SetPatchFields(sstFlds, patchI, pTraits<sphericalTensor>::zero);
|
||||
SetPatchFields(ssymtFlds, patchI, pTraits<symmTensor>::zero);
|
||||
SetPatchFields(stFlds, patchI, pTraits<tensor>::zero);
|
||||
}
|
||||
}
|
||||
forAll(newSlavePatches, i)
|
||||
{
|
||||
label patchI = newSlavePatches[i];
|
||||
const fvPatchMapper& pm = mapper.boundaryMap()[patchI];
|
||||
if (pm.sizeBeforeMapping() == 0)
|
||||
{
|
||||
SetPatchFields(vsFlds, patchI, pTraits<scalar>::zero);
|
||||
SetPatchFields(vvFlds, patchI, pTraits<vector>::zero);
|
||||
SetPatchFields(vstFlds, patchI, pTraits<sphericalTensor>::zero);
|
||||
SetPatchFields(vsymtFlds, patchI, pTraits<symmTensor>::zero);
|
||||
SetPatchFields(vtFlds, patchI, pTraits<tensor>::zero);
|
||||
|
||||
SetPatchFields(ssFlds, patchI, pTraits<scalar>::zero);
|
||||
SetPatchFields(svFlds, patchI, pTraits<vector>::zero);
|
||||
SetPatchFields(sstFlds, patchI, pTraits<sphericalTensor>::zero);
|
||||
SetPatchFields(ssymtFlds, patchI, pTraits<symmTensor>::zero);
|
||||
SetPatchFields(stFlds, patchI, pTraits<tensor>::zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Move mesh (since morphing might not do this)
|
||||
if (map().hasMotionPoints())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user