Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry
2012-06-22 11:54:02 +01:00
105 changed files with 2041 additions and 1089 deletions

View File

@ -1,16 +1,11 @@
Info<< "Creating reaction model\n" << endl; Info<< "Creating reaction model\n" << endl;
autoPtr<combustionModels::psiChemistryCombustionModel> reaction autoPtr<combustionModels::psiCombustionModel> reaction
( (
combustionModels::psiChemistryCombustionModel::New combustionModels::psiCombustionModel::New(mesh)
(
mesh
)
); );
psiChemistryModel& chemistry = reaction->pChemistry(); psiReactionThermo& thermo = reaction->thermo();
psiReactionThermo& thermo = chemistry.thermo();
basicMultiComponentMixture& composition = thermo.composition(); basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y(); PtrList<volScalarField>& Y = composition.Y();

View File

@ -31,7 +31,7 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "psiChemistryCombustionModel.H" #include "psiCombustionModel.H"
#include "multivariateScheme.H" #include "multivariateScheme.H"
#include "pimpleControl.H" #include "pimpleControl.H"

View File

@ -1,16 +1,11 @@
Info<< "Creating reaction model\n" << endl; Info<< "Creating reaction model\n" << endl;
autoPtr<combustionModels::rhoChemistryCombustionModel> reaction autoPtr<combustionModels::rhoCombustionModel> reaction
( (
combustionModels::rhoChemistryCombustionModel::New combustionModels::rhoCombustionModel::New(mesh)
(
mesh
)
); );
rhoChemistryModel& chemistry = reaction->pChemistry(); rhoReactionThermo& thermo = reaction->thermo();
rhoReactionThermo& thermo = chemistry.thermo();
basicMultiComponentMixture& composition = thermo.composition(); basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y(); PtrList<volScalarField>& Y = composition.Y();

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,7 +31,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "rhoChemistryCombustionModel.H" #include "rhoCombustionModel.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "multivariateScheme.H" #include "multivariateScheme.H"
#include "pimpleControl.H" #include "pimpleControl.H"

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,7 +38,7 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicReactingMultiphaseCloud.H" #include "basicReactingMultiphaseCloud.H"
#include "rhoChemistryCombustionModel.H" #include "rhoCombustionModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "porousZones.H" #include "porousZones.H"
#include "IObasicSourceList.H" #include "IObasicSourceList.H"

View File

@ -1,16 +1,11 @@
Info<< "Creating combustion model\n" << endl; Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::rhoChemistryCombustionModel> combustion autoPtr<combustionModels::rhoCombustionModel> combustion
( (
combustionModels::rhoChemistryCombustionModel::New combustionModels::rhoCombustionModel::New(mesh)
(
mesh
)
); );
rhoChemistryModel& chemistry = combustion->pChemistry(); rhoReactionThermo& thermo = combustion->thermo();
rhoReactionThermo& thermo = chemistry.thermo();
SLGThermo slgThermo(mesh, thermo); SLGThermo slgThermo(mesh, thermo);

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -39,7 +39,7 @@ Description
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicThermoCloud.H" #include "basicThermoCloud.H"
#include "coalCloud.H" #include "coalCloud.H"
#include "psiChemistryCombustionModel.H" #include "psiCombustionModel.H"
#include "IObasicSourceList.H" #include "IObasicSourceList.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H" #include "SLGThermo.H"

View File

@ -1,16 +1,11 @@
Info<< "Creating combustion model\n" << endl; Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::psiChemistryCombustionModel> combustion autoPtr<combustionModels::psiCombustionModel> combustion
( (
combustionModels::psiChemistryCombustionModel::New combustionModels::psiCombustionModel::New(mesh)
(
mesh
)
); );
psiChemistryModel& chemistry = combustion->pChemistry(); psiReactionThermo& thermo = combustion->thermo();
psiReactionThermo& thermo = chemistry.thermo();
SLGThermo slgThermo(mesh, thermo); SLGThermo slgThermo(mesh, thermo);

View File

@ -1,16 +1,11 @@
Info<< "Creating combustion model\n" << endl; Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::rhoChemistryCombustionModel> combustion autoPtr<combustionModels::rhoCombustionModel> combustion
( (
combustionModels::rhoChemistryCombustionModel::New combustionModels::rhoCombustionModel::New(mesh)
(
mesh
)
); );
rhoChemistryModel& chemistry = combustion->pChemistry(); rhoReactionThermo& thermo = combustion->thermo();
rhoReactionThermo& thermo = chemistry.thermo();
SLGThermo slgThermo(mesh, thermo); SLGThermo slgThermo(mesh, thermo);

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Application
porousExplicitSourceReactingParcelFoam porousExplicitSourceReactingParcelFoam
Description Description
Transient PISO solver for compressible, laminar or turbulent flow with Transient PIMPLE solver for compressible, laminar or turbulent flow with
reacting multiphase Lagrangian parcels for porous media, including explicit reacting multiphase Lagrangian parcels for porous media, including explicit
sources for mass, momentum and energy sources for mass, momentum and energy
@ -42,7 +42,7 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicReactingMultiphaseCloud.H" #include "basicReactingMultiphaseCloud.H"
#include "rhoChemistryCombustionModel.H" #include "rhoCombustionModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "porousZones.H" #include "porousZones.H"
#include "IObasicSourceList.H" #include "IObasicSourceList.H"

View File

@ -1,16 +1,11 @@
Info<< "Creating combustion model\n" << endl; Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::psiChemistryCombustionModel> combustion autoPtr<combustionModels::psiCombustionModel> combustion
( (
combustionModels::psiChemistryCombustionModel::New combustionModels::psiCombustionModel::New(mesh)
(
mesh
)
); );
psiChemistryModel& chemistry = combustion->pChemistry(); psiReactionThermo& thermo = combustion->thermo();
psiReactionThermo& thermo = chemistry.thermo();
SLGThermo slgThermo(mesh, thermo); SLGThermo slgThermo(mesh, thermo);

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Application
reactingParcelFilmFoam reactingParcelFilmFoam
Description Description
Transient PISO solver for compressible, laminar or turbulent flow with Transient PIMPLE solver for compressible, laminar or turbulent flow with
reacting Lagrangian parcels, and surface film modelling. reacting Lagrangian parcels, and surface film modelling.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -34,7 +34,7 @@ Description
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicReactingCloud.H" #include "basicReactingCloud.H"
#include "surfaceFilmModel.H" #include "surfaceFilmModel.H"
#include "psiChemistryCombustionModel.H" #include "psiCombustionModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H" #include "SLGThermo.H"
#include "pimpleControl.H" #include "pimpleControl.H"

View File

@ -1,6 +1,7 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
@ -20,12 +21,14 @@ EXE_INC = \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/combustionModels/lnInclude \ -I$(LIB_SRC)/combustionModels/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude \
-I$(FOAM_SOLVERS)/combustion/reactingFoam -I$(FOAM_SOLVERS)/combustion/reactingFoam
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-lsampling \
-lcompressibleTurbulenceModel \ -lcompressibleTurbulenceModel \
-lcompressibleRASModels \ -lcompressibleRASModels \
-lcompressibleLESModels \ -lcompressibleLESModels \
@ -45,4 +48,5 @@ EXE_LIBS = \
-lODE \ -lODE \
-lregionModels \ -lregionModels \
-lsurfaceFilmModels \ -lsurfaceFilmModels \
-lfieldSources \
-lcombustionModels -lcombustionModels

View File

@ -10,8 +10,10 @@
UEqn.relax(); UEqn.relax();
sources.constrain(UEqn);
if (pimple.momentumPredictor()) if (pimple.momentumPredictor())
{ {
solve(UEqn == -fvc::grad(p)); solve(UEqn == -fvc::grad(p) + sources(rho, U));
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
} }

View File

@ -5,7 +5,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection
mesh, mesh,
fields, fields,
phi, phi,
mesh.divScheme("div(phi,Yi_h)") mesh.divScheme("div(phi,Yi_hs)")
) )
); );
@ -30,9 +30,13 @@ tmp<fv::convectionScheme<scalar> > mvConvection
== ==
parcels.SYi(i, Yi) parcels.SYi(i, Yi)
+ combustion->R(Yi) + combustion->R(Yi)
+ sources(rho, Yi)
); );
YiEqn.relax(); YiEqn.relax();
sources.constrain(YiEqn);
YiEqn.solve(mesh.solver("Yi")); YiEqn.solve(mesh.solver("Yi"));
Yi.max(0.0); Yi.max(0.0);

View File

@ -1,16 +1,11 @@
Info<< "Creating combustion model\n" << endl; Info<< "Creating combustion model\n" << endl;
autoPtr<combustionModels::psiChemistryCombustionModel> combustion autoPtr<combustionModels::psiCombustionModel> combustion
( (
combustionModels::psiChemistryCombustionModel::New combustionModels::psiCombustionModel::New(mesh)
(
mesh
)
); );
psiChemistryModel& chemistry = combustion->pChemistry(); psiReactionThermo& thermo = combustion->thermo();
psiReactionThermo& thermo = chemistry.thermo();
SLGThermo slgThermo(mesh, thermo); SLGThermo slgThermo(mesh, thermo);
@ -102,3 +97,6 @@
mesh, mesh,
dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) dimensionedScalar("dQ", dimEnergy/dimTime, 0.0)
); );
Info<< "Creating sources\n" << endl;
IObasicSourceList sources(mesh);

View File

@ -1,5 +1,5 @@
{ {
fvScalarMatrix hEqn fvScalarMatrix hsEqn
( (
fvm::ddt(rho, hs) fvm::ddt(rho, hs)
+ mvConvection->fvmDiv(phi, hs) + mvConvection->fvmDiv(phi, hs)
@ -10,11 +10,14 @@
+ parcels.Sh(hs) + parcels.Sh(hs)
+ radiation->Sh(thermo) + radiation->Sh(thermo)
+ combustion->Sh() + combustion->Sh()
+ sources(rho, hs)
); );
hEqn.relax(); hsEqn.relax();
hEqn.solve(); sources.constrain(hsEqn);
hsEqn.solve();
thermo.correct(); thermo.correct();

View File

@ -2,7 +2,7 @@ rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
volVectorField HbyA("HbyA", U); volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H(); HbyA = rAU*(UEqn == sources(rho, U))().H();
if (pimple.transonic()) if (pimple.transonic())
{ {
@ -25,6 +25,7 @@ if (pimple.transonic())
- fvm::laplacian(rho*rAU, p) - fvm::laplacian(rho*rAU, p)
== ==
parcels.Srho() parcels.Srho()
+ sources(psi, p, rho.name())
); );
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
@ -56,6 +57,7 @@ else
- fvm::laplacian(rho*rAU, p) - fvm::laplacian(rho*rAU, p)
== ==
parcels.Srho() parcels.Srho()
+ sources(psi, p, rho.name())
); );
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
@ -72,6 +74,7 @@ else
U = HbyA - rAU*fvc::grad(p); U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
sources.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
dpdt = fvc::ddt(p); dpdt = fvc::ddt(p);

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Application
reactingParcelFoam reactingParcelFoam
Description Description
Transient PISO solver for compressible, laminar or turbulent flow with Transient PIMPLE solver for compressible, laminar or turbulent flow with
reacting Lagrangian parcels. reacting Lagrangian parcels.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -33,10 +33,11 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicReactingCloud.H" #include "basicReactingCloud.H"
#include "psiChemistryCombustionModel.H" #include "psiCombustionModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H" #include "SLGThermo.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "IObasicSourceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,13 +30,18 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
{ {
solve fvScalarMatrix rhoEqn
( (
fvm::ddt(rho) fvm::ddt(rho)
+ fvc::div(phi) + fvc::div(phi)
== ==
parcels.Srho(rho) parcels.Srho(rho)
+ sources(rho)
); );
sources.constrain(rhoEqn);
rhoEqn.solve();
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,6 +2,7 @@ EXE_INC = \
-I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam \ -I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
@ -21,12 +22,14 @@ EXE_INC = \
-I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude \
-I$(LIB_SRC)/combustionModels/lnInclude -I$(LIB_SRC)/combustionModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-lsampling \
-lcompressibleTurbulenceModel \ -lcompressibleTurbulenceModel \
-lcompressibleRASModels \ -lcompressibleRASModels \
-lcompressibleLESModels \ -lcompressibleLESModels \
@ -47,4 +50,5 @@ EXE_LIBS = \
-lODE \ -lODE \
-lregionModels \ -lregionModels \
-lsurfaceFilmModels \ -lsurfaceFilmModels \
-lfieldSources \
-lcombustionModels -lcombustionModels

View File

@ -3,6 +3,7 @@ EXE_INC = \
-I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam \ -I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
@ -23,12 +24,14 @@ EXE_INC = \
-I$(LIB_SRC)/engine/lnInclude \ -I$(LIB_SRC)/engine/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude \
-I$(LIB_SRC)/combustionModels/lnInclude -I$(LIB_SRC)/combustionModels/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-lsampling \
-lcompressibleTurbulenceModel \ -lcompressibleTurbulenceModel \
-lcompressibleRASModels \ -lcompressibleRASModels \
-lcompressibleLESModels \ -lcompressibleLESModels \
@ -50,4 +53,5 @@ EXE_LIBS = \
-lengine \ -lengine \
-lregionModels \ -lregionModels \
-lsurfaceFilmModels \ -lsurfaceFilmModels \
-lfieldSources \
-lcombustionModels -lcombustionModels

View File

@ -2,7 +2,7 @@ rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
volVectorField HbyA("HbyA", U); volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn.H(); HbyA = rAU*(UEqn == sources(rho, U))().H();
if (pimple.transonic()) if (pimple.transonic())
{ {
@ -25,6 +25,7 @@ if (pimple.transonic())
- fvm::laplacian(rho*rAU, p) - fvm::laplacian(rho*rAU, p)
== ==
parcels.Srho() parcels.Srho()
+ sources(psi, p, rho.name())
); );
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
@ -56,6 +57,7 @@ else
- fvm::laplacian(rho*rAU, p) - fvm::laplacian(rho*rAU, p)
== ==
parcels.Srho() parcels.Srho()
+ sources(psi, p, rho.name())
); );
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
@ -72,6 +74,7 @@ else
U = HbyA - rAU*fvc::grad(p); U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
sources.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
dpdt = fvc::ddt(p); dpdt = fvc::ddt(p);

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,10 +35,11 @@ Description
#include "engineMesh.H" #include "engineMesh.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicSprayCloud.H" #include "basicSprayCloud.H"
#include "psiChemistryCombustionModel.H" #include "psiCombustionModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H" #include "SLGThermo.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "IObasicSourceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -105,7 +106,7 @@ int main(int argc, char *argv[])
if (runTime.write()) if (runTime.write())
{ {
chemistry.dQ()().write(); combustion->dQ()().write();
} }
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,10 +33,11 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicSprayCloud.H" #include "basicSprayCloud.H"
#include "psiChemistryCombustionModel.H" #include "psiCombustionModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "SLGThermo.H" #include "SLGThermo.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "IObasicSourceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -98,7 +99,7 @@ int main(int argc, char *argv[])
if (runTime.write()) if (runTime.write())
{ {
chemistry.dQ()().write(); combustion->dQ()().write();
} }
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -78,10 +78,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
typedef treeDataPrimitivePatch<face, List, const pointField, point>
treeDataBPatch;
typedef PrimitivePatch<face, List, const pointField, point> bPatch; typedef PrimitivePatch<face, List, const pointField, point> bPatch;
typedef treeDataPrimitivePatch<bPatch> treeDataBPatch;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class backgroundMeshDecomposition Declaration Class backgroundMeshDecomposition Declaration

View File

@ -154,6 +154,7 @@ castellatedMeshControls
//faceZone sphere; //faceZone sphere;
//cellZone sphere; //cellZone sphere;
//cellZoneInside inside; //outside/insidePoint //cellZoneInside inside; //outside/insidePoint
//- Optional specification of what to do with faceZone faces: //- Optional specification of what to do with faceZone faces:
// internal : keep them as internal faces (default) // internal : keep them as internal faces (default)
// baffle : create baffles from them. This gives more // baffle : create baffles from them. This gives more

View File

@ -1018,6 +1018,11 @@ int main(int argc, char *argv[])
// Update proc maps // Update proc maps
if (cellProcAddressing.headerOk()) if (cellProcAddressing.headerOk())
if
(
cellProcAddressing.headerOk()
&& cellProcAddressing.size() == mesh.nCells()
)
{ {
Info<< "Renumbering processor cell decomposition map " Info<< "Renumbering processor cell decomposition map "
<< cellProcAddressing.name() << endl; << cellProcAddressing.name() << endl;
@ -1028,6 +1033,11 @@ int main(int argc, char *argv[])
); );
} }
if (faceProcAddressing.headerOk()) if (faceProcAddressing.headerOk())
if
(
faceProcAddressing.headerOk()
&& faceProcAddressing.size() == mesh.nFaces()
)
{ {
Info<< "Renumbering processor face decomposition map " Info<< "Renumbering processor face decomposition map "
<< faceProcAddressing.name() << endl; << faceProcAddressing.name() << endl;
@ -1054,6 +1064,11 @@ int main(int argc, char *argv[])
} }
} }
if (pointProcAddressing.headerOk()) if (pointProcAddressing.headerOk())
if
(
pointProcAddressing.headerOk()
&& pointProcAddressing.size() == mesh.nPoints()
)
{ {
Info<< "Renumbering processor point decomposition map " Info<< "Renumbering processor point decomposition map "
<< pointProcAddressing.name() << endl; << pointProcAddressing.name() << endl;
@ -1173,21 +1188,41 @@ int main(int argc, char *argv[])
mesh.write(); mesh.write();
if (cellProcAddressing.headerOk()) if (cellProcAddressing.headerOk())
if
(
cellProcAddressing.headerOk()
&& cellProcAddressing.size() == mesh.nCells()
)
{ {
cellProcAddressing.instance() = mesh.facesInstance(); cellProcAddressing.instance() = mesh.facesInstance();
cellProcAddressing.write(); cellProcAddressing.write();
} }
if (faceProcAddressing.headerOk()) if (faceProcAddressing.headerOk())
if
(
faceProcAddressing.headerOk()
&& faceProcAddressing.size() == mesh.nFaces()
)
{ {
faceProcAddressing.instance() = mesh.facesInstance(); faceProcAddressing.instance() = mesh.facesInstance();
faceProcAddressing.write(); faceProcAddressing.write();
} }
if (pointProcAddressing.headerOk()) if (pointProcAddressing.headerOk())
if
(
pointProcAddressing.headerOk()
&& pointProcAddressing.size() == mesh.nPoints()
)
{ {
pointProcAddressing.instance() = mesh.facesInstance(); pointProcAddressing.instance() = mesh.facesInstance();
pointProcAddressing.write(); pointProcAddressing.write();
} }
if (boundaryProcAddressing.headerOk()) if (boundaryProcAddressing.headerOk())
if
(
boundaryProcAddressing.headerOk()
&& boundaryProcAddressing.size() == mesh.boundaryMesh().size()
)
{ {
boundaryProcAddressing.instance() = mesh.facesInstance(); boundaryProcAddressing.instance() = mesh.facesInstance();
boundaryProcAddressing.write(); boundaryProcAddressing.write();

View File

@ -238,6 +238,14 @@ FoamFile
// cos 0.01; // Tolerance (max cos of angle) // cos 0.01; // Tolerance (max cos of angle)
// } // }
// //
// // Walk on faces in faceSet, starting from face nearest given position
// source regionToFace;
// sourceInfo
// {
// set f0;
// nearPoint (0.1 0.1 0.005);
// }
//
// //
// //
// pointSet // pointSet

View File

@ -811,7 +811,6 @@ void Foam::vtkPV3Foam::renderPatchNames(vtkRenderer* renderer, const bool show)
} }
void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const
{ {
os << indent << "Number of nodes: " os << indent << "Number of nodes: "
@ -821,9 +820,10 @@ void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const
<< (meshPtr_ ? meshPtr_->nCells() : 0) << "\n"; << (meshPtr_ ? meshPtr_->nCells() : 0) << "\n";
os << indent << "Number of available time steps: " os << indent << "Number of available time steps: "
<< (dbPtr_.valid() ? dbPtr_().times().size() : 0) << endl; << (dbPtr_.valid() ? dbPtr_().times().size() : 0) << "\n";
os << indent << "mesh region: " << meshRegion_ << "\n"; os << indent << "mesh region: " << meshRegion_ << "\n";
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,9 +41,9 @@ int main(int argc, char *argv[])
{ {
timeSelector::addOptions(); timeSelector::addOptions();
#include "setRootCase.H" #include "setRootCase.H"
# include "createTime.H" #include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args); instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H" #include "createMesh.H"
forAll(timeDirs, timeI) forAll(timeDirs, timeI)
{ {
@ -90,7 +90,7 @@ int main(int argc, char *argv[])
mesh mesh
); );
# include "createPhi.H" #include "createPhi.H"
singlePhaseTransportModel laminarTransport(U, phi); singlePhaseTransportModel laminarTransport(U, phi);
@ -124,8 +124,8 @@ int main(int argc, char *argv[])
Info<< "Patch " << patchi Info<< "Patch " << patchi
<< " named " << currPatch.name() << " named " << currPatch.name()
<< " y+ : min: " << min(Yp) << " max: " << max(Yp) << " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp)
<< " average: " << average(Yp) << nl << endl; << " average: " << gAverage(Yp) << nl << endl;
} }
} }

View File

@ -86,8 +86,8 @@ void calcIncompressibleYPlus
Info<< "Patch " << patchi Info<< "Patch " << patchi
<< " named " << nutPw.patch().name() << " named " << nutPw.patch().name()
<< " y+ : min: " << min(Yp) << " max: " << max(Yp) << " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp)
<< " average: " << average(Yp) << nl << endl; << " average: " << gAverage(Yp) << nl << endl;
} }
} }
@ -166,8 +166,8 @@ void calcCompressibleYPlus
Info<< "Patch " << patchi Info<< "Patch " << patchi
<< " named " << mutPw.patch().name() << " named " << mutPw.patch().name()
<< " y+ : min: " << min(Yp) << " max: " << max(Yp) << " y+ : min: " << gMin(Yp) << " max: " << gMax(Yp)
<< " average: " << average(Yp) << nl << endl; << " average: " << gAverage(Yp) << nl << endl;
} }
} }

View File

@ -92,7 +92,15 @@ bool setCellFieldType
field.boundaryField()[patchi].patchInternalField(); field.boundaryField()[patchi].patchInternalField();
} }
field.write(); if (!field.write())
{
FatalErrorIn
(
"void setCellFieldType"
"(const fvMesh& mesh, const labelList& selectedCells,"
"Istream& fieldValueStream)"
) << "Failed writing field " << fieldName << endl;
}
} }
else else
{ {
@ -102,6 +110,9 @@ bool setCellFieldType
"(const fvMesh& mesh, const labelList& selectedCells," "(const fvMesh& mesh, const labelList& selectedCells,"
"Istream& fieldValueStream)" "Istream& fieldValueStream)"
) << "Field " << fieldName << " not found" << endl; ) << "Field " << fieldName << " not found" << endl;
// Consume value
(void)pTraits<Type>(fieldValueStream);
} }
return true; return true;
@ -260,7 +271,15 @@ bool setFaceFieldType
} }
} }
field.write(); if (!field.write())
{
FatalErrorIn
(
"void setFaceFieldType"
"(const fvMesh& mesh, const labelList& selectedFaces,"
"Istream& fieldValueStream)"
) << "Failed writing field " << field.name() << exit(FatalError);
}
} }
else else
{ {
@ -270,6 +289,9 @@ bool setFaceFieldType
"(const fvMesh& mesh, const labelList& selectedFaces," "(const fvMesh& mesh, const labelList& selectedFaces,"
"Istream& fieldValueStream)" "Istream& fieldValueStream)"
) << "Field " << fieldName << " not found" << endl; ) << "Field " << fieldName << " not found" << endl;
// Consume value
(void)pTraits<Type>(fieldValueStream);
} }
return true; return true;

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,7 +36,8 @@ namespace combustionModels
template<class CombThermoType, class ThermoType> template<class CombThermoType, class ThermoType>
FSD<CombThermoType, ThermoType>::FSD FSD<CombThermoType, ThermoType>::FSD
( (
const word& modelType, const fvMesh& mesh const word& modelType,
const fvMesh& mesh
) )
: :
singleStepCombustion<CombThermoType, ThermoType>(modelType, mesh), singleStepCombustion<CombThermoType, ThermoType>(modelType, mesh),
@ -62,14 +63,8 @@ FSD<CombThermoType, ThermoType>::FSD
this->mesh(), this->mesh(),
dimensionedScalar("zero", dimless, 0.0) dimensionedScalar("zero", dimless, 0.0)
), ),
YFuelFuelStream_ YFuelFuelStream_(dimensionedScalar("YFuelStream", dimless, 1.0)),
( YO2OxiStream_(dimensionedScalar("YOxiStream", dimless, 0.23)),
dimensionedScalar("YFuelStream", dimless, 1.0)
),
YO2OxiStream_
(
dimensionedScalar("YOxiStream", dimless, 0.23)
),
Cv_(readScalar(this->coeffs().lookup("Cv"))), Cv_(readScalar(this->coeffs().lookup("Cv"))),
C_(5.0), C_(5.0),
ftMin_(0.0), ftMin_(0.0),
@ -91,15 +86,15 @@ FSD<CombThermoType, ThermoType>::~FSD()
template<class CombThermoType, class ThermoType> template<class CombThermoType, class ThermoType>
void FSD<CombThermoType, ThermoType>::calculateSourceNorm() void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
{ {
this->singleMixture_.fresCorrect(); this->singleMixturePtr_->fresCorrect();
const label fuelI = this->singleMixture_.fuelIndex(); const label fuelI = this->singleMixturePtr_->fuelIndex();
const volScalarField& YFuel = this->thermo_->composition().Y()[fuelI]; const volScalarField& YFuel = this->thermoPtr_->composition().Y()[fuelI];
const volScalarField& YO2 = this->thermo_->composition().Y("O2"); const volScalarField& YO2 = this->thermoPtr_->composition().Y("O2");
const dimensionedScalar s = this->singleMixture_.s(); const dimensionedScalar s = this->singleMixturePtr_->s();
ft_ = ft_ =
(s*YFuel - (YO2 - YO2OxiStream_))/(s*YFuelFuelStream_ + YO2OxiStream_); (s*YFuel - (YO2 - YO2OxiStream_))/(s*YFuelFuelStream_ + YO2OxiStream_);
@ -195,7 +190,7 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
volScalarField deltaF volScalarField deltaF
( (
lesModel.delta()/dimensionedScalar("flame",dimLength, 1.5e-3) lesModel.delta()/dimensionedScalar("flame", dimLength, 1.5e-3)
); );
// Linear correlation between delta and flame thickness // Linear correlation between delta and flame thickness
@ -205,33 +200,33 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
forAll(ft_, cellI) forAll(ft_, cellI)
{ {
if(ft_[cellI] > ftMin_ && ft_[cellI] < ftMax_) if (ft_[cellI] > ftMin_ && ft_[cellI] < ftMax_)
{ {
scalar ftCell = ft_[cellI]; scalar ftCell = ft_[cellI];
if(ftVar[cellI] > ftVarMin_) //sub-grid beta pdf of ft_ if (ftVar[cellI] > ftVarMin_) //sub-grid beta pdf of ft_
{ {
scalar ftVarc = ftVar[cellI]; scalar ftVarc = ftVar[cellI];
scalar a = scalar a =
max(ftCell*(ftCell*(1.0 - ftCell)/ftVarc - 1.0), 0.0); max(ftCell*(ftCell*(1.0 - ftCell)/ftVarc - 1.0), 0.0);
scalar b = max(a/ftCell - a, 0.0); scalar b = max(a/ftCell - a, 0.0);
for(int i=1; i<ftDim_; i++) for (int i=1; i<ftDim_; i++)
{ {
scalar ft = i*deltaFt; scalar ft = i*deltaFt;
pc[cellI] += pow(ft, a-1.0)*pow(1.0 - ft, b - 1.0)*deltaFt; pc[cellI] += pow(ft, a-1.0)*pow(1.0 - ft, b - 1.0)*deltaFt;
} }
for(int i=1; i<ftDim_; i++) for (int i=1; i<ftDim_; i++)
{ {
scalar ft = i*deltaFt; scalar ft = i*deltaFt;
omegaFuelBar[cellI] += omegaFuelBar[cellI] +=
omegaFuel[cellI]/omegaF[cellI] omegaFuel[cellI]/omegaF[cellI]
*exp *exp
( (
-sqr(ft - ftStoich) -sqr(ft - ftStoich)
/(2.0*sqr(0.01*omegaF[cellI])) /(2.0*sqr(0.01*omegaF[cellI]))
) )
*pow(ft, a - 1.0) *pow(ft, a - 1.0)
*pow(1.0 - ft, b - 1.0) *pow(1.0 - ft, b - 1.0)
*deltaFt; *deltaFt;
@ -241,31 +236,25 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
else else
{ {
omegaFuelBar[cellI] = omegaFuelBar[cellI] =
(omegaFuel[cellI]/omegaF[cellI]) omegaFuel[cellI]/omegaF[cellI]
*exp *exp(-sqr(ftCell - ftStoich)/(2.0*sqr(0.01*omegaF[cellI])));
(
-sqr(ftCell - ftStoich)/(2.0*sqr(0.01*omegaF[cellI]))
);
} }
} }
else else
{ {
omegaFuelBar[cellI] = 0.0; omegaFuelBar[cellI] = 0.0;
} }
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Combustion progress variable, c
// Combustion progress variable (c).
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
List<label> productsIndex(2, label(-1)); List<label> productsIndex(2, label(-1));
{ {
label i = 0; label i = 0;
forAll (this->singleMixture_.specieProd(), specieI) forAll(this->singleMixturePtr_->specieProd(), specieI)
{ {
if (this->singleMixture_.specieProd()[specieI] < 0) if (this->singleMixturePtr_->specieProd()[specieI] < 0)
{ {
productsIndex[i] = specieI; productsIndex[i] = specieI;
i++; i++;
@ -276,9 +265,9 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
// Flamelet probability of the progress c based on IFC (reuse pc) // Flamelet probability of the progress c based on IFC (reuse pc)
scalar YprodTotal = 0; scalar YprodTotal = 0;
forAll (productsIndex, j) forAll(productsIndex, j)
{ {
YprodTotal += this->singleMixture_.Yprod0()[productsIndex[j]]; YprodTotal += this->singleMixturePtr_->Yprod0()[productsIndex[j]];
} }
forAll(ft_, cellI) forAll(ft_, cellI)
@ -312,10 +301,10 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
volScalarField& products = tproducts(); volScalarField& products = tproducts();
forAll (productsIndex, j) forAll(productsIndex, j)
{ {
label specieI = productsIndex[j]; label specieI = productsIndex[j];
const volScalarField& Yp = this->thermo_->composition().Y()[specieI]; const volScalarField& Yp = this->thermoPtr_->composition().Y()[specieI];
products += Yp; products += Yp;
} }
@ -326,7 +315,7 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
pc = min(C_*c, scalar(1)); pc = min(C_*c, scalar(1));
const volScalarField fres(this->singleMixture_.fres(fuelI)); const volScalarField fres(this->singleMixturePtr_->fres(fuelI));
this->wFuel_ == mgft*pc*omegaFuelBar; this->wFuel_ == mgft*pc*omegaFuelBar;
} }

View File

@ -27,6 +27,9 @@ License
#include "thermoPhysicsTypes.H" #include "thermoPhysicsTypes.H"
#include "psiCombustionModel.H" #include "psiCombustionModel.H"
#include "psiThermoCombustion.H"
#include "rhoCombustionModel.H"
#include "rhoThermoCombustion.H"
#include "FSD.H" #include "FSD.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -38,10 +41,34 @@ namespace combustionModels
makeCombustionTypesThermo makeCombustionTypesThermo
( (
FSD, FSD,
psiCombustionModel, psiThermoCombustion,
gasThermoPhysics gasThermoPhysics,
psiCombustionModel
); );
makeCombustionTypesThermo
(
FSD,
psiThermoCombustion,
constGasThermoPhysics,
psiCombustionModel
);
makeCombustionTypesThermo
(
FSD,
rhoThermoCombustion,
gasThermoPhysics,
rhoCombustionModel
);
makeCombustionTypesThermo
(
FSD,
rhoThermoCombustion,
constGasThermoPhysics,
rhoCombustionModel
);
} }
} }

View File

@ -1,19 +1,17 @@
combustionModel/combustionModel.C combustionModel/combustionModel.C
psiCombustionModel/psiCombustionModel.C psiCombustionModel/psiCombustionModel/psiCombustionModel.C
psiCombustionModel/psiCombustionModelNew.C psiCombustionModel/psiCombustionModel/psiCombustionModelNew.C
psiCombustionModel/psiThermoCombustion/psiThermoCombustion.C
psiCombustionModel/psiChemistryCombustion/psiChemistryCombustion.C
rhoCombustionModel/rhoCombustionModel.C rhoCombustionModel/rhoCombustionModel/rhoCombustionModel.C
rhoCombustionModel/rhoCombustionModelNew.C rhoCombustionModel/rhoCombustionModel/rhoCombustionModelNew.C
rhoCombustionModel/rhoThermoCombustion/rhoThermoCombustion.C
rhoCombustionModel/rhoChemistryCombustion/rhoChemistryCombustion.C
infinitelyFastChemistry/infinitelyFastChemistrys.C infinitelyFastChemistry/infinitelyFastChemistrys.C
psiChemistryCombustionModel/psiChemistryCombustionModel.C
psiChemistryCombustionModel/psiChemistryCombustionModelNew.C
rhoChemistryCombustionModel/rhoChemistryCombustionModel.C
rhoChemistryCombustionModel/rhoChemistryCombustionModelNew.C
PaSR/PaSRs.C PaSR/PaSRs.C
FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C

View File

@ -25,29 +25,27 @@ License
#include "PaSR.H" #include "PaSR.H"
#include "fvmSup.H" #include "fvmSup.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CombThermoType> template<class Type>
Foam::combustionModels::PaSR<CombThermoType>::PaSR Foam::combustionModels::PaSR<Type>::PaSR
( (
const word& modelType, const word& modelType,
const fvMesh& mesh const fvMesh& mesh
) )
: :
CombThermoType(modelType, mesh), Type(modelType, mesh),
Cmix_(this->coeffs().lookup("Cmix")), Cmix_(readScalar(this->coeffs().lookup("Cmix"))),
turbulentReaction_(this->coeffs().lookup("turbulentReaction")), turbulentReaction_(this->coeffs().lookup("turbulentReaction")),
kappa_ kappa_
( (
IOobject IOobject
( (
"kappa", "PaSR::kappa",
mesh.time().timeName(), mesh.time().timeName(),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE, IOobject::AUTO_WRITE
false
), ),
mesh, mesh,
dimensionedScalar("kappa", dimless, 0.0) dimensionedScalar("kappa", dimless, 0.0)
@ -63,24 +61,22 @@ Foam::combustionModels::PaSR<CombThermoType>::PaSR
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CombThermoType> template<class Type>
Foam::combustionModels::PaSR<CombThermoType>::~PaSR() Foam::combustionModels::PaSR<Type>::~PaSR()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Type>
template<class CombThermoType> Foam::tmp<Foam::volScalarField> Foam::combustionModels::PaSR<Type>::tc() const
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::PaSR<CombThermoType>::tc() const
{ {
return this->pChemistry_->tc(); return this->chemistryPtr_->tc();
} }
template<class CombThermoType> template<class Type>
void Foam::combustionModels::PaSR<CombThermoType>::correct() void Foam::combustionModels::PaSR<Type>::correct()
{ {
if (this->active()) if (this->active())
{ {
@ -89,11 +85,11 @@ void Foam::combustionModels::PaSR<CombThermoType>::correct()
if (!useReactionRate_) if (!useReactionRate_)
{ {
this->pChemistry_->solve(t - dt, dt); this->chemistryPtr_->solve(t - dt, dt);
} }
else else
{ {
this->pChemistry_->calculate(); this->chemistryPtr_->calculate();
} }
if (turbulentReaction_) if (turbulentReaction_)
@ -108,20 +104,12 @@ void Foam::combustionModels::PaSR<CombThermoType>::correct()
tmp<volScalarField> ttc(tc()); tmp<volScalarField> ttc(tc());
const volScalarField& tc = ttc(); const volScalarField& tc = ttc();
const dimensionedScalar e0
(
"e0",
sqr(dimLength)/pow3(dimTime),
SMALL
);
forAll(epsilon, i) forAll(epsilon, i)
{ {
if (epsilon[i] > 0) if (epsilon[i] > 0)
{ {
scalar tk = scalar tk =
Cmix_.value() Cmix_*Foam::sqrt(muEff[i]/rho[i]/(epsilon[i] + SMALL));
*Foam::sqrt(muEff[i]/rho[i]/(epsilon[i] + e0.value()));
// Chalmers PaSR model // Chalmers PaSR model
if (!useReactionRate_) if (!useReactionRate_)
@ -148,9 +136,9 @@ void Foam::combustionModels::PaSR<CombThermoType>::correct()
} }
template<class CombThermoType> template<class Type>
Foam::tmp<Foam::fvScalarMatrix> Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::PaSR<CombThermoType>::R(const volScalarField& Y) const Foam::combustionModels::PaSR<Type>::R(const volScalarField& Y) const
{ {
tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime)); tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime));
@ -160,16 +148,16 @@ Foam::combustionModels::PaSR<CombThermoType>::R(const volScalarField& Y) const
{ {
const label specieI = this->thermo().composition().species()[Y.name()]; const label specieI = this->thermo().composition().species()[Y.name()];
Su += kappa_*this->pChemistry_->RR(specieI); Su += kappa_*this->chemistryPtr_->RR(specieI);
} }
return tSu; return tSu;
} }
template<class CombThermoType> template<class Type>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::combustionModels::PaSR<CombThermoType>::dQ() const Foam::combustionModels::PaSR<Type>::dQ() const
{ {
tmp<volScalarField> tdQ tmp<volScalarField> tdQ
( (
@ -193,16 +181,16 @@ Foam::combustionModels::PaSR<CombThermoType>::dQ() const
if (this->active()) if (this->active())
{ {
volScalarField& dQ = tdQ(); volScalarField& dQ = tdQ();
dQ = kappa_*this->pChemistry_->dQ(); dQ = kappa_*this->chemistryPtr_->dQ();
} }
return tdQ; return tdQ;
} }
template<class CombThermoType> template<class Type>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::combustionModels::PaSR<CombThermoType>::Sh() const Foam::combustionModels::PaSR<Type>::Sh() const
{ {
tmp<volScalarField> tSh tmp<volScalarField> tSh
( (
@ -226,17 +214,17 @@ Foam::combustionModels::PaSR<CombThermoType>::Sh() const
if (this->active()) if (this->active())
{ {
scalarField& Sh = tSh(); scalarField& Sh = tSh();
Sh = kappa_*this->pChemistry_->Sh(); Sh = kappa_*this->chemistryPtr_->Sh();
} }
return tSh; return tSh;
} }
template<class CombThermoType> template<class Type>
bool Foam::combustionModels::PaSR<CombThermoType>::read() bool Foam::combustionModels::PaSR<Type>::read()
{ {
if (CombThermoType::read()) if (Type::read())
{ {
this->coeffs().lookup("Cmix") >> Cmix_; this->coeffs().lookup("Cmix") >> Cmix_;
this->coeffs().lookup("turbulentReaction") >> turbulentReaction_; this->coeffs().lookup("turbulentReaction") >> turbulentReaction_;

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -47,15 +47,15 @@ namespace combustionModels
Class PaSR Declaration Class PaSR Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CombThermoType> template<class Type>
class PaSR class PaSR
: :
public CombThermoType public Type
{ {
// Private data // Private data
//- Mixing constant //- Mixing constant
dimensionedScalar Cmix_; scalar Cmix_;
//- Turbulent reaction switch //- Turbulent reaction switch
Switch turbulentReaction_; Switch turbulentReaction_;
@ -88,11 +88,7 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
PaSR PaSR(const word& modelType, const fvMesh& mesh);
(
const word& modelType,
const fvMesh& mesh
);
//- Destructor //- Destructor
@ -115,6 +111,7 @@ public:
//- Return source for enthalpy equation [kg/m/s3] //- Return source for enthalpy equation [kg/m/s3]
virtual tmp<volScalarField> Sh() const; virtual tmp<volScalarField> Sh() const;
// I-O // I-O
//- Update properties from given dictionary //- Update properties from given dictionary

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,8 +25,8 @@ License
#include "makeCombustionTypes.H" #include "makeCombustionTypes.H"
#include "psiChemistryCombustionModel.H" #include "psiChemistryCombustion.H"
#include "rhoChemistryCombustionModel.H" #include "rhoChemistryCombustion.H"
#include "PaSR.H" #include "PaSR.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -35,19 +35,10 @@ namespace Foam
{ {
namespace combustionModels namespace combustionModels
{ {
makeCombustionTypes makeCombustionTypes(PaSR, psiChemistryCombustion, psiCombustionModel);
( makeCombustionTypes(PaSR, rhoChemistryCombustion, rhoCombustionModel);
PaSR,
psiChemistryCombustionModel
);
makeCombustionTypes
(
PaSR,
rhoChemistryCombustionModel
);
} }
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ************************************************************************* //

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,45 +30,44 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeCombustionTypesThermo(CombModel, Comb, Thermo) \ #define makeCombustionTypesThermo(CombModel, CombType, Thermo, Table) \
\
typedef CombModel<Comb, Thermo> CombModel##Comb##Thermo; \
\ \
typedef CombModel<CombType, Thermo> CombModel##CombType##Thermo; \
\ \
defineTemplateTypeNameAndDebugWithName \ defineTemplateTypeNameAndDebugWithName \
( \ ( \
CombModel##Comb##Thermo, \ CombModel##CombType##Thermo, \
#CombModel"<"#Comb","#Thermo">", \ #CombModel"<"#CombType","#Thermo">", \
0 \ 0 \
); \ ); \
\ \
\
addToRunTimeSelectionTable \ addToRunTimeSelectionTable \
( \ ( \
Comb, \ Table, \
CombModel##Comb##Thermo, \ CombModel##CombType##Thermo, \
dictionary \ dictionary \
); );
#define makeCombustionTypes(CombModel, CombThermoType) \
#define makeCombustionTypes(CombModel, CombType, Table) \
\ \
typedef CombModel<CombThermoType> \ typedef CombModel<CombType> CombModel##CombType; \
CombModel##CombThermoType; \
\ \
defineTemplateTypeNameAndDebugWithName \ defineTemplateTypeNameAndDebugWithName \
( \ ( \
CombModel##CombThermoType, \ CombModel##CombType, \
#CombModel"<"#CombThermoType">", \ #CombModel"<"#CombType">", \
0 \ 0 \
); \ ); \
\ \
addToRunTimeSelectionTable \ addToRunTimeSelectionTable \
( \ ( \
CombThermoType, \ Table, \
CombModel##CombThermoType, \ CombModel##CombType, \
dictionary \ dictionary \
); );
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -59,21 +59,22 @@ void infinitelyFastChemistry<CombThermoType, ThermoType>::correct()
if (this->active()) if (this->active())
{ {
this->singleMixture_.fresCorrect(); this->singleMixturePtr_->fresCorrect();
const label fuelI = this->singleMixture_.fuelIndex(); const label fuelI = this->singleMixturePtr_->fuelIndex();
const volScalarField& YFuel = this->thermo_->composition().Y()[fuelI]; const volScalarField& YFuel =
this->thermoPtr_->composition().Y()[fuelI];
const dimensionedScalar s = this->singleMixture_.s(); const dimensionedScalar s = this->singleMixturePtr_->s();
if (this->thermo_->composition().contains("O2")) if (this->thermoPtr_->composition().contains("O2"))
{ {
const volScalarField& YO2 = this->thermo_->composition().Y("O2"); const volScalarField& YO2 = this->thermoPtr_->composition().Y("O2");
this->wFuel_ == this->wFuel_ ==
this->rho()/(this->mesh().time().deltaT()*C_) this->rho()/(this->mesh().time().deltaT()*C_)
*min(YFuel, YO2/s.value()); *min(YFuel, YO2/s.value());
} }
} }
} }

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,6 +35,7 @@ SourceFiles
#ifndef infinitelyFastChemistry_H #ifndef infinitelyFastChemistry_H
#define infinitelyFastChemistry_H #define infinitelyFastChemistry_H
#include "singleStepCombustion.H" #include "singleStepCombustion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,7 +52,7 @@ namespace combustionModels
template<class CombThermoType, class ThermoType> template<class CombThermoType, class ThermoType>
class infinitelyFastChemistry class infinitelyFastChemistry
: :
public singleStepCombustion <CombThermoType, ThermoType> public singleStepCombustion<CombThermoType, ThermoType>
{ {
// Private data // Private data
@ -77,10 +78,7 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
infinitelyFastChemistry infinitelyFastChemistry(const word& modelType, const fvMesh& mesh);
(
const word& modelType, const fvMesh& mesh
);
//- Destructor //- Destructor
@ -95,7 +93,7 @@ public:
virtual void correct(); virtual void correct();
// I-O // I-O
//- Update properties //- Update properties
virtual bool read(); virtual bool read();

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,10 +26,9 @@ License
#include "makeCombustionTypes.H" #include "makeCombustionTypes.H"
#include "thermoPhysicsTypes.H" #include "thermoPhysicsTypes.H"
#include "psiCombustionModel.H" #include "psiThermoCombustion.H"
#include "rhoCombustionModel.H" #include "rhoThermoCombustion.H"
#include "infinitelyFastChemistry.H" #include "infinitelyFastChemistry.H"
#include "singleStepCombustion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -37,26 +36,36 @@ namespace Foam
{ {
namespace combustionModels namespace combustionModels
{ {
makeCombustionTypesThermo makeCombustionTypesThermo
( (
infinitelyFastChemistry, infinitelyFastChemistry,
psiCombustionModel, psiThermoCombustion,
gasThermoPhysics gasThermoPhysics,
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
infinitelyFastChemistry, infinitelyFastChemistry,
psiCombustionModel, psiThermoCombustion,
constGasThermoPhysics constGasThermoPhysics,
psiCombustionModel
); );
makeCombustionTypesThermo makeCombustionTypesThermo
( (
infinitelyFastChemistry, infinitelyFastChemistry,
rhoCombustionModel, rhoThermoCombustion,
gasThermoPhysics gasThermoPhysics,
rhoCombustionModel
);
makeCombustionTypesThermo
(
infinitelyFastChemistry,
rhoThermoCombustion,
constGasThermoPhysics,
rhoCombustionModel
); );
} }
} }

View File

@ -27,6 +27,9 @@ License
#include "psiCombustionModel.H" #include "psiCombustionModel.H"
#include "rhoCombustionModel.H" #include "rhoCombustionModel.H"
#include "psiThermoCombustion.H"
#include "rhoThermoCombustion.H"
#include "noCombustion.H" #include "noCombustion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -38,12 +41,14 @@ namespace combustionModels
makeCombustionTypes makeCombustionTypes
( (
noCombustion, noCombustion,
psiThermoCombustion,
psiCombustionModel psiCombustionModel
); );
makeCombustionTypes makeCombustionTypes
( (
noCombustion, noCombustion,
rhoThermoCombustion,
rhoCombustionModel rhoCombustionModel
); );
} }

View File

@ -1,78 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 "psiChemistryCombustionModel.H"
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::combustionModels::psiChemistryCombustionModel>
Foam::combustionModels::psiChemistryCombustionModel::New
(
const fvMesh& mesh
)
{
const word combModelName
(
IOdictionary
(
IOobject
(
"combustionProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
).lookup("combustionModel")
);
Info<< "Selecting combustion model " << combModelName << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(combModelName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"psiChemistryCombustionModel::New"
) << "Unknown psiChemistryCombustionModel type "
<< combModelName << endl << endl
<< "Valid combustionModels are : " << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
const label tempOpen = combModelName.find('<');
const word className = combModelName(0, tempOpen);
return autoPtr<psiChemistryCombustionModel>
(cstrIter()(className, mesh));
}
// ************************************************************************* //

View File

@ -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) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,54 +23,48 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "psiChemistryCombustionModel.H" #include "psiChemistryCombustion.H"
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
namespace combustionModels
{
defineTypeNameAndDebug(psiChemistryCombustionModel, 0);
defineRunTimeSelectionTable(psiChemistryCombustionModel, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
psiChemistryCombustionModel::psiChemistryCombustionModel Foam::combustionModels::psiChemistryCombustion::psiChemistryCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh const fvMesh& mesh
) )
: :
combustionModel(modelType, mesh), psiCombustionModel(modelType, mesh),
pChemistry_(psiChemistryModel::New(mesh)) chemistryPtr_(psiChemistryModel::New(mesh))
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
psiChemistryCombustionModel::~psiChemistryCombustionModel() Foam::combustionModels::psiChemistryCombustion::~psiChemistryCombustion()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::psiReactionThermo&
bool psiChemistryCombustionModel::read() Foam::combustionModels::psiChemistryCombustion::thermo()
{ {
if (combustionModel::read()) return chemistryPtr_->thermo();
{
return true;
}
else
{
return false;
}
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam const Foam::psiReactionThermo&
} // End namespace combustionModels Foam::combustionModels::psiChemistryCombustion::thermo() const
{
return chemistryPtr_->thermo();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::psiChemistryCombustion::rho() const
{
return chemistryPtr_->thermo().rho();
}
// ************************************************************************* //

View File

@ -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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,24 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::psiChemistryCombustionModel Foam::psiChemistryCombustion
Description Description
Combustion models for compressibility-based thermodynamics Compressibility-based chemistry model wrapper for combustion models
SourceFiles SourceFiles
psiChemistryCombustionModelI.H psiChemistryCombustion.C
psiChemistryCombustionModel.C
psiChemistryCombustionModelNew.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef psiChemistryCombustionModel_H #ifndef psiChemistryCombustion_H
#define psiChemistryCombustionModel_H #define psiChemistryCombustion_H
#include "combustionModel.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "psiCombustionModel.H"
#include "psiChemistryModel.H" #include "psiChemistryModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,108 +47,59 @@ namespace combustionModels
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
class psiChemistryCombustionModel Declaration class psiChemistryCombustion Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class psiChemistryCombustionModel class psiChemistryCombustion
: :
public combustionModel public psiCombustionModel
{ {
// Private Member Functions // Private Member Functions
//- Construct as copy (not implemented) //- Construct as copy (not implemented)
psiChemistryCombustionModel(const psiChemistryCombustionModel&); psiChemistryCombustion(const psiChemistryCombustion&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const psiChemistryCombustionModel&); void operator=(const psiChemistryCombustion&);
protected: protected:
// Protected data // Protected data
//- Auto pointer to psiChemistry //- Pointer to chemistry model
autoPtr<psiChemistryModel> pChemistry_; autoPtr<psiChemistryModel> chemistryPtr_;
public: public:
//- Runtime type information
TypeName("psiChemistryCombustionModel");
//- Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
psiChemistryCombustionModel,
dictionary,
(
const word& modelType,
const fvMesh& mesh
),
(modelType, mesh)
);
// Constructors // Constructors
//- Construct from components and thermo //- Construct from components and thermo
psiChemistryCombustionModel psiChemistryCombustion(const word& modelType, const fvMesh& mesh);
(
const word& modelType,
const fvMesh& mesh
);
//- Selector
static autoPtr<psiChemistryCombustionModel> New
(
const fvMesh& mesh
);
//- Destructor //- Destructor
virtual ~psiChemistryCombustionModel(); virtual ~psiChemistryCombustion();
// Member Functions // Member Functions
//- Return access to the thermo package //- Return access to the thermo package
inline psiChemistryModel& pChemistry(); virtual psiReactionThermo& thermo();
//- Return const access to the thermo package //- Return const access to the thermo package
inline const psiChemistryModel& pChemistry() const; virtual const psiReactionThermo& thermo() const;
//- Return const access to rho //- Return const access to the density field
inline tmp<volScalarField> rho() const; virtual tmp<volScalarField> rho() const;
//- Return const access to rho
inline const psiReactionThermo& thermo() const;
//- Return non const access to rho
inline psiReactionThermo& thermo();
// I-O
//- Update properties from given dictionary
virtual bool read();
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
} // End namespace combustionModels } // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "psiChemistryCombustionModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -38,24 +38,23 @@ namespace combustionModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModels::psiCombustionModel::psiCombustionModel Foam::combustionModels::psiCombustionModel::psiCombustionModel
( (
const word& modelType, const word& modelType,
const fvMesh& mesh const fvMesh& mesh
) )
: :
combustionModel(modelType, mesh), combustionModel(modelType, mesh)
thermo_(psiReactionThermo::New(mesh))
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::combustionModels::psiCombustionModel::~psiCombustionModel() Foam::combustionModels::psiCombustionModel::~psiCombustionModel()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::combustionModels::psiCombustionModel::read() bool Foam::combustionModels::psiCombustionModel::read()
{ {
@ -69,10 +68,5 @@ bool Foam::combustionModels::psiCombustionModel::read()
} }
} }
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::psiCombustionModel::rho() const
{
return thermo_->rho();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -67,17 +67,6 @@ class psiCombustionModel
void operator=(const psiCombustionModel&); void operator=(const psiCombustionModel&);
protected:
// Protected data
//- Thermo package
autoPtr<psiReactionThermo> thermo_;
public: public:
//- Runtime type information //- Runtime type information
@ -100,21 +89,13 @@ public:
// Constructors // Constructors
//- Construct from components and thermo //- Construct from components and thermo
psiCombustionModel psiCombustionModel(const word& modelType, const fvMesh& mesh);
(
const word& modelType,
const fvMesh& mesh
);
//- Selector //- Selector
static autoPtr<psiCombustionModel> New static autoPtr<psiCombustionModel> New(const fvMesh& mesh);
(
const fvMesh& mesh
);
//- Destructor //- Destructor
@ -124,13 +105,14 @@ public:
// Member Functions // Member Functions
//- Return access to the thermo package //- Return access to the thermo package
inline psiReactionThermo& thermo(); virtual psiReactionThermo& thermo() = 0;
//- Return const access to the thermo package //- Return const access to the thermo package
inline const psiReactionThermo& thermo() const; virtual const psiReactionThermo& thermo() const = 0;
//- Return tmp of rho //- Return tmp of rho
virtual tmp<volScalarField> rho() const; virtual tmp<volScalarField> rho() const = 0;
// I-O // I-O
@ -141,12 +123,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
} // End namespace combustionModels } // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "psiCombustionModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,54 +23,48 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "rhoChemistryCombustionModel.H" #include "psiThermoCombustion.H"
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
namespace combustionModels
{
defineTypeNameAndDebug(rhoChemistryCombustionModel, 0);
defineRunTimeSelectionTable(rhoChemistryCombustionModel, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
rhoChemistryCombustionModel::rhoChemistryCombustionModel Foam::combustionModels::psiThermoCombustion::psiThermoCombustion
( (
const word& modelType, const word& modelType,
const fvMesh& mesh const fvMesh& mesh
) )
: :
combustionModel(modelType, mesh), psiCombustionModel(modelType, mesh),
pChemistry_(rhoChemistryModel::New(mesh)) thermoPtr_(psiReactionThermo::New(mesh))
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
rhoChemistryCombustionModel::~rhoChemistryCombustionModel() Foam::combustionModels::psiThermoCombustion::~psiThermoCombustion()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::psiReactionThermo&
bool rhoChemistryCombustionModel::read() Foam::combustionModels::psiThermoCombustion::thermo()
{ {
if (combustionModel::read()) return thermoPtr_();
{
return true;
}
else
{
return false;
}
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam const Foam::psiReactionThermo&
} // End namespace combustionModels Foam::combustionModels::psiThermoCombustion::thermo() const
{
return thermoPtr_();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::psiThermoCombustion::rho() const
{
return thermoPtr_->rho();
}
// ************************************************************************* //

View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::psiThermoCombustion
Description
Compressibility-based thermo model wrapper for combustion models
SourceFiles
psiThermoCombustion.C
\*---------------------------------------------------------------------------*/
#ifndef psiThermoCombustion_H
#define psiThermoCombustion_H
#include "autoPtr.H"
#include "psiCombustionModel.H"
#include "psiReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace combustionModels
{
/*---------------------------------------------------------------------------*\
class psiThermoCombustion Declaration
\*---------------------------------------------------------------------------*/
class psiThermoCombustion
:
public psiCombustionModel
{
// Private Member Functions
//- Construct as copy (not implemented)
psiThermoCombustion(const psiThermoCombustion&);
//- Disallow default bitwise assignment
void operator=(const psiThermoCombustion&);
protected:
// Protected data
//- Pointer to chemistry model
autoPtr<psiReactionThermo> thermoPtr_;
public:
// Constructors
//- Construct from components and thermo
psiThermoCombustion(const word& modelType, const fvMesh& mesh);
//- Destructor
virtual ~psiThermoCombustion();
// Member Functions
//- Return access to the thermo package
virtual psiReactionThermo& thermo();
//- Return const access to the thermo package
virtual const psiReactionThermo& thermo() const;
//- Return const access to the density field
virtual tmp<volScalarField> rho() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,78 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 "rhoChemistryCombustionModel.H"
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::combustionModels::rhoChemistryCombustionModel>
Foam::combustionModels::rhoChemistryCombustionModel::New
(
const fvMesh& mesh
)
{
const word combModelName
(
IOdictionary
(
IOobject
(
"combustionProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
).lookup("combustionModel")
);
Info<< "Selecting combustion model " << combModelName << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(combModelName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"rhoChemistryCombustionModel::New"
) << "Unknown rhoChemistryCombustionModel type "
<< combModelName << endl << endl
<< "Valid combustionModels are : " << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
const label tempOpen = combModelName.find('<');
const word className = combModelName(0, tempOpen);
return autoPtr<rhoChemistryCombustionModel>
(cstrIter()(className, mesh));
}
// ************************************************************************* //

View File

@ -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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,37 +23,48 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // #include "rhoChemistryCombustion.H"
inline Foam::rhoChemistryModel& // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModels::rhoChemistryCombustionModel::pChemistry()
Foam::combustionModels::rhoChemistryCombustion::rhoChemistryCombustion
(
const word& modelType,
const fvMesh& mesh
)
:
rhoCombustionModel(modelType, mesh),
chemistryPtr_(rhoChemistryModel::New(mesh))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::combustionModels::rhoChemistryCombustion::~rhoChemistryCombustion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::rhoReactionThermo&
Foam::combustionModels::rhoChemistryCombustion::thermo()
{ {
return pChemistry_(); return chemistryPtr_->thermo();
} }
inline const Foam::rhoChemistryModel&
Foam::combustionModels::rhoChemistryCombustionModel:: const Foam::rhoReactionThermo&
pChemistry() const Foam::combustionModels::rhoChemistryCombustion::thermo() const
{ {
return pChemistry_(); return chemistryPtr_->thermo();
} }
inline Foam::tmp<Foam::volScalarField>
Foam::combustionModels::rhoChemistryCombustionModel::rho() const Foam::tmp<Foam::volScalarField>
Foam::combustionModels::rhoChemistryCombustion::rho() const
{ {
return pChemistry_->thermo().rho(); return chemistryPtr_->thermo().rho();
} }
inline const Foam::rhoReactionThermo&
Foam::combustionModels::rhoChemistryCombustionModel::thermo() const
{
return pChemistry_->thermo();
}
inline Foam::rhoReactionThermo&
Foam::combustionModels::rhoChemistryCombustionModel::thermo()
{
return pChemistry_->thermo();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,24 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::rhoChemistryCombustionModel Foam::rhoChemistryCombustion
Description Description
Combustion models for compressibility-based thermodynamics Density-based chemistry model wrapper for combustion models
SourceFiles SourceFiles
rhoChemistryCombustionModelI.H rhoChemistryCombustion.C
rhoChemistryCombustionModel.C
rhoChemistryCombustionModelNew.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef rhoChemistryCombustionModel_H #ifndef rhoChemistryCombustion_H
#define rhoChemistryCombustionModel_H #define rhoChemistryCombustion_H
#include "combustionModel.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "rhoCombustionModel.H"
#include "rhoChemistryModel.H" #include "rhoChemistryModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,108 +47,59 @@ namespace combustionModels
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
class rhoChemistryCombustionModel Declaration class rhoChemistryCombustion Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class rhoChemistryCombustionModel class rhoChemistryCombustion
: :
public combustionModel public rhoCombustionModel
{ {
// Private Member Functions // Private Member Functions
//- Construct as copy (not implemented) //- Construct as copy (not implemented)
rhoChemistryCombustionModel(const rhoChemistryCombustionModel&); rhoChemistryCombustion(const rhoChemistryCombustion&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const rhoChemistryCombustionModel&); void operator=(const rhoChemistryCombustion&);
protected: protected:
// Protected data // Protected data
//- Auto pointer to psiChemistry //- Pointer to chemistry model
autoPtr<rhoChemistryModel> pChemistry_; autoPtr<rhoChemistryModel> chemistryPtr_;
public: public:
//- Runtime type information
TypeName("rhoChemistryCombustionModel");
//- Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
rhoChemistryCombustionModel,
dictionary,
(
const word& modelType,
const fvMesh& mesh
),
(modelType, mesh)
);
// Constructors // Constructors
//- Construct from components and thermo //- Construct from components and thermo
rhoChemistryCombustionModel rhoChemistryCombustion(const word& modelType, const fvMesh& mesh);
(
const word& modelType,
const fvMesh& mesh
);
//- Selector
static autoPtr<rhoChemistryCombustionModel> New
(
const fvMesh& mesh
);
//- Destructor //- Destructor
virtual ~rhoChemistryCombustionModel(); virtual ~rhoChemistryCombustion();
// Member Functions // Member Functions
//- Return access to the thermo package //- Return access to the thermo package
inline rhoChemistryModel& pChemistry(); virtual rhoReactionThermo& thermo();
//- Return const access to the thermo package //- Return const access to the thermo package
inline const rhoChemistryModel& pChemistry() const; virtual const rhoReactionThermo& thermo() const;
//- Return const access to rho //- Return const access to the density field
inline tmp<volScalarField> rho() const; virtual tmp<volScalarField> rho() const;
//- Return const access to rho
inline const rhoReactionThermo& thermo() const;
//- Return non const access to rho
inline rhoReactionThermo& thermo();
// I-O
//- Update properties from given dictionary
virtual bool read();
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
} // End namespace combustionModels } // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "rhoChemistryCombustionModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -45,24 +45,18 @@ Foam::combustionModels::rhoCombustionModel::rhoCombustionModel
const fvMesh& mesh const fvMesh& mesh
) )
: :
combustionModel(modelType, mesh), combustionModel(modelType, mesh)
thermo_(rhoReactionThermo::New(mesh))
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::combustionModels::rhoCombustionModel::~rhoCombustionModel() Foam::combustionModels::rhoCombustionModel::~rhoCombustionModel()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::rhoCombustionModel::rho() const
{
return thermo_->rho();
}
bool Foam::combustionModels::rhoCombustionModel::read() bool Foam::combustionModels::rhoCombustionModel::read()
{ {
if (combustionModel::read()) if (combustionModel::read())
@ -75,4 +69,5 @@ bool Foam::combustionModels::rhoCombustionModel::read()
} }
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -67,14 +67,6 @@ class rhoCombustionModel
void operator=(const rhoCombustionModel&); void operator=(const rhoCombustionModel&);
protected:
// Protected data
//- Thermo package
autoPtr<rhoReactionThermo> thermo_;
public: public:
//- Runtime type information //- Runtime type information
@ -99,19 +91,12 @@ public:
//- Construct from components and thermo //- Construct from components and thermo
rhoCombustionModel rhoCombustionModel(const word& modelType, const fvMesh& mesh);
(
const word& modelType,
const fvMesh& mesh
);
//- Selector //- Selector
static autoPtr<rhoCombustionModel> New static autoPtr<rhoCombustionModel> New(const fvMesh& mesh);
(
const fvMesh& mesh
);
//- Destructor //- Destructor
@ -127,13 +112,14 @@ public:
//- Return access to the thermo package //- Return access to the thermo package
inline rhoReactionThermo& thermo(); virtual rhoReactionThermo& thermo() = 0;
//- Return const access to the thermo package //- Return const access to the thermo package
inline const rhoReactionThermo& thermo() const; virtual const rhoReactionThermo& thermo() const = 0;
//- Return tmp of rho //- Return tmp of rho
virtual tmp<volScalarField> rho() const; virtual tmp<volScalarField> rho() const = 0;
// I-O // I-O
@ -144,12 +130,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
} // End namespace combustionModels } // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "rhoCombustionModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,41 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::rhoReactionThermo&
Foam::combustionModels::rhoCombustionModel::thermo()
{
return thermo_();
}
inline const Foam::rhoReactionThermo&
Foam::combustionModels::rhoCombustionModel::thermo() const
{
return thermo_();
}
// ************************************************************************* //

View File

@ -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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,37 +23,48 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // #include "rhoThermoCombustion.H"
inline Foam::psiChemistryModel& // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModels::psiChemistryCombustionModel::pChemistry()
Foam::combustionModels::rhoThermoCombustion::rhoThermoCombustion
(
const word& modelType,
const fvMesh& mesh
)
:
rhoCombustionModel(modelType, mesh),
thermoPtr_(rhoReactionThermo::New(mesh))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::combustionModels::rhoThermoCombustion::~rhoThermoCombustion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::rhoReactionThermo&
Foam::combustionModels::rhoThermoCombustion::thermo()
{ {
return pChemistry_(); return thermoPtr_();
} }
inline const Foam::psiChemistryModel&
Foam::combustionModels::psiChemistryCombustionModel:: const Foam::rhoReactionThermo&
pChemistry() const Foam::combustionModels::rhoThermoCombustion::thermo() const
{ {
return pChemistry_(); return thermoPtr_();
} }
inline Foam::tmp<Foam::volScalarField>
Foam::combustionModels::psiChemistryCombustionModel::rho() const Foam::tmp<Foam::volScalarField>
Foam::combustionModels::rhoThermoCombustion::rho() const
{ {
return pChemistry_->thermo().rho(); return thermoPtr_().rho();
} }
inline const Foam::psiReactionThermo&
Foam::combustionModels::psiChemistryCombustionModel::thermo() const
{
return pChemistry_->thermo();
}
inline Foam::psiReactionThermo&
Foam::combustionModels::psiChemistryCombustionModel::thermo()
{
return pChemistry_->thermo();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::rhoThermoCombustion
Description
Density-based thermo model wrapper for combustion models
SourceFiles
rhoThermoCombustion.C
\*---------------------------------------------------------------------------*/
#ifndef rhoThermoCombustion_H
#define rhoThermoCombustion_H
#include "autoPtr.H"
#include "rhoCombustionModel.H"
#include "rhoChemistryModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace combustionModels
{
/*---------------------------------------------------------------------------*\
class rhoThermoCombustion Declaration
\*---------------------------------------------------------------------------*/
class rhoThermoCombustion
:
public rhoCombustionModel
{
// Private Member Functions
//- Construct as copy (not implemented)
rhoThermoCombustion(const rhoThermoCombustion&);
//- Disallow default bitwise assignment
void operator=(const rhoThermoCombustion&);
protected:
// Protected data
//- Pointer to thermo model
autoPtr<rhoReactionThermo> thermoPtr_;
public:
// Constructors
//- Construct from components and thermo
rhoThermoCombustion(const word& modelType, const fvMesh& mesh);
//- Destructor
virtual ~rhoThermoCombustion();
// Member Functions
//- Return access to the thermo package
virtual rhoReactionThermo& thermo();
//- Return const access to the thermo package
virtual const rhoReactionThermo& thermo() const;
//- Return const access to the density field
virtual tmp<volScalarField> rho() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,17 +33,14 @@ namespace combustionModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class CombThermoType, class ThermoType>
singleStepCombustion<CombThermoType, ThermoType> singleStepCombustion<CombThermoType, ThermoType>::singleStepCombustion
::singleStepCombustion
( (
const word& modelType, const fvMesh& mesh const word& modelType,
const fvMesh& mesh
) )
: :
CombThermoType(modelType, mesh), CombThermoType(modelType, mesh),
singleMixture_ singleMixturePtr_(NULL),
(
dynamic_cast<singleStepReactingMixture<ThermoType>&>(this->thermo())
),
wFuel_ wFuel_
( (
IOobject IOobject
@ -55,22 +52,45 @@ singleStepCombustion<CombThermoType, ThermoType>
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
this->mesh(), this->mesh(),
dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0) dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
) )
{} {
if (isA<singleStepReactingMixture<ThermoType> >(this->thermo()))
{
singleMixturePtr_ =
&dynamic_cast<singleStepReactingMixture<ThermoType>&>
(
this->thermo()
);
}
else
{
FatalErrorIn
(
"singleStepCombustion<CombThermoType, ThermoType>::"
"singleStepCombustion"
"("
"const word&, "
"const fvMesh&"
")"
)
<< "Inconsistent thermo package for " << this->type() << " model:\n"
<< " " << this->thermo().type() << nl << nl
<< "Please select a thermo package based on "
<< "singleStepReactingMixture" << exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class CombThermoType, class ThermoType>
singleStepCombustion<CombThermoType, ThermoType> singleStepCombustion<CombThermoType, ThermoType>::~singleStepCombustion()
::~singleStepCombustion()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CombThermoType, class ThermoType> template<class CombThermoType, class ThermoType>
Foam::tmp<Foam::fvScalarMatrix> Foam::tmp<Foam::fvScalarMatrix>
singleStepCombustion<CombThermoType, ThermoType>::R singleStepCombustion<CombThermoType, ThermoType>::R
@ -78,11 +98,11 @@ singleStepCombustion<CombThermoType, ThermoType>::R
const volScalarField& Y const volScalarField& Y
) const ) const
{ {
const label specieI = this->thermo_->composition().species()[Y.name()]; const label specieI = this->thermoPtr_->composition().species()[Y.name()];
const volScalarField wSpecie const volScalarField wSpecie
( (
wFuel_*singleMixture_.specieStoichCoeffs()[specieI] wFuel_*singleMixturePtr_->specieStoichCoeffs()[specieI]
); );
return wSpecie + fvm::Sp(0.0*wSpecie, Y); return wSpecie + fvm::Sp(0.0*wSpecie, Y);
@ -93,10 +113,10 @@ template<class CombThermoType, class ThermoType>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
singleStepCombustion< CombThermoType, ThermoType>::Sh() const singleStepCombustion< CombThermoType, ThermoType>::Sh() const
{ {
const label fuelI = singleMixture_.fuelIndex(); const label fuelI = singleMixturePtr_->fuelIndex();
const volScalarField& YFuel = this->thermo_->composition().Y(fuelI); const volScalarField& YFuel = this->thermoPtr_->composition().Y(fuelI);
return -singleMixture_.qFuel()*(R(YFuel) & YFuel); return -singleMixturePtr_->qFuel()*(R(YFuel) & YFuel);
} }

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -44,7 +44,7 @@ namespace combustionModels
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class singleStepCombustion Declaration Class singleStepCombustion Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CombThermoType, class ThermoType> template<class CombThermoType, class ThermoType>
@ -52,20 +52,6 @@ class singleStepCombustion
: :
public CombThermoType public CombThermoType
{ {
protected:
// Protected data
//- Reference to singleStepReactingMixture mixture
singleStepReactingMixture<ThermoType>& singleMixture_;
//- Fuel consumption rate
volScalarField wFuel_;
private:
// Private Member Functions // Private Member Functions
//- Disallow copy construct //- Disallow copy construct
@ -75,16 +61,23 @@ private:
void operator=(const singleStepCombustion&); void operator=(const singleStepCombustion&);
public: protected:
// Protected data
//- Pointer to singleStepReactingMixture mixture
singleStepReactingMixture<ThermoType>* singleMixturePtr_;
//- Fuel consumption rate
volScalarField wFuel_;
public:
// Constructors // Constructors
//- Construct from components //- Construct from components
singleStepCombustion singleStepCombustion(const word& modelType, const fvMesh& mesh);
(
const word& modelType, const fvMesh& mesh
);
//- Destructor //- Destructor
@ -95,7 +88,6 @@ public:
// Evolution // Evolution
//- Fuel consumption rate matrix //- Fuel consumption rate matrix
virtual tmp<fvScalarMatrix> R(const volScalarField& Y) const; virtual tmp<fvScalarMatrix> R(const volScalarField& Y) const;
@ -106,7 +98,7 @@ public:
virtual tmp<volScalarField> Sh() const; virtual tmp<volScalarField> Sh() const;
// I-O // I-O
//- Update properties from given dictionary //- Update properties from given dictionary
virtual bool read(); virtual bool read();
@ -120,7 +112,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "singleStepCombustion.C" # include "singleStepCombustion.C"
#endif #endif

View File

@ -924,10 +924,10 @@ Foam::labelList Foam::boundaryMesh::getNearest
// Create the octrees // Create the octrees
indexedOctree indexedOctree
< <
treeDataPrimitivePatch<face, UIndirectList, const pointField&> treeDataPrimitivePatch<uindirectPrimitivePatch>
> leftTree > leftTree
( (
treeDataPrimitivePatch<face, UIndirectList, const pointField&> treeDataPrimitivePatch<uindirectPrimitivePatch>
( (
false, // cacheBb false, // cacheBb
leftPatch leftPatch
@ -939,10 +939,10 @@ Foam::labelList Foam::boundaryMesh::getNearest
); );
indexedOctree indexedOctree
< <
treeDataPrimitivePatch<face, UIndirectList, const pointField&> treeDataPrimitivePatch<uindirectPrimitivePatch>
> rightTree > rightTree
( (
treeDataPrimitivePatch<face, UIndirectList, const pointField&> treeDataPrimitivePatch<uindirectPrimitivePatch>
( (
false, // cacheBb false, // cacheBb
rightPatch rightPatch

View File

@ -209,8 +209,8 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs()
<< exit(FatalError); << exit(FatalError);
} }
Info<< "min/max mag(zetap) = " << min(zetap & nf()) << ", " Info<< "min/max(zetap) = " << gMin(zetap & nf()) << ", "
<< max(zetap & nf()) << endl; << gMax(zetap & nf()) << endl;
fixedValueFvPatchScalarField::updateCoeffs(); fixedValueFvPatchScalarField::updateCoeffs();
} }

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -44,7 +44,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class multivariateSurfaceInterpolationScheme Declaration Class multivariateSurfaceInterpolationScheme Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>

View File

@ -318,7 +318,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
Sph = dt*htc*As; Sph = dt*htc*As;
dhsTrans += Sph*(0.5*(T_ + Tnew) - Tc_); dhsTrans += Sph*(Tres.average() - Tc_);
return Tnew; return Tnew;
} }

View File

@ -26,6 +26,7 @@ License
#include "InjectionModel.H" #include "InjectionModel.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "meshTools.H" #include "meshTools.H"
#include "volFields.H"
using namespace Foam::constant::mathematical; using namespace Foam::constant::mathematical;

View File

@ -52,6 +52,7 @@ SourceFiles
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "SubModelBase.H" #include "SubModelBase.H"
#include "vector.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -396,7 +396,7 @@ Foam::scalar Foam::CompositionModel<CloudType>::H
forAll(Y, i) forAll(Y, i)
{ {
label gid = props.globalIds()[i]; label gid = props.globalIds()[i];
HMixture += Y[i]*thermo_.carrier().Hs(gid, p, T); HMixture += Y[i]*thermo_.carrier().Ha(gid, p, T);
} }
break; break;
} }

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -249,9 +249,10 @@ class autoSnapDriver
const indirectPrimitivePatch& pp, const indirectPrimitivePatch& pp,
const scalarField& snapDist, const scalarField& snapDist,
const List<List<point> >& pointFaceNormals, const List<List<point> >& pointFaceSurfNormals,
const List<List<point> >& pointFaceDisp, const List<List<point> >& pointFaceDisp,
const List<List<point> >& pointFaceCentres, const List<List<point> >& pointFaceCentres,
const labelListList& pointFacePatchID,
vectorField& patchAttraction, vectorField& patchAttraction,
List<pointConstraint>& patchConstraints List<pointConstraint>& patchConstraints

View File

@ -71,14 +71,15 @@ namespace Foam
} }
}; };
template<class T>
class listPlusEqOp class listPlusEqOp
{ {
public: public:
void operator() void operator()
( (
List<point>& x, List<T>& x,
const List<point>& y const List<T>& y
) const ) const
{ {
label sz = x.size(); label sz = x.size();
@ -486,7 +487,7 @@ void Foam::autoSnapDriver::binFeatureFaces
const label pointI, const label pointI,
const List<List<point> >& pointFaceNormals, const List<List<point> >& pointFaceSurfNormals,
const List<List<point> >& pointFaceDisp, const List<List<point> >& pointFaceDisp,
const List<List<point> >& pointFaceCentres, const List<List<point> >& pointFaceCentres,
@ -495,7 +496,7 @@ void Foam::autoSnapDriver::binFeatureFaces
DynamicList<label>& surfaceCount DynamicList<label>& surfaceCount
) const ) const
{ {
const List<point>& pfNormals = pointFaceNormals[pointI]; const List<point>& pfNormals = pointFaceSurfNormals[pointI];
const List<point>& pfDisp = pointFaceDisp[pointI]; const List<point>& pfDisp = pointFaceDisp[pointI];
const List<point>& pfCentres = pointFaceCentres[pointI]; const List<point>& pfCentres = pointFaceCentres[pointI];
@ -531,7 +532,7 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction
const indirectPrimitivePatch& pp, const indirectPrimitivePatch& pp,
const scalarField& snapDist, const scalarField& snapDist,
const List<List<point> >& pointFaceNormals, const List<List<point> >& pointFaceSurfNormals,
const List<List<point> >& pointFaceDisp, const List<List<point> >& pointFaceDisp,
const List<List<point> >& pointFaceCentres, const List<List<point> >& pointFaceCentres,
@ -590,7 +591,7 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction
snapDist, snapDist,
pointI, pointI,
pointFaceNormals, pointFaceSurfNormals,
pointFaceDisp, pointFaceDisp,
pointFaceCentres, pointFaceCentres,
@ -720,7 +721,7 @@ void Foam::autoSnapDriver::determineAllFeatures
const indirectPrimitivePatch& pp, const indirectPrimitivePatch& pp,
const scalarField& snapDist, const scalarField& snapDist,
const List<List<point> >& pointFaceNormals, const List<List<point> >& pointFaceSurfNormals,
const List<List<point> >& pointFaceDisp, const List<List<point> >& pointFaceDisp,
const List<List<point> >& pointFaceCentres, const List<List<point> >& pointFaceCentres,
@ -873,7 +874,7 @@ void Foam::autoSnapDriver::determineFeatures
//const vectorField& faceSurfaceNormal, //const vectorField& faceSurfaceNormal,
//const vectorField& faceDisp, //const vectorField& faceDisp,
//const vectorField& faceRotation, //const vectorField& faceRotation,
const List<List<point> >& pointFaceNormals, const List<List<point> >& pointFaceSurfNormals,
const List<List<point> >& pointFaceDisp, const List<List<point> >& pointFaceDisp,
const List<List<point> >& pointFaceCentres, const List<List<point> >& pointFaceCentres,
@ -955,7 +956,7 @@ void Foam::autoSnapDriver::determineFeatures
//faceSurfaceNormal, //faceSurfaceNormal,
//faceDisp, //faceDisp,
pointFaceNormals, pointFaceSurfNormals,
pointFaceDisp, pointFaceDisp,
pointFaceCentres, pointFaceCentres,
@ -1132,9 +1133,10 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
//const vectorField& faceSurfaceNormal, //const vectorField& faceSurfaceNormal,
//const vectorField& faceDisp, //const vectorField& faceDisp,
//const vectorField& faceRotation, //const vectorField& faceRotation,
const List<List<point> >& pointFaceNormals, const List<List<point> >& pointFaceSurfNormals,
const List<List<point> >& pointFaceDisp, const List<List<point> >& pointFaceDisp,
const List<List<point> >& pointFaceCentres, const List<List<point> >& pointFaceCentres,
const labelListList& pointFacePatchID,
vectorField& patchAttraction, vectorField& patchAttraction,
List<pointConstraint>& patchConstraints List<pointConstraint>& patchConstraints
@ -1181,7 +1183,7 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
pp, pp,
snapDist, snapDist,
pointFaceNormals, pointFaceSurfNormals,
pointFaceDisp, pointFaceDisp,
pointFaceCentres, pointFaceCentres,
@ -1340,6 +1342,131 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
} }
//MEJ: any faces that have multi-patch points only keep the multi-patch
// points.
{
autoPtr<OFstream> multiPatchStr;
if (debug&meshRefinement::OBJINTERSECTIONS)
{
multiPatchStr.reset
(
new OFstream
(
meshRefiner_.mesh().time().path()
/ "multiPatch_" + name(iter) + ".obj"
)
);
Pout<< nl << "Dumping removed constraints due to same-face"
<< " multi-patch points to "
<< multiPatchStr().name() << endl;
}
// 1. Mark points on multiple patches
PackedBoolList isMultiPatchPoint(pp.size());
forAll(pointFacePatchID, pointI)
{
const labelList& patches = pointFacePatchID[pointI];
label patch0 = patches[0];
for (label i = 1; i < patches.size(); i++)
{
if (patch0 != patches[i])
{
isMultiPatchPoint[pointI] = 1u;
break;
}
}
}
// 2. Make sure multi-patch points are also attracted
forAll(isMultiPatchPoint, pointI)
{
if (isMultiPatchPoint[pointI])
{
if
(
patchConstraints[pointI].first() == 0
&& allPatchConstraints[pointI].first() > 0
)
{
patchAttraction[pointI] = allPatchAttraction[pointI];
patchConstraints[pointI] = allPatchConstraints[pointI];
if (multiPatchStr.valid())
{
Pout<< "Adding constraint on multiPatchPoint:"
<< pp.localPoints()[pointI]
<< " constraint:" << patchConstraints[pointI]
<< " attraction:" << patchAttraction[pointI]
<< endl;
}
}
}
}
// Up to here it is all parallel ok.
// 3. Knock out any attraction on faces with multi-patch points
label nChanged = 0;
forAll(pp.localFaces(), faceI)
{
const face& f = pp.localFaces()[faceI];
label nMultiPatchPoints = 0;
forAll(f, fp)
{
label pointI = f[fp];
if
(
isMultiPatchPoint[pointI]
&& patchConstraints[pointI].first() != 0
)
{
nMultiPatchPoints++;
}
}
if (nMultiPatchPoints > 0)
{
forAll(f, fp)
{
label pointI = f[fp];
if
(
!isMultiPatchPoint[pointI]
&& patchConstraints[pointI].first() != 0
)
{
//Pout<< "Knocking out constraint"
// << " on non-multiPatchPoint:"
// << pp.localPoints()[pointI] << endl;
patchAttraction[pointI] = vector::zero;
patchConstraints[pointI] = pointConstraint();
nChanged++;
if (multiPatchStr.valid())
{
meshTools::writeOBJ
(
multiPatchStr(),
pp.localPoints()[pointI]
);
}
}
}
}
}
reduce(nChanged, sumOp<label>());
Info<< "Removing constraints near multi-patch points : changed "
<< nChanged << " points" << endl;
}
// Dump // Dump
if (debug&meshRefinement::OBJINTERSECTIONS) if (debug&meshRefinement::OBJINTERSECTIONS)
{ {
@ -1753,8 +1880,12 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
const pointField& localPoints = pp.localPoints(); const pointField& localPoints = pp.localPoints();
const fvMesh& mesh = meshRefiner_.mesh(); const fvMesh& mesh = meshRefiner_.mesh();
// Displacement and orientation per pp face. // Displacement and orientation per pp face
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// vector from point on surface back to face centre
vectorField faceDisp(pp.size(), vector::zero); vectorField faceDisp(pp.size(), vector::zero);
// normal of surface at point on surface
vectorField faceSurfaceNormal(pp.size(), vector::zero); vectorField faceSurfaceNormal(pp.size(), vector::zero);
vectorField faceRotation(pp.size(), vector::zero); vectorField faceRotation(pp.size(), vector::zero);
@ -1771,34 +1902,42 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
vectorField patchDisp = nearestDisp; vectorField patchDisp = nearestDisp;
// Collect (possibly remote) face-wise data on coupled points. // Collect (possibly remote) per point data of all surrounding faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// - faceSurfaceNormal // - faceSurfaceNormal
// - faceDisp // - faceDisp
// - faceRotation // - faceRotation
// - faceCentres // - faceCentres&faceNormal
// For now just get all surrounding face data. Expensive - should just // For now just get all surrounding face data. Expensive - should just
// store and sync data on coupled points only (see e.g PatchToolsNormals.C) // store and sync data on coupled points only (see e.g PatchToolsNormals.C)
List<List<point> > pointFaceNormals(pp.nPoints()); List<List<point> > pointFaceSurfNormals(pp.nPoints());
List<List<point> > pointFaceDisp(pp.nPoints()); List<List<point> > pointFaceDisp(pp.nPoints());
List<List<point> > pointFaceCentres(pp.nPoints()); List<List<point> > pointFaceCentres(pp.nPoints());
List<labelList> pointFacePatchID(pp.nPoints());
// Fill local data // Fill local data
forAll(pp.pointFaces(), pointI) forAll(pp.pointFaces(), pointI)
{ {
const labelList& pFaces = pp.pointFaces()[pointI]; const labelList& pFaces = pp.pointFaces()[pointI];
List<point>& pNormals = pointFaceNormals[pointI]; List<point>& pNormals = pointFaceSurfNormals[pointI];
pNormals.setSize(pFaces.size()); pNormals.setSize(pFaces.size());
List<point>& pDisp = pointFaceDisp[pointI]; List<point>& pDisp = pointFaceDisp[pointI];
pDisp.setSize(pFaces.size()); pDisp.setSize(pFaces.size());
List<point>& pFc = pointFaceCentres[pointI]; List<point>& pFc = pointFaceCentres[pointI];
pFc.setSize(pFaces.size()); pFc.setSize(pFaces.size());
labelList& pFid = pointFacePatchID[pointI];
pFid.setSize(pFaces.size());
forAll(pFaces, i) forAll(pFaces, i)
{ {
pNormals[i] = faceSurfaceNormal[pFaces[i]]; label faceI = pFaces[i];
pDisp[i] = faceDisp[pFaces[i]]; pNormals[i] = faceSurfaceNormal[faceI];
pFc[i] = pp.faceCentres()[pFaces[i]]; pDisp[i] = faceDisp[faceI];
pFc[i] = pp.faceCentres()[faceI];
label meshFaceI = pp.addressing()[faceI];
pFid[i] = mesh.boundaryMesh().whichPatch(meshFaceI);
} }
} }
@ -1806,8 +1945,8 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
( (
mesh, mesh,
pp.meshPoints(), pp.meshPoints(),
pointFaceNormals, pointFaceSurfNormals,
listPlusEqOp(), listPlusEqOp<point>(),
List<point>(), List<point>(),
listTransform() listTransform()
); );
@ -1816,7 +1955,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
mesh, mesh,
pp.meshPoints(), pp.meshPoints(),
pointFaceDisp, pointFaceDisp,
listPlusEqOp(), listPlusEqOp<point>(),
List<point>(), List<point>(),
listTransform() listTransform()
); );
@ -1825,13 +1964,27 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
mesh, mesh,
pp.meshPoints(), pp.meshPoints(),
pointFaceCentres, pointFaceCentres,
listPlusEqOp(), listPlusEqOp<point>(),
List<point>(), List<point>(),
listTransform() listTransform()
); );
syncTools::syncPointList
(
mesh,
pp.meshPoints(),
pointFacePatchID,
listPlusEqOp<label>(),
List<label>()
);
// Main calculation
// ~~~~~~~~~~~~~~~~
// This is the main intelligence which calculates per point the vector to
// attract it to the nearest surface. There are lots of possibilities
// here.
// Nearest feature // Nearest feature
vectorField patchAttraction(localPoints.size(), vector::zero); vectorField patchAttraction(localPoints.size(), vector::zero);
// Constraints at feature // Constraints at feature
@ -1845,9 +1998,10 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurfaceFeature
pp, pp,
snapDist, snapDist,
pointFaceNormals, pointFaceSurfNormals,
pointFaceDisp, pointFaceDisp,
pointFaceCentres, pointFaceCentres,
pointFacePatchID,
patchAttraction, patchAttraction,
patchConstraints patchConstraints

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -272,7 +272,11 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
// Find all start cells of features. Is done by tracking from keepPoint. // Find all start cells of features. Is done by tracking from keepPoint.
Cloud<trackedParticle> cloud(mesh_, IDLList<trackedParticle>()); Cloud<trackedParticle> cloud(mesh_, IDLList<trackedParticle>());
// Create particles on whichever processor holds the keepPoint.
// Features are identical on all processors. Number them so we know
// what to seed. Do this on only the processor that
// holds the keepPoint.
label cellI = -1; label cellI = -1;
label tetFaceI = -1; label tetFaceI = -1;
label tetPtI = -1; label tetPtI = -1;
@ -281,13 +285,25 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
if (cellI != -1) if (cellI != -1)
{ {
// I am the processor that holds the keepPoint
forAll(features_, featI) forAll(features_, featI)
{ {
const featureEdgeMesh& featureMesh = features_[featI]; const featureEdgeMesh& featureMesh = features_[featI];
const label featureLevel = features_.levels()[featI]; const label featureLevel = features_.levels()[featI];
const labelListList& pointEdges = featureMesh.pointEdges(); const labelListList& pointEdges = featureMesh.pointEdges();
// Find regions on edgeMesh
labelList edgeRegion;
label nRegions = featureMesh.regions(edgeRegion);
PackedBoolList regionVisited(nRegions);
// 1. Seed all 'knots' in edgeMesh
forAll(pointEdges, pointI) forAll(pointEdges, pointI)
{ {
if (pointEdges[pointI].size() != 2) if (pointEdges[pointI].size() != 2)
@ -316,6 +332,50 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
pointI // end point pointI // end point
) )
); );
// Mark
if (pointEdges[pointI].size() > 0)
{
label e0 = pointEdges[pointI][0];
label regionI = edgeRegion[e0];
regionVisited[regionI] = 1u;
}
}
}
// 2. Any regions that have not been visited at all? These can
// only be circular regions!
forAll(featureMesh.edges(), edgeI)
{
if (regionVisited.set(edgeRegion[edgeI], 1u))
{
const edge& e = featureMesh.edges()[edgeI];
label pointI = e.start();
if (debug)
{
Pout<< "Adding particle from point:" << pointI
<< " coord:" << featureMesh.points()[pointI]
<< " on circular region:" << edgeRegion[edgeI]
<< endl;
}
// Non-manifold point. Create particle.
cloud.addParticle
(
new trackedParticle
(
mesh_,
keepPoint,
cellI,
tetFaceI,
tetPtI,
featureMesh.points()[pointI], // endpos
featureLevel, // level
featI, // featureMesh
pointI // end point
)
);
} }
} }
} }
@ -329,6 +389,8 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
trackedParticle::trackingData td(cloud, maxFeatureLevel); trackedParticle::trackingData td(cloud, maxFeatureLevel);
// Track all particles to their end position (= starting feature point) // Track all particles to their end position (= starting feature point)
// Note that the particle might have started on a different processor
// so this will transfer across nicely until we can start tracking proper.
cloud.move(td, GREAT); cloud.move(td, GREAT);
// Reset level // Reset level

View File

@ -149,13 +149,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::checkPatches
const scalar maxBoundsError = 0.05; const scalar maxBoundsError = 0.05;
// check bounds of source and target // check bounds of source and target
boundBox bbSrc(srcPatch.points(), srcPatch.meshPoints()); boundBox bbSrc(srcPatch.points(), srcPatch.meshPoints(), true);
reduce(bbSrc.min(), minOp<point>()); boundBox bbTgt(tgtPatch.points(), tgtPatch.meshPoints(), true);
reduce(bbSrc.max(), maxOp<point>());
boundBox bbTgt(tgtPatch.points(), tgtPatch.meshPoints());
reduce(bbTgt.min(), minOp<point>());
reduce(bbTgt.max(), maxOp<point>());
boundBox bbTgtInf(bbTgt); boundBox bbTgtInf(bbTgt);
bbTgtInf.inflate(maxBoundsError); bbTgtInf.inflate(maxBoundsError);
@ -1164,50 +1159,36 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
const word& patchName, const word& patchName,
const labelListList& addr, const labelListList& addr,
scalarListList& wght, scalarListList& wght,
scalarField& wghtSum,
const bool output const bool output
) )
{ {
scalar minBound = VGREAT;
scalar maxBound = -VGREAT;
scalar tSum = 0.0;
// Normalise the weights // Normalise the weights
wghtSum.setSize(wght.size());
forAll(wght, faceI) forAll(wght, faceI)
{ {
scalar s = sum(wght[faceI]); scalar s = sum(wght[faceI]);
scalar t = s/patchAreas[faceI]; scalar t = s/patchAreas[faceI];
tSum += t;
if (t < minBound)
{
minBound = t;
}
if (t > maxBound)
{
maxBound = t;
}
forAll(addr[faceI], i) forAll(addr[faceI], i)
{ {
wght[faceI][i] /= s; wght[faceI][i] /= s;
} }
wghtSum[faceI] = t;
} }
if (output) if (output)
{ {
const label nFace = returnReduce(wght.size(), sumOp<scalar>()); const label nFace = returnReduce(wght.size(), sumOp<label>());
reduce(tSum, sumOp<scalar>());
if (nFace) if (nFace)
{ {
Info<< "AMI: Patch " << patchName << " weights min/max/average = " Info<< "AMI: Patch " << patchName << " weights min/max/average = "
<< returnReduce(minBound, minOp<scalar>()) << ", " << gMin(wghtSum) << ", "
<< returnReduce(maxBound, maxOp<scalar>()) << ", " << gMax(wghtSum) << ", "
<< tSum/nFace << endl; << gAverage(wghtSum) << endl;
} }
} }
} }
@ -1227,6 +1208,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
scalarField& srcMagSf, scalarField& srcMagSf,
labelListList& srcAddress, labelListList& srcAddress,
scalarListList& srcWeights, scalarListList& srcWeights,
scalarField& srcWeightsSum,
autoPtr<mapDistribute>& tgtMap autoPtr<mapDistribute>& tgtMap
) )
{ {
@ -1468,6 +1450,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
"source", "source",
srcAddress, srcAddress,
srcWeights, srcWeights,
srcWeightsSum,
false false
); );
} }
@ -1488,9 +1471,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
singlePatchProc_(-999), singlePatchProc_(-999),
srcAddress_(), srcAddress_(),
srcWeights_(), srcWeights_(),
srcWeightsSum_(),
srcNonOverlap_(), srcNonOverlap_(),
tgtAddress_(), tgtAddress_(),
tgtWeights_(), tgtWeights_(),
tgtWeightsSum_(),
treePtr_(NULL), treePtr_(NULL),
triMode_(triMode), triMode_(triMode),
srcMapPtr_(NULL), srcMapPtr_(NULL),
@ -1521,9 +1506,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
singlePatchProc_(-999), singlePatchProc_(-999),
srcAddress_(), srcAddress_(),
srcWeights_(), srcWeights_(),
srcWeightsSum_(),
srcNonOverlap_(), srcNonOverlap_(),
tgtAddress_(), tgtAddress_(),
tgtWeights_(), tgtWeights_(),
tgtWeightsSum_(),
treePtr_(NULL), treePtr_(NULL),
triMode_(triMode), triMode_(triMode),
srcMapPtr_(NULL), srcMapPtr_(NULL),
@ -1609,9 +1596,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
singlePatchProc_(fineAMI.singlePatchProc_), singlePatchProc_(fineAMI.singlePatchProc_),
srcAddress_(), srcAddress_(),
srcWeights_(), srcWeights_(),
srcWeightsSum_(),
srcNonOverlap_(), srcNonOverlap_(),
tgtAddress_(), tgtAddress_(),
tgtWeights_(), tgtWeights_(),
tgtWeightsSum_(),
treePtr_(NULL), treePtr_(NULL),
triMode_(fineAMI.triMode_), triMode_(fineAMI.triMode_),
srcMapPtr_(NULL), srcMapPtr_(NULL),
@ -1681,6 +1670,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
srcMagSf_, srcMagSf_,
srcAddress_, srcAddress_,
srcWeights_, srcWeights_,
srcWeightsSum_,
tgtMapPtr_ tgtMapPtr_
); );
@ -1706,6 +1696,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
tgtMagSf_, tgtMagSf_,
tgtAddress_, tgtAddress_,
tgtWeights_, tgtWeights_,
tgtWeightsSum_,
srcMapPtr_ srcMapPtr_
); );
@ -1857,8 +1848,24 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
); );
// weights normalisation // weights normalisation
normaliseWeights(srcMagSf_, "source", srcAddress_, srcWeights_, true); normaliseWeights
normaliseWeights(tgtMagSf_, "target", tgtAddress_, tgtWeights_, true); (
srcMagSf_,
"source",
srcAddress_,
srcWeights_,
srcWeightsSum_,
true
);
normaliseWeights
(
tgtMagSf_,
"target",
tgtAddress_,
tgtWeights_,
tgtWeightsSum_,
true
);
// cache maps and reset addresses // cache maps and reset addresses
List<Map<label> > cMap; List<Map<label> > cMap;
@ -1877,8 +1884,24 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
calcAddressing(srcPatch, tgtPatch); calcAddressing(srcPatch, tgtPatch);
normaliseWeights(srcMagSf_, "source", srcAddress_, srcWeights_, true); normaliseWeights
normaliseWeights(tgtMagSf_, "target", tgtAddress_, tgtWeights_, true); (
srcMagSf_,
"source",
srcAddress_,
srcWeights_,
srcWeightsSum_,
true
);
normaliseWeights
(
tgtMagSf_,
"target",
tgtAddress_,
tgtWeights_,
tgtWeightsSum_,
true
);
} }
if (debug) if (debug)

View File

@ -82,7 +82,7 @@ class AMIInterpolation
public AMIInterpolationName public AMIInterpolationName
{ {
//- local typedef to octree tree-type //- local typedef to octree tree-type
typedef treeDataPrimitivePatch<face, SubList, const pointField&> treeType; typedef treeDataPrimitivePatch<TargetPatch> treeType;
// Private data // Private data
@ -106,6 +106,9 @@ class AMIInterpolation
//- Weights of target faces per source face //- Weights of target faces per source face
scalarListList srcWeights_; scalarListList srcWeights_;
//- Sum of weights of target faces per source face
scalarField srcWeightsSum_;
//- Labels of faces that are not overlapped by any target faces //- Labels of faces that are not overlapped by any target faces
// (should be empty for correct functioning) // (should be empty for correct functioning)
labelList srcNonOverlap_; labelList srcNonOverlap_;
@ -122,6 +125,9 @@ class AMIInterpolation
//- Weights of source faces per target face //- Weights of source faces per target face
scalarListList tgtWeights_; scalarListList tgtWeights_;
//- Sum of weights of source faces per target face
scalarField tgtWeightsSum_;
//- Octree used to find face seeds //- Octree used to find face seeds
autoPtr<indexedOctree<treeType> > treePtr_; autoPtr<indexedOctree<treeType> > treePtr_;
@ -285,6 +291,7 @@ class AMIInterpolation
const word& patchName, const word& patchName,
const labelListList& addr, const labelListList& addr,
scalarListList& wght, scalarListList& wght,
scalarField& wghtSum,
const bool output const bool output
); );
@ -304,6 +311,7 @@ class AMIInterpolation
scalarField& srcMagSf, scalarField& srcMagSf,
labelListList& srcAddress, labelListList& srcAddress,
scalarListList& srcWeights, scalarListList& srcWeights,
scalarField& srcWeightsSum,
autoPtr<mapDistribute>& tgtMap autoPtr<mapDistribute>& tgtMap
); );
@ -365,11 +373,14 @@ public:
//- Return const access to source patch weights //- Return const access to source patch weights
inline const scalarListList& srcWeights() const; inline const scalarListList& srcWeights() const;
//- Return const access to normalisation factor of source
// patch weights (i.e. the sum before normalisation)
inline const scalarField& srcWeightsSum() const;
//- Labels of faces that are not overlapped by any target faces //- Labels of faces that are not overlapped by any target faces
// (should be empty for correct functioning) // (should be empty for correct functioning)
inline const labelList& srcNonOverlap() const; inline const labelList& srcNonOverlap() const;
//- Source map pointer - valid only if singlePatchProc = -1 //- Source map pointer - valid only if singlePatchProc = -1
// This gets source data into a form to be consumed by // This gets source data into a form to be consumed by
// tgtAddress, tgtWeights // tgtAddress, tgtWeights
@ -387,7 +398,11 @@ public:
//- Return const access to target patch weights //- Return const access to target patch weights
inline const scalarListList& tgtWeights() const; inline const scalarListList& tgtWeights() const;
//- Target map pointer - valid only if singlePatchProc = -1 //- Return const access to normalisation factor of target
// patch weights (i.e. the sum before normalisation)
inline const scalarField& tgtWeightsSum() const;
//- Target map pointer - valid only if singlePatchProc=-1.
// This gets target data into a form to be consumed by // This gets target data into a form to be consumed by
// srcAddress, srcWeights // srcAddress, srcWeights
inline const mapDistribute& tgtMap() const; inline const mapDistribute& tgtMap() const;

View File

@ -63,6 +63,14 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcNonOverlap() const
} }
template<class SourcePatch, class TargetPatch>
inline const Foam::scalarField&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcWeightsSum() const
{
return srcWeightsSum_;
}
template<class SourcePatch, class TargetPatch> template<class SourcePatch, class TargetPatch>
inline const Foam::mapDistribute& inline const Foam::mapDistribute&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcMap() const Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcMap() const
@ -95,6 +103,14 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtWeights() const
} }
template<class SourcePatch, class TargetPatch>
inline const Foam::scalarField&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtWeightsSum() const
{
return tgtWeightsSum_;
}
template<class SourcePatch, class TargetPatch> template<class SourcePatch, class TargetPatch>
inline const Foam::mapDistribute& inline const Foam::mapDistribute&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtMap() const Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtMap() const

View File

@ -110,6 +110,8 @@ $(faceSources)/patchToFace/patchToFace.C
$(faceSources)/boundaryToFace/boundaryToFace.C $(faceSources)/boundaryToFace/boundaryToFace.C
$(faceSources)/zoneToFace/zoneToFace.C $(faceSources)/zoneToFace/zoneToFace.C
$(faceSources)/boxToFace/boxToFace.C $(faceSources)/boxToFace/boxToFace.C
$(faceSources)/regionToFace/regionToFace.C
$(faceSources)/regionToFace/patchEdgeFaceRegion.C
pointSources = sets/pointSources pointSources = sets/pointSources
$(pointSources)/labelToPoint/labelToPoint.C $(pointSources)/labelToPoint/labelToPoint.C

View File

@ -29,30 +29,14 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template template<class PatchType>
< Foam::scalar Foam::treeDataPrimitivePatch<PatchType>::tolSqr = sqr(1e-6);
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::scalar
Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>::
tolSqr = sqr(1e-6);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template template<class PatchType>
< Foam::treeBoundBox Foam::treeDataPrimitivePatch<PatchType>::calcBb
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::treeBoundBox
Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>::
calcBb
( (
const pointField& points, const pointField& points,
const face& f const face& f
@ -71,15 +55,8 @@ calcBb
} }
template template<class PatchType>
< void Foam::treeDataPrimitivePatch<PatchType>::update()
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>::
update()
{ {
if (cacheBb_) if (cacheBb_)
{ {
@ -96,18 +73,11 @@ update()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components // Construct from components
template template<class PatchType>
< Foam::treeDataPrimitivePatch<PatchType>::treeDataPrimitivePatch
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>::
treeDataPrimitivePatch
( (
const bool cacheBb, const bool cacheBb,
const PrimitivePatch<Face, FaceList, PointField, PointType>& patch const PatchType& patch
) )
: :
patch_(patch), patch_(patch),
@ -119,16 +89,8 @@ treeDataPrimitivePatch
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class PatchType>
< Foam::pointField Foam::treeDataPrimitivePatch<PatchType>::shapePoints() const
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::pointField
Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>::
shapePoints() const
{ {
pointField cc(patch_.size()); pointField cc(patch_.size());
@ -143,27 +105,10 @@ shapePoints() const
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
template template<class PatchType>
< Foam::label Foam::treeDataPrimitivePatch<PatchType>:: getVolumeType
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
Foam::label
Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>::
getVolumeType
( (
const indexedOctree const indexedOctree<treeDataPrimitivePatch<PatchType> >& oc,
<
treeDataPrimitivePatch
<
Face,
FaceList,
PointField,
PointType
>
>& oc,
const point& sample const point& sample
) const ) const
{ {
@ -396,16 +341,8 @@ getVolumeType
// Check if any point on shape is inside cubeBb. // Check if any point on shape is inside cubeBb.
template template<class PatchType>
< bool Foam::treeDataPrimitivePatch<PatchType>::overlaps
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
bool
Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>::
overlaps
( (
const label index, const label index,
const treeBoundBox& cubeBb const treeBoundBox& cubeBb
@ -462,16 +399,8 @@ overlaps
// Check if any point on shape is inside sphere. // Check if any point on shape is inside sphere.
template template<class PatchType>
< bool Foam::treeDataPrimitivePatch<PatchType>::overlaps
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
bool
Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>::
overlaps
( (
const label index, const label index,
const point& centre, const point& centre,
@ -512,16 +441,8 @@ overlaps
// Calculate nearest point to sample. Updates (if any) nearestDistSqr, minIndex, // Calculate nearest point to sample. Updates (if any) nearestDistSqr, minIndex,
// nearestPoint. // nearestPoint.
template template<class PatchType>
< void Foam::treeDataPrimitivePatch<PatchType>::findNearest
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void
Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>::
findNearest
( (
const labelUList& indices, const labelUList& indices,
const point& sample, const point& sample,
@ -552,16 +473,8 @@ findNearest
} }
template template<class PatchType>
< bool Foam::treeDataPrimitivePatch<PatchType>::intersects
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
bool
Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>::
intersects
( (
const label index, const label index,
const point& start, const point& start,

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -59,13 +59,7 @@ TemplateName(treeDataPrimitivePatch);
Class treeDataPrimitivePatch Declaration Class treeDataPrimitivePatch Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template template<class PatchType>
<
class Face,
template<class> class FaceList,
class PointField,
class PointType=point
>
class treeDataPrimitivePatch class treeDataPrimitivePatch
: :
public treeDataPrimitivePatchName public treeDataPrimitivePatchName
@ -78,7 +72,7 @@ class treeDataPrimitivePatch
// Private data // Private data
//- Underlying geometry //- Underlying geometry
const PrimitivePatch<Face, FaceList, PointField, PointType>& patch_; const PatchType& patch_;
//- Whether to precalculate and store face bounding box //- Whether to precalculate and store face bounding box
const bool cacheBb_; const bool cacheBb_;
@ -103,7 +97,7 @@ public:
treeDataPrimitivePatch treeDataPrimitivePatch
( (
const bool cacheBb, const bool cacheBb,
const PrimitivePatch<Face, FaceList, PointField, PointType>& const PatchType&
); );
@ -121,8 +115,7 @@ public:
pointField shapePoints() const; pointField shapePoints() const;
//- Return access to the underlying patch //- Return access to the underlying patch
const PrimitivePatch<Face, FaceList, PointField, PointType>& const PatchType& patch() const
patch() const
{ {
return patch_; return patch_;
} }
@ -134,16 +127,7 @@ public:
// Only makes sense for closed surfaces. // Only makes sense for closed surfaces.
label getVolumeType label getVolumeType
( (
const indexedOctree const indexedOctree<treeDataPrimitivePatch<PatchType> >&,
<
treeDataPrimitivePatch
<
Face,
FaceList,
PointField,
PointType
>
>&,
const point& const point&
) const; ) const;

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -95,4 +95,21 @@ Foam::searchableSurface::~searchableSurface()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::searchableSurface::findNearest
(
const pointField& sample,
const scalarField& nearestDistSqr,
List<pointIndexHit>& info,
vectorField& normal,
labelList& region
) const
{
findNearest(sample, nearestDistSqr, info);
getNormal(info, normal);
getRegion(info, region);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -323,6 +323,17 @@ public:
List<volumeType>& List<volumeType>&
) const = 0; ) const = 0;
//- Find nearest, normal and region. Can be overridden with
// optimised implementation
virtual void findNearest
(
const pointField& sample,
const scalarField& nearestDistSqr,
List<pointIndexHit>&,
vectorField& normal,
labelList& region
) const;
// Other // Other

View File

@ -827,6 +827,8 @@ void Foam::triSurfaceMesh::getNormal
vectorField& normal vectorField& normal
) const ) const
{ {
const triSurface& s = static_cast<const triSurface&>(*this);
normal.setSize(info.size()); normal.setSize(info.size());
if (minQuality_ >= 0) if (minQuality_ >= 0)
@ -834,7 +836,6 @@ void Foam::triSurfaceMesh::getNormal
// Make sure we don't use triangles with low quality since // Make sure we don't use triangles with low quality since
// normal is not reliable. // normal is not reliable.
const triSurface& s = static_cast<const triSurface&>(*this);
const labelListList& faceFaces = s.faceFaces(); const labelListList& faceFaces = s.faceFaces();
forAll(info, i) forAll(info, i)
@ -842,6 +843,7 @@ void Foam::triSurfaceMesh::getNormal
if (info[i].hit()) if (info[i].hit())
{ {
label faceI = info[i].index(); label faceI = info[i].index();
normal[i] = s[faceI].normal(points());
scalar qual = s[faceI].tri(points()).quality(); scalar qual = s[faceI].tri(points()).quality();
@ -861,11 +863,8 @@ void Foam::triSurfaceMesh::getNormal
} }
} }
} }
else
{ normal[i] /= mag(normal[i]) + VSMALL;
normal[i] = s[faceI].normal(points());
}
normal[i] /= mag(normal[i]);
} }
else else
{ {
@ -885,7 +884,7 @@ void Foam::triSurfaceMesh::getNormal
//normal[i] = faceNormals()[faceI]; //normal[i] = faceNormals()[faceI];
//- Uncached //- Uncached
normal[i] = triSurface::operator[](faceI).normal(points()); normal[i] = s[faceI].normal(points());
normal[i] /= mag(normal[i]) + VSMALL; normal[i] /= mag(normal[i]) + VSMALL;
} }
else else

View File

@ -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-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,18 +23,27 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // #include "patchEdgeFaceRegion.H"
inline Foam::psiReactionThermo& // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::combustionModels::psiCombustionModel::thermo()
Foam::Ostream& Foam::operator<<
(
Foam::Ostream& os,
const Foam::patchEdgeFaceRegion& wDist
)
{ {
return thermo_(); return os << wDist.region_;
} }
inline const Foam::psiReactionThermo&
Foam::combustionModels::psiCombustionModel::thermo() const Foam::Istream& Foam::operator>>
(
Foam::Istream& is,
Foam::patchEdgeFaceRegion& wDist
)
{ {
return thermo_(); return is >> wDist.region_;
} }

View File

@ -0,0 +1,193 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::patchEdgeFaceRegion
Description
Transport of region for use in PatchEdgeFaceWave.
Set element to -2 to denote blocked.
SourceFiles
patchEdgeFaceRegionI.H
patchEdgeFaceRegion.C
\*---------------------------------------------------------------------------*/
#ifndef patchEdgeFaceRegion_H
#define patchEdgeFaceRegion_H
#include "point.H"
#include "label.H"
#include "scalar.H"
#include "tensor.H"
#include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class polyPatch;
class polyMesh;
/*---------------------------------------------------------------------------*\
Class patchEdgeFaceRegion Declaration
\*---------------------------------------------------------------------------*/
class patchEdgeFaceRegion
{
// Private data
//- region
label region_;
// Private Member Functions
//- Combine current with w2. Update region_ if w2 has smaller
// quantities and returns true.
template<class TrackingData>
inline bool update
(
const patchEdgeFaceRegion& w2,
const scalar tol,
TrackingData& td
);
public:
// Constructors
//- Construct null
inline patchEdgeFaceRegion();
//- Construct from origin, distance
inline patchEdgeFaceRegion(const label);
// Member Functions
// Access
inline label region() const;
// Needed by meshWave
//- Check whether origin has been changed at all or
// still contains original (invalid) value.
template<class TrackingData>
inline bool valid(TrackingData& td) const;
//- Apply rotation matrix
template<class TrackingData>
inline void transform
(
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const tensor& rotTensor,
const scalar tol,
TrackingData& td
);
//- Influence of face on edge
template<class TrackingData>
inline bool updateEdge
(
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const label edgeI,
const label faceI,
const patchEdgeFaceRegion& faceInfo,
const scalar tol,
TrackingData& td
);
//- New information for edge (from e.g. coupled edge)
template<class TrackingData>
inline bool updateEdge
(
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const patchEdgeFaceRegion& edgeInfo,
const bool sameOrientation,
const scalar tol,
TrackingData& td
);
//- Influence of edge on face.
template<class TrackingData>
inline bool updateFace
(
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const label faceI,
const label edgeI,
const patchEdgeFaceRegion& edgeInfo,
const scalar tol,
TrackingData& td
);
//- Same (like operator==)
template<class TrackingData>
inline bool equal(const patchEdgeFaceRegion&, TrackingData&) const;
// Member Operators
// Needed for List IO
inline bool operator==(const patchEdgeFaceRegion&) const;
inline bool operator!=(const patchEdgeFaceRegion&) const;
// IOstream Operators
friend Ostream& operator<<(Ostream&, const patchEdgeFaceRegion&);
friend Istream& operator>>(Istream&, patchEdgeFaceRegion&);
};
//- Data associated with patchEdgeFaceRegion type are contiguous
template<>
inline bool contiguous<patchEdgeFaceRegion>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "patchEdgeFaceRegionI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,209 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "polyMesh.H"
#include "transform.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Update this with w2 if w2 nearer to pt.
template<class TrackingData>
inline bool Foam::patchEdgeFaceRegion::update
(
const patchEdgeFaceRegion& w2,
const scalar tol,
TrackingData& td
)
{
if (!w2.valid(td))
{
FatalErrorIn("patchEdgeFaceRegion::update(..)")
<< "problem." << abort(FatalError);
}
if (w2.region_ == -2 || region_ == -2)
{
Pout<< "update : " << *this << " w2:" << w2 << " return FALSE" << endl;
// Blocked edge/face
return false;
}
if (!valid(td))
{
// current not yet set so use any value
label oldRegion = region_;
operator=(w2);
Pout<< "update : " << *this << " was:" << oldRegion
<< " w2:" << w2 << " return TRUE" << endl;
return true;
}
else
{
if (w2.region_ < region_)
{
label oldRegion = region_;
operator=(w2);
Pout<< "update : " << *this << " was:" << oldRegion
<< " w2:" << w2 << " return TRUE" << endl;
return true;
return true;
}
else
{
Pout<< "update : " << *this
<< " w2:" << w2 << " return FALSE" << endl;
return false;
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::patchEdgeFaceRegion::patchEdgeFaceRegion()
:
region_(-1)
{}
// Construct from origin, distance
inline Foam::patchEdgeFaceRegion::patchEdgeFaceRegion
(
const label region
)
:
region_(region)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::label Foam::patchEdgeFaceRegion::region() const
{
return region_;
}
template<class TrackingData>
inline bool Foam::patchEdgeFaceRegion::valid(TrackingData& td) const
{
return region_ != -1;
}
template<class TrackingData>
inline void Foam::patchEdgeFaceRegion::transform
(
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const tensor& rotTensor,
const scalar tol,
TrackingData& td
)
{}
template<class TrackingData>
inline bool Foam::patchEdgeFaceRegion::updateEdge
(
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const label edgeI,
const label faceI,
const patchEdgeFaceRegion& faceInfo,
const scalar tol,
TrackingData& td
)
{
return update(faceInfo, tol, td);
}
template<class TrackingData>
inline bool Foam::patchEdgeFaceRegion::updateEdge
(
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const patchEdgeFaceRegion& edgeInfo,
const bool sameOrientation,
const scalar tol,
TrackingData& td
)
{
return update(edgeInfo, tol, td);
}
template<class TrackingData>
inline bool Foam::patchEdgeFaceRegion::updateFace
(
const polyMesh& mesh,
const indirectPrimitivePatch& patch,
const label faceI,
const label edgeI,
const patchEdgeFaceRegion& edgeInfo,
const scalar tol,
TrackingData& td
)
{
return update(edgeInfo, tol, td);
}
template <class TrackingData>
inline bool Foam::patchEdgeFaceRegion::equal
(
const patchEdgeFaceRegion& rhs,
TrackingData& td
) const
{
return operator==(rhs);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool Foam::patchEdgeFaceRegion::operator==
(
const Foam::patchEdgeFaceRegion& rhs
) const
{
return region() == rhs.region();
}
inline bool Foam::patchEdgeFaceRegion::operator!=
(
const Foam::patchEdgeFaceRegion& rhs
) const
{
return !(*this == rhs);
}
// ************************************************************************* //

View File

@ -0,0 +1,254 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "regionToFace.H"
#include "polyMesh.H"
#include "faceSet.H"
#include "mappedPatchBase.H"
#include "indirectPrimitivePatch.H"
#include "PatchTools.H"
#include "addToRunTimeSelectionTable.H"
#include "PatchEdgeFaceWave.H"
#include "patchEdgeFaceRegion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(regionToFace, 0);
addToRunTimeSelectionTable(topoSetSource, regionToFace, word);
addToRunTimeSelectionTable(topoSetSource, regionToFace, istream);
}
Foam::topoSetSource::addToUsageTable Foam::regionToFace::usage_
(
regionToFace::typeName,
"\n Usage: regionToFace <faceSet> (x y z)\n\n"
" Select all faces in the connected region of the faceSet"
" starting from the point.\n"
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::regionToFace::markZone
(
const indirectPrimitivePatch& patch,
const label procI,
const label faceI,
const label zoneI,
labelList& faceZone
) const
{
// Data on all edges and faces
List<patchEdgeFaceRegion> allEdgeInfo(patch.nEdges());
List<patchEdgeFaceRegion> allFaceInfo(patch.size());
DynamicList<label> changedEdges;
DynamicList<patchEdgeFaceRegion> changedInfo;
if (Pstream::myProcNo() == procI)
{
const labelList& fEdges = patch.faceEdges()[faceI];
forAll(fEdges, i)
{
changedEdges.append(fEdges[i]);
changedInfo.append(zoneI);
}
}
// Walk
PatchEdgeFaceWave
<
indirectPrimitivePatch,
patchEdgeFaceRegion
> calc
(
mesh_,
patch,
changedEdges,
changedInfo,
allEdgeInfo,
allFaceInfo,
returnReduce(patch.nEdges(), sumOp<label>())
);
forAll(allFaceInfo, faceI)
{
if (allFaceInfo[faceI].region() == zoneI)
{
faceZone[faceI] = zoneI;
}
}
}
void Foam::regionToFace::combine(topoSet& set, const bool add) const
{
Info<< " Loading subset " << setName_ << " to delimit search region."
<< endl;
faceSet subSet(mesh_, setName_);
indirectPrimitivePatch patch
(
IndirectList<face>(mesh_.faces(), subSet.toc()),
mesh_.points()
);
mappedPatchBase::nearInfo ni
(
pointIndexHit(false, vector::zero, -1),
Tuple2<scalar, label>
(
sqr(GREAT),
Pstream::myProcNo()
)
);
forAll(patch, i)
{
const point& fc = patch.faceCentres()[i];
scalar d2 = magSqr(fc-nearPoint_);
if (!ni.first().hit() || d2 < ni.second().first())
{
ni.second().first() = d2;
ni.first().setHit();
ni.first().setPoint(fc);
ni.first().setIndex(i);
}
}
// Globally reduce
combineReduce(ni, mappedPatchBase::nearestEqOp());
Info<< " Found nearest face at " << ni.first().rawPoint()
<< " on processor " << ni.second().second()
<< " face " << ni.first().index()
<< " distance " << Foam::sqrt(ni.second().first()) << endl;
labelList faceRegion(patch.size(), -1);
markZone
(
patch,
ni.second().second(), // procI
ni.first().index(), // start face
0, // currentZone
faceRegion
);
forAll(faceRegion, faceI)
{
if (faceRegion[faceI] == 0)
{
addOrDelete(set, patch.addressing()[faceI], add);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::regionToFace::regionToFace
(
const polyMesh& mesh,
const word& setName,
const point& nearPoint
)
:
topoSetSource(mesh),
setName_(setName),
nearPoint_(nearPoint)
{}
// Construct from dictionary
Foam::regionToFace::regionToFace
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
setName_(dict.lookup("set")),
nearPoint_(dict.lookup("nearPoint"))
{}
// Construct from Istream
Foam::regionToFace::regionToFace
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
setName_(checkIs(is)),
nearPoint_(checkIs(is))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionToFace::~regionToFace()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::regionToFace::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding all faces of connected region of set "
<< setName_
<< " starting from point "
<< nearPoint_ << " ..." << endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing all cells of connected region of set "
<< setName_
<< " starting from point "
<< nearPoint_ << " ..." << endl;
combine(set, false);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,139 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::regionToFace
Description
A topoSetSource to select faces belonging to topological connected region
(that contains given point)
SourceFiles
regionToFace.C
\*---------------------------------------------------------------------------*/
#ifndef regionToFace_H
#define regionToFace_H
#include "topoSetSource.H"
#include "PackedBoolList.H"
#include "indirectPrimitivePatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class regionToFace Declaration
\*---------------------------------------------------------------------------*/
class regionToFace
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- Name of set to use
word setName_;
//- Coordinate that is nearest/on connected region
point nearPoint_;
// Private Member Functions
//- Walk edge-face-edge
void markZone
(
const indirectPrimitivePatch& patch,
const label procI,
const label faceI,
const label zoneI,
labelList& faceZone
) const;
void combine(topoSet& set, const bool add) const;
public:
//- Runtime type information
TypeName("regionToFace");
// Constructors
//- Construct from components
regionToFace
(
const polyMesh& mesh,
const word& setName,
const point& nearPoint
);
//- Construct from dictionary
regionToFace
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
regionToFace
(
const polyMesh& mesh,
Istream&
);
//- Destructor
virtual ~regionToFace();
// Member Functions
virtual sourceType setType() const
{
return FACESETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -255,6 +255,9 @@ void thermoSingleLayer::updateSubmodels()
// Update source fields // Update source fields
hsSp_ += primaryEnergyPCTrans_/magSf()/time().deltaT(); hsSp_ += primaryEnergyPCTrans_/magSf()/time().deltaT();
rhoSp_ += primaryMassPCTrans_/magSf()/time().deltaT(); rhoSp_ += primaryMassPCTrans_/magSf()/time().deltaT();
// Vapour recoil pressure
pSp_ -= sqr(primaryMassPCTrans_/magSf()/time_.deltaT())/2.0/rhoPrimary_;
} }

View File

@ -15,18 +15,13 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<psiChemistryCombustionModel>; combustionModel PaSR<psiChemistryCombustion>;
active true; active true;
infinitelyFastChemistryCoeffs
{
C 10.0;
}
PaSRCoeffs PaSRCoeffs
{ {
Cmix Cmix [ 0 0 0 0 0 0 0 ] 0.1; Cmix 0.1;
turbulentReaction on; turbulentReaction on;
} }

View File

@ -27,7 +27,7 @@ k 5;
epsilon 6; epsilon 6;
gamma 150; alpha1 150;
// ************************************************************************* // // ************************************************************************* //

View File

@ -15,13 +15,13 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<rhoChemistryCombustionModel>; combustionModel PaSR<rhoChemistryCombustion>;
active true; active true;
PaSRCoeffs PaSRCoeffs
{ {
Cmix Cmix [ 0 0 0 0 0 0 0 ] 0.1; Cmix 0.1;
turbulentReaction on; turbulentReaction on;
useReactionRate true; useReactionRate true;
} }

View File

@ -15,13 +15,13 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<rhoChemistryCombustionModel>; combustionModel PaSR<rhoChemistryCombustion>;
active false; active false;
PaSRCoeffs PaSRCoeffs
{ {
Cmix Cmix [ 0 0 0 0 0 0 0 ] 0.1; Cmix 0.1;
turbulentReaction off; turbulentReaction off;
useReactionRate true; useReactionRate true;
} }

View File

@ -15,14 +15,14 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<psiChemistryCombustionModel>; combustionModel PaSR<psiChemistryCombustion>;
active true; active true;
PaSRCoeffs PaSRCoeffs
{ {
Cmix Cmix [ 0 0 0 0 0 0 0 ] 1.0; Cmix 1.0;
turbulentReaction on; turbulentReaction on;
} }

View File

@ -15,13 +15,13 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<rhoChemistryCombustionModel>; combustionModel PaSR<rhoChemistryCombustion>;
active false; active false;
PaSRCoeffs PaSRCoeffs
{ {
Cmix Cmix [ 0 0 0 0 0 0 0 ] 1.0; Cmix 1.0;
turbulentReaction off; turbulentReaction off;
} }

View File

@ -15,13 +15,13 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<rhoChemistryCombustionModel>; combustionModel PaSR<rhoChemistryCombustion>;
active false; active false;
PaSRCoeffs PaSRCoeffs
{ {
Cmix Cmix [ 0 0 0 0 0 0 0 ] 1.0; Cmix 1.0;
turbulentReaction off; turbulentReaction off;
} }

View File

@ -15,13 +15,13 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<rhoChemistryCombustionModel>; combustionModel PaSR<rhoChemistryCombustion>;
active false; active false;
PaSRCoeffs PaSRCoeffs
{ {
Cmix Cmix [ 0 0 0 0 0 0 0 ] 1.0; Cmix 1.0;
turbulentReaction off; turbulentReaction off;
} }

View File

@ -15,13 +15,13 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<psiChemistryCombustionModel>; combustionModel PaSR<psiChemistryCombustion>;
active false; active false;
PaSRCoeffs PaSRCoeffs
{ {
Cmix Cmix [ 0 0 0 0 0 0 0 ] 1.0; Cmix 1.0;
turbulentReaction on; turbulentReaction on;
} }

View File

@ -15,13 +15,13 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<psiChemistryCombustionModel>; combustionModel PaSR<psiChemistryCombustion>;
active false; active false;
PaSRCoeffs PaSRCoeffs
{ {
Cmix Cmix [ 0 0 0 0 0 0 0 ] 1.0; Cmix 1.0;
turbulentReaction off; turbulentReaction off;
} }

View File

@ -15,13 +15,13 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<psiChemistryCombustionModel>; combustionModel PaSR<psiChemistryCombustion>;
active false; active false;
PaSRCoeffs PaSRCoeffs
{ {
Cmix Cmix [ 0 0 0 0 0 0 0 ] 1.0; Cmix 1.0;
turbulentReaction off; turbulentReaction off;
} }

Some files were not shown because too many files have changed in this diff Show More