Commit 3a899a1b authored by andy's avatar andy
Browse files

Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

parents ff3b9eef f149f167
......@@ -132,6 +132,7 @@ Usage
#include "surfaceFields.H"
#include "syncTools.H"
#include "cyclicPolyPatch.H"
#include "wedgePolyPatch.H"
#include "nonuniformTransformCyclicPolyPatch.H"
#include "extrudeModel.H"
......@@ -951,6 +952,12 @@ int main(int argc, char *argv[])
// Region
const word shellRegionName(dict.lookup("region"));
const wordList zoneNames(dict.lookup("faceZones"));
wordList zoneShadowNames(0);
if (dict.found("faceZonesShadow"))
{
dict.lookup("faceZonesShadow") >> zoneShadowNames;
}
const Switch oneD(dict.lookup("oneD"));
const Switch adaptMesh(dict.lookup("adaptMesh"));
......@@ -1007,6 +1014,47 @@ int main(int argc, char *argv[])
}
}
labelList zoneShadowIDs;
if (zoneShadowNames.size())
{
zoneShadowIDs.setSize(zoneShadowNames.size());
forAll(zoneShadowNames, i)
{
zoneShadowIDs[i] = faceZones.findZoneID(zoneShadowNames[i]);
if (zoneShadowIDs[i] == -1)
{
FatalErrorIn(args.executable())
<< "Cannot find zone " << zoneShadowNames[i] << endl
<< "Valid zones are " << faceZones.names()
<< exit(FatalError);
}
}
}
label nShadowFaces = 0;
forAll(zoneShadowIDs, i)
{
nShadowFaces += faceZones[zoneShadowIDs[i]].size();
}
labelList extrudeMeshShadowFaces(nShadowFaces);
boolList zoneShadowFlipMap(nShadowFaces);
labelList zoneShadowID(nShadowFaces);
nShadowFaces = 0;
forAll(zoneShadowIDs, i)
{
const faceZone& fz = faceZones[zoneShadowIDs[i]];
forAll(fz, j)
{
extrudeMeshShadowFaces[nShadowFaces] = fz[j];
zoneShadowFlipMap[nShadowFaces] = fz.flipMap()[j];
zoneShadowID[nShadowFaces] = zoneShadowIDs[i];
nShadowFaces++;
}
}
// Collect faces to extrude and per-face information
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -1047,6 +1095,19 @@ int main(int argc, char *argv[])
<< nl
<< endl;
// Check nExtrudeFaces = nShadowFaces
if (zoneShadowNames.size())
{
if (nExtrudeFaces != nShadowFaces)
{
FatalErrorIn(args.executable())
<< "Extruded faces " << nExtrudeFaces << endl
<< "is different from shadow faces. " << nShadowFaces
<< "This is not permitted " << endl
<< exit(FatalError);
}
}
// Determine corresponding mesh edges
const labelList extrudeMeshEdges
......@@ -1135,7 +1196,7 @@ int main(int argc, char *argv[])
<< '\t' << patches[interRegionBottomPatch[i]].type()
<< nl;
}
else
else if (zoneShadowNames.size() == 0)
{
interRegionTopPatch[i] = addPatch<polyPatch>
(
......@@ -1159,6 +1220,31 @@ int main(int argc, char *argv[])
<< '\t' << patches[interRegionBottomPatch[i]].type()
<< nl;
}
else if (zoneShadowNames.size() > 0) //patch using shadow face zones.
{
interRegionTopPatch[i] = addPatch<directMappedWallPolyPatch>
(
mesh,
zoneShadowNames[i] + "_top"
);
nCoupled++;
Info<< interRegionTopPatch[i]
<< '\t' << patches[interRegionTopPatch[i]].name()
<< '\t' << patches[interRegionTopPatch[i]].type()
<< nl;
interRegionBottomPatch[i] = addPatch<directMappedWallPolyPatch>
(
mesh,
interName
);
nCoupled++;
Info<< interRegionBottomPatch[i]
<< '\t' << patches[interRegionBottomPatch[i]].name()
<< '\t' << patches[interRegionBottomPatch[i]].type()
<< nl;
}
}
Info<< "Added " << nCoupled << " inter-region patches." << nl
<< endl;
......@@ -1216,9 +1302,9 @@ int main(int argc, char *argv[])
if (oneD)
{
// Reuse single empty patch.
word patchName = "oneDEmptPatch";
word patchName = "oneDWedgePatch";
zoneSidePatch[zoneI] = addPatch<emptyPolyPatch>
zoneSidePatch[zoneI] = addPatch<wedgePolyPatch>
(
mesh,
patchName
......@@ -1335,7 +1421,7 @@ int main(int argc, char *argv[])
if (oneD)
{
nonManifoldEdge[edgeI] = 1;
//nonManifoldEdge[edgeI] = 1; //To fill the space
ePatches.setSize(eFaces.size());
forAll(eFaces, i)
{
......@@ -1754,48 +1840,91 @@ int main(int argc, char *argv[])
}
}
// Add faces (using same points) to be in top patch
forAll(extrudeMeshFaces, zoneFaceI)
if (zoneShadowNames.size() > 0) //if there is a top faceZone specified
{
label meshFaceI = extrudeMeshFaces[zoneFaceI];
bool flip = zoneFlipMap[zoneFaceI];
const face& f = mesh.faces()[meshFaceI];
if (!flip)
forAll(extrudeMeshFaces, zoneFaceI)
{
if (mesh.isInternalFace(meshFaceI))
label meshFaceI = extrudeMeshShadowFaces[zoneFaceI];
label zoneI = zoneShadowID[zoneFaceI];
bool flip = zoneShadowFlipMap[zoneFaceI];
const face& f = mesh.faces()[meshFaceI];
if (!flip)
{
meshMod.addFace
meshMod.modifyFace
(
f, // modified face
meshFaceI, // face being modified
mesh.faceOwner()[meshFaceI],// owner
-1, // neighbour
false, // face flip
extrudeTopPatchID[zoneFaceI],// patch for face
zoneI, // zone for face
flip // face flip in zone
);
}
else if (mesh.isInternalFace(meshFaceI))
{
meshMod.modifyFace
(
f.reverseFace(), // modified face
meshFaceI, // label modified face
mesh.faceNeighbour()[meshFaceI],// owner
-1, // neighbour
true, // face flip
extrudeTopPatchID[zoneFaceI], // patch for face
zoneI, // zone for face
!flip // face flip in zone
);
}
}
}
else
{
// Add faces (using same points) to be in top patch
forAll(extrudeMeshFaces, zoneFaceI)
{
label meshFaceI = extrudeMeshFaces[zoneFaceI];
bool flip = zoneFlipMap[zoneFaceI];
const face& f = mesh.faces()[meshFaceI];
if (!flip)
{
if (mesh.isInternalFace(meshFaceI))
{
meshMod.addFace
(
f.reverseFace(), // modified face
mesh.faceNeighbour()[meshFaceI],// owner
-1, // neighbour
-1, // master point
-1, // master edge
meshFaceI, // master face
true, // flip flux
extrudeTopPatchID[zoneFaceI], // patch for face
-1, // zone for face
false //face flip in zone
);
}
}
else
{
meshMod.addFace
(
f, // face
mesh.faceOwner()[meshFaceI], // owner
-1, // neighbour
-1, // master point
-1, // master edge
meshFaceI, // master face
true, // flip flux
false, // flip flux
extrudeTopPatchID[zoneFaceI], // patch for face
-1, // zone for face
false // face flip in zone
false // zone flip
);
}
}
else
{
meshMod.addFace
(
f, // face
mesh.faceOwner()[meshFaceI], // owner
-1, // neighbour
-1, // master point
-1, // master edge
meshFaceI, // master face
false, // flip flux
extrudeTopPatchID[zoneFaceI], // patch for face
-1, // zone for face
false // zone flip
);
}
}
// Change the mesh. Change points directly (no inflation).
......
......@@ -29,6 +29,7 @@ derivedFvPatches = $(fvPatches)/derived
$(derivedFvPatches)/wall/wallFvPatch.C
$(derivedFvPatches)/directMapped/directMappedFvPatch.C
$(derivedFvPatches)/directMapped/directMappedWallFvPatch.C
$(derivedFvPatches)/directMapped/directMappedVariableThicknessWallFvPatch.C
wallDist = fvMesh/wallDist
$(wallDist)/wallPointYPlus/wallPointYPlus.C
......
EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
LIB_LIBS = \
-lOpenFOAM \
-ltriSurface \
-lmeshTools
-lmeshTools \
-lregionModels
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "directMappedVariableThicknessWallFvPatch.H"
#include "addToRunTimeSelectionTable.H"
#include "regionModel1D.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(directMappedVariableThicknessWallFvPatch, 0);
addToRunTimeSelectionTable
(
fvPatch,
directMappedVariableThicknessWallFvPatch,
polyPatch
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::directMappedVariableThicknessWallFvPatch::
makeDeltaCoeffs(scalarField& dc) const
{
const directMappedVariableThicknessWallPolyPatch& pp =
refCast<const directMappedVariableThicknessWallPolyPatch>
(
patch()
);
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
(
patch()
);
const polyMesh& nbrMesh = mpp.sampleMesh();
typedef regionModels::regionModel1D modelType;
const modelType& region1D =
nbrMesh.objectRegistry::lookupObject<modelType>
(
"thermoBaffleProperties"
);
dc = 2.0/(pp.thickness()/region1D.nLayers());
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
Class
Foam::directMappedVariableThicknessWallFvPatch
Description
Take thickness field and number of layers and returns deltaCoeffs
as 2.0/thickness/nLayers.
To be used with 1D thermo baffle.
SourceFiles
directMappedVariableThicknessWallFvPatch.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedWallFvPatch_H
#define directMappedWallFvPatch_H
#include "wallFvPatch.H"
#include "directMappedVariableThicknessWallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedVariableThicknessWallFvPatch Declaration
\*---------------------------------------------------------------------------*/
class directMappedVariableThicknessWallFvPatch
:
public wallFvPatch
{
protected:
// Protected Member Functions
//- Read neighbour cell distances from dictionary
void makeDeltaCoeffs(scalarField& dc) const;
public:
//- Runtime type information
TypeName(directMappedVariableThicknessWallPolyPatch::typeName_());
// Constructors
//- Construct from components
directMappedVariableThicknessWallFvPatch
(
const polyPatch& patch,
const fvBoundaryMesh& bm
)
:
wallFvPatch(patch, bm)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -158,7 +158,10 @@ twoDPointCorrector/twoDPointCorrector.C
directMapped/directMappedPolyPatch/directMappedPatchBase.C
directMapped/directMappedPolyPatch/directMappedPolyPatch.C
directMapped/directMappedPolyPatch/directMappedWallPolyPatch.C
directMapped/directMappedPolyPatch/directMappedVariableThicknessWallPolyPatch.C
directMapped/directMappedPointPatch/directMappedPointPatch.C
directMapped/directMappedPointPatch/directMappedWallPointPatch.C
LIB = $(FOAM_LIBBIN)/libmeshTools
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "directMappedVariableThicknessWallPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(directMappedVariableThicknessWallPolyPatch, 0);
addToRunTimeSelectionTable
(
polyPatch,
directMappedVariableThicknessWallPolyPatch,
word
);
addToRunTimeSelectionTable
(
polyPatch,
directMappedVariableThicknessWallPolyPatch,
dictionary
);
}
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
Foam::directMappedVariableThicknessWallPolyPatch::
directMappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm
)
:
directMappedWallPolyPatch(name, size, start, index, bm),
thickness_(size)
{}
Foam::directMappedVariableThicknessWallPolyPatch::
directMappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
)
:
directMappedWallPolyPatch(name, size, start, index, bm),
thickness_(size)
{}
Foam::directMappedVariableThicknessWallPolyPatch::
directMappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
)
:
directMappedWallPolyPatch(name, size, start, index, bm),
thickness_(size)
{}
Foam::directMappedVariableThicknessWallPolyPatch::