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

This commit is contained in:
Sergio Ferraris
2013-09-12 17:40:23 +01:00
53 changed files with 1059 additions and 500 deletions

View File

@ -48,6 +48,7 @@ int main(int argc, char *argv[])
#include "createEngineMesh.H" #include "createEngineMesh.H"
#include "createFields.H" #include "createFields.H"
#include "createFvOptions.H" #include "createFvOptions.H"
#include "createRhoUf.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "readEngineTimeControls.H" #include "readEngineTimeControls.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"

View File

@ -72,6 +72,7 @@ int main(int argc, char *argv[])
#include "readCombustionProperties.H" #include "readCombustionProperties.H"
#include "createFields.H" #include "createFields.H"
#include "createFvOptions.H" #include "createFvOptions.H"
#include "createRhoUf.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "readEngineTimeControls.H" #include "readEngineTimeControls.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"

View File

@ -15,12 +15,12 @@ if (pimple.transonic())
*( *(
( (
(fvc::interpolate(rho*HbyA) & mesh.Sf()) (fvc::interpolate(rho*HbyA) & mesh.Sf())
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi) + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
)/fvc::interpolate(rho) )/fvc::interpolate(rho)
- fvc::meshPhi(rho, U)
) )
); );
fvc::makeRelative(phid, psi, U);
fvOptions.makeRelative(fvc::interpolate(psi), phid); fvOptions.makeRelative(fvc::interpolate(psi), phid);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
@ -51,11 +51,11 @@ else
"phiHbyA", "phiHbyA",
( (
(fvc::interpolate(rho*HbyA) & mesh.Sf()) (fvc::interpolate(rho*HbyA) & mesh.Sf())
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi) + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
) )
- fvc::interpolate(rho)*fvc::meshPhi(rho, U)
); );
fvc::makeRelative(phiHbyA, rho, U);
fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA); fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
@ -88,6 +88,15 @@ U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
{
rhoUf = fvc::interpolate(rho*U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
rhoUf +=
mesh.Sf()
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
/sqr(mesh.magSf());
}
if (thermo.dpdt()) if (thermo.dpdt())
{ {
dpdt = fvc::ddt(p) - fvc::div(fvc::meshPhi(rho, U), p); dpdt = fvc::ddt(p) - fvc::div(fvc::meshPhi(rho, U), p);

View File

@ -22,10 +22,11 @@ if (pimple.transonic())
fvc::interpolate(psi) fvc::interpolate(psi)
*( *(
(fvc::interpolate(rho*HbyA) & mesh.Sf()) (fvc::interpolate(rho*HbyA) & mesh.Sf())
+ rhorAUf*fvc::ddtCorr(rho, U, phiAbs) + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
)/fvc::interpolate(rho) )/fvc::interpolate(rho)
); );
fvc::makeRelative(phid, psi, U);
fvOptions.makeRelative(fvc::interpolate(psi), phid); fvOptions.makeRelative(fvc::interpolate(psi), phid);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
@ -55,9 +56,10 @@ else
( (
"phiHbyA", "phiHbyA",
(fvc::interpolate(rho*HbyA) & mesh.Sf()) (fvc::interpolate(rho*HbyA) & mesh.Sf())
+ rhorAUf*fvc::ddtCorr(rho, U, phiAbs) + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
); );
fvc::makeRelative(phiHbyA, rho, U);
fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA); fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
@ -102,6 +104,15 @@ U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
{
rhoUf = fvc::interpolate(rho*U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
rhoUf +=
mesh.Sf()
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
/sqr(mesh.magSf());
}
if (thermo.dpdt()) if (thermo.dpdt())
{ {
dpdt = fvc::ddt(p); dpdt = fvc::ddt(p);

View File

@ -56,13 +56,10 @@ int main(int argc, char *argv[])
#include "createFields.H" #include "createFields.H"
#include "createFvOptions.H" #include "createFvOptions.H"
#include "createPcorrTypes.H" #include "createPcorrTypes.H"
#include "createRhoUf.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
// Create old-time absolute flux for ddtCorr
surfaceScalarField phiAbs("phiAbs", phi);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -72,12 +69,6 @@ int main(int argc, char *argv[])
#include "readControls.H" #include "readControls.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
// Make the fluxes absolute before mesh-motion
fvc::makeAbsolute(phi, rho, U);
// Update absolute flux for ddtCorr
phiAbs = phi;
#include "setDeltaT.H" #include "setDeltaT.H"
runTime++; runTime++;
@ -85,21 +76,27 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
{ {
// Store momentum to set rhoUf for introduced faces.
volVectorField rhoU("rhoU", rho*U);
// Store divrhoU from the previous time-step/mesh for the correctPhi // Store divrhoU from the previous time-step/mesh for the correctPhi
volScalarField divrhoU(fvc::div(phi)); volScalarField divrhoU(fvc::div(fvc::absolute(phi, rho, U)));
// Do any mesh changes // Do any mesh changes
mesh.update(); mesh.update();
if (mesh.changing() && correctPhi) if (mesh.changing() && correctPhi)
{ {
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & rhoUf;
#include "correctPhi.H" #include "correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
} }
} }
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
if (mesh.changing() && checkMeshCourantNo) if (mesh.changing() && checkMeshCourantNo)
{ {
#include "meshCourantNo.H" #include "meshCourantNo.H"

View File

@ -13,12 +13,13 @@ surfaceScalarField phid
*( *(
( (
(fvc::interpolate(rho*HbyA) & mesh.Sf()) (fvc::interpolate(rho*HbyA) & mesh.Sf())
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi) + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
)/fvc::interpolate(rho) )/fvc::interpolate(rho)
- fvc::meshPhi(rho, U)
) )
); );
fvc::makeRelative(phid, psi, U);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
@ -37,3 +38,12 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
U = HbyA - rAU*fvc::grad(p); U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
{
rhoUf = fvc::interpolate(rho*U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
rhoUf +=
mesh.Sf()
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
/sqr(mesh.magSf());
}

View File

@ -64,12 +64,6 @@ int main(int argc, char *argv[])
mesh.movePoints(motionPtr->newPoints()); mesh.movePoints(motionPtr->newPoints());
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & rhoUf;
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, rho, U);
#include "rhoEqn.H" #include "rhoEqn.H"
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop

View File

@ -15,12 +15,12 @@ if (pimple.transonic())
*( *(
( (
(fvc::interpolate(rho*HbyA) & mesh.Sf()) (fvc::interpolate(rho*HbyA) & mesh.Sf())
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi) + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
)/fvc::interpolate(rho) )/fvc::interpolate(rho)
- fvc::meshPhi(rho, U)
) )
); );
fvc::makeRelative(phid, psi, U);
fvOptions.makeRelative(fvc::interpolate(psi), phid); fvOptions.makeRelative(fvc::interpolate(psi), phid);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
@ -52,11 +52,11 @@ else
"phiHbyA", "phiHbyA",
( (
(fvc::interpolate(HbyA) & mesh.Sf()) (fvc::interpolate(HbyA) & mesh.Sf())
//***HGW + rhorAUf*fvc::ddtCorr(rho, U, phi) + rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
) )
- fvc::interpolate(rho)*fvc::meshPhi(rho, U)
); );
fvc::makeRelative(phiHbyA, rho, U);
fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA); fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
@ -90,6 +90,15 @@ U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
{
rhoUf = fvc::interpolate(rho*U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
rhoUf +=
mesh.Sf()
*(fvc::absolute(phi, rho, U) - (mesh.Sf() & rhoUf))
/sqr(mesh.magSf());
}
if (thermo.dpdt()) if (thermo.dpdt())
{ {
dpdt = fvc::ddt(p) - fvc::div(fvc::meshPhi(rho, U), p); dpdt = fvc::ddt(p) - fvc::div(fvc::meshPhi(rho, U), p);

View File

@ -52,6 +52,7 @@ int main(int argc, char *argv[])
#include "readGravitationalAcceleration.H" #include "readGravitationalAcceleration.H"
#include "createFields.H" #include "createFields.H"
#include "createFvOptions.H" #include "createFvOptions.H"
#include "createRhoUf.H"
#include "createClouds.H" #include "createClouds.H"
#include "createRadiationModel.H" #include "createRadiationModel.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"

View File

@ -3,7 +3,17 @@
if (nAlphaSubCycles > 1) if (nAlphaSubCycles > 1)
{ {
dimensionedScalar totalDeltaT = runTime.deltaT(); dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum(0.0*rhoPhi); surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("0", dimDensity, 0)
);
for for
( (

View File

@ -100,6 +100,8 @@ int main(int argc, char *argv[])
// Make the flux relative to the mesh motion // Make the flux relative to the mesh motion
fvc::makeRelative(phi, U); fvc::makeRelative(phi, U);
interface.correct();
} }
if (mesh.changing() && checkMeshCourantNo) if (mesh.changing() && checkMeshCourantNo)

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) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,7 +37,6 @@ SourceFiles
#define dimFieldDecomposer_H #define dimFieldDecomposer_H
#include "fvMesh.H" #include "fvMesh.H"
#include "fvPatchFieldMapper.H"
#include "surfaceFields.H" #include "surfaceFields.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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -39,7 +39,8 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
completeMeshPatch, completeMeshPatch,
procMeshPatch procMeshPatch
), ),
directAddressing_(procMeshPatch.size(), -1) directAddressing_(procMeshPatch.size(), -1),
hasUnmapped_(false)
{ {
// Create the inverse-addressing of the patch point labels. // Create the inverse-addressing of the patch point labels.
labelList pointMap(completeMeshPatch.boundaryMesh().mesh().size(), -1); labelList pointMap(completeMeshPatch.boundaryMesh().mesh().size(), -1);
@ -64,6 +65,8 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer
// Check that all the patch point addresses are set // Check that all the patch point addresses are set
if (directAddressing_.size() && min(directAddressing_) < 0) if (directAddressing_.size() && min(directAddressing_) < 0)
{ {
hasUnmapped_ = true;
FatalErrorIn FatalErrorIn
( (
"pointFieldDecomposer::patchFieldDecomposer()" "pointFieldDecomposer::patchFieldDecomposer()"

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -63,6 +63,9 @@ public:
labelList directAddressing_; labelList directAddressing_;
//- Does map contain any unmapped values
bool hasUnmapped_;
public: public:
// Constructors // Constructors
@ -88,6 +91,11 @@ public:
return true; return true;
} }
bool hasUnmapped() const
{
return hasUnmapped_;
}
const labelUList& directAddressing() const const labelUList& directAddressing() const
{ {
return directAddressing_; return directAddressing_;

View File

@ -27,6 +27,7 @@ License
#include "linePointRef.H" #include "linePointRef.H"
#include "OFstream.H" #include "OFstream.H"
#include "ListOps.H" #include "ListOps.H"
#include "memInfo.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -2383,12 +2384,14 @@ Foam::indexedOctree<Type>::indexedOctree
contents_(0), contents_(0),
nodeTypes_(0) nodeTypes_(0)
{ {
int oldMemSize = 0;
if (debug) if (debug)
{ {
Pout<< "indexedOctree<Type>::indexedOctree:" << nl Pout<< "indexedOctree<Type>::indexedOctree:" << nl
<< " shapes:" << shapes.size() << nl << " shapes:" << shapes.size() << nl
<< " bb:" << bb << nl << " bb:" << bb << nl
<< endl; << endl;
oldMemSize = memInfo().size();
} }
if (shapes.size() == 0) if (shapes.size() == 0)
@ -2503,6 +2506,9 @@ Foam::indexedOctree<Type>::indexedOctree
nEntries += contents_[i].size(); nEntries += contents_[i].size();
} }
label memSize = memInfo().size();
Pout<< "indexedOctree<Type>::indexedOctree" Pout<< "indexedOctree<Type>::indexedOctree"
<< " : finished construction of tree of:" << shapes.typeName << " : finished construction of tree of:" << shapes.typeName
<< nl << nl
@ -2515,6 +2521,7 @@ Foam::indexedOctree<Type>::indexedOctree
<< scalar(nEntries)/contents.size() << nl << scalar(nEntries)/contents.size() << nl
<< " per shape (duplicity):" << " per shape (duplicity):"
<< scalar(nEntries)/shapes.size() << nl << scalar(nEntries)/shapes.size() << nl
<< " total memory:" << memSize-oldMemSize
<< endl; << endl;
} }
} }

View File

@ -124,6 +124,34 @@ Foam::Field<Type>::Field
} }
template<class Type>
Foam::Field<Type>::Field
(
const UList<Type>& mapF,
const FieldMapper& mapper,
const Type& defaultValue
)
:
List<Type>(mapper.size(), defaultValue)
{
map(mapF, mapper);
}
template<class Type>
Foam::Field<Type>::Field
(
const UList<Type>& mapF,
const FieldMapper& mapper,
const UList<Type>& defaultValues
)
:
List<Type>(defaultValues)
{
map(mapF, mapper);
}
template<class Type> template<class Type>
Foam::Field<Type>::Field Foam::Field<Type>::Field
( (
@ -137,6 +165,34 @@ Foam::Field<Type>::Field
} }
template<class Type>
Foam::Field<Type>::Field
(
const tmp<Field<Type> >& tmapF,
const FieldMapper& mapper,
const Type& defaultValue
)
:
List<Type>(mapper.size(), defaultValue)
{
map(tmapF, mapper);
}
template<class Type>
Foam::Field<Type>::Field
(
const tmp<Field<Type> >& tmapF,
const FieldMapper& mapper,
const UList<Type>& defaultValues
)
:
List<Type>(defaultValues)
{
map(tmapF, mapper);
}
template<class Type> template<class Type>
Foam::Field<Type>::Field(const Field<Type>& f) Foam::Field<Type>::Field(const Field<Type>& f)
: :

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -160,6 +160,22 @@ public:
const FieldMapper& map const FieldMapper& map
); );
//- Construct by mapping from the given field
Field
(
const UList<Type>& mapF,
const FieldMapper& map,
const Type& defaultValue
);
//- Construct by mapping from the given field
Field
(
const UList<Type>& mapF,
const FieldMapper& map,
const UList<Type>& defaultValues
);
//- Construct by mapping from the given tmp field //- Construct by mapping from the given tmp field
Field Field
( (
@ -167,6 +183,24 @@ public:
const FieldMapper& map const FieldMapper& map
); );
//- Construct by mapping from the given tmp field. Supplied uniform
// value for unmapped items
Field
(
const tmp<Field<Type> >& tmapF,
const FieldMapper& map,
const Type& defaultValue
);
//- Construct by mapping from the given tmp field. Supplied values
// for unmapped items
Field
(
const tmp<Field<Type> >& tmapF,
const FieldMapper& map,
const UList<Type>& defaultValues
);
//- Construct as copy //- Construct as copy
Field(const Field<Type>&); Field(const Field<Type>&);

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -64,6 +64,10 @@ public:
virtual bool direct() const = 0; virtual bool direct() const = 0;
//- Are there unmapped values? I.e. do all size() elements get
// get value
virtual bool hasUnmapped() const = 0;
virtual const labelUList& directAddressing() const virtual const labelUList& directAddressing() const
{ {
FatalErrorIn("FieldMapper::directAddressing() const") FatalErrorIn("FieldMapper::directAddressing() const")

View File

@ -0,0 +1,104 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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::directFieldMapper
Description
FieldMapper with direct mapping.
\*---------------------------------------------------------------------------*/
#ifndef directFieldMapper_H
#define directFieldMapper_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directFieldMapper Declaration
\*---------------------------------------------------------------------------*/
class directFieldMapper
:
public FieldMapper
{
const labelUList& directAddressing_;
bool hasUnmapped_;
public:
// Constructors
//- Construct given addressing
patchFieldSubset(const labelUList& directAddressing)
:
directAddressing_(directAddressing),
hasUnmapped_(false)
{
if (directAddressing_.size() && min(directAddressing_) < 0)
{
hasUnmapped_ = true;
}
}
//- Destructor
virtual ~directFieldMapper()
{}
// Member Functions
label size() const
{
return directAddressing_.size();
}
bool direct() const
{
return true;
}
bool hasUnmapped() const
{
return hasUnmapped_;
}
const labelUList& directAddressing() const
{
return directAddressing_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,111 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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::directPointPatchFieldMapper
Description
direct pointPatchFieldMapper
\*---------------------------------------------------------------------------*/
#ifndef directPointPatchFieldMapper_H
#define directPointPatchFieldMapper_H
#include "pointPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directPointPatchFieldMapper Declaration
\*---------------------------------------------------------------------------*/
class directPointPatchFieldMapper
:
public pointPatchFieldMapper
{
//- Addressing from new back to old
const labelUList& directAddressing_;
//- Does map contain any unmapped values
bool hasUnmapped_;
public:
// Constructors
//- Construct given addressing
directPointPatchFieldMapper(const labelUList& directAddressing)
:
directAddressing_(directAddressing),
hasUnmapped_(false)
{
if (directAddressing_.size() && min(directAddressing_) < 0)
{
hasUnmapped_ = true;
}
}
//- Destructor
virtual ~directPointPatchFieldMapper()
{}
// Member Functions
label size() const
{
return directAddressing_.size();
}
bool direct() const
{
return true;
}
bool hasUnmapped() const
{
return hasUnmapped_;
}
const labelUList& directAddressing() const
{
return directAddressing_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // 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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -129,6 +129,13 @@ public:
return direct_; return direct_;
} }
//- Are there unmapped values? I.e. do all size() elements get
// get value
virtual bool hasUnmapped() const
{
return insertedObjects();
}
//- Return direct addressing //- Return direct addressing
virtual const labelUList& directAddressing() const; virtual const labelUList& directAddressing() 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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -47,6 +47,8 @@ void Foam::pointPatchMapper::calcAddressing() const
<< abort(FatalError); << abort(FatalError);
} }
hasUnmapped_ = false;
if (direct()) if (direct())
{ {
// Direct mapping. // Direct mapping.
@ -57,7 +59,7 @@ void Foam::pointPatchMapper::calcAddressing() const
{ {
if (addr[i] < 0) if (addr[i] < 0)
{ {
addr[i] = 0; hasUnmapped_ = true;
} }
} }
} }
@ -87,9 +89,11 @@ void Foam::pointPatchMapper::calcAddressing() const
} }
else else
{ {
// Inserted point. Map from point0 (arbitrary choice) // Inserted point.
addr[i] = labelList(1, label(0)); ///// Map from point0 (arbitrary choice)
w[i] = scalarList(1, 1.0); //addr[i] = labelList(1, label(0));
//w[i] = scalarList(1, 1.0);
hasUnmapped_ = true;
} }
} }
} }
@ -101,6 +105,7 @@ void Foam::pointPatchMapper::clearOut()
deleteDemandDrivenData(directAddrPtr_); deleteDemandDrivenData(directAddrPtr_);
deleteDemandDrivenData(interpolationAddrPtr_); deleteDemandDrivenData(interpolationAddrPtr_);
deleteDemandDrivenData(weightsPtr_); deleteDemandDrivenData(weightsPtr_);
hasUnmapped_ = false;
} }
@ -124,6 +129,7 @@ Foam::pointPatchMapper::pointPatchMapper
? mpm_.oldPatchNMeshPoints()[patch_.index()] ? mpm_.oldPatchNMeshPoints()[patch_.index()]
: 0 : 0
), ),
hasUnmapped_(false),
directAddrPtr_(NULL), directAddrPtr_(NULL),
interpolationAddrPtr_(NULL), interpolationAddrPtr_(NULL),
weightsPtr_(NULL) weightsPtr_(NULL)

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -74,6 +74,8 @@ class pointPatchMapper
// Demand-driven private data // Demand-driven private data
mutable bool hasUnmapped_;
//- Direct addressing (only one for of addressing is used) //- Direct addressing (only one for of addressing is used)
mutable labelList* directAddrPtr_; mutable labelList* directAddrPtr_;
@ -130,6 +132,11 @@ public:
return patch_.size(); return patch_.size();
} }
virtual bool hasUnmapped() const
{
return hasUnmapped_;
}
//- Return size of field before mapping //- Return size of field before mapping
virtual label sizeBeforeMapping() const virtual label sizeBeforeMapping() 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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -130,6 +130,11 @@ public:
return direct_; return direct_;
} }
virtual bool hasUnmapped() const
{
return insertedObjects();
}
//- Return direct addressing //- Return direct addressing
virtual const labelUList& directAddressing() const; virtual const labelUList& directAddressing() const;
@ -140,13 +145,13 @@ public:
virtual const scalarListList& weights() const; virtual const scalarListList& weights() const;
//- Are there any inserted cells //- Are there any inserted cells
bool insertedObjects() const virtual bool insertedObjects() const
{ {
return insertedCells_; return insertedCells_;
} }
//- Return list of inserted cells //- Return list of inserted cells
const labelList& insertedObjectLabels() const; const virtual labelList& insertedObjectLabels() 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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -134,6 +134,11 @@ public:
return direct_; return direct_;
} }
virtual bool hasUnmapped() const
{
return insertedObjects();
}
//- Return direct addressing //- Return direct addressing
virtual const labelUList& directAddressing() const; virtual const labelUList& directAddressing() 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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,53 +67,6 @@ class fvMeshAdder
private: private:
// Private class
class directFvPatchFieldMapper
:
public fvPatchFieldMapper
{
// Private data
const labelList& directAddressing_;
public:
// Constructors
//- Construct from components
directFvPatchFieldMapper(const labelList& directAddressing)
:
fvPatchFieldMapper(),
directAddressing_(directAddressing)
{}
//- Destructor
virtual ~directFvPatchFieldMapper()
{}
// Member Functions
label size() const
{
return directAddressing_.size();
}
bool direct() const
{
return true;
}
const labelUList& directAddressing() const
{
return directAddressing_;
}
};
// Private Member Functions // Private Member Functions
//- Calculate map from new patch faces to old patch faces. -1 where //- Calculate map from new patch faces to old patch faces. -1 where

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,10 +23,10 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "emptyFvPatchField.H" #include "emptyFvPatchField.H"
#include "directFvPatchFieldMapper.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -55,7 +55,25 @@ Foam::directionMixedFvPatchField<Type>::directionMixedFvPatchField
refValue_(ptf.refValue_, mapper), refValue_(ptf.refValue_, mapper),
refGrad_(ptf.refGrad_, mapper), refGrad_(ptf.refGrad_, mapper),
valueFraction_(ptf.valueFraction_, mapper) valueFraction_(ptf.valueFraction_, mapper)
{} {
if (mapper.hasUnmapped())
{
WarningIn
(
"directionMixedFvPatchField<Type>::directionMixedFvPatchField\n"
"(\n"
" const directionMixedFvPatchField<Type>&,\n"
" const fvPatch&,\n"
" const DimensionedField<Type, volMesh>&,\n"
" const fvPatchFieldMapper&\n"
")\n"
) << "On field " << iF.name() << " patch " << p.name()
<< " patchField " << this->type()
<< " : mapper does not map all values." << nl
<< " To avoid this warning fully specify the mapping in derived"
<< " patch fields." << endl;
}
}
template<class Type> template<class Type>

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -56,7 +56,25 @@ fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
: :
fvPatchField<Type>(ptf, p, iF, mapper), fvPatchField<Type>(ptf, p, iF, mapper),
gradient_(ptf.gradient_, mapper) gradient_(ptf.gradient_, mapper)
{} {
if (mapper.hasUnmapped())
{
WarningIn
(
"fixedGradientFvPatchField<Type>::fixedGradientFvPatchField\n"
"(\n"
" const fixedGradientFvPatchField<Type>&,\n"
" const fvPatch&,\n"
" const DimensionedField<Type, volMesh>&,\n"
" const fvPatchFieldMapper&\n"
")\n"
) << "On field " << iF.name() << " patch " << p.name()
<< " patchField " << this->type()
<< " : mapper does not map all values." << nl
<< " To avoid this warning fully specify the mapping in derived"
<< " patch fields." << endl;
}
}
template<class Type> template<class Type>

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -65,7 +65,25 @@ fixedValueFvPatchField<Type>::fixedValueFvPatchField
) )
: :
fvPatchField<Type>(ptf, p, iF, mapper) fvPatchField<Type>(ptf, p, iF, mapper)
{} {
if (mapper.hasUnmapped())
{
WarningIn
(
"fixedValueFvPatchField<Type>::fixedValueFvPatchField\n"
"(\n"
" const fixedGradientFvPatchField<Type>&,\n"
" const fvPatch&,\n"
" const DimensionedField<Type, volMesh>&,\n"
" const fvPatchFieldMapper&\n"
")\n"
) << "On field " << iF.name() << " patch " << p.name()
<< " patchField " << this->type()
<< " : mapper does not map all values." << nl
<< " To avoid this warning fully specify the mapping in derived"
<< " patch fields." << endl;
}
}
template<class Type> template<class Type>

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -59,7 +59,25 @@ mixedFvPatchField<Type>::mixedFvPatchField
refValue_(ptf.refValue_, mapper), refValue_(ptf.refValue_, mapper),
refGrad_(ptf.refGrad_, mapper), refGrad_(ptf.refGrad_, mapper),
valueFraction_(ptf.valueFraction_, mapper) valueFraction_(ptf.valueFraction_, mapper)
{} {
if (mapper.hasUnmapped())
{
WarningIn
(
"mixedFvPatchField<Type>::mixedFvPatchField\n"
"(\n"
" const mixedFvPatchField<Type>&,\n"
" const fvPatch&,\n"
" const DimensionedField<Type, volMesh>&,\n"
" const fvPatchFieldMapper&\n"
")\n"
) << "On field " << iF.name() << " patch " << p.name()
<< " patchField " << this->type()
<< " : mapper does not map all values." << nl
<< " To avoid this warning fully specify the mapping in derived"
<< " patch fields." << endl;
}
}
template<class Type> template<class Type>

View File

@ -53,12 +53,17 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
fixedGradientFvPatchScalarField(p, iF), fixedGradientFvPatchScalarField(p, iF),
curTimeIndex_(-1) curTimeIndex_(-1)
{ {
// Map value. Set unmapped values and overwrite with mapped ptf patchType() = ptf.patchType();
fvPatchField<scalar>::operator=(patchInternalField());
map(ptf, mapper);
// Map gradient. Set unmapped values and overwrite with mapped ptf // Map gradient. Set unmapped values and overwrite with mapped ptf
gradient() = 0.0; gradient() = 0.0;
gradient().map(ptf.gradient(), mapper); gradient().map(ptf.gradient(), mapper);
// Evaluate the value field from the gradient if the internal field is valid
if (&iF && iF.size())
{
evaluate();
}
} }

View File

@ -0,0 +1,111 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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::directFvPatchFieldMapper
Description
direct fvPatchFieldMapper
\*---------------------------------------------------------------------------*/
#ifndef directFvPatchFieldMapper_H
#define directFvPatchFieldMapper_H
#include "fvPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directFvPatchFieldMapper Declaration
\*---------------------------------------------------------------------------*/
class directFvPatchFieldMapper
:
public fvPatchFieldMapper
{
//- Addressing from new back to old
const labelUList& directAddressing_;
//- Does map contain any unmapped values
bool hasUnmapped_;
public:
// Constructors
//- Construct given addressing
directFvPatchFieldMapper(const labelUList& directAddressing)
:
directAddressing_(directAddressing),
hasUnmapped_(false)
{
if (directAddressing_.size() && min(directAddressing_) < 0)
{
hasUnmapped_ = true;
}
}
//- Destructor
virtual ~directFvPatchFieldMapper()
{}
// Member Functions
label size() const
{
return directAddressing_.size();
}
bool direct() const
{
return true;
}
bool hasUnmapped() const
{
return hasUnmapped_;
}
const labelUList& directAddressing() const
{
return directAddressing_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -47,6 +47,23 @@ Foam::fvPatchField<Type>::fvPatchField
{} {}
template<class Type>
Foam::fvPatchField<Type>::fvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const word& patchType
)
:
Field<Type>(p.size()),
patch_(p),
internalField_(iF),
updated_(false),
manipulatedMatrix_(false),
patchType_(patchType)
{}
template<class Type> template<class Type>
Foam::fvPatchField<Type>::fvPatchField Foam::fvPatchField<Type>::fvPatchField
( (
@ -73,7 +90,7 @@ Foam::fvPatchField<Type>::fvPatchField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
Field<Type>(ptf, mapper), Field<Type>(p.size()),
patch_(p), patch_(p),
internalField_(iF), internalField_(iF),
updated_(false), updated_(false),
@ -83,44 +100,9 @@ Foam::fvPatchField<Type>::fvPatchField
// For unmapped faces set to internal field value (zero-gradient) // For unmapped faces set to internal field value (zero-gradient)
if (&iF && iF.size()) if (&iF && iF.size())
{ {
Field<Type>& f = *this; fvPatchField<Type>::operator=(this->patchInternalField());
if
(
mapper.direct()
&& &mapper.directAddressing()
&& mapper.directAddressing().size()
)
{
Field<Type> pif(this->patchInternalField());
const labelList& mapAddressing = mapper.directAddressing();
forAll(mapAddressing, i)
{
if (mapAddressing[i] < 0)
{
f[i] = pif[i];
}
}
}
else if (!mapper.direct() && mapper.addressing().size())
{
Field<Type> pif(this->patchInternalField());
const labelListList& mapAddressing = mapper.addressing();
forAll(mapAddressing, i)
{
const labelList& localAddrs = mapAddressing[i];
if (!localAddrs.size())
{
f[i] = pif[i];
}
}
}
} }
this->map(ptf, mapper);
} }

View File

@ -166,6 +166,14 @@ public:
const DimensionedField<Type, volMesh>& const DimensionedField<Type, volMesh>&
); );
//- Construct from patch and internal field and patch type
fvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const word& patchType
);
//- Construct from patch and internal field and patch field //- Construct from patch and internal field and patch field
fvPatchField fvPatchField
( (

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) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -174,7 +174,7 @@ Foam::tmp<Foam::surfaceScalarField> Foam::fvc::absolute
{ {
if (tphi().mesh().moving()) if (tphi().mesh().moving())
{ {
return tphi + fvc::meshPhi(rho, U); return tphi + fvc::interpolate(rho)*fvc::meshPhi(rho, U);
} }
else else
{ {

View File

@ -55,6 +55,8 @@ void Foam::fvPatchMapper::calcAddressing() const
const label oldPatchEnd = const label oldPatchEnd =
oldPatchStart + faceMap_.oldPatchSizes()[patch_.index()]; oldPatchStart + faceMap_.oldPatchSizes()[patch_.index()];
hasUnmapped_ = false;
// Assemble the maps: slice to patch // Assemble the maps: slice to patch
if (direct()) if (direct())
{ {
@ -84,6 +86,7 @@ void Foam::fvPatchMapper::calcAddressing() const
{ {
//addr[faceI] = 0; //addr[faceI] = 0;
addr[faceI] = -1; addr[faceI] = -1;
hasUnmapped_ = true;
} }
} }
@ -175,6 +178,10 @@ void Foam::fvPatchMapper::calcAddressing() const
{ {
newWeights /= sum(newWeights); newWeights /= sum(newWeights);
} }
else
{
hasUnmapped_ = true;
}
// Reset addressing and weights // Reset addressing and weights
curAddr = newAddr; curAddr = newAddr;
@ -206,6 +213,7 @@ void Foam::fvPatchMapper::clearOut()
deleteDemandDrivenData(directAddrPtr_); deleteDemandDrivenData(directAddrPtr_);
deleteDemandDrivenData(interpolationAddrPtr_); deleteDemandDrivenData(interpolationAddrPtr_);
deleteDemandDrivenData(weightsPtr_); deleteDemandDrivenData(weightsPtr_);
hasUnmapped_ = false;
} }
@ -221,6 +229,7 @@ Foam::fvPatchMapper::fvPatchMapper
patch_(patch), patch_(patch),
faceMap_(faceMap), faceMap_(faceMap),
sizeBeforeMapping_(faceMap.oldPatchSizes()[patch_.index()]), sizeBeforeMapping_(faceMap.oldPatchSizes()[patch_.index()]),
hasUnmapped_(false),
directAddrPtr_(NULL), directAddrPtr_(NULL),
interpolationAddrPtr_(NULL), interpolationAddrPtr_(NULL),
weightsPtr_(NULL) weightsPtr_(NULL)

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -71,6 +71,8 @@ class fvPatchMapper
// Demand-driven private data // Demand-driven private data
mutable bool hasUnmapped_;
//- Direct addressing (only one for of addressing is used) //- Direct addressing (only one for of addressing is used)
mutable labelList* directAddrPtr_; mutable labelList* directAddrPtr_;
@ -138,6 +140,11 @@ public:
return faceMap_.direct(); return faceMap_.direct();
} }
virtual bool hasUnmapped() const
{
return hasUnmapped_;
}
//- Return direct addressing //- Return direct addressing
virtual const labelUList& directAddressing() const; virtual const labelUList& directAddressing() 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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -133,6 +133,12 @@ public:
return faceMap_.direct(); return faceMap_.direct();
} }
//- Has unmapped elements
virtual bool hasUnmapped() const
{
return insertedObjects();
}
//- Return direct addressing //- Return direct addressing
virtual const labelUList& directAddressing() const; virtual const labelUList& directAddressing() const;

View File

@ -56,8 +56,6 @@ SourceFiles
#include "fvMesh.H" #include "fvMesh.H"
#include "pointMesh.H" #include "pointMesh.H"
#include "fvPatchFieldMapper.H"
#include "pointPatchFieldMapper.H"
#include "GeometricField.H" #include "GeometricField.H"
#include "HashSet.H" #include "HashSet.H"
#include "surfaceMesh.H" #include "surfaceMesh.H"
@ -74,90 +72,6 @@ namespace Foam
class fvMeshSubset class fvMeshSubset
{ {
public:
//- Patch-field subset interpolation class
class patchFieldSubset
:
public fvPatchFieldMapper
{
const labelList& directAddressing_;
public:
// Constructors
//- Construct given addressing
patchFieldSubset(const labelList& directAddressing)
:
directAddressing_(directAddressing)
{}
//- Destructor
virtual ~patchFieldSubset()
{}
// Member Functions
label size() const
{
return directAddressing_.size();
}
bool direct() const
{
return true;
}
const labelUList& directAddressing() const
{
return directAddressing_;
}
};
//- Patch-field subset interpolation class
class pointPatchFieldSubset
:
public pointPatchFieldMapper
{
const labelList& directAddressing_;
public:
// Constructors
//- Construct given addressing
pointPatchFieldSubset(const labelList& directAddressing)
:
directAddressing_(directAddressing)
{}
//- Destructor
virtual ~pointPatchFieldSubset()
{}
// Member Functions
label size() const
{
return directAddressing_.size();
}
bool direct() const
{
return true;
}
const labelUList& directAddressing() const
{
return directAddressing_;
}
};
private: private:
// Private data // Private data

View File

@ -27,6 +27,8 @@ License
#include "emptyFvsPatchField.H" #include "emptyFvsPatchField.H"
#include "emptyPointPatchField.H" #include "emptyPointPatchField.H"
#include "emptyFvPatchFields.H" #include "emptyFvPatchFields.H"
#include "directFvPatchFieldMapper.H"
#include "directPointPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -70,8 +72,9 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > fvMeshSubset::interpolate
patchFields.set patchFields.set
( (
patchI, patchI,
new calculatedFvPatchField<Type> fvPatchField<Type>::New
( (
calculatedFvPatchField<Type>::typeName,
sMesh.boundary()[patchI], sMesh.boundary()[patchI],
DimensionedField<Type, volMesh>::null() DimensionedField<Type, volMesh>::null()
) )
@ -142,7 +145,7 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > fvMeshSubset::interpolate
vf.boundaryField()[patchMap[patchI]], vf.boundaryField()[patchMap[patchI]],
subPatch, subPatch,
resF.dimensionedInternalField(), resF.dimensionedInternalField(),
patchFieldSubset(directAddressing) directFvPatchFieldMapper(directAddressing)
) )
); );
} }
@ -203,8 +206,9 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > fvMeshSubset::interpolate
patchFields.set patchFields.set
( (
patchI, patchI,
new calculatedFvsPatchField<Type> fvsPatchField<Type>::New
( (
calculatedFvsPatchField<Type>::typeName,
sMesh.boundary()[patchI], sMesh.boundary()[patchI],
DimensionedField<Type, surfaceMesh>::null() DimensionedField<Type, surfaceMesh>::null()
) )
@ -285,7 +289,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > fvMeshSubset::interpolate
vf.boundaryField()[patchMap[patchI]], vf.boundaryField()[patchMap[patchI]],
subPatch, subPatch,
resF.dimensionedInternalField(), resF.dimensionedInternalField(),
patchFieldSubset(directAddressing) directFvPatchFieldMapper(directAddressing)
) )
); );
@ -348,10 +352,7 @@ fvMeshSubset::interpolate
const labelList& pointMap const labelList& pointMap
) )
{ {
// Create and map the internal-field values // 1. Create the complete field with dummy patch fields
Field<Type> internalField(vf.internalField(), pointMap);
// Create and map the patch field values
PtrList<pointPatchField<Type> > patchFields(patchMap.size()); PtrList<pointPatchField<Type> > patchFields(patchMap.size());
forAll(patchFields, patchI) forAll(patchFields, patchI)
@ -372,6 +373,54 @@ fvMeshSubset::interpolate
); );
} }
else else
{
patchFields.set
(
patchI,
pointPatchField<Type>::New
(
calculatedPointPatchField<Type>::typeName,
sMesh.boundary()[patchI],
DimensionedField<Type, pointMesh>::null()
)
);
}
}
// Create the complete field from the pieces
tmp<GeometricField<Type, pointPatchField, pointMesh> > tresF
(
new GeometricField<Type, pointPatchField, pointMesh>
(
IOobject
(
"subset"+vf.name(),
sMesh.time().timeName(),
sMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
sMesh,
vf.dimensions(),
Field<Type>(vf.internalField(), pointMap),
patchFields
)
);
GeometricField<Type, pointPatchField, pointMesh>& resF = tresF();
// 2. Change the pointPatchFields to the correct type using a mapper
// constructor (with reference to the now correct internal field)
typename GeometricField<Type, pointPatchField, pointMesh>::
GeometricBoundaryField& bf = resF.boundaryField();
forAll(bf, patchI)
{
// Set the first one by hand as it corresponds to the
// exposed internal faces. Additional interpolation can be put here
// as necessary.
if (patchMap[patchI] != -1)
{ {
// Construct addressing // Construct addressing
const pointPatch& basePatch = const pointPatch& basePatch =
@ -406,40 +455,20 @@ fvMeshSubset::interpolate
} }
} }
patchFields.set bf.set
( (
patchI, patchI,
pointPatchField<Type>::New pointPatchField<Type>::New
( (
vf.boundaryField()[patchMap[patchI]], vf.boundaryField()[patchMap[patchI]],
subPatch, subPatch,
DimensionedField<Type, pointMesh>::null(), resF.dimensionedInternalField(),
pointPatchFieldSubset(directAddressing) directPointPatchFieldMapper(directAddressing)
) )
); );
} }
} }
// Create the complete field from the pieces
tmp<GeometricField<Type, pointPatchField, pointMesh> > tresF
(
new GeometricField<Type, pointPatchField, pointMesh>
(
IOobject
(
"subset"+vf.name(),
vf.time().timeName(),
sMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
sMesh,
vf.dimensions(),
internalField,
patchFields
)
);
return tresF; return tresF;
} }

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -87,39 +87,6 @@ class singleCellFvMesh
public: public:
//- Patch field mapper class for non-agglomerated meshes
class directPatchFieldMapper
:
public fvPatchFieldMapper
{
// Private data
const labelUList& directAddressing_;
public:
//- Construct given addressing
directPatchFieldMapper(const labelUList& directAddressing)
:
directAddressing_(directAddressing)
{}
virtual label size() const
{
return directAddressing_.size();
}
virtual bool direct() const
{
return true;
}
virtual const labelUList& directAddressing() const
{
return directAddressing_;
}
};
//- Patch field mapper class for agglomerated meshes //- Patch field mapper class for agglomerated meshes
class agglomPatchFieldMapper class agglomPatchFieldMapper
: :
@ -129,6 +96,7 @@ public:
const labelListList& addressing_; const labelListList& addressing_;
const scalarListList& weights_; const scalarListList& weights_;
bool hasUnmapped_;
public: public:
@ -140,8 +108,18 @@ public:
) )
: :
addressing_(addressing), addressing_(addressing),
weights_(weights) weights_(weights),
{} hasUnmapped_(false)
{
forAll(addressing_, i)
{
if (addressing_[i].empty())
{
hasUnmapped_ = true;
break;
}
}
}
virtual label size() const virtual label size() const
{ {
@ -153,6 +131,11 @@ public:
return false; return false;
} }
bool hasUnmapped() const
{
return hasUnmapped_;
}
virtual const labelListList& addressing() const virtual const labelListList& addressing() const
{ {
return addressing_; return addressing_;

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "singleCellFvMesh.H" #include "singleCellFvMesh.H"
#include "calculatedFvPatchFields.H"
#include "directFvPatchFieldMapper.H"
#include "Time.H" #include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -39,12 +41,51 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > singleCellFvMesh::interpolate
const GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) const ) const
{ {
// Create internal-field values // 1. Create the complete field with dummy patch fields
Field<Type> internalField(1, gAverage(vf));
// Create and map the patch field values
PtrList<fvPatchField<Type> > patchFields(vf.boundaryField().size()); PtrList<fvPatchField<Type> > patchFields(vf.boundaryField().size());
forAll(patchFields, patchI)
{
patchFields.set
(
patchI,
fvPatchField<Type>::New
(
calculatedFvPatchField<Type>::typeName,
boundary()[patchI],
DimensionedField<Type, volMesh>::null()
)
);
}
// Create the complete field from the pieces
tmp<GeometricField<Type, fvPatchField, volMesh> > tresF
(
new GeometricField<Type, fvPatchField, volMesh>
(
IOobject
(
vf.name(),
time().timeName(),
*this,
IOobject::NO_READ,
IOobject::NO_WRITE
),
*this,
vf.dimensions(),
Field<Type>(1, gAverage(vf)),
patchFields
)
);
GeometricField<Type, fvPatchField, volMesh>& resF = tresF();
// 2. Change the fvPatchFields to the correct type using a mapper
// constructor (with reference to the now correct internal field)
typename GeometricField<Type, fvPatchField, volMesh>::
GeometricBoundaryField& bf = resF.boundaryField();
if (agglomerate()) if (agglomerate())
{ {
forAll(vf.boundaryField(), patchI) forAll(vf.boundaryField(), patchI)
@ -67,14 +108,14 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > singleCellFvMesh::interpolate
); );
} }
patchFields.set bf.set
( (
patchI, patchI,
fvPatchField<Type>::New fvPatchField<Type>::New
( (
vf.boundaryField()[patchI], vf.boundaryField()[patchI],
boundary()[patchI], boundary()[patchI],
DimensionedField<Type, volMesh>::null(), resF.dimensionedInternalField(),
agglomPatchFieldMapper(coarseToFine, coarseWeights) agglomPatchFieldMapper(coarseToFine, coarseWeights)
) )
); );
@ -86,40 +127,20 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > singleCellFvMesh::interpolate
{ {
labelList map(identity(vf.boundaryField()[patchI].size())); labelList map(identity(vf.boundaryField()[patchI].size()));
patchFields.set bf.set
( (
patchI, patchI,
fvPatchField<Type>::New fvPatchField<Type>::New
( (
vf.boundaryField()[patchI], vf.boundaryField()[patchI],
boundary()[patchI], boundary()[patchI],
DimensionedField<Type, volMesh>::null(), resF.dimensionedInternalField(),
directPatchFieldMapper(map) directFvPatchFieldMapper(map)
) )
); );
} }
} }
// Create the complete field from the pieces
tmp<GeometricField<Type, fvPatchField, volMesh> > tresF
(
new GeometricField<Type, fvPatchField, volMesh>
(
IOobject
(
vf.name(),
time().timeName(),
*this,
IOobject::NO_READ,
IOobject::NO_WRITE
),
*this,
vf.dimensions(),
internalField,
patchFields
)
);
return tresF; return tresF;
} }

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -88,6 +88,12 @@ public:
return true; return true;
} }
//- Are there unmapped values
bool hasUnmapped() const
{
return false;
}
const labelUList& directAddressing() const const labelUList& directAddressing() const
{ {
return directAddressing_; return directAddressing_;
@ -128,6 +134,12 @@ public:
return true; return true;
} }
//- Are there unmapped values
bool hasUnmapped() const
{
return false;
}
const labelUList& directAddressing() const const labelUList& directAddressing() const
{ {
return directAddressing_; return directAddressing_;
@ -165,6 +177,12 @@ public:
return false; return false;
} }
//- Are there unmapped values
bool hasUnmapped() const
{
return false;
}
const labelListList& addressing() const const labelListList& addressing() const
{ {
return addressing_; return addressing_;

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,83 +40,25 @@ Foam::fvFieldDecomposer::decomposeField
const bool allowUnknownPatchFields const bool allowUnknownPatchFields
) const ) const
{ {
// Create and map the internal field values // 1. Create the complete field with dummy patch fields
Field<Type> internalField(field.internalField(), cellAddressing_);
// Create and map the patch field values
PtrList<fvPatchField<Type> > patchFields(boundaryAddressing_.size()); PtrList<fvPatchField<Type> > patchFields(boundaryAddressing_.size());
forAll(boundaryAddressing_, patchi) forAll(boundaryAddressing_, patchi)
{ {
if (patchFieldDecomposerPtrs_[patchi]) patchFields.set
{ (
patchFields.set patchi,
fvPatchField<Type>::New
( (
patchi, calculatedFvPatchField<Type>::typeName,
fvPatchField<Type>::New procMesh_.boundary()[patchi],
( DimensionedField<Type, volMesh>::null()
field.boundaryField()[boundaryAddressing_[patchi]], )
procMesh_.boundary()[patchi], );
DimensionedField<Type, volMesh>::null(),
*patchFieldDecomposerPtrs_[patchi]
)
);
}
else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi]))
{
patchFields.set
(
patchi,
new processorCyclicFvPatchField<Type>
(
procMesh_.boundary()[patchi],
DimensionedField<Type, volMesh>::null(),
Field<Type>
(
field.internalField(),
*processorVolPatchFieldDecomposerPtrs_[patchi]
)
)
);
}
else if (isA<processorFvPatch>(procMesh_.boundary()[patchi]))
{
patchFields.set
(
patchi,
new processorFvPatchField<Type>
(
procMesh_.boundary()[patchi],
DimensionedField<Type, volMesh>::null(),
Field<Type>
(
field.internalField(),
*processorVolPatchFieldDecomposerPtrs_[patchi]
)
)
);
}
else if (allowUnknownPatchFields)
{
patchFields.set
(
patchi,
new emptyFvPatchField<Type>
(
procMesh_.boundary()[patchi],
DimensionedField<Type, volMesh>::null()
)
);
}
else
{
FatalErrorIn("fvFieldDecomposer::decomposeField()")
<< "Unknown type." << abort(FatalError);
}
} }
// Create the field for the processor // Create the field for the processor
return tmp<GeometricField<Type, fvPatchField, volMesh> > tmp<GeometricField<Type, fvPatchField, volMesh> > tresF
( (
new GeometricField<Type, fvPatchField, volMesh> new GeometricField<Type, fvPatchField, volMesh>
( (
@ -130,10 +72,90 @@ Foam::fvFieldDecomposer::decomposeField
), ),
procMesh_, procMesh_,
field.dimensions(), field.dimensions(),
internalField, Field<Type>(field.internalField(), cellAddressing_),
patchFields patchFields
) )
); );
GeometricField<Type, fvPatchField, volMesh>& resF = tresF();
// 2. Change the fvPatchFields to the correct type using a mapper
// constructor (with reference to the now correct internal field)
typename GeometricField<Type, fvPatchField, volMesh>::
GeometricBoundaryField& bf = resF.boundaryField();
forAll(bf, patchi)
{
if (patchFieldDecomposerPtrs_[patchi])
{
bf.set
(
patchi,
fvPatchField<Type>::New
(
field.boundaryField()[boundaryAddressing_[patchi]],
procMesh_.boundary()[patchi],
resF.dimensionedInternalField(),
*patchFieldDecomposerPtrs_[patchi]
)
);
}
else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi]))
{
bf.set
(
patchi,
new processorCyclicFvPatchField<Type>
(
procMesh_.boundary()[patchi],
resF.dimensionedInternalField(),
Field<Type>
(
field.internalField(),
*processorVolPatchFieldDecomposerPtrs_[patchi]
)
)
);
}
else if (isA<processorFvPatch>(procMesh_.boundary()[patchi]))
{
bf.set
(
patchi,
new processorFvPatchField<Type>
(
procMesh_.boundary()[patchi],
resF.dimensionedInternalField(),
Field<Type>
(
field.internalField(),
*processorVolPatchFieldDecomposerPtrs_[patchi]
)
)
);
}
else if (allowUnknownPatchFields)
{
bf.set
(
patchi,
new emptyFvPatchField<Type>
(
procMesh_.boundary()[patchi],
resF.dimensionedInternalField()
)
);
}
else
{
FatalErrorIn("fvFieldDecomposer::decomposeField()")
<< "Unknown type." << abort(FatalError);
}
}
// Create the field for the processor
return tresF;
} }
@ -188,34 +210,76 @@ Foam::fvFieldDecomposer::decomposeField
} }
} }
// Create and map the patch field values
// 1. Create the complete field with dummy patch fields
PtrList<fvsPatchField<Type> > patchFields(boundaryAddressing_.size()); PtrList<fvsPatchField<Type> > patchFields(boundaryAddressing_.size());
forAll(boundaryAddressing_, patchi)
{
patchFields.set
(
patchi,
fvsPatchField<Type>::New
(
calculatedFvsPatchField<Type>::typeName,
procMesh_.boundary()[patchi],
DimensionedField<Type, surfaceMesh>::null()
)
);
}
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tresF
(
new GeometricField<Type, fvsPatchField, surfaceMesh>
(
IOobject
(
field.name(),
procMesh_.time().timeName(),
procMesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
procMesh_,
field.dimensions(),
Field<Type>(field.internalField(), mapAddr),
patchFields
)
);
GeometricField<Type, fvsPatchField, surfaceMesh>& resF = tresF();
// 2. Change the fvsPatchFields to the correct type using a mapper
// constructor (with reference to the now correct internal field)
typename GeometricField<Type, fvsPatchField, surfaceMesh>::
GeometricBoundaryField& bf = resF.boundaryField();
forAll(boundaryAddressing_, patchi) forAll(boundaryAddressing_, patchi)
{ {
if (patchFieldDecomposerPtrs_[patchi]) if (patchFieldDecomposerPtrs_[patchi])
{ {
patchFields.set bf.set
( (
patchi, patchi,
fvsPatchField<Type>::New fvsPatchField<Type>::New
( (
field.boundaryField()[boundaryAddressing_[patchi]], field.boundaryField()[boundaryAddressing_[patchi]],
procMesh_.boundary()[patchi], procMesh_.boundary()[patchi],
DimensionedField<Type, surfaceMesh>::null(), resF.dimensionedInternalField(),
*patchFieldDecomposerPtrs_[patchi] *patchFieldDecomposerPtrs_[patchi]
) )
); );
} }
else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi])) else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi]))
{ {
patchFields.set bf.set
( (
patchi, patchi,
new processorCyclicFvsPatchField<Type> new processorCyclicFvsPatchField<Type>
( (
procMesh_.boundary()[patchi], procMesh_.boundary()[patchi],
DimensionedField<Type, surfaceMesh>::null(), resF.dimensionedInternalField(),
Field<Type> Field<Type>
( (
allFaceField, allFaceField,
@ -226,13 +290,13 @@ Foam::fvFieldDecomposer::decomposeField
} }
else if (isA<processorFvPatch>(procMesh_.boundary()[patchi])) else if (isA<processorFvPatch>(procMesh_.boundary()[patchi]))
{ {
patchFields.set bf.set
( (
patchi, patchi,
new processorFvsPatchField<Type> new processorFvsPatchField<Type>
( (
procMesh_.boundary()[patchi], procMesh_.boundary()[patchi],
DimensionedField<Type, surfaceMesh>::null(), resF.dimensionedInternalField(),
Field<Type> Field<Type>
( (
allFaceField, allFaceField,
@ -249,24 +313,7 @@ Foam::fvFieldDecomposer::decomposeField
} }
// Create the field for the processor // Create the field for the processor
return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > return tresF;
(
new GeometricField<Type, fvsPatchField, surfaceMesh>
(
IOobject
(
field.name(),
procMesh_.time().timeName(),
procMesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
procMesh_,
field.dimensions(),
internalField,
patchFields
)
);
} }

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -116,6 +116,11 @@ public:
return true; return true;
} }
bool hasUnmapped() const
{
return false;
}
const labelUList& directAddressing() const const labelUList& directAddressing() const
{ {
return labelUList::null(); return labelUList::null();

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -112,6 +112,11 @@ public:
return true; return true;
} }
bool hasUnmapped() const
{
return false;
}
const labelUList& directAddressing() const const labelUList& directAddressing() const
{ {
return labelUList::null(); return labelUList::null();

View File

@ -86,34 +86,36 @@ functions
dumpObjects dumpObjects
{ {
// Forcibly write registered objects. E.g. fields that have been // Forcibly write registered objects
// created with NO_WRITE.
type writeRegisteredObject; type writeRegisteredObject;
// Where to load it from // Where to load it from
functionObjectLibs ("libIOFunctionObjects.so"); functionObjectLibs ("libIOFunctionObjects.so");
// Execute upon outputTime: // When to write:
// timeStep // timeStep (with optional outputInterval)
// outputTime // outputTime (with optional outputInterval)
// adjustableTime // adjustableTime
// runTime // runTime
// clockTime // clockTime
// cpuTime // cpuTime
outputControl outputTime; outputControl outputTime;
// Is the object written by this function Object alone // Write every writeInterval (only valid for timeStemp, outputTime)
exclusiveWriting true; outputInterval 1;
// Interval of time (sec) to write down( // Interval of time (valid for adjustableTime, runTime, clockTime,
writeInterval 10.5 //(adjustableTime, runTime, clockTime, cpuTime) // cpuTime)
writeInterval 10.5;
// Write as normal every writeInterval'th outputTime.
outputInterval 1; // (timeStep, outputTime)
// Objects to write // Objects to write
objectNames (); objectNames ();
// Is the object written by this function Object alone
// (default is false)
//exclusiveWriting true;
} }
} }

View File

@ -46,7 +46,7 @@ Foam::writeRegisteredObject::writeRegisteredObject
) )
: :
name_(name), name_(name),
exclusiveWriting_(true), exclusiveWriting_(false),
obr_(obr), obr_(obr),
objectNames_() objectNames_()
{ {

View File

@ -26,6 +26,7 @@ License
#include "thermoSingleLayer.H" #include "thermoSingleLayer.H"
#include "heatTransferModel.H" #include "heatTransferModel.H"
#include "filmRadiationModel.H" #include "filmRadiationModel.H"
#include "phaseChangeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -175,48 +175,6 @@ public:
~meshToMesh(); ~meshToMesh();
//- Patch-field interpolation class
class patchFieldInterpolator
:
public fvPatchFieldMapper
{
const labelList& directAddressing_;
public:
// Constructors
//- Construct given addressing
patchFieldInterpolator(const labelList& addr)
:
directAddressing_(addr)
{}
//- Destructor
virtual ~patchFieldInterpolator()
{}
// Member Functions
label size() const
{
return directAddressing_.size();
}
bool direct() const
{
return true;
}
const labelList& directAddressing() const
{
return directAddressing_;
}
};
// Member Functions // Member Functions
// Access // Access

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-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,6 +28,7 @@ License
#include "interpolationCellPoint.H" #include "interpolationCellPoint.H"
#include "SubField.H" #include "SubField.H"
#include "mixedFvPatchField.H" #include "mixedFvPatchField.H"
#include "directFvPatchFieldMapper.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -408,7 +409,7 @@ Foam::meshToMesh::interpolate
<< exit(FatalError); << exit(FatalError);
} }
// Create and map the patch field values // 1. Create the complete field with dummy patch fields
PtrList<fvPatchField<Type> > patchFields PtrList<fvPatchField<Type> > patchFields
( (
boundaryAddressing_.size() boundaryAddressing_.size()
@ -421,13 +422,9 @@ Foam::meshToMesh::interpolate
patchI, patchI,
fvPatchField<Type>::New fvPatchField<Type>::New
( (
fromVf.boundaryField()[patchI], calculatedFvPatchField<Type>::typeName,
toMesh_.boundary()[patchI], toMesh_.boundary()[patchI],
DimensionedField<Type, volMesh>::null(), DimensionedField<Type, volMesh>::null()
patchFieldInterpolator
(
boundaryAddressing_[patchI]
)
) )
); );
} }
@ -452,6 +449,31 @@ Foam::meshToMesh::interpolate
patchFields patchFields
) )
); );
GeometricField<Type, fvPatchField, volMesh>& toF = ttoF();
// 2. Change the fvPatchFields to the correct type using a mapper
// constructor (with reference to the now correct internal field)
typename GeometricField<Type, fvPatchField, volMesh>::
GeometricBoundaryField& bf = toF.boundaryField();
forAll(boundaryAddressing_, patchI)
{
bf.set
(
patchI,
fvPatchField<Type>::New
(
fromVf.boundaryField()[patchI],
toMesh_.boundary()[patchI],
toF.dimensionedInternalField(),
directFvPatchFieldMapper
(
boundaryAddressing_[patchI]
)
)
);
}
return ttoF; return ttoF;
} }