mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
GIT: Resolved conflict on merge from upstream
This commit is contained in:
@ -90,3 +90,27 @@ volScalarField dpdt
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
setRefCell
|
||||
(
|
||||
p,
|
||||
p_rgh,
|
||||
pimple.dict(),
|
||||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
}
|
||||
|
||||
dimensionedScalar initialMass("initialMass", fvc::domainIntegrate(rho));
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
{
|
||||
bool closedVolume = p_rgh.needReference();
|
||||
|
||||
dimensionedScalar compressibility = fvc::domainIntegrate(psi);
|
||||
bool compressible = (compressibility.value() > SMALL);
|
||||
|
||||
rho = thermo.rho();
|
||||
|
||||
// Thermodynamic density needs to be updated by psi*d(p) after the
|
||||
@ -36,19 +41,27 @@
|
||||
)/(mesh.magSf().boundaryField()*rAUf.boundaryField())
|
||||
);
|
||||
|
||||
fvScalarMatrix p_rghDDtEqn
|
||||
tmp<fvScalarMatrix> p_rghDDtEqn
|
||||
(
|
||||
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
|
||||
+ fvc::div(phiHbyA)
|
||||
==
|
||||
fvOptions(psi, p_rgh, rho.name())
|
||||
new fvScalarMatrix(p_rgh, dimMass/dimTime)
|
||||
);
|
||||
|
||||
if (compressible)
|
||||
{
|
||||
p_rghDDtEqn =
|
||||
(
|
||||
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
|
||||
==
|
||||
fvOptions(psi, p_rgh, rho.name())
|
||||
);
|
||||
}
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
p_rghDDtEqn
|
||||
p_rghDDtEqn()
|
||||
+ fvc::div(phiHbyA)
|
||||
- fvm::laplacian(rAUf, p_rgh)
|
||||
);
|
||||
|
||||
@ -81,6 +94,32 @@
|
||||
dpdt = fvc::ddt(p);
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
if (compressible)
|
||||
{
|
||||
#include "rhoEqn.H"
|
||||
}
|
||||
#include "compressibleContinuityErrs.H"
|
||||
|
||||
if (closedVolume)
|
||||
{
|
||||
if (!compressible)
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
p += (initialMass - fvc::domainIntegrate(thermo.rho()))
|
||||
/compressibility;
|
||||
rho = thermo.rho();
|
||||
}
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -37,9 +37,9 @@ volVectorField U
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::RASModel> turbulence
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
compressible::New<compressible::RASModel>
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
)/(mesh.magSf().boundaryField()*rhorAUf.boundaryField())
|
||||
);
|
||||
|
||||
|
||||
while (simple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
@ -64,12 +65,27 @@
|
||||
|
||||
p = p_rgh + rho*gh;
|
||||
|
||||
dimensionedScalar compressibility = fvc::domainIntegrate(psi);
|
||||
bool compressible = (compressibility.value() > SMALL);
|
||||
|
||||
// For closed-volume cases adjust the pressure level
|
||||
// to obey overall mass continuity
|
||||
if (closedVolume)
|
||||
{
|
||||
p += (initialMass - fvc::domainIntegrate(psi*p))
|
||||
/fvc::domainIntegrate(psi);
|
||||
if(!compressible)
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
p += (initialMass - fvc::domainIntegrate(psi*p))
|
||||
/fvc::domainIntegrate(psi);
|
||||
}
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
|
||||
@ -36,12 +36,21 @@
|
||||
)/(mesh.magSf().boundaryField()*rhorAUf.boundaryField())
|
||||
);
|
||||
|
||||
tmp<fvScalarMatrix> p_rghDDtEqn
|
||||
(
|
||||
new fvScalarMatrix(p_rgh, dimMass/dimTime)
|
||||
);
|
||||
|
||||
{
|
||||
fvScalarMatrix p_rghDDtEqn
|
||||
(
|
||||
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
|
||||
+ fvc::div(phiHbyA)
|
||||
);
|
||||
if (compressible)
|
||||
{
|
||||
p_rghDDtEqn =
|
||||
(
|
||||
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
|
||||
==
|
||||
fvOptions(psi, p_rgh, rho.name())
|
||||
);
|
||||
}
|
||||
|
||||
// Thermodynamic density needs to be updated by psi*d(p) after the
|
||||
// pressure solution - done in 2 parts. Part 1:
|
||||
@ -52,6 +61,7 @@
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
p_rghDDtEqn
|
||||
+ fvc::div(phiHbyA)
|
||||
- fvm::laplacian(rhorAUf, p_rgh)
|
||||
);
|
||||
|
||||
@ -93,8 +103,11 @@
|
||||
dpdt = fvc::ddt(p);
|
||||
}
|
||||
|
||||
// Solve continuity
|
||||
#include "rhoEqn.H"
|
||||
if (compressible)
|
||||
{
|
||||
// Solve continuity
|
||||
#include "rhoEqn.H"
|
||||
}
|
||||
|
||||
// Update continuity errors
|
||||
#include "compressibleContinuityErrors.H"
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
simpleCoalParcelFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/simpleCoalParcelFoam
|
||||
@ -0,0 +1,57 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I${LIB_SRC}/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/coalCombustion/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/ODE/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||
-I$(LIB_SRC)/combustionModels/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam/simpleReactingParcelFoam
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lturbulenceModels \
|
||||
-lcompressibleTurbulenceModels \
|
||||
-llagrangian \
|
||||
-llagrangianIntermediate \
|
||||
-llagrangianTurbulence \
|
||||
-lspecie \
|
||||
-lfluidThermophysicalModels \
|
||||
-lliquidProperties \
|
||||
-lliquidMixtureProperties \
|
||||
-lsolidProperties \
|
||||
-lsolidMixtureProperties \
|
||||
-lthermophysicalFunctions \
|
||||
-lreactionThermophysicalModels \
|
||||
-lSLGThermo \
|
||||
-lchemistryModel \
|
||||
-lradiationModels \
|
||||
-lODE \
|
||||
-lregionModels \
|
||||
-lsurfaceFilmModels \
|
||||
-lcombustionModels \
|
||||
-lfvOptions \
|
||||
-lsampling \
|
||||
-lcoalCombustion
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
Info<< "\nConstructing coal cloud" << endl;
|
||||
coalCloud parcels
|
||||
(
|
||||
"reactingCloud1",
|
||||
rho,
|
||||
U,
|
||||
g,
|
||||
slgThermo
|
||||
);
|
||||
@ -0,0 +1,100 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 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/>.
|
||||
|
||||
Application
|
||||
simpleReactingParcelFoam
|
||||
|
||||
Description
|
||||
Steady state SIMPLE solver for laminar or turbulent flow with coal
|
||||
Lagrangian parcels.
|
||||
|
||||
Note:
|
||||
- including run-time selectable finite volume options,e.g. sources,
|
||||
constraints
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "coalCloud.H"
|
||||
#include "rhoCombustionModel.H"
|
||||
#include "radiationModel.H"
|
||||
#include "IOporosityModelList.H"
|
||||
#include "fvOptions.H"
|
||||
#include "SLGThermo.H"
|
||||
#include "simpleControl.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "readGravitationalAcceleration.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
#include "createFields.H"
|
||||
#include "createRadiationModel.H"
|
||||
#include "createClouds.H"
|
||||
#include "createMRF.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (simple.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
parcels.evolve();
|
||||
|
||||
// --- Pressure-velocity SIMPLE corrector loop
|
||||
{
|
||||
#include "UEqn.H"
|
||||
#include "YEqn.H"
|
||||
#include "EEqn.H"
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,24 +2,17 @@
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
location "system";
|
||||
object collapseDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// If on, after collapsing check the quality of the mesh. If bad faces are
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1077,7 +1077,7 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
pointMesh::New(mesh),
|
||||
scalar(labelMin)
|
||||
dimensionedScalar("min", dimless, scalar(labelMin))
|
||||
);
|
||||
|
||||
labelIOList boundaryPtsIO
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright 2015 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -58,6 +58,7 @@ Description
|
||||
#include "globalIndex.H"
|
||||
#include "IOmanip.H"
|
||||
#include "decompositionModel.H"
|
||||
#include "fvMeshTools.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -813,6 +814,7 @@ int main(int argc, char *argv[])
|
||||
readScalar(meshDict.lookup("mergeTolerance"))
|
||||
);
|
||||
|
||||
const Switch keepPatches(meshDict.lookupOrDefault("keepPatches", false));
|
||||
|
||||
|
||||
// Read decomposePar dictionary
|
||||
@ -1517,6 +1519,12 @@ int main(int argc, char *argv[])
|
||||
motionDict
|
||||
);
|
||||
|
||||
// Remove zero sized patches originating from faceZones
|
||||
if (!keepPatches && !wantSnap && !wantLayers)
|
||||
{
|
||||
fvMeshTools::removeEmptyPatches(mesh, true);
|
||||
}
|
||||
|
||||
writeMesh
|
||||
(
|
||||
"Refined mesh",
|
||||
@ -1559,6 +1567,12 @@ int main(int argc, char *argv[])
|
||||
snapParams
|
||||
);
|
||||
|
||||
// Remove zero sized patches originating from faceZones
|
||||
if (!keepPatches && !wantLayers)
|
||||
{
|
||||
fvMeshTools::removeEmptyPatches(mesh, true);
|
||||
}
|
||||
|
||||
writeMesh
|
||||
(
|
||||
"Snapped mesh",
|
||||
@ -1609,6 +1623,12 @@ int main(int argc, char *argv[])
|
||||
distributor
|
||||
);
|
||||
|
||||
// Remove zero sized patches originating from faceZones
|
||||
if (!keepPatches)
|
||||
{
|
||||
fvMeshTools::removeEmptyPatches(mesh, true);
|
||||
}
|
||||
|
||||
writeMesh
|
||||
(
|
||||
"Layer mesh",
|
||||
@ -1622,6 +1642,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
|
||||
{
|
||||
// Check final mesh
|
||||
Info<< "Checking final mesh ..." << endl;
|
||||
|
||||
@ -187,7 +187,8 @@ castellatedMeshControls
|
||||
|
||||
//faceZone sphere;
|
||||
//cellZone sphere;
|
||||
//cellZoneInside inside; //outside/insidePoint
|
||||
//cellZoneInside inside; // outside/insidePoint
|
||||
//insidePoint (1 1 1); // if (cellZoneInside == insidePoint)
|
||||
|
||||
//- Optional specification of what to do with faceZone faces:
|
||||
// internal : keep them as internal faces (default)
|
||||
@ -259,7 +260,12 @@ castellatedMeshControls
|
||||
}
|
||||
|
||||
|
||||
// Limit refinement in geometric region
|
||||
// Optionally limit refinement in geometric region. This limits all
|
||||
// refinement (from features, refinementSurfaces, refinementRegions)
|
||||
// in a given geometric region. The syntax is exactly the same as for the
|
||||
// refinementRegions; the cell level now specifies the upper limit
|
||||
// for any cell. Note that it does not override the refinement constraints
|
||||
// given by the nCellsBetweenLevels settting.
|
||||
limitRegions
|
||||
{
|
||||
}
|
||||
@ -290,14 +296,25 @@ castellatedMeshControls
|
||||
locationInMesh (5 0.28 0.43);
|
||||
|
||||
// Whether any faceZones (as specified in the refinementSurfaces)
|
||||
// are only on the boundary of corresponding cellZones or also allow
|
||||
// free-standing zone faces. Not used if there are no faceZones.
|
||||
// are only on the boundary of corresponding cellZones.
|
||||
// Not used if there are no faceZones. The behaviour has changed
|
||||
// with respect to previous versions:
|
||||
// true : all intersections with surface are put in faceZone
|
||||
// (same behaviour as before)
|
||||
// false : depending on the type of surface intersected:
|
||||
// - if intersecting surface has faceZone only (so no cellZone)
|
||||
// leave in faceZone (so behave as if set to true) (= changed
|
||||
// behaviour)
|
||||
// - if intersecting surface has faceZone and cellZone
|
||||
// remove if inbetween same cellZone or if on boundary
|
||||
// (same behaviour as before)
|
||||
allowFreeStandingZoneFaces true;
|
||||
|
||||
|
||||
|
||||
// 2. Specify multiple locations with optional cellZones for the
|
||||
// regions. faceZones are automatically constructed from the
|
||||
// regions (use cellZone "none" to specify the unzoned cells)
|
||||
// FaceZones are automatically constructed from the
|
||||
// names of the cellZones: <cellZoneA> _to_ <cellZoneB>
|
||||
// where the cellZoneA is the lowest numbered cellZone (non-cellZone
|
||||
// cells are in a special region called "none" which is always
|
||||
|
||||
@ -1827,6 +1827,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (detectOnly)
|
||||
{
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -183,7 +183,7 @@ void Foam::helpType::init()
|
||||
(
|
||||
"browse",
|
||||
"word",
|
||||
"display documentation for boundary condition in browser"
|
||||
"display documentation in browser"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
@ -290,6 +290,10 @@ void calc
|
||||
mesh
|
||||
);
|
||||
|
||||
// Note: fvOptions not directly used but constructs fvOptions so
|
||||
// e.g. porosity modelling is effective for use in forces fo.
|
||||
#include "createFvOptions.H"
|
||||
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
IOobject turbulencePropertiesHeader
|
||||
@ -436,18 +440,23 @@ autoPtr<functionObjectList> readFunctionObjects
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Foam::timeSelector::addOptions();
|
||||
timeSelector::addOptions();
|
||||
#include "addRegionOption.H"
|
||||
Foam::argList::addBoolOption
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noFlow",
|
||||
"suppress creating flow models"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noRead",
|
||||
"do not read any field data"
|
||||
);
|
||||
#include "addDictOption.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
// Externally stored dictionary for functionObjectList
|
||||
|
||||
@ -23,21 +23,6 @@ dict.add
|
||||
);
|
||||
dict.add("mergeDistance", SMALL);
|
||||
|
||||
labelHashSet includePatches;
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
if
|
||||
(
|
||||
!pp.coupled()
|
||||
&& !isA<cyclicAMIPolyPatch>(pp)
|
||||
&& !isA<emptyPolyPatch>(pp)
|
||||
)
|
||||
{
|
||||
includePatches.insert(patchI);
|
||||
}
|
||||
}
|
||||
|
||||
labelList triSurfaceToAgglom(5*nFineFaces);
|
||||
|
||||
const triSurface localSurface = triangulate
|
||||
@ -69,6 +54,4 @@ distributedTriSurfaceMesh surfacesMesh
|
||||
|
||||
triSurfaceToAgglom.resize(surfacesMesh.size());
|
||||
|
||||
//surfacesMesh.searchableSurface::write();
|
||||
|
||||
surfacesMesh.setField(triSurfaceToAgglom);
|
||||
|
||||
@ -87,8 +87,8 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++)
|
||||
|
||||
DynamicList<label> dRayIs;
|
||||
|
||||
// Collect the rays which has not hit obstacle inbetween rayStartFace
|
||||
// and rayEndFace. If the ray hit itself get stored in dRayIs
|
||||
// Collect the rays which have no obstacle in between rayStartFace
|
||||
// and rayEndFace. If the ray hit itself, it gets stored in dRayIs
|
||||
forAll(hitInfo, rayI)
|
||||
{
|
||||
if (!hitInfo[rayI].hit())
|
||||
|
||||
@ -29,33 +29,42 @@ Description
|
||||
(finalAgglom generated by faceAgglomerate utility).
|
||||
|
||||
Each view factor between the agglomerated faces i and j (Fij) is calculated
|
||||
using a double integral of the sub-areas composing the agglomaration.
|
||||
using a double integral of the sub-areas composing the agglomeration.
|
||||
|
||||
The patches involved in the view factor calculation are taken from the Qr
|
||||
volScalarField (radiative flux) when is greyDiffusiveRadiationViewFactor
|
||||
otherwise they are not included.
|
||||
The patches involved in the view factor calculation are taken from the
|
||||
boundary file and should be part on the group viewFactorWall. ie.:
|
||||
|
||||
floor
|
||||
{
|
||||
type wall;
|
||||
inGroups 2(wall viewFactorWall);
|
||||
nFaces 100;
|
||||
startFace 3100;
|
||||
}
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "fvMesh.H"
|
||||
#include "singleCellFvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "distributedTriSurfaceMesh.H"
|
||||
#include "cyclicAMIPolyPatch.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "meshTools.H"
|
||||
|
||||
#include "uindirectPrimitivePatch.H"
|
||||
#include "DynamicField.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
#include "scalarMatrices.H"
|
||||
#include "labelListIOList.H"
|
||||
#include "scalarListIOList.H"
|
||||
|
||||
#include "singleCellFvMesh.H"
|
||||
|
||||
#include "IOmapDistribute.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
triSurface triangulate
|
||||
(
|
||||
@ -116,7 +125,7 @@ triSurface triangulate
|
||||
newPatchI++;
|
||||
}
|
||||
|
||||
triSurfaceToAgglom.resize(localTriFaceI);
|
||||
//striSurfaceToAgglom.resize(localTriFaceI-1);
|
||||
|
||||
triangles.shrink();
|
||||
|
||||
@ -209,7 +218,7 @@ scalar calculateViewFactorFij
|
||||
return
|
||||
(
|
||||
(cosThetaI*cosThetaJ*dAjMag*dAiMag)
|
||||
/(sqr(rMag)*constant::mathematical::pi)
|
||||
/(sqr(rMag)*constant::mathematical::pi)
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -264,6 +273,8 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
const word viewFactorWall("viewFactorWall");
|
||||
|
||||
const bool writeViewFactors =
|
||||
viewFactorDict.lookupOrDefault<bool>("writeViewFactorMatrix", false);
|
||||
|
||||
@ -272,19 +283,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
const label debug = viewFactorDict.lookupOrDefault<label>("debug", 0);
|
||||
|
||||
volScalarField Qr
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Qr",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
// Read agglomeration map
|
||||
labelListIOList finalAgglom
|
||||
(
|
||||
@ -336,27 +334,14 @@ int main(int argc, char *argv[])
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
const polyBoundaryMesh& coarsePatches = coarseMesh.boundaryMesh();
|
||||
|
||||
labelList viewFactorsPatches(patches.size());
|
||||
|
||||
const volScalarField::GeometricBoundaryField& Qrb = Qr.boundaryField();
|
||||
|
||||
label count = 0;
|
||||
forAll(Qrb, patchI)
|
||||
labelList viewFactorsPatches(patches.findIndices(viewFactorWall));
|
||||
forAll (viewFactorsPatches, i)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
const fvPatchScalarField& QrpI = Qrb[patchI];
|
||||
|
||||
if ((isA<fixedValueFvPatchScalarField>(QrpI)) && (pp.size() > 0))
|
||||
{
|
||||
viewFactorsPatches[count] = QrpI.patch().index();
|
||||
nCoarseFaces += coarsePatches[patchI].size();
|
||||
nFineFaces += patches[patchI].size();
|
||||
count ++;
|
||||
}
|
||||
label patchI = viewFactorsPatches[i];
|
||||
nCoarseFaces += coarsePatches[patchI].size();
|
||||
nFineFaces += patches[patchI].size();
|
||||
}
|
||||
|
||||
viewFactorsPatches.resize(count);
|
||||
|
||||
// total number of coarse faces
|
||||
label totalNCoarseFaces = nCoarseFaces;
|
||||
|
||||
@ -381,78 +366,85 @@ int main(int argc, char *argv[])
|
||||
|
||||
DynamicList<label> localAgg(nCoarseFaces);
|
||||
|
||||
forAll (viewFactorsPatches, i)
|
||||
labelHashSet includePatches;
|
||||
forAll(viewFactorsPatches, i)
|
||||
{
|
||||
const label patchID = viewFactorsPatches[i];
|
||||
|
||||
const polyPatch& pp = patches[patchID];
|
||||
const labelList& agglom = finalAgglom[patchID];
|
||||
label nAgglom = max(agglom)+1;
|
||||
labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
|
||||
const labelList& coarsePatchFace = coarseMesh.patchFaceMap()[patchID];
|
||||
|
||||
const pointField& coarseCf = coarseMesh.Cf().boundaryField()[patchID];
|
||||
const pointField& coarseSf = coarseMesh.Sf().boundaryField()[patchID];
|
||||
|
||||
labelHashSet includePatches;
|
||||
includePatches.insert(patchID);
|
||||
|
||||
forAll(coarseCf, faceI)
|
||||
if (agglom.size() > 0)
|
||||
{
|
||||
point cf = coarseCf[faceI];
|
||||
label nAgglom = max(agglom)+1;
|
||||
labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
|
||||
const labelList& coarsePatchFace =
|
||||
coarseMesh.patchFaceMap()[patchID];
|
||||
|
||||
const label coarseFaceI = coarsePatchFace[faceI];
|
||||
const labelList& fineFaces = coarseToFine[coarseFaceI];
|
||||
const label agglomI =
|
||||
agglom[fineFaces[0]] + coarsePatches[patchID].start();
|
||||
const pointField& coarseCf =
|
||||
coarseMesh.Cf().boundaryField()[patchID];
|
||||
const pointField& coarseSf =
|
||||
coarseMesh.Sf().boundaryField()[patchID];
|
||||
|
||||
// Construct single face
|
||||
uindirectPrimitivePatch upp
|
||||
(
|
||||
UIndirectList<face>(pp, fineFaces),
|
||||
pp.points()
|
||||
);
|
||||
|
||||
|
||||
List<point> availablePoints
|
||||
(
|
||||
upp.faceCentres().size()
|
||||
+ upp.localPoints().size()
|
||||
);
|
||||
|
||||
SubList<point>
|
||||
(
|
||||
availablePoints,
|
||||
upp.faceCentres().size()
|
||||
).assign(upp.faceCentres());
|
||||
|
||||
SubList<point>
|
||||
(
|
||||
availablePoints,
|
||||
upp.localPoints().size(),
|
||||
upp.faceCentres().size()
|
||||
).assign(upp.localPoints());
|
||||
|
||||
point cfo = cf;
|
||||
scalar dist = GREAT;
|
||||
forAll(availablePoints, iPoint)
|
||||
forAll(coarseCf, faceI)
|
||||
{
|
||||
point cfFine = availablePoints[iPoint];
|
||||
if (mag(cfFine-cfo) < dist)
|
||||
{
|
||||
dist = mag(cfFine-cfo);
|
||||
cf = cfFine;
|
||||
}
|
||||
}
|
||||
point cf = coarseCf[faceI];
|
||||
|
||||
point sf = coarseSf[faceI];
|
||||
localCoarseCf.append(cf);
|
||||
localCoarseSf.append(sf);
|
||||
localAgg.append(agglomI);
|
||||
const label coarseFaceI = coarsePatchFace[faceI];
|
||||
const labelList& fineFaces = coarseToFine[coarseFaceI];
|
||||
const label agglomI =
|
||||
agglom[fineFaces[0]] + coarsePatches[patchID].start();
|
||||
|
||||
// Construct single face
|
||||
uindirectPrimitivePatch upp
|
||||
(
|
||||
UIndirectList<face>(pp, fineFaces),
|
||||
pp.points()
|
||||
);
|
||||
|
||||
|
||||
List<point> availablePoints
|
||||
(
|
||||
upp.faceCentres().size()
|
||||
+ upp.localPoints().size()
|
||||
);
|
||||
|
||||
SubList<point>
|
||||
(
|
||||
availablePoints,
|
||||
upp.faceCentres().size()
|
||||
).assign(upp.faceCentres());
|
||||
|
||||
SubList<point>
|
||||
(
|
||||
availablePoints,
|
||||
upp.localPoints().size(),
|
||||
upp.faceCentres().size()
|
||||
).assign(upp.localPoints());
|
||||
|
||||
point cfo = cf;
|
||||
scalar dist = GREAT;
|
||||
forAll(availablePoints, iPoint)
|
||||
{
|
||||
point cfFine = availablePoints[iPoint];
|
||||
if (mag(cfFine-cfo) < dist)
|
||||
{
|
||||
dist = mag(cfFine-cfo);
|
||||
cf = cfFine;
|
||||
}
|
||||
}
|
||||
|
||||
point sf = coarseSf[faceI];
|
||||
localCoarseCf.append(cf);
|
||||
localCoarseSf.append(sf);
|
||||
localAgg.append(agglomI);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Distribute local coarse Cf and Sf for shooting rays
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -478,7 +470,6 @@ int main(int argc, char *argv[])
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#include "searchingEngine.H"
|
||||
|
||||
|
||||
// Determine rays between coarse face centres
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
DynamicList<label> rayStartFace(nCoarseFaces + 0.01*nCoarseFaces);
|
||||
@ -486,8 +477,8 @@ int main(int argc, char *argv[])
|
||||
DynamicList<label> rayEndFace(rayStartFace.size());
|
||||
|
||||
|
||||
// Return rayStartFace in local index andrayEndFace in global index
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Return rayStartFace in local index and rayEndFace in global index
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
#include "shootRays.H"
|
||||
|
||||
@ -508,7 +499,6 @@ int main(int argc, char *argv[])
|
||||
nViewFactors += nVisibleFaceFaces[faceI];
|
||||
}
|
||||
|
||||
|
||||
// - Construct compact numbering
|
||||
// - return map from remote to compact indices
|
||||
// (per processor (!= myProcNo) a map from remote index to compact index)
|
||||
@ -519,54 +509,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
mapDistribute map(globalNumbering, rayEndFace, compactMap);
|
||||
|
||||
labelListIOList IOsubMap
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"subMap",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
map.subMap()
|
||||
);
|
||||
IOsubMap.write();
|
||||
|
||||
|
||||
labelListIOList IOconstructMap
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"constructMap",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
map.constructMap()
|
||||
);
|
||||
IOconstructMap.write();
|
||||
|
||||
|
||||
IOList<label> consMapDim
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"constructMapDim",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
List<label>(1, map.constructSize())
|
||||
);
|
||||
consMapDim.write();
|
||||
|
||||
|
||||
// visibleFaceFaces has:
|
||||
// (local face, local viewed face) = compact viewed face
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -600,33 +542,38 @@ int main(int argc, char *argv[])
|
||||
forAll(viewFactorsPatches, i)
|
||||
{
|
||||
label patchID = viewFactorsPatches[i];
|
||||
|
||||
const labelList& agglom = finalAgglom[patchID];
|
||||
label nAgglom = max(agglom)+1;
|
||||
labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
|
||||
const labelList& coarsePatchFace = coarseMesh.patchFaceMap()[patchID];
|
||||
|
||||
forAll(coarseToFine, coarseI)
|
||||
if (agglom.size() > 0)
|
||||
{
|
||||
compactPatchId.append(patchID);
|
||||
List<point>& fineCf = compactFineCf[compactI];
|
||||
List<point>& fineSf = compactFineSf[compactI++];
|
||||
label nAgglom = max(agglom)+1;
|
||||
labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
|
||||
const labelList& coarsePatchFace =
|
||||
coarseMesh.patchFaceMap()[patchID];
|
||||
|
||||
const label coarseFaceI = coarsePatchFace[coarseI];
|
||||
const labelList& fineFaces = coarseToFine[coarseFaceI];
|
||||
forAll(coarseToFine, coarseI)
|
||||
{
|
||||
compactPatchId.append(patchID);
|
||||
List<point>& fineCf = compactFineCf[compactI];
|
||||
List<point>& fineSf = compactFineSf[compactI++];
|
||||
|
||||
fineCf.setSize(fineFaces.size());
|
||||
fineSf.setSize(fineFaces.size());
|
||||
const label coarseFaceI = coarsePatchFace[coarseI];
|
||||
const labelList& fineFaces = coarseToFine[coarseFaceI];
|
||||
|
||||
fineCf = UIndirectList<point>
|
||||
(
|
||||
mesh.Cf().boundaryField()[patchID],
|
||||
coarseToFine[coarseFaceI]
|
||||
);
|
||||
fineSf = UIndirectList<point>
|
||||
(
|
||||
mesh.Sf().boundaryField()[patchID],
|
||||
coarseToFine[coarseFaceI]
|
||||
);
|
||||
fineCf.setSize(fineFaces.size());
|
||||
fineSf.setSize(fineFaces.size());
|
||||
|
||||
fineCf = UIndirectList<point>
|
||||
(
|
||||
mesh.Cf().boundaryField()[patchID],
|
||||
coarseToFine[coarseFaceI]
|
||||
);
|
||||
fineSf = UIndirectList<point>
|
||||
(
|
||||
mesh.Sf().boundaryField()[patchID],
|
||||
coarseToFine[coarseFaceI]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -837,22 +784,25 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
label patchID = viewFactorsPatches[i];
|
||||
const labelList& agglom = finalAgglom[patchID];
|
||||
label nAgglom = max(agglom)+1;
|
||||
labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
|
||||
const labelList& coarsePatchFace =
|
||||
coarseMesh.patchFaceMap()[patchID];
|
||||
|
||||
forAll(coarseToFine, coarseI)
|
||||
if (agglom.size() > 0)
|
||||
{
|
||||
const scalar Fij = sum(F[compactI]);
|
||||
const label coarseFaceID = coarsePatchFace[coarseI];
|
||||
const labelList& fineFaces = coarseToFine[coarseFaceID];
|
||||
forAll (fineFaces, fineId)
|
||||
label nAgglom = max(agglom)+1;
|
||||
labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
|
||||
const labelList& coarsePatchFace =
|
||||
coarseMesh.patchFaceMap()[patchID];
|
||||
|
||||
forAll(coarseToFine, coarseI)
|
||||
{
|
||||
const label faceID = fineFaces[fineId];
|
||||
viewFactorField.boundaryField()[patchID][faceID] = Fij;
|
||||
const scalar Fij = sum(F[compactI]);
|
||||
const label coarseFaceID = coarsePatchFace[coarseI];
|
||||
const labelList& fineFaces = coarseToFine[coarseFaceID];
|
||||
forAll (fineFaces, fineId)
|
||||
{
|
||||
const label faceID = fineFaces[fineId];
|
||||
viewFactorField.boundaryField()[patchID][faceID] = Fij;
|
||||
}
|
||||
compactI++;
|
||||
}
|
||||
compactI++;
|
||||
}
|
||||
}
|
||||
viewFactorField.write();
|
||||
@ -886,66 +836,64 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
if (Pstream::master())
|
||||
labelListList globalFaceFaces(visibleFaceFaces.size());
|
||||
|
||||
// Create globalFaceFaces needed to insert view factors
|
||||
// in F to the global matrix Fmatrix
|
||||
forAll(globalFaceFaces, faceI)
|
||||
{
|
||||
scalarSquareMatrix Fmatrix(totalNCoarseFaces, totalNCoarseFaces, 0.0);
|
||||
|
||||
labelListList globalFaceFaces(visibleFaceFaces.size());
|
||||
|
||||
// Create globalFaceFaces needed to insert view factors
|
||||
// in F to the global matrix Fmatrix
|
||||
forAll(globalFaceFaces, faceI)
|
||||
{
|
||||
globalFaceFaces[faceI] = renumber
|
||||
(
|
||||
compactToGlobal,
|
||||
visibleFaceFaces[faceI]
|
||||
);
|
||||
}
|
||||
|
||||
labelListIOList IOglobalFaceFaces
|
||||
globalFaceFaces[faceI] = renumber
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"globalFaceFaces",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
globalFaceFaces
|
||||
compactToGlobal,
|
||||
visibleFaceFaces[faceI]
|
||||
);
|
||||
IOglobalFaceFaces.write();
|
||||
}
|
||||
else
|
||||
{
|
||||
labelListList globalFaceFaces(visibleFaceFaces.size());
|
||||
forAll(globalFaceFaces, faceI)
|
||||
{
|
||||
globalFaceFaces[faceI] = renumber
|
||||
(
|
||||
compactToGlobal,
|
||||
visibleFaceFaces[faceI]
|
||||
);
|
||||
}
|
||||
|
||||
labelListIOList IOglobalFaceFaces
|
||||
labelListIOList IOglobalFaceFaces
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"globalFaceFaces",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
globalFaceFaces
|
||||
);
|
||||
"globalFaceFaces",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
globalFaceFaces
|
||||
);
|
||||
IOglobalFaceFaces.write();
|
||||
|
||||
IOglobalFaceFaces.write();
|
||||
}
|
||||
|
||||
labelListIOList IOvisibleFaceFaces
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"visibleFaceFaces",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
visibleFaceFaces
|
||||
);
|
||||
IOvisibleFaceFaces.write();
|
||||
|
||||
IOmapDistribute IOmapDist
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"mapDist",
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
map.xfer()
|
||||
);
|
||||
|
||||
IOmapDist.write();
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
return 0;
|
||||
|
||||
@ -74,13 +74,16 @@ void writeProcStats
|
||||
|
||||
forAll(surfBb, procI)
|
||||
{
|
||||
const List<treeBoundBox>& bbs = meshBb[procI];
|
||||
Info<< "processor" << procI << nl;
|
||||
|
||||
Info<< "processor" << procI << nl
|
||||
<< "\tMesh bounds : " << bbs[0] << nl;
|
||||
for (label i = 1; i < bbs.size(); i++)
|
||||
const List<treeBoundBox>& bbs = meshBb[procI];
|
||||
if (bbs.size())
|
||||
{
|
||||
Info<< "\t " << bbs[i]<< nl;
|
||||
Info<< "\tMesh bounds : " << bbs[0] << nl;
|
||||
for (label i = 1; i < bbs.size(); i++)
|
||||
{
|
||||
Info<< "\t " << bbs[i]<< nl;
|
||||
}
|
||||
}
|
||||
Info<< "\tSurface bounding box : " << surfBb[procI] << nl
|
||||
<< "\tTriangles : " << nFaces[procI] << nl
|
||||
@ -112,12 +115,13 @@ int main(int argc, char *argv[])
|
||||
runTime.functionObjects().off();
|
||||
|
||||
const fileName surfFileName = args[1];
|
||||
const word distType = args[2];
|
||||
const word distTypeName = args[2];
|
||||
const label distType =
|
||||
distributedTriSurfaceMesh::distributionTypeNames_[distTypeName];
|
||||
|
||||
Info<< "Reading surface from " << surfFileName << nl << nl
|
||||
<< "Using distribution method "
|
||||
<< distributedTriSurfaceMesh::distributionTypeNames_[distType]
|
||||
<< " " << distType << nl << endl;
|
||||
<< distTypeName << nl << endl;
|
||||
|
||||
const bool keepNonMapped = args.options().found("keepNonMapped");
|
||||
|
||||
@ -141,13 +145,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
#include "createPolyMesh.H"
|
||||
|
||||
Random rndGen(653213);
|
||||
|
||||
// Determine mesh bounding boxes:
|
||||
List<List<treeBoundBox> > meshBb(Pstream::nProcs());
|
||||
if (distType == distributedTriSurfaceMesh::FOLLOW)
|
||||
{
|
||||
#include "createPolyMesh.H"
|
||||
|
||||
meshBb[Pstream::myProcNo()] = List<treeBoundBox>
|
||||
(
|
||||
1,
|
||||
@ -160,6 +165,23 @@ int main(int argc, char *argv[])
|
||||
Pstream::scatterList(meshBb);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Temporarily: override master-only checking
|
||||
regIOobject::fileCheckTypes oldCheckType =
|
||||
regIOobject::fileModificationChecking;
|
||||
|
||||
if (oldCheckType == regIOobject::timeStampMaster)
|
||||
{
|
||||
regIOobject::fileModificationChecking = regIOobject::timeStamp;
|
||||
}
|
||||
else if (oldCheckType == regIOobject::inotifyMaster)
|
||||
{
|
||||
regIOobject::fileModificationChecking = regIOobject::inotify;
|
||||
}
|
||||
|
||||
|
||||
|
||||
IOobject io
|
||||
(
|
||||
surfFileName, // name
|
||||
@ -175,83 +197,48 @@ int main(int argc, char *argv[])
|
||||
fileName localPath(actualPath);
|
||||
localPath.replace(runTime.rootPath() + '/', "");
|
||||
|
||||
|
||||
autoPtr<distributedTriSurfaceMesh> surfMeshPtr;
|
||||
|
||||
if (actualPath == io.objectPath())
|
||||
{
|
||||
Info<< "Loading local (decomposed) surface " << localPath << nl <<endl;
|
||||
surfMeshPtr.reset(new distributedTriSurfaceMesh(io));
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Loading undecomposed surface " << localPath << nl << endl;
|
||||
}
|
||||
Info<< "Loading undecomposed surface " << localPath
|
||||
<< " on master only" << endl;
|
||||
|
||||
triSurface s;
|
||||
List<treeBoundBox> bbs;
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Actually load the surface
|
||||
triSurfaceMesh surf(io);
|
||||
s = surf;
|
||||
bbs = List<treeBoundBox>(1, treeBoundBox(boundBox::greatBox));
|
||||
}
|
||||
else
|
||||
{
|
||||
bbs = List<treeBoundBox>(1, treeBoundBox(boundBox::invertedBox));
|
||||
}
|
||||
|
||||
// Create dummy dictionary for bounding boxes if does not exist.
|
||||
if (!isFile(actualPath / "Dict"))
|
||||
{
|
||||
dictionary dict;
|
||||
dict.add("bounds", meshBb[Pstream::myProcNo()]);
|
||||
dict.add("distributionType", distType);
|
||||
dict.add("distributionType", distTypeName);
|
||||
dict.add("mergeDistance", SMALL);
|
||||
dict.add("bounds", bbs);
|
||||
|
||||
IOdictionary ioDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
io.name() + "Dict",
|
||||
io.instance(),
|
||||
io.local(),
|
||||
io.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
dict
|
||||
);
|
||||
// Scatter patch information
|
||||
Pstream::scatter(s.patches());
|
||||
|
||||
Info<< "Writing dummy bounds dictionary to " << ioDict.name()
|
||||
<< nl << endl;
|
||||
|
||||
// Force writing in ascii
|
||||
ioDict.regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
ioDict.time().writeCompression()
|
||||
);
|
||||
// Construct distributedTrisurfaceMesh from components
|
||||
IOobject notReadIO(io);
|
||||
notReadIO.readOpt() = IOobject::NO_READ;
|
||||
surfMeshPtr.reset(new distributedTriSurfaceMesh(notReadIO, s, dict));
|
||||
}
|
||||
|
||||
|
||||
// Load surface
|
||||
distributedTriSurfaceMesh surfMesh(io);
|
||||
Info<< "Loaded surface" << nl << endl;
|
||||
|
||||
|
||||
// Generate a test field
|
||||
{
|
||||
const triSurface& s = static_cast<const triSurface&>(surfMesh);
|
||||
|
||||
autoPtr<triSurfaceVectorField> fcPtr
|
||||
(
|
||||
new triSurfaceVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faceCentres", // name
|
||||
surfMesh.searchableSurface::time().timeName(), // instance
|
||||
surfMesh.searchableSurface::local(), // local
|
||||
surfMesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
surfMesh,
|
||||
dimLength,
|
||||
s.faceCentres()
|
||||
)
|
||||
);
|
||||
|
||||
// Steal pointer and store object on surfMesh
|
||||
fcPtr.ptr()->store();
|
||||
}
|
||||
distributedTriSurfaceMesh& surfMesh = surfMeshPtr();
|
||||
|
||||
|
||||
// Write per-processor stats
|
||||
@ -284,6 +271,10 @@ int main(int argc, char *argv[])
|
||||
Info<< "Writing surface." << nl << endl;
|
||||
surfMesh.objectRegistry::write();
|
||||
|
||||
|
||||
regIOobject::fileModificationChecking = oldCheckType;
|
||||
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user