Merge commit 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2010-02-03 17:40:37 +01:00
258 changed files with 9316 additions and 2597 deletions

View File

@ -1,6 +1,10 @@
regionProperties/regionProperties.C
derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C
derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.C
fluid/compressibleCourantNo.C fluid/compressibleCourantNo.C
solid/solidRegionDiffNo.C
chtMultiRegionFoam.C chtMultiRegionFoam.C

View File

@ -2,11 +2,11 @@ EXE_INC = \
-Ifluid \ -Ifluid \
-Isolid \ -Isolid \
-IregionProperties \ -IregionProperties \
-Iinclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lbasicThermophysicalModels \ -lbasicThermophysicalModels \

View File

@ -37,6 +37,7 @@ Description
#include "fixedGradientFvPatchFields.H" #include "fixedGradientFvPatchFields.H"
#include "regionProperties.H" #include "regionProperties.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
#include "solidRegionDiffNo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,23 +57,24 @@ int main(int argc, char *argv[])
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "readTimeControls.H" #include "readTimeControls.H"
#include "readSolidTimeControls.H"
#include "compressibleMultiRegionCourantNo.H"
#include "solidRegionDiffusionNo.H"
#include "setInitialMultiRegionDeltaT.H"
if (fluidRegions.size())
{
#include "compressibleMultiRegionCourantNo.H"
#include "setInitialDeltaT.H"
}
while (runTime.run()) while (runTime.run())
{ {
#include "readTimeControls.H" #include "readTimeControls.H"
#include "readSolidTimeControls.H"
#include "readPIMPLEControls.H" #include "readPIMPLEControls.H"
if (fluidRegions.size())
{ #include "compressibleMultiRegionCourantNo.H"
#include "compressibleMultiRegionCourantNo.H" #include "solidRegionDiffusionNo.H"
#include "setDeltaT.H" #include "setMultiRegionDeltaT.H"
}
runTime++; runTime++;
@ -117,7 +119,7 @@ int main(int argc, char *argv[])
<< nl << endl; << nl << endl;
} }
Info<< "End\n" << endl; Info << "End\n" << endl;
return 0; return 0;
} }

View File

@ -0,0 +1,382 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "solidWallMixedTemperatureCoupledFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "directMappedPatchBase.H"
#include "regionProperties.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::interfaceOwner
(
const polyMesh& nbrRegion
) const
{
const fvMesh& myRegion = patch().boundaryMesh().mesh();
const regionProperties& props =
myRegion.objectRegistry::parent().lookupObject<regionProperties>
(
"regionProperties"
);
label myIndex = findIndex(props.fluidRegionNames(), myRegion.name());
if (myIndex == -1)
{
label i = findIndex(props.solidRegionNames(), myRegion.name());
if (i == -1)
{
FatalErrorIn
(
"solidWallMixedTemperatureCoupledFvPatchScalarField"
"::interfaceOwner(const polyMesh&) const"
) << "Cannot find region " << myRegion.name()
<< " neither in fluids " << props.fluidRegionNames()
<< " nor in solids " << props.solidRegionNames()
<< exit(FatalError);
}
myIndex = props.fluidRegionNames().size() + i;
}
label nbrIndex = findIndex(props.fluidRegionNames(), nbrRegion.name());
if (nbrIndex == -1)
{
label i = findIndex(props.solidRegionNames(), nbrRegion.name());
if (i == -1)
{
FatalErrorIn("coupleManager::interfaceOwner(const polyMesh&) const")
<< "Cannot find region " << nbrRegion.name()
<< " neither in fluids " << props.fluidRegionNames()
<< " nor in solids " << props.solidRegionNames()
<< exit(FatalError);
}
nbrIndex = props.fluidRegionNames().size() + i;
}
return myIndex < nbrIndex;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(p, iF),
neighbourFieldName_("undefined-neighbourFieldName"),
KName_("undefined-K")
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 1.0;
this->fixesValue_ = true;
}
Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const solidWallMixedTemperatureCoupledFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
neighbourFieldName_(ptf.neighbourFieldName_),
KName_(ptf.KName_),
fixesValue_(ptf.fixesValue_)
{}
Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF),
neighbourFieldName_(dict.lookup("neighbourFieldName")),
KName_(dict.lookup("K"))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"solidWallMixedTemperatureCoupledFvPatchScalarField::"
"solidWallMixedTemperatureCoupledFvPatchScalarField\n"
"(\n"
" const fvPatch& p,\n"
" const DimensionedField<scalar, volMesh>& iF,\n"
" const dictionary& dict\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
<< exit(FatalError);
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
if (dict.found("refValue"))
{
// Full restart
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
fixesValue_ = readBool(dict.lookup("fixesValue"));
}
else
{
// Start from user entered data. Assume fixedValue.
refValue() = *this;
refGrad() = 0.0;
valueFraction() = 1.0;
fixesValue_ = true;
}
}
Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const solidWallMixedTemperatureCoupledFvPatchScalarField& wtcsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(wtcsf, iF),
neighbourFieldName_(wtcsf.neighbourFieldName_),
KName_(wtcsf.KName_),
fixesValue_(wtcsf.fixesValue_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::fvPatchScalarField&
Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::K() const
{
return this->patch().lookupPatchField<volScalarField, scalar>(KName_);
}
void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
(
patch().patch()
);
const polyMesh& nbrMesh = mpp.sampleMesh();
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
(void)distMap.schedule();
tmp<scalarField> intFld = patchInternalField();
if (interfaceOwner(nbrMesh))
{
// Note: other side information could be cached - it only needs
// to be updated the first time round the iteration (i.e. when
// switching regions) but unfortunately we don't have this information.
const fvPatch& nbrPatch = refCast<const fvMesh>
(
nbrMesh
).boundary()[mpp.samplePolyPatch().index()];
// Calculate the temperature by harmonic averaging
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
const solidWallMixedTemperatureCoupledFvPatchScalarField& nbrField =
refCast<const solidWallMixedTemperatureCoupledFvPatchScalarField>
(
nbrPatch.lookupPatchField<volScalarField, scalar>
(
neighbourFieldName_
)
);
// Swap to obtain full local values of neighbour internal field
scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
// Swap to obtain full local values of neighbour K*delta
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrKDelta
);
tmp<scalarField> myKDelta = K()*patch().deltaCoeffs();
// Calculate common wall temperature. Reuse *this to store common value.
scalarField Twall
(
(myKDelta()*intFld() + nbrKDelta*nbrIntFld)
/ (myKDelta() + nbrKDelta)
);
// Assign to me
fvPatchScalarField::operator=(Twall);
// Distribute back and assign to neighbour
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
nbrField.size(),
distMap.constructMap(), // reverse : what to send
distMap.subMap(),
Twall
);
const_cast<solidWallMixedTemperatureCoupledFvPatchScalarField&>
(
nbrField
).fvPatchScalarField::operator=(Twall);
}
// Switch between fixed value (of harmonic avg) or gradient
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
label nFixed = 0;
// Like snGrad but bypass switching on refValue/refGrad.
tmp<scalarField> normalGradient = (*this-intFld())*patch().deltaCoeffs();
if (debug)
{
scalar Q = gSum(K()*patch().magSf()*normalGradient());
Info<< "solidWallMixedTemperatureCoupledFvPatchScalarField::"
<< "updateCoeffs() :"
<< " patch:" << patch().name()
<< " heatFlux:" << Q
<< " walltemperature "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< " avg:" << gAverage(*this)
<< endl;
}
forAll(*this, i)
{
// if outgoing flux use fixed value.
if (normalGradient()[i] < 0.0)
{
this->refValue()[i] = operator[](i);
this->refGrad()[i] = 0.0; // not used by me
this->valueFraction()[i] = 1.0;
nFixed++;
}
else
{
// Fixed gradient. Make sure to have valid refValue (even though
// I am not using it - other boundary conditions might)
this->refValue()[i] = operator[](i);
this->refGrad()[i] = normalGradient()[i];
this->valueFraction()[i] = 0.0;
}
}
reduce(nFixed, sumOp<label>());
fixesValue_ = (nFixed > 0);
if (debug)
{
label nTotSize = returnReduce(this->size(), sumOp<label>());
Info<< "solidWallMixedTemperatureCoupledFvPatchScalarField::"
<< "updateCoeffs() :"
<< " patch:" << patch().name()
<< " out of:" << nTotSize
<< " fixedBC:" << nFixed
<< " gradient:" << nTotSize-nFixed << endl;
}
mixedFvPatchScalarField::updateCoeffs();
}
void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::write
(
Ostream& os
) const
{
mixedFvPatchScalarField::write(os);
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
<< token::END_STATEMENT << nl;
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
os.writeKeyword("fixesValue") << fixesValue_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
solidWallMixedTemperatureCoupledFvPatchScalarField
);
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,193 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
solidWallMixedTemperatureCoupledFvPatchScalarField
Description
Mixed boundary condition for temperature, to be used by the
conjugate heat transfer solver.
If my temperature is T1, neighbour is T2:
T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient.
Example usage:
myInterfacePatchName
{
type solidWallMixedTemperatureCoupled;
neighbourFieldName T;
K K;
value uniform 300;
}
Needs to be on underlying directMapped(Wall)FvPatch.
Note: runs in parallel with arbitrary decomposition. Uses directMapped
functionality to calculate exchange.
Note: lags interface data so both sides use same data.
- problem: schedule to calculate average would interfere
with standard processor swaps.
- so: updateCoeffs sets both to same Twall. Only need to do
this for last outer iteration but don't have access to this.
SourceFiles
solidWallMixedTemperatureCoupledFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef solidWallMixedTemperatureCoupledFvPatchScalarField_H
#define solidWallMixedTemperatureCoupledFvPatchScalarField_H
#include "fvPatchFields.H"
#include "mixedFvPatchFields.H"
#include "fvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class solidWallMixedTemperatureCoupledFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class solidWallMixedTemperatureCoupledFvPatchScalarField
:
public mixedFvPatchScalarField
{
// Private data
//- Name of field on the neighbour region
const word neighbourFieldName_;
//- Name of thermal conductivity field
const word KName_;
bool fixesValue_;
// Private Member Functions
//- Am I or neighbour owner of interface
bool interfaceOwner(const polyMesh& nbrRegion) const;
public:
//- Runtime type information
TypeName("solidWallMixedTemperatureCoupled");
// Constructors
//- Construct from patch and internal field
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// solidWallMixedTemperatureCoupledFvPatchScalarField onto a new patch
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const solidWallMixedTemperatureCoupledFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new solidWallMixedTemperatureCoupledFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const solidWallMixedTemperatureCoupledFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new solidWallMixedTemperatureCoupledFvPatchScalarField
(
*this,
iF
)
);
}
// Member functions
//- Get corresponding K field
const fvPatchScalarField& K() const;
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return fixesValue_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -47,10 +47,10 @@ Foam::scalar Foam::compressibleCourantNo
/ fvc::interpolate(rho); / fvc::interpolate(rho);
CoNum = max(SfUfbyDelta/mesh.magSf()) CoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaTValue(); .value()*runTime.deltaT().value();
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf())) meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaTValue(); .value()*runTime.deltaT().value();
} }
Info<< "Region: " << mesh.name() << " Courant Number mean: " << meanCoNum Info<< "Region: " << mesh.name() << " Courant Number mean: " << meanCoNum

View File

@ -1,15 +1,18 @@
scalar CoNum = -GREAT; scalar CoNum = -GREAT;
forAll(fluidRegions, regionI) if (fluidRegions.size())
{ {
CoNum = max forAll(fluidRegions, regionI)
( {
compressibleCourantNo CoNum = max
( (
fluidRegions[regionI], compressibleCourantNo
runTime, (
rhoFluid[regionI], fluidRegions[regionI],
phiFluid[regionI] runTime,
), rhoFluid[regionI],
CoNum phiFluid[regionI]
); ),
CoNum
);
}
} }

View File

@ -41,6 +41,24 @@
) )
); );
Info<< " Adding to KFluid\n" << endl;
KFluid.set
(
i,
new volScalarField
(
IOobject
(
"K",
runTime.timeName(),
fluidRegions[i],
IOobject::NO_READ,
IOobject::NO_WRITE
),
thermoFluid[i].Cp()*thermoFluid[i].alpha()
)
);
Info<< " Adding to UFluid\n" << endl; Info<< " Adding to UFluid\n" << endl;
UFluid.set UFluid.set
( (
@ -111,24 +129,6 @@
).ptr() ).ptr()
); );
Info<< " Adding to KFluid\n" << endl;
KFluid.set
(
i,
new volScalarField
(
IOobject
(
"K",
runTime.timeName(),
fluidRegions[i],
IOobject::NO_READ,
IOobject::NO_WRITE
),
thermoFluid[i].Cp()*turbulence[i].alphaEff()
)
);
Info<< " Adding to DpDtFluid\n" << endl; Info<< " Adding to DpDtFluid\n" << endl;
DpDtFluid.set DpDtFluid.set
( (

View File

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Global
setInitialDeltaT
Description
Set the initial timestep for the CHT MultiRegion solver.
\*---------------------------------------------------------------------------*/
if (adjustTimeStep)
{
if ((runTime.timeIndex() == 0) && ((CoNum > SMALL) || (DiNum > SMALL)))
{
if (CoNum == -GREAT)
{
CoNum = SMALL;
}
if (DiNum == -GREAT)
{
DiNum = SMALL;
}
runTime.setDeltaT
(
min
(
min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaT().value(),
maxDeltaT
)
);
Info<< "deltaT = " << runTime.deltaT().value() << endl;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,69 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Global
setMultiRegionDeltaT
Description
Reset the timestep to maintain a constant maximum courant and diffusion
Numbers. Reduction of time-step is immediate, but increase is damped to avoid
unstable oscillations.
\*---------------------------------------------------------------------------*/
if (adjustTimeStep)
{
if (CoNum == -GREAT)
{
CoNum = SMALL;
}
if (DiNum == -GREAT)
{
DiNum = SMALL;
}
scalar maxDeltaTFluid = maxCo/(CoNum + SMALL);
scalar maxDeltaTSolid = maxDi/(DiNum + SMALL);
scalar deltaTFluid =
min
(
min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid),
1.2
);
runTime.setDeltaT
(
min
(
min(deltaTFluid, maxDeltaTSolid)*runTime.deltaT().value(),
maxDeltaT
)
);
Info<< "deltaT = " << runTime.deltaT().value() << endl;
}
// ************************************************************************* //

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) 2009-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,32 +22,48 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Macros for defining parcel IOLists
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef makeParcelIOList_H #include "regionProperties.H"
#define makeParcelIOList_H
#include "IOPtrList.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Foam::regionProperties::regionProperties(const Time& runTime)
:
IOdictionary
(
IOobject
(
"regionProperties",
runTime.time().constant(),
runTime.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
fluidRegionNames_(lookup("fluidRegionNames")),
solidRegionNames_(lookup("solidRegionNames"))
{}
#define makeParcelIOList(ParcelType) \
\
typedef IOPtrList<ParcelType> IOPtrList##ParcelType; \
\
defineTemplateTypeNameAndDebugWithName \
( \
IOPtrList##ParcelType, \
"IOPtrList<"#ParcelType">", \
0 \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionProperties::~regionProperties()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::List<Foam::word>& Foam::regionProperties::fluidRegionNames() const
{
return fluidRegionNames_;
}
const Foam::List<Foam::word>& Foam::regionProperties::solidRegionNames() const
{
return solidRegionNames_;
}
#endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
regionProperties
Description
Simple class to hold region information for coupled region simulations
SourceFiles
regionProperties.C
\*---------------------------------------------------------------------------*/
#ifndef regionProperties_H
#define regionProperties_H
#include "IOdictionary.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class regionProperties Declaration
\*---------------------------------------------------------------------------*/
class regionProperties
:
public IOdictionary
{
// Private data
//- List of the fluid region names
List<word> fluidRegionNames_;
//- List of the solid region names
List<word> solidRegionNames_;
// Private Member Functions
//- Disallow default bitwise copy construct
regionProperties(const regionProperties&);
//- Disallow default bitwise assignment
void operator=(const regionProperties&);
public:
// Constructors
//- Construct from components
regionProperties(const Time& runTime);
// Destructor
~regionProperties();
// Member Functions
// Access
//- Return const reference to the list of fluid region names
const List<word>& fluidRegionNames() const;
//- Return const reference to the list of solid region names
const List<word>& solidRegionNames() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // 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) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,27 +22,14 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Global
readSolidTimeControls
Description
Read the control parameters used in the solid
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "expDirectionMixedFvPatchFields.H" scalar maxDi = runTime.controlDict().lookupOrDefault<scalar>("maxDi", 10.0);
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
makePatchTypeField(fvPatchVectorField, expDirectionMixedFvPatchVectorField);
template<>
makePatchTypeField(fvPatchTensorField, expDirectionMixedFvPatchTensorField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,61 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "solidRegionDiffNo.H"
#include "fvc.H"
Foam::scalar Foam::solidRegionDiffNo
(
const fvMesh& mesh,
const Time& runTime,
const volScalarField& Cprho,
const volScalarField& K
)
{
scalar DiNum = 0.0;
scalar meanDiNum = 0.0;
//- Can have fluid domains with 0 cells so do not test.
if (mesh.nInternalFaces())
{
surfaceScalarField KrhoCpbyDelta =
mesh.surfaceInterpolation::deltaCoeffs()
* fvc::interpolate(K)
/ fvc::interpolate(Cprho);
DiNum = max(KrhoCpbyDelta.internalField())*runTime.deltaT().value();
meanDiNum = (average(KrhoCpbyDelta)).value()*runTime.deltaT().value();
}
Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum
<< " max: " << DiNum << endl;
return DiNum;
}
// ************************************************************************* //

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) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,28 +22,27 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Calculates and outputs the mean and maximum Diffusion Numbers for the solid
regions
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef expDirectionMixedFvPatchFields_H #ifndef solidRegionDiff_H
#define expDirectionMixedFvPatchFields_H #define solidRegionDiff_H
#include "expDirectionMixedFvPatchField.H" #include "fvMesh.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
scalar solidRegionDiffNo
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // (
const fvMesh& mesh,
makePatchTypeFieldTypedefs(expDirectionMixed) const Time& runTime,
const volScalarField& Cprho,
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // const volScalarField& K
);
} // End namespace Foam }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif

View File

@ -0,0 +1,18 @@
scalar DiNum = -GREAT;
if (solidRegions.size())
{
forAll(solidRegions, regionI)
{
DiNum = max
(
solidRegionDiffNo
(
solidRegions[regionI],
runTime,
rhosCps[regionI],
Ks[regionI]
),
DiNum
);
}
}

View File

@ -22,8 +22,7 @@
== ==
fvc::reconstruct fvc::reconstruct
( (
fvc::interpolate(rho)*(g & mesh.Sf()) (- ghf*fvc::snGrad(rho) - fvc::snGrad(pmh))*mesh.magSf()
- fvc::snGrad(p)*mesh.magSf()
) )
); );
} }

View File

@ -1,9 +1,9 @@
Info<< "Reading field p\n" << endl; Info<< "Reading field pmh\n" << endl;
volScalarField p volScalarField pmh
( (
IOobject IOobject
( (
"p", "pmh",
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
@ -119,11 +119,6 @@
#include "compressibleCreatePhi.H" #include "compressibleCreatePhi.H"
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
Info<< "Calculating field mul\n" << endl; Info<< "Calculating field mul\n" << endl;
volScalarField mul volScalarField mul
( (
@ -346,3 +341,48 @@
), ),
mut + mul mut + mul
); );
Info<< "Calculating field (g.h)f\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf = surfaceScalarField("gh", g & mesh.Cf());
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
pmh + rho*gh
);
label pmhRefCell = 0;
scalar pmhRefValue = 0.0;
setRefCell
(
pmh,
mesh.solutionDict().subDict("PISO"),
pmhRefCell,
pmhRefValue
);
scalar pRefValue = 0.0;
if (pmh.needReference())
{
pRefValue = readScalar
(
mesh.solutionDict().subDict("PISO").lookup("pRefValue")
);
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pmhRefCell)
);
}

View File

@ -0,0 +1,52 @@
volScalarField rUA = 1.0/UEqn.A();
surfaceScalarField rUAf
(
"(rho*(1|A(U)))",
fvc::interpolate(rho)*fvc::interpolate(rUA)
);
U = rUA*UEqn.H();
phi =
fvc::interpolate(rho)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
);
surfaceScalarField phiU("phiU", phi);
phi -= ghf*fvc::snGrad(rho)*rUAf*mesh.magSf();
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pmhEqn
(
fvm::laplacian(rUAf, pmh) == fvc::ddt(rho) + fvc::div(phi)
);
pmhEqn.setReference(pmhRefCell, pmhRefValue);
pmhEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi -= pmhEqn.flux();
}
}
p == pmh + rho*gh;
if (pmh.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pmhRefCell)
);
}
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
U.correctBoundaryConditions();

View File

@ -64,22 +64,24 @@ int main(int argc, char *argv[])
#include "rhoEqn.H" #include "rhoEqn.H"
#include "calcVdj.H" for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
#include "UEqn.H"
#include "alphaEqn.H"
#include "correctViscosity.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{ {
#include "pEqn.H" #include "calcVdj.H"
}
#include "kEpsilon.H" #include "UEqn.H"
#include "alphaEqn.H"
#include "correctViscosity.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{
#include "pmhEqn.H"
}
#include "kEpsilon.H"
}
runTime.write(); runTime.write();

View File

@ -441,6 +441,19 @@ int main(int argc, char *argv[])
// Layer addition parameters // Layer addition parameters
layerParameters layerParams(layerDict, mesh.boundaryMesh()); layerParameters layerParams(layerDict, mesh.boundaryMesh());
//!!! Temporary hack to get access to maxLocalCells
bool preBalance;
{
refinementParameters refineParams(refineDict);
preBalance = returnReduce
(
(mesh.nCells() >= refineParams.maxLocalCells()),
orOp<bool>()
);
}
if (!overwrite) if (!overwrite)
{ {
const_cast<Time&>(mesh.time())++; const_cast<Time&>(mesh.time())++;
@ -451,6 +464,7 @@ int main(int argc, char *argv[])
layerDict, layerDict,
motionDict, motionDict,
layerParams, layerParams,
preBalance,
decomposer, decomposer,
distributor distributor
); );

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
object autoHexMeshDict; object snappyHexMeshDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,7 +40,7 @@ geometry
{ {
type triSurfaceMesh; type triSurfaceMesh;
//tolerance 1E-6; // optional:non-default tolerance on intersections //tolerance 1E-5; // optional:non-default tolerance on intersections
//maxTreeDepth 10; // optional:depth of octree. Decrease only in case //maxTreeDepth 10; // optional:depth of octree. Decrease only in case
// of memory limitations. // of memory limitations.
@ -71,9 +71,9 @@ castellatedMeshControls
// Refinement parameters // Refinement parameters
// ~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~
// While refining maximum number of cells per processor. This is basically // If local number of cells is >= maxLocalCells on any processor
// the number of cells that fit on a processor. If you choose this too small // switches from from refinement followed by balancing
// it will do just more refinement iterations to obtain a similar mesh. // (current method) to (weighted) balancing before refinement.
maxLocalCells 1000000; maxLocalCells 1000000;
// Overall cell limit (approximately). Refinement will stop immediately // Overall cell limit (approximately). Refinement will stop immediately
@ -89,6 +89,13 @@ castellatedMeshControls
// (unless the number of cells to refine is 0) // (unless the number of cells to refine is 0)
minRefinementCells 0; minRefinementCells 0;
// Allow a certain level of imbalance during refining
// (since balancing is quite expensive)
// Expressed as fraction of perfect balance (= overall number of cells /
// nProcs). 0=balance always.
maxLoadUnbalance 0.10;
// Number of buffer layers between different levels. // Number of buffer layers between different levels.
// 1 means normal 2:1 refinement restriction, larger means slower // 1 means normal 2:1 refinement restriction, larger means slower
// refinement. // refinement.

View File

@ -47,6 +47,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nNonAligned Info<< " <<Writing " << nNonAligned
<< " points on non-aligned edges to set " << " points on non-aligned edges to set "
<< nonAlignedPoints.name() << endl; << nonAlignedPoints.name() << endl;
nonAlignedPoints.instance() = mesh.pointsInstance();
nonAlignedPoints.write(); nonAlignedPoints.write();
} }
} }
@ -67,6 +68,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
Info<< " <<Writing " << nNonClosed Info<< " <<Writing " << nNonClosed
<< " non closed cells to set " << cells.name() << endl; << " non closed cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance();
cells.write(); cells.write();
} }
} }
@ -78,6 +80,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nHighAspect Info<< " <<Writing " << nHighAspect
<< " cells with high aspect ratio to set " << " cells with high aspect ratio to set "
<< aspectCells.name() << endl; << aspectCells.name() << endl;
aspectCells.instance() = mesh.pointsInstance();
aspectCells.write(); aspectCells.write();
} }
} }
@ -94,6 +97,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
Info<< " <<Writing " << nFaces Info<< " <<Writing " << nFaces
<< " zero area faces to set " << faces.name() << endl; << " zero area faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
} }
} }
@ -111,6 +115,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
Info<< " <<Writing " << nCells Info<< " <<Writing " << nCells
<< " zero volume cells to set " << cells.name() << endl; << " zero volume cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance();
cells.write(); cells.write();
} }
} }
@ -129,6 +134,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
Info<< " <<Writing " << nFaces Info<< " <<Writing " << nFaces
<< " non-orthogonal faces to set " << faces.name() << endl; << " non-orthogonal faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
} }
} }
@ -147,6 +153,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nFaces Info<< " <<Writing " << nFaces
<< " faces with incorrect orientation to set " << " faces with incorrect orientation to set "
<< faces.name() << endl; << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
} }
} }
@ -164,6 +171,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
Info<< " <<Writing " << nFaces Info<< " <<Writing " << nFaces
<< " skew faces to set " << faces.name() << endl; << " skew faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
} }
} }
@ -184,6 +192,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nPoints Info<< " <<Writing " << nPoints
<< " points on short edges to set " << points.name() << " points on short edges to set " << points.name()
<< endl; << endl;
points.instance() = mesh.pointsInstance();
points.write(); points.write();
} }
} }
@ -202,6 +211,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nPoints Info<< " <<Writing " << nPoints
<< " near (closer than " << Foam::sqrt(minDistSqr) << " near (closer than " << Foam::sqrt(minDistSqr)
<< " apart) points to set " << nearPoints.name() << endl; << " apart) points to set " << nearPoints.name() << endl;
nearPoints.instance() = mesh.pointsInstance();
nearPoints.write(); nearPoints.write();
} }
} }
@ -221,6 +231,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nFaces Info<< " <<Writing " << nFaces
<< " faces with concave angles to set " << faces.name() << " faces with concave angles to set " << faces.name()
<< endl; << endl;
faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
} }
} }
@ -239,6 +250,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
Info<< " <<Writing " << nFaces Info<< " <<Writing " << nFaces
<< " warped faces to set " << faces.name() << endl; << " warped faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
} }
} }
@ -255,6 +267,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
Info<< " <<Writing " << nCells Info<< " <<Writing " << nCells
<< " under-determined cells to set " << cells.name() << endl; << " under-determined cells to set " << cells.name() << endl;
cells.instance() = mesh.pointsInstance();
cells.write(); cells.write();
} }
} }

View File

@ -89,6 +89,7 @@ Foam::label Foam::checkTopology
Info<< " <<Writing " << nPoints Info<< " <<Writing " << nPoints
<< " unused points to set " << points.name() << endl; << " unused points to set " << points.name() << endl;
points.instance() = mesh.pointsInstance();
points.write(); points.write();
} }
} }
@ -106,6 +107,7 @@ Foam::label Foam::checkTopology
{ {
Info<< " <<Writing " << nFaces Info<< " <<Writing " << nFaces
<< " unordered faces to set " << faces.name() << endl; << " unordered faces to set " << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
} }
} }
@ -122,6 +124,7 @@ Foam::label Foam::checkTopology
Info<< " <<Writing " << nCells Info<< " <<Writing " << nCells
<< " cells with over used edges to set " << cells.name() << " cells with over used edges to set " << cells.name()
<< endl; << endl;
cells.instance() = mesh.pointsInstance();
cells.write(); cells.write();
} }
} }
@ -137,6 +140,7 @@ Foam::label Foam::checkTopology
Info<< " <<Writing " << nFaces Info<< " <<Writing " << nFaces
<< " faces with out-of-range or duplicate vertices to set " << " faces with out-of-range or duplicate vertices to set "
<< faces.name() << endl; << faces.name() << endl;
faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
} }
} }
@ -153,6 +157,7 @@ Foam::label Foam::checkTopology
Info<< " <<Writing " << nFaces Info<< " <<Writing " << nFaces
<< " faces with incorrect edges to set " << faces.name() << " faces with incorrect edges to set " << faces.name()
<< endl; << endl;
faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();
} }
} }
@ -203,6 +208,7 @@ Foam::label Foam::checkTopology
<< " cells with with single non-boundary face to set " << " cells with with single non-boundary face to set "
<< oneCells.name() << oneCells.name()
<< endl; << endl;
oneCells.instance() = mesh.pointsInstance();
oneCells.write(); oneCells.write();
} }
@ -214,6 +220,7 @@ Foam::label Foam::checkTopology
<< " cells with with single non-boundary face to set " << " cells with with single non-boundary face to set "
<< twoCells.name() << twoCells.name()
<< endl; << endl;
twoCells.instance() = mesh.pointsInstance();
twoCells.write(); twoCells.write();
} }
} }
@ -354,6 +361,7 @@ Foam::label Foam::checkTopology
<< " conflicting points to set " << " conflicting points to set "
<< points.name() << endl; << points.name() << endl;
points.instance() = mesh.pointsInstance();
points.write(); points.write();
} }

View File

@ -43,6 +43,8 @@ FoamFile
matchTolerance 1E-3; matchTolerance 1E-3;
// Do a synchronisation of coupled points after creation of any patches. // Do a synchronisation of coupled points after creation of any patches.
// Note: this does not work with points that are on multiple coupled patches
// with transformations.
pointSync true; pointSync true;
// Patches to create. // Patches to create.

View File

@ -45,6 +45,7 @@ Description
#include "cellZoneSet.H" #include "cellZoneSet.H"
#include "faceZoneSet.H" #include "faceZoneSet.H"
#include "pointZoneSet.H" #include "pointZoneSet.H"
#include "timeSelector.H"
#include <stdio.h> #include <stdio.h>
@ -82,45 +83,6 @@ Istream& selectStream(Istream* is0Ptr, Istream* is1Ptr)
} }
} }
// Copy set
void backup
(
const word& setType,
const polyMesh& mesh,
const word& fromName,
const topoSet& fromSet,
const word& toName
)
{
if (fromSet.size())
{
Info<< " Backing up " << fromName << " into " << toName << endl;
topoSet::New(setType, mesh, toName, fromSet)().write();
}
}
// Read and copy set
void backup
(
const word& setType,
const polyMesh& mesh,
const word& fromName,
const word& toName
)
{
autoPtr<topoSet> fromSet = topoSet::New
(
setType,
mesh,
fromName,
IOobject::READ_IF_PRESENT
);
backup(setType, mesh, fromName, fromSet(), toName);
}
// Write set to VTK readable files // Write set to VTK readable files
void writeVTK void writeVTK
@ -304,7 +266,13 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
IOobjectList objects IOobjectList objects
( (
mesh, mesh,
mesh.pointsInstance(), mesh.time().findInstance
(
polyMesh::meshSubDir/"sets",
word::null,
IOobject::READ_IF_PRESENT,
mesh.facesInstance()
),
polyMesh::meshSubDir/"sets" polyMesh::meshSubDir/"sets"
); );
IOobjectList cellSets(objects.lookupClass(cellSet::typeName)); IOobjectList cellSets(objects.lookupClass(cellSet::typeName));
@ -417,7 +385,13 @@ void removeSet
IOobjectList objects IOobjectList objects
( (
mesh, mesh,
mesh.pointsInstance(), mesh.time().findInstance
(
polyMesh::meshSubDir/"sets",
word::null,
IOobject::READ_IF_PRESENT,
mesh.facesInstance()
),
polyMesh::meshSubDir/"sets" polyMesh::meshSubDir/"sets"
); );
@ -465,6 +439,7 @@ bool doCommand
const word& setName, const word& setName,
const word& actionName, const word& actionName,
const bool writeVTKFile, const bool writeVTKFile,
const bool writeCurrentTime,
Istream& is Istream& is
) )
{ {
@ -628,8 +603,6 @@ bool doCommand
/currentSet.name() /currentSet.name()
<< " and to vtk file " << vtkName << endl << endl; << " and to vtk file " << vtkName << endl << endl;
currentSet.write();
writeVTK(mesh, currentSet, vtkName); writeVTK(mesh, currentSet, vtkName);
} }
else else
@ -638,9 +611,13 @@ bool doCommand
<< " (size " << currentSet.size() << ") to " << " (size " << currentSet.size() << ") to "
<< currentSet.instance()/currentSet.local() << currentSet.instance()/currentSet.local()
/currentSet.name() << endl << endl; /currentSet.name() << endl << endl;
currentSet.write();
} }
if (writeCurrentTime)
{
currentSet.instance() = mesh.time().timeName();
}
currentSet.write();
} }
} }
} }
@ -692,6 +669,48 @@ void printMesh(const Time& runTime, const polyMesh& mesh)
} }
polyMesh::readUpdateState meshReadUpdate(polyMesh& mesh)
{
polyMesh::readUpdateState stat = mesh.readUpdate();
switch(stat)
{
case polyMesh::UNCHANGED:
{
Info<< " mesh not changed." << endl;
break;
}
case polyMesh::POINTS_MOVED:
{
Info<< " points moved; topology unchanged." << endl;
break;
}
case polyMesh::TOPO_CHANGE:
{
Info<< " topology changed; patches unchanged." << nl
<< " ";
printMesh(mesh.time(), mesh);
break;
}
case polyMesh::TOPO_PATCH_CHANGE:
{
Info<< " topology changed and patches changed." << nl
<< " ";
printMesh(mesh.time(), mesh);
break;
}
default:
{
FatalErrorIn("meshReadUpdate(polyMesh&)")
<< "Illegal mesh update state "
<< stat << abort(FatalError);
break;
}
}
return stat;
}
commandStatus parseType commandStatus parseType
( (
@ -730,44 +749,10 @@ commandStatus parseType
<< " to " << Times[nearestIndex].name() << " to " << Times[nearestIndex].name()
<< endl; << endl;
// Set time
runTime.setTime(Times[nearestIndex], nearestIndex); runTime.setTime(Times[nearestIndex], nearestIndex);
polyMesh::readUpdateState stat = mesh.readUpdate(); // Optionally re-read mesh
meshReadUpdate(mesh);
switch(stat)
{
case polyMesh::UNCHANGED:
{
Info<< " mesh not changed." << endl;
break;
}
case polyMesh::POINTS_MOVED:
{
Info<< " points moved; topology unchanged." << endl;
break;
}
case polyMesh::TOPO_CHANGE:
{
Info<< " topology changed; patches unchanged." << nl
<< " ";
printMesh(runTime, mesh);
break;
}
case polyMesh::TOPO_PATCH_CHANGE:
{
Info<< " topology changed and patches changed." << nl
<< " ";
printMesh(runTime, mesh);
break;
}
default:
{
FatalErrorIn("parseType")
<< "Illegal mesh update state "
<< stat << abort(FatalError);
break;
}
}
return INVALID; return INVALID;
} }
@ -840,23 +825,28 @@ commandStatus parseAction(const word& actionName)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions(true, false);
# include "addRegionOption.H" # include "addRegionOption.H"
# include "addTimeOptions.H" argList::addBoolOption("noVTK", "do not write VTK files");
argList::addBoolOption("loop", "execute batch commands for all timesteps");
argList::addBoolOption("noVTK");
argList::addOption("batch", "file"); argList::addOption("batch", "file");
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
bool writeVTK = !args.optionFound("noVTK"); bool writeVTK = !args.optionFound("noVTK");
bool loop = args.optionFound("loop");
bool batch = args.optionFound("batch");
// Get times list
instantList Times = runTime.times();
# include "checkTimeOptions.H" if (loop && !batch)
{
FatalErrorIn(args.executable())
<< "Can only loop when in batch mode."
<< exit(FatalError);
}
runTime.setTime(Times[startTime], startTime);
# include "createNamedPolyMesh.H" # include "createNamedPolyMesh.H"
@ -866,135 +856,171 @@ int main(int argc, char *argv[])
// Print current sets // Print current sets
printAllSets(mesh, Info); printAllSets(mesh, Info);
// Read history if interactive
# if READLINE != 0
std::ifstream* fileStreamPtr(NULL); if (!batch && !read_history(historyFile))
if (args.optionFound("batch"))
{
fileName batchFile(args.option("batch"));
Info<< "Reading commands from file " << batchFile << endl;
// we cannot handle .gz files
if (!isFile(batchFile, false))
{
FatalErrorIn(args.executable())
<< "Cannot open file " << batchFile << exit(FatalError);
}
fileStreamPtr = new std::ifstream(batchFile.c_str());
}
#if READLINE != 0
else if (!read_history(historyFile))
{ {
Info<< "Successfully read history from " << historyFile << endl; Info<< "Successfully read history from " << historyFile << endl;
} }
#endif # endif
Info<< "Please type 'help', 'quit' or a set command after prompt." << endl;
bool ok = true; // Exit status
int status = 0;
FatalError.throwExceptions();
FatalIOError.throwExceptions();
do forAll(timeDirs, timeI)
{ {
string rawLine; runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
// Type: cellSet, faceSet, pointSet // Handle geometry/topology changes
word setType; meshReadUpdate(mesh);
// Name of destination set.
word setName;
// Action (new, invert etc.)
word actionName;
commandStatus stat = INVALID;
if (fileStreamPtr) // Main command read & execute loop
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
autoPtr<IFstream> fileStreamPtr(NULL);
if (batch)
{ {
if (!fileStreamPtr->good()) fileName batchFile(args.option("batch"));
Info<< "Reading commands from file " << batchFile << endl;
// we cannot handle .gz files
if (!isFile(batchFile, false))
{ {
Info<< "End of batch file" << endl; FatalErrorIn(args.executable())
break; << "Cannot open file " << batchFile << exit(FatalError);
} }
std::getline(*fileStreamPtr, rawLine); fileStreamPtr.reset(new IFstream(batchFile));
if (rawLine.size())
{
Info<< "Doing:" << rawLine << endl;
}
} }
else
Info<< "Please type 'help', 'quit' or a set command after prompt."
<< endl;
// Whether to quit
bool quit = false;
FatalError.throwExceptions();
FatalIOError.throwExceptions();
do
{ {
# if READLINE != 0 string rawLine;
// Type: cellSet, faceSet, pointSet
word setType;
// Name of destination set.
word setName;
// Action (new, invert etc.)
word actionName;
commandStatus stat = INVALID;
if (fileStreamPtr.valid())
{ {
char* linePtr = readline("readline>"); if (!fileStreamPtr().good())
rawLine = string(linePtr);
if (*linePtr)
{ {
add_history(linePtr); Info<< "End of batch file" << endl;
write_history(historyFile); // No error.
break;
} }
free(linePtr); // readline uses malloc, not new. fileStreamPtr().getLine(rawLine);
}
# else
{
Info<< "Command>" << flush;
std::getline(std::cin, rawLine);
}
# endif
}
if (rawLine.empty() || rawLine[0] == '#') if (rawLine.size())
{
continue;
}
IStringStream is(rawLine + ' ');
// Type: cellSet, faceSet, pointSet, faceZoneSet
is >> setType;
stat = parseType(runTime, mesh, setType, is);
if (stat == VALIDSETCMD || stat == VALIDZONECMD)
{
if (is >> setName)
{
if (is >> actionName)
{ {
stat = parseAction(actionName); Info<< "Doing:" << rawLine << endl;
} }
} }
} else
ok = true; {
# if READLINE != 0
{
char* linePtr = readline("readline>");
if (stat == QUIT) rawLine = string(linePtr);
if (*linePtr)
{
add_history(linePtr);
write_history(historyFile);
}
free(linePtr); // readline uses malloc, not new.
}
# else
{
Info<< "Command>" << flush;
std::getline(std::cin, rawLine);
}
# endif
}
if (rawLine.empty() || rawLine[0] == '#')
{
continue;
}
IStringStream is(rawLine + ' ');
// Type: cellSet, faceSet, pointSet, faceZoneSet
is >> setType;
stat = parseType(runTime, mesh, setType, is);
if (stat == VALIDSETCMD || stat == VALIDZONECMD)
{
if (is >> setName)
{
if (is >> actionName)
{
stat = parseAction(actionName);
}
}
}
if (stat == QUIT)
{
// Make sure to quit
quit = true;
}
else if (stat == VALIDSETCMD || stat == VALIDZONECMD)
{
bool ok = doCommand
(
mesh,
setType,
setName,
actionName,
writeVTK,
loop, // if in looping mode dump sets to time directory
is
);
if (!ok)
{
// Exit with error.
quit = true;
status = 1;
}
}
} while (!quit);
if (quit)
{ {
break; break;
} }
else if (stat == VALIDSETCMD || stat == VALIDZONECMD)
{
ok = doCommand(mesh, setType, setName, actionName, writeVTK, is);
}
} while (ok);
if (fileStreamPtr)
{
delete fileStreamPtr;
} }
Info<< "\nEnd\n" << endl; Info<< "\nEnd\n" << endl;
return 0; return status;
} }

View File

@ -81,14 +81,17 @@ int main(int argc, char *argv[])
# include "createNamedPolyMesh.H" # include "createNamedPolyMesh.H"
// Search for list of objects for the time of the mesh // Search for list of objects for the time of the mesh
IOobjectList objects word setsInstance = runTime.findInstance
( (
mesh, polyMesh::meshSubDir/"sets",
mesh.pointsInstance(), word::null,
polyMesh::meshSubDir/"sets" IOobject::MUST_READ,
mesh.facesInstance()
); );
Info<< "Searched : " << mesh.pointsInstance()/polyMesh::meshSubDir/"sets" IOobjectList objects(mesh, setsInstance, polyMesh::meshSubDir/"sets");
Info<< "Searched : " << setsInstance/polyMesh::meshSubDir/"sets"
<< nl << nl
<< "Found : " << objects.names() << nl << "Found : " << objects.names() << nl
<< endl; << endl;

View File

@ -64,6 +64,7 @@ Description
#include "syncTools.H" #include "syncTools.H"
#include "ReadFields.H" #include "ReadFields.H"
#include "directMappedWallPolyPatch.H" #include "directMappedWallPolyPatch.H"
#include "zeroGradientFvPatchFields.H"
using namespace Foam; using namespace Foam;
@ -164,25 +165,24 @@ void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
// Adds patch if not yet there. Returns patchID. // Adds patch if not yet there. Returns patchID.
template<class PatchType> label addPatch(fvMesh& mesh, const polyPatch& patch)
label addPatch(fvMesh& mesh, const word& patchName)
{ {
polyBoundaryMesh& polyPatches = polyBoundaryMesh& polyPatches =
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
label patchI = polyPatches.findPatchID(patchName); label patchI = polyPatches.findPatchID(patch.name());
if (patchI != -1) if (patchI != -1)
{ {
if (isA<PatchType>(polyPatches[patchI])) if (polyPatches[patchI].type() == patch.type())
{ {
// Already there // Already there
return patchI; return patchI;
} }
else else
{ {
FatalErrorIn("addPatch<PatchType>(fvMesh&, const word&)") FatalErrorIn("addPatch(fvMesh&, const polyPatch*)")
<< "Already have patch " << patchName << "Already have patch " << patch.name()
<< " but of type " << PatchType::typeName << " but of type " << patch.type()
<< exit(FatalError); << exit(FatalError);
} }
} }
@ -219,14 +219,12 @@ label addPatch(fvMesh& mesh, const word& patchName)
polyPatches.set polyPatches.set
( (
sz, sz,
polyPatch::New patch.clone
( (
PatchType::typeName, polyPatches,
patchName, insertPatchI, //index
0, // size 0, //size
startFaceI, startFaceI //start
insertPatchI,
polyPatches
) )
); );
fvPatches.setSize(sz+1); fvPatches.setSize(sz+1);
@ -1086,16 +1084,37 @@ EdgeMap<label> addRegionPatches
if (interfaceSizes[e] > 0) if (interfaceSizes[e] > 0)
{ {
label patchI = addPatch<directMappedWallPolyPatch> const word inter1 = regionNames[e[0]] + "_to_" + regionNames[e[1]];
const word inter2 = regionNames[e[1]] + "_to_" + regionNames[e[0]];
directMappedWallPolyPatch patch1
( (
mesh, inter1,
regionNames[e[0]] + "_to_" + regionNames[e[1]] 0, // overridden
0, // overridden
0, // overridden
regionNames[e[1]], // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,
inter2, // samplePatch
point::zero, // offset
mesh.boundaryMesh()
); );
addPatch<directMappedWallPolyPatch>
label patchI = addPatch(mesh, patch1);
directMappedWallPolyPatch patch2
( (
mesh, inter2,
regionNames[e[1]] + "_to_" + regionNames[e[0]] 0,
0,
0,
regionNames[e[0]], // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,
inter1,
point::zero, // offset
mesh.boundaryMesh()
); );
addPatch(mesh, patch2);
Info<< "For interface between region " << e[0] Info<< "For interface between region " << e[0]
<< " and " << e[1] << " added patch " << patchI << " and " << e[1] << " added patch " << patchI
@ -1495,7 +1514,8 @@ int main(int argc, char *argv[])
false false
), ),
mesh, mesh,
dimensionedScalar("zero", dimless, 0) dimensionedScalar("zero", dimless, 0),
zeroGradientFvPatchScalarField::typeName
); );
forAll(cellRegion, cellI) forAll(cellRegion, cellI)
{ {

View File

@ -80,6 +80,4 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "tecplotWriter.H"
//extern "C" //extern "C"
//{ //{
#include "MASTER.h" #include "MASTER.h"
#include "GLOBAL.h" #include "GLOBAL.h"
//} //}
#include "tecplotWriter.H"
#include "fvc.H" #include "fvc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -67,11 +67,11 @@ void Foam::vtkPV3Foam::convertLagrangianField
{ {
const label nComp = pTraits<Type>::nComponents; const label nComp = pTraits<Type>::nComponents;
vtkFloatArray *pointData = vtkFloatArray::New(); vtkFloatArray* pointData = vtkFloatArray::New();
pointData->SetNumberOfTuples( tf.size() ); pointData->SetNumberOfTuples(tf.size());
pointData->SetNumberOfComponents( nComp ); pointData->SetNumberOfComponents(nComp);
pointData->Allocate( nComp*tf.size() ); pointData->Allocate(nComp*tf.size());
pointData->SetName( tf.name().c_str() ); pointData->SetName(tf.name().c_str());
if (debug) if (debug)
{ {

View File

@ -130,7 +130,7 @@ void Foam::vtkPV3Foam::updateInfoInternalMesh
// Determine mesh parts (internalMesh, patches...) // Determine mesh parts (internalMesh, patches...)
//- Add internal mesh as first entry //- Add internal mesh as first entry
arrayRangeVolume_.reset( arraySelection->GetNumberOfArrays() ); arrayRangeVolume_.reset(arraySelection->GetNumberOfArrays());
arraySelection->AddArray arraySelection->AddArray
( (
"internalMesh" "internalMesh"
@ -173,7 +173,7 @@ void Foam::vtkPV3Foam::updateInfoLagrangian
readDir(dbPtr_->timePath()/lagrangianPrefix, fileName::DIRECTORY) readDir(dbPtr_->timePath()/lagrangianPrefix, fileName::DIRECTORY)
); );
arrayRangeLagrangian_.reset( arraySelection->GetNumberOfArrays() ); arrayRangeLagrangian_.reset(arraySelection->GetNumberOfArrays());
int nClouds = 0; int nClouds = 0;
forAll(cloudDirs, cloudI) forAll(cloudDirs, cloudI)
@ -209,7 +209,7 @@ void Foam::vtkPV3Foam::updateInfoPatches
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl; << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
} }
arrayRangePatches_.reset( arraySelection->GetNumberOfArrays() ); arrayRangePatches_.reset(arraySelection->GetNumberOfArrays());
int nPatches = 0; int nPatches = 0;
if (meshPtr_) if (meshPtr_)
@ -319,7 +319,7 @@ void Foam::vtkPV3Foam::updateInfoZones
namesLst = readZoneNames("cellZones"); namesLst = readZoneNames("cellZones");
} }
arrayRangeCellZones_.reset( arraySelection->GetNumberOfArrays() ); arrayRangeCellZones_.reset(arraySelection->GetNumberOfArrays());
forAll(namesLst, elemI) forAll(namesLst, elemI)
{ {
arraySelection->AddArray arraySelection->AddArray
@ -342,7 +342,7 @@ void Foam::vtkPV3Foam::updateInfoZones
namesLst = readZoneNames("faceZones"); namesLst = readZoneNames("faceZones");
} }
arrayRangeFaceZones_.reset( arraySelection->GetNumberOfArrays() ); arrayRangeFaceZones_.reset(arraySelection->GetNumberOfArrays());
forAll(namesLst, elemI) forAll(namesLst, elemI)
{ {
arraySelection->AddArray arraySelection->AddArray
@ -365,7 +365,7 @@ void Foam::vtkPV3Foam::updateInfoZones
namesLst = readZoneNames("pointZones"); namesLst = readZoneNames("pointZones");
} }
arrayRangePointZones_.reset( arraySelection->GetNumberOfArrays() ); arrayRangePointZones_.reset(arraySelection->GetNumberOfArrays());
forAll(namesLst, elemI) forAll(namesLst, elemI)
{ {
arraySelection->AddArray arraySelection->AddArray
@ -400,16 +400,34 @@ void Foam::vtkPV3Foam::updateInfoSets
Info<< "<beg> Foam::vtkPV3Foam::updateInfoSets" << endl; Info<< "<beg> Foam::vtkPV3Foam::updateInfoSets" << endl;
} }
// Add names of sets // Add names of sets. Search for last time directory with a sets
IOobjectList objects // subdirectory. Take care not to search beyond the last mesh.
word facesInstance = dbPtr_().findInstance
( (
dbPtr_(), meshDir_,
dbPtr_().findInstance(meshDir_, "faces", IOobject::READ_IF_PRESENT), "faces",
meshDir_/"sets" IOobject::READ_IF_PRESENT
); );
word setsInstance = dbPtr_().findInstance
(
meshDir_/"sets",
word::null,
IOobject::READ_IF_PRESENT,
facesInstance
);
arrayRangeCellSets_.reset( arraySelection->GetNumberOfArrays() ); IOobjectList objects(dbPtr_(), setsInstance, meshDir_/"sets");
if (debug)
{
Info<< " Foam::vtkPV3Foam::updateInfoSets read "
<< objects.names() << " from " << setsInstance << endl;
}
arrayRangeCellSets_.reset(arraySelection->GetNumberOfArrays());
arrayRangeCellSets_ += addToSelection<cellSet> arrayRangeCellSets_ += addToSelection<cellSet>
( (
arraySelection, arraySelection,
@ -417,7 +435,7 @@ void Foam::vtkPV3Foam::updateInfoSets
" - cellSet" " - cellSet"
); );
arrayRangeFaceSets_.reset( arraySelection->GetNumberOfArrays() ); arrayRangeFaceSets_.reset(arraySelection->GetNumberOfArrays());
arrayRangeFaceSets_ += addToSelection<faceSet> arrayRangeFaceSets_ += addToSelection<faceSet>
( (
arraySelection, arraySelection,
@ -425,7 +443,7 @@ void Foam::vtkPV3Foam::updateInfoSets
" - faceSet" " - faceSet"
); );
arrayRangePointSets_.reset( arraySelection->GetNumberOfArrays() ); arrayRangePointSets_.reset(arraySelection->GetNumberOfArrays());
arrayRangePointSets_ += addToSelection<pointSet> arrayRangePointSets_ += addToSelection<pointSet>
( (
arraySelection, arraySelection,

View File

@ -83,9 +83,9 @@ sets
type uniform; type uniform;
axis distance; axis distance;
//- cavity //- cavity. Slightly perturbed so not to align with face or edge.
start (0.02 0.051 0.005); start (0.0201 0.05101 0.00501);
end (0.06 0.051 0.005); end (0.0601 0.05101 0.00501);
nPoints 10; nPoints 10;
} }
@ -103,8 +103,8 @@ sets
//end ( 1 0.05 0.005); //end ( 1 0.05 0.005);
//- cavity //- cavity
start (0.0 0.51 0.005); start (0.001 0.5101 0.00501);
end (2 0.51 0.005); end (2.01 0.5101 0.00501);
nPoints 10; nPoints 10;
} }
@ -112,15 +112,13 @@ sets
{ {
type cloud; type cloud;
axis xyz; axis xyz;
points ((0.049 0.049 0.005)(0.051 0.049 0.005)); points ((0.049 0.049 0.00501)(0.051 0.049 0.00501));
} }
); );
// Surface sampling definition: choice of // Surface sampling definition
// plane : values on plane defined by point, normal.
// patch : values on patch.
// //
// 1] patches are not triangulated by default // 1] patches are not triangulated by default
// 2] planes are always triangulated // 2] planes are always triangulated
@ -209,6 +207,28 @@ surfaces
// regularise false; // Optional: do not simplify // regularise false; // Optional: do not simplify
} }
distance
{
// Isosurface from signed/unsigned distance to surface
type distanceSurface;
signed true;
// Definition of surface
surfaceType triSurfaceMesh;
surfaceName integrationPlane.stl;
// Distance to surface
distance 0.0;
interpolate false;
}
triSurfaceSampling
{
// Sampling on triSurface
type sampledTriSurfaceMesh;
surface integrationPlane.stl;
interpolate true;
}
); );

View File

@ -1,4 +1,3 @@
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox

View File

@ -296,7 +296,7 @@ int main(int argc, char *argv[])
( (
"density", "density",
"scalar", "scalar",
"Specify density," "Specify density, "
"kg/m3 for solid properties, kg/m2 for shell properties" "kg/m3 for solid properties, kg/m2 for shell properties"
); );

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox

View File

@ -44,8 +44,8 @@ foreach cmake ( cmake-2.6.4 cmake-2.6.2 cmake-2.4.6 )
endif endif
end end
set paraviewMajor=paraview-3.6 if ( ! $?ParaView_MAJOR ) setenv ParaView_MAJOR paraview-3.6
setenv ParaView_VERSION 3.6.1 if ( ! $?ParaView_VERSION ) setenv ParaView_VERSION 3.6.1
setenv ParaView_INST_DIR $WM_THIRD_PARTY_DIR/paraview-$ParaView_VERSION setenv ParaView_INST_DIR $WM_THIRD_PARTY_DIR/paraview-$ParaView_VERSION
setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
@ -54,9 +54,9 @@ setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
if ( -r $paraviewPython ) then if ( -r $paraviewPython ) then
if ($?PYTHONPATH) then if ($?PYTHONPATH) then
setenv PYTHONPATH ${PYTHONPATH}:${paraviewPython}:$ParaView_DIR/lib/${paraviewMajor} setenv PYTHONPATH ${PYTHONPATH}:${paraviewPython}:$ParaView_DIR/lib/${ParaView_MAJOR}
else else
setenv PYTHONPATH ${paraviewPython}:$ParaView_DIR/lib/${paraviewMajor} setenv PYTHONPATH ${paraviewPython}:$ParaView_DIR/lib/${ParaView_MAJOR}
endif endif
endif endif
@ -65,5 +65,5 @@ if ( -r $ParaView_INST_DIR ) then
setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview
endif endif
unset cmake paraviewMajor paraviewPython unset cmake paraviewPython
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -109,7 +109,6 @@ struct HashTableCore
{ {
return iteratorEnd(); return iteratorEnd();
} }
}; };
@ -139,6 +138,7 @@ class HashTable
//- Construct from key, next pointer and object //- Construct from key, next pointer and object
inline hashedEntry(const Key&, hashedEntry* next, const T&); inline hashedEntry(const Key&, hashedEntry* next, const T&);
private: private:
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
hashedEntry(const hashedEntry&); hashedEntry(const hashedEntry&);
@ -209,9 +209,8 @@ public:
HashTable(const Xfer<HashTable<T, Key, Hash> >&); HashTable(const Xfer<HashTable<T, Key, Hash> >&);
// Destructor //- Destructor
~HashTable();
~HashTable();
// Member Functions // Member Functions
@ -247,6 +246,7 @@ public:
//- Print information //- Print information
Ostream& printInfo(Ostream&) const; Ostream& printInfo(Ostream&) const;
// Edit // Edit
//- Insert a new hashedEntry //- Insert a new hashedEntry
@ -291,7 +291,7 @@ public:
void transfer(HashTable<T, Key, Hash>&); void transfer(HashTable<T, Key, Hash>&);
//- Transfer contents to the Xfer container //- Transfer contents to the Xfer container
inline Xfer< HashTable<T, Key, Hash> > xfer(); inline Xfer<HashTable<T, Key, Hash> > xfer();
// Member Operators // Member Operators
@ -356,9 +356,8 @@ public:
//- Current hash index //- Current hash index
label hashIndex_; label hashIndex_;
protected:
// Protected Member Functions protected:
// Constructors // Constructors
@ -380,6 +379,8 @@ public:
); );
// Protected Member Functions
//- Increment to the next position //- Increment to the next position
inline void increment(); inline void increment();
@ -392,6 +393,7 @@ public:
//- Return const access to referenced object //- Return const access to referenced object
inline const T& cobject() const; inline const T& cobject() const;
public: public:
// Member operators // Member operators
@ -434,6 +436,7 @@ public:
const label hashIndex const label hashIndex
); );
public: public:
// Constructors // Constructors
@ -444,13 +447,12 @@ public:
//- Construct end iterator //- Construct end iterator
inline iterator(const iteratorEnd& unused); inline iterator(const iteratorEnd& unused);
// Member operators // Member operators
//- Conversion to a const_iterator //- Conversion to a const_iterator
inline operator const_iterator() const; inline operator const_iterator() const;
// Access
//- Return referenced hash value //- Return referenced hash value
inline T& operator*(); inline T& operator*();
inline T& operator()(); inline T& operator()();
@ -492,6 +494,7 @@ public:
const label hashIndex const label hashIndex
); );
public: public:
// Constructors // Constructors
@ -502,9 +505,8 @@ public:
//- Construct end iterator //- Construct end iterator
inline const_iterator(const iteratorEnd& unused); inline const_iterator(const iteratorEnd& unused);
// Member operators
// Access // Member operators
//- Return referenced hash value //- Return referenced hash value
inline const T& operator*() const; inline const T& operator*() const;
@ -536,7 +538,6 @@ public:
Ostream&, Ostream&,
const HashTable<T, Key, Hash>& const HashTable<T, Key, Hash>&
); );
}; };

View File

@ -97,11 +97,10 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
{} {}
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
( (
const Xfer< StaticHashTable<T, Key, Hash> >& ht const Xfer<StaticHashTable<T, Key, Hash> >& ht
) )
: :
StaticHashTableCore(), StaticHashTableCore(),
@ -452,7 +451,6 @@ void Foam::StaticHashTable<T, Key, Hash>::clearStorage()
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
void Foam::StaticHashTable<T, Key, Hash>::transfer void Foam::StaticHashTable<T, Key, Hash>::transfer
( (

View File

@ -72,10 +72,6 @@ template<class T, class Key, class Hash> Ostream& operator<<
); );
/*---------------------------------------------------------------------------*\
Class StaticHashTableName Declaration
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class StaticHashTableCore Declaration Class StaticHashTableCore Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -100,7 +96,6 @@ struct StaticHashTableCore
iteratorEnd() iteratorEnd()
{} {}
}; };
}; };
@ -135,6 +130,7 @@ class StaticHashTable
//- Assign a new hashed entry to a possibly already existing key //- Assign a new hashed entry to a possibly already existing key
bool set(const Key&, const T& newElmt, bool protect); bool set(const Key&, const T& newElmt, bool protect);
public: public:
@ -183,11 +179,11 @@ public:
StaticHashTable(const StaticHashTable<T, Key, Hash>&); StaticHashTable(const StaticHashTable<T, Key, Hash>&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
StaticHashTable(const Xfer< StaticHashTable<T, Key, Hash> >&); StaticHashTable(const Xfer<StaticHashTable<T, Key, Hash> >&);
// Destructor
~StaticHashTable(); //- Destructor
~StaticHashTable();
// Member Functions // Member Functions
@ -251,7 +247,7 @@ public:
void transfer(StaticHashTable<T, Key, Hash>&); void transfer(StaticHashTable<T, Key, Hash>&);
//- Transfer contents to the Xfer container //- Transfer contents to the Xfer container
inline Xfer< StaticHashTable<T, Key, Hash> > xfer(); inline Xfer<StaticHashTable<T, Key, Hash> > xfer();
// Member Operators // Member Operators
@ -275,6 +271,7 @@ public:
//- The opposite of the equality operation. //- The opposite of the equality operation.
bool operator!=(const StaticHashTable<T, Key, Hash>&) const; bool operator!=(const StaticHashTable<T, Key, Hash>&) const;
// STL type definitions // STL type definitions
//- Type of values the StaticHashTable contains. //- Type of values the StaticHashTable contains.
@ -317,6 +314,7 @@ public:
//- Index of current element at hashIndex //- Index of current element at hashIndex
label elemIndex_; label elemIndex_;
public: public:
// Constructors // Constructors

View File

@ -79,7 +79,7 @@ inline bool Foam::StaticHashTable<T, Key, Hash>::set
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline Foam::Xfer< Foam::StaticHashTable<T, Key, Hash> > inline Foam::Xfer<Foam::StaticHashTable<T, Key, Hash> >
Foam::StaticHashTable<T, Key, Hash>::xfer() Foam::StaticHashTable<T, Key, Hash>::xfer()
{ {
return xferMove(*this); return xferMove(*this);
@ -417,6 +417,4 @@ Foam::StaticHashTable<T, Key, Hash>::end() const
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -74,7 +74,7 @@ public:
( (
const UList<T>& posList, const UList<T>& posList,
const UList<T>& negList, const UList<T>& negList,
const Xfer< List<label> >& const Xfer<List<label> >&
); );
@ -102,7 +102,7 @@ public:
//- Reset addressing //- Reset addressing
inline void resetAddressing(const UList<label>&); inline void resetAddressing(const UList<label>&);
inline void resetAddressing(const Xfer< List<label> >&); inline void resetAddressing(const Xfer<List<label> >&);
// Member Operators // Member Operators

View File

@ -45,7 +45,7 @@ inline Foam::BiIndirectList<T>::BiIndirectList
( (
const UList<T>& posList, const UList<T>& posList,
const UList<T>& negList, const UList<T>& negList,
const Xfer< List<label> >& addr const Xfer<List<label> >& addr
) )
: :
posList_(const_cast<UList<T>&>(posList)), posList_(const_cast<UList<T>&>(posList)),
@ -105,7 +105,7 @@ inline void Foam::BiIndirectList<T>::resetAddressing
template<class T> template<class T>
inline void Foam::BiIndirectList<T>::resetAddressing inline void Foam::BiIndirectList<T>::resetAddressing
( (
const Xfer< List<label> >& addr const Xfer<List<label> >& addr
) )
{ {
addressing_.transfer(addr()); addressing_.transfer(addr());

View File

@ -224,7 +224,7 @@ inline Foam::UList<T> Foam::CompactListList<T, Container>::operator[]
) )
{ {
label start = offsets_[i]; label start = offsets_[i];
return UList<T>(&m_[start], offsets_[i+1] - start); return UList<T>((m_.size() ? &m_[start] : NULL), offsets_[i+1] - start);
} }
@ -238,7 +238,7 @@ Foam::CompactListList<T, Container>::operator[]
label start = offsets_[i]; label start = offsets_[i];
return UList<T> return UList<T>
( (
const_cast<T*>(&m_[start]), (m_.size() ? const_cast<T*>(&m_[start]) : NULL),
offsets_[i+1] - start offsets_[i+1] - start
); );
} }

View File

@ -84,7 +84,6 @@ class DynamicList
//- The capacity (allocated size) of the underlying list. //- The capacity (allocated size) of the underlying list.
label capacity_; label capacity_;
// Private Member Functions
public: public:
@ -93,6 +92,7 @@ public:
//- Declare friendship with the List class //- Declare friendship with the List class
friend class List<T>; friend class List<T>;
// Constructors // Constructors
//- Construct null //- Construct null
@ -115,7 +115,7 @@ public:
explicit inline DynamicList(const UIndirectList<T>&); explicit inline DynamicList(const UIndirectList<T>&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
explicit inline DynamicList(const Xfer< List<T> >&); explicit inline DynamicList(const Xfer<List<T> >&);
//- Construct from Istream. Size set to size of read list. //- Construct from Istream. Size set to size of read list.
explicit DynamicList(Istream&); explicit DynamicList(Istream&);
@ -125,103 +125,105 @@ public:
// Access // Access
//- Size of the underlying storage. //- Size of the underlying storage.
inline label capacity() const; inline label capacity() const;
// Edit // Edit
//- Alter the size of the underlying storage. //- Alter the size of the underlying storage.
// The addressed size will be truncated if needed to fit, but will // The addressed size will be truncated if needed to fit, but will
// remain otherwise untouched. // remain otherwise untouched.
// Use this or reserve() in combination with append(). // Use this or reserve() in combination with append().
inline void setCapacity(const label); inline void setCapacity(const label);
//- Alter the addressed list size. //- Alter the addressed list size.
// New space will be allocated if required. // New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for // Use this to resize the list prior to using the operator[] for
// setting values (as per List usage). // setting values (as per List usage).
inline void setSize(const label); inline void setSize(const label);
//- Alter the addressed list size and fill new space with a constant. //- Alter the addressed list size and fill new space with a constant.
inline void setSize(const label, const T&); inline void setSize(const label, const T&);
//- Alter the addressed list size. //- Alter the addressed list size.
// New space will be allocated if required. // New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for // Use this to resize the list prior to using the operator[] for
// setting values (as per List usage). // setting values (as per List usage).
inline void resize(const label); inline void resize(const label);
//- Alter the addressed list size and fill new space with a constant. //- Alter the addressed list size and fill new space with a constant.
inline void resize(const label, const T&); inline void resize(const label, const T&);
//- Reserve allocation space for at least this size. //- Reserve allocation space for at least this size.
// Never shrinks the allocated size, use setCapacity() for that. // Never shrinks the allocated size, use setCapacity() for that.
inline void reserve(const label); inline void reserve(const label);
//- Clear the addressed list, i.e. set the size to zero. //- Clear the addressed list, i.e. set the size to zero.
// Allocated size does not change // Allocated size does not change
inline void clear(); inline void clear();
//- Clear the list and delete storage. //- Clear the list and delete storage.
inline void clearStorage(); inline void clearStorage();
//- Shrink the allocated space to the number of elements used. //- Shrink the allocated space to the number of elements used.
// Returns a reference to the DynamicList. // Returns a reference to the DynamicList.
inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink(); inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink();
//- Transfer contents of the argument List into this DynamicList //- Transfer contents of the argument List into this DynamicList
inline void transfer(List<T>&); inline void transfer(List<T>&);
//- Transfer contents of the argument DynamicList into this DynamicList //- Transfer contents of the argument DynamicList into this DynamicList
inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&); inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&);
//- Transfer contents to the Xfer container as a plain List //- Transfer contents to the Xfer container as a plain List
inline Xfer< List<T> > xfer(); inline Xfer<List<T> > xfer();
// Member Operators
//- Append an element at the end of the list // Member Operators
inline void append(const T&);
//- Append a List at the end of this list //- Append an element at the end of the list
inline void append(const UList<T>&); inline void append(const T&);
//- Append a UIndirectList at the end of this list //- Append a List at the end of this list
inline void append(const UIndirectList<T>&); inline void append(const UList<T>&);
//- Remove and return the top element //- Append a UIndirectList at the end of this list
inline T remove(); inline void append(const UIndirectList<T>&);
//- Return non-const access to an element, resizing list if necessary //- Remove and return the top element
inline T& operator()(const label); inline T remove();
//- Assignment of all addressed entries to the given value //- Return non-const access to an element, resizing list if necessary
inline void operator=(const T&); inline T& operator()(const label);
//- Assignment from DynamicList //- Assignment of all addressed entries to the given value
inline void operator= inline void operator=(const T&);
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Assignment from UList //- Assignment from DynamicList
inline void operator=(const UList<T>&); inline void operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
// IOstream operators //- Assignment from UList
inline void operator=(const UList<T>&);
// Write DynamicList to Ostream.
friend Ostream& operator<< <T, SizeInc, SizeMult, SizeDiv>
(
Ostream&,
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Read from Istream, discarding contents of existing DynamicList. // IOstream operators
friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv>
( // Write DynamicList to Ostream.
Istream&, friend Ostream& operator<< <T, SizeInc, SizeMult, SizeDiv>
DynamicList<T, SizeInc, SizeMult, SizeDiv>& (
); Ostream&,
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Read from Istream, discarding contents of existing DynamicList.
friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv>
(
Istream&,
DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
}; };

View File

@ -298,7 +298,7 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline Foam::Xfer< Foam::List<T> > inline Foam::Xfer<Foam::List<T> >
Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::xfer() Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::xfer()
{ {
return xferMoveTo< List<T> >(*this); return xferMoveTo< List<T> >(*this);

View File

@ -64,7 +64,8 @@ public:
inline IndirectList(const UList<T>&, const UList<label>&); inline IndirectList(const UList<T>&, const UList<label>&);
//- Construct given the complete list and by transferring addressing //- Construct given the complete list and by transferring addressing
inline IndirectList(const UList<T>&, const Xfer< List<label> >&); inline IndirectList(const UList<T>&, const Xfer<List<label> >&);
// Member Functions // Member Functions
@ -94,11 +95,12 @@ public:
//- Return the list addressing //- Return the list addressing
inline const List<label>& addressing() const; inline const List<label>& addressing() const;
// Edit // Edit
//- Reset addressing //- Reset addressing
inline void resetAddressing(const UList<label>&); inline void resetAddressing(const UList<label>&);
inline void resetAddressing(const Xfer< List<label> >&); inline void resetAddressing(const Xfer<List<label> >&);
// Member Operators // Member Operators

View File

@ -42,7 +42,7 @@ template<class T>
inline Foam::IndirectList<T>::IndirectList inline Foam::IndirectList<T>::IndirectList
( (
const UList<T>& completeList, const UList<T>& completeList,
const Xfer< List<label> >& addr const Xfer<List<label> >& addr
) )
: :
completeList_(const_cast<UList<T>&>(completeList)), completeList_(const_cast<UList<T>&>(completeList)),
@ -121,7 +121,7 @@ inline void Foam::IndirectList<T>::resetAddressing
template<class T> template<class T>
inline void Foam::IndirectList<T>::resetAddressing inline void Foam::IndirectList<T>::resetAddressing
( (
const Xfer< List<label> >& addr const Xfer<List<label> >& addr
) )
{ {
addressing_.transfer(addr()); addressing_.transfer(addr());

View File

@ -114,7 +114,7 @@ Foam::List<T>::List(const List<T>& a)
// Construct by transferring the parameter contents // Construct by transferring the parameter contents
template<class T> template<class T>
Foam::List<T>::List(const Xfer< List<T> >& lst) Foam::List<T>::List(const Xfer<List<T> >& lst)
{ {
transfer(lst()); transfer(lst());
} }

View File

@ -87,6 +87,7 @@ protected:
// Use with care. // Use with care.
inline void size(const label); inline void size(const label);
public: public:
// Static Member Functions // Static Member Functions
@ -109,7 +110,7 @@ public:
List(const List<T>&); List(const List<T>&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
List(const Xfer< List<T> >&); List(const Xfer<List<T> >&);
//- Construct as copy or re-use as specified. //- Construct as copy or re-use as specified.
List(List<T>&, bool reUse); List(List<T>&, bool reUse);
@ -147,9 +148,8 @@ public:
inline autoPtr<List<T> > clone() const; inline autoPtr<List<T> > clone() const;
// Destructor //- Destructor
~List();
~List();
// Related types // Related types
@ -201,7 +201,7 @@ public:
void transfer(SortableList<T>&); void transfer(SortableList<T>&);
//- Transfer contents to the Xfer container //- Transfer contents to the Xfer container
inline Xfer< List<T> > xfer(); inline Xfer<List<T> > xfer();
//- Return subscript-checked element of UList. //- Return subscript-checked element of UList.
inline T& newElmt(const label); inline T& newElmt(const label);

View File

@ -88,7 +88,7 @@ inline Foam::label Foam::List<T>::size() const
template<class T> template<class T>
inline Foam::Xfer< Foam::List<T> > Foam::List<T>::xfer() inline Foam::Xfer<Foam::List<T> > Foam::List<T>::xfer()
{ {
return xferMove(*this); return xferMove(*this);
} }

View File

@ -132,6 +132,7 @@ class PackedList
//- Calculate the list length when packed //- Calculate the list length when packed
inline static label packedLength(const label); inline static label packedLength(const label);
public: public:
// Public data // Public data
@ -150,12 +151,14 @@ public:
//- Masking for all bits below the offset //- Masking for all bits below the offset
inline static unsigned int maskLower(unsigned offset); inline static unsigned int maskLower(unsigned offset);
// Forward declaration of iterators // Forward declaration of iterators
class iteratorBase; class iteratorBase;
class iterator; class iterator;
class const_iterator; class const_iterator;
// Constructors // Constructors
//- Null constructor //- Null constructor
@ -171,7 +174,7 @@ public:
inline PackedList(const PackedList<nBits>&); inline PackedList(const PackedList<nBits>&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
inline PackedList(const Xfer< PackedList<nBits> >&); inline PackedList(const Xfer<PackedList<nBits> >&);
//- Construct from a list of labels //- Construct from a list of labels
explicit PackedList(const UList<label>&); explicit PackedList(const UList<label>&);
@ -179,123 +182,126 @@ public:
//- Clone //- Clone
inline autoPtr< PackedList<nBits> > clone() const; inline autoPtr< PackedList<nBits> > clone() const;
// Member Functions // Member Functions
// Access // Access
//- The number of elements that can be stored before reallocating //- The number of elements that can be stored before reallocating
inline label capacity() const; inline label capacity() const;
//- Number of entries. //- Number of entries.
inline label size() const; inline label size() const;
//- Return true if the list is empty (ie, size() is zero). //- Return true if the list is empty (ie, size() is zero).
inline bool empty() const; inline bool empty() const;
//- Get value at index I. //- Get value at index I.
// Never auto-vivify entries. // Never auto-vivify entries.
inline unsigned int get(const label) const; inline unsigned int get(const label) const;
//- Set value at index I. Return true if value changed. //- Set value at index I. Return true if value changed.
// Does auto-vivify for non-existent entries. // Does auto-vivify for non-existent entries.
// Default value set is the max_value. // Default value set is the max_value.
inline bool set(const label, const unsigned int val = ~0u); inline bool set(const label, const unsigned int val = ~0u);
//- Unset the entry at index I. Return true if value changed. //- Unset the entry at index I. Return true if value changed.
// Never auto-vivify entries. // Never auto-vivify entries.
inline bool unset(const label); inline bool unset(const label);
//- Return the underlying packed storage //- Return the underlying packed storage
inline List<unsigned int>& storage(); inline List<unsigned int>& storage();
//- Return the underlying packed storage //- Return the underlying packed storage
inline const List<unsigned int>& storage() const; inline const List<unsigned int>& storage() const;
//- Count number of bits set, O(log(n)) //- Count number of bits set, O(log(n))
// Uses the Hamming weight (population count) method // Uses the Hamming weight (population count) method
// http://en.wikipedia.org/wiki/Hamming_weight // http://en.wikipedia.org/wiki/Hamming_weight
unsigned int count() const; unsigned int count() const;
//- Return the values as a labelList //- Return the values as a labelList
labelList values() const; labelList values() const;
//- Print values and information //- Print values and information
Ostream& print(Ostream&) const; Ostream& print(Ostream&) const;
// Edit // Edit
//- Trim any trailing zero elements //- Trim any trailing zero elements
bool trim(); bool trim();
//- Invert the bits in the addressable region. //- Invert the bits in the addressable region.
void flip(); void flip();
//- Alter the size of the underlying storage. //- Alter the size of the underlying storage.
// The addressed size will be truncated if needed to fit, but will // The addressed size will be truncated if needed to fit, but will
// remain otherwise untouched. // remain otherwise untouched.
inline void setCapacity(const label); inline void setCapacity(const label);
//- Reset addressable list size, does not shrink the allocated size. //- Reset addressable list size, does not shrink the allocated size.
// Optionally specify a value for new elements. // Optionally specify a value for new elements.
inline void resize(const label, const unsigned int& val = 0); inline void resize(const label, const unsigned int& val = 0);
//- Alias for resize() //- Alias for resize()
inline void setSize(const label, const unsigned int& val = 0); inline void setSize(const label, const unsigned int& val = 0);
//- Reserve allocation space for at least this size. //- Reserve allocation space for at least this size.
// Never shrinks the allocated size. // Never shrinks the allocated size.
// The list size is adjusted as per DynamicList with // The list size is adjusted as per DynamicList with
// SizeInc=0, SizeMult=2, SizeDiv=1 // SizeInc=0, SizeMult=2, SizeDiv=1
inline void reserve(const label); inline void reserve(const label);
//- Clear the list, i.e. set addressable size to zero. //- Clear the list, i.e. set addressable size to zero.
// Does not adjust the underlying storage // Does not adjust the underlying storage
inline void clear(); inline void clear();
//- Clear the list and delete storage. //- Clear the list and delete storage.
inline void clearStorage(); inline void clearStorage();
//- Shrink the allocated space to what is actually used. //- Shrink the allocated space to what is actually used.
inline void shrink(); inline void shrink();
//- Transfer the contents of the argument list into this list //- Transfer the contents of the argument list into this list
// and annul the argument list. // and annul the argument list.
inline void transfer(PackedList<nBits>&); inline void transfer(PackedList<nBits>&);
//- Transfer contents to the Xfer container //- Transfer contents to the Xfer container
inline Xfer< PackedList<nBits> > xfer(); inline Xfer<PackedList<nBits> > xfer();
// Member operators // Member operators
//- Append a value at the end of the list //- Append a value at the end of the list
inline void append(const unsigned int val); inline void append(const unsigned int val);
//- Remove and return the last element //- Remove and return the last element
inline unsigned int remove(); inline unsigned int remove();
//- Get value at index I //- Get value at index I
// Never auto-vivify entries. // Never auto-vivify entries.
inline unsigned int operator[](const label) const; inline unsigned int operator[](const label) const;
//- Set value at index I. //- Set value at index I.
// Returns iterator to perform the actual operation. // Returns iterator to perform the actual operation.
// Does not auto-vivify entries, but will when assigned to. // Does not auto-vivify entries, but will when assigned to.
inline iteratorBase operator[](const label); inline iteratorBase operator[](const label);
//- Assignment of all entries to the given value. Takes linear time. //- Assignment of all entries to the given value. Takes linear time.
inline void operator=(const unsigned int val); inline void operator=(const unsigned int val);
//- Assignment operator. Takes linear time. //- Assignment operator. Takes linear time.
void operator=(const PackedList<nBits>&); void operator=(const PackedList<nBits>&);
//- Assignment operator. Takes linear time. //- Assignment operator. Takes linear time.
void operator=(const UList<label>&); void operator=(const UList<label>&);
// Ostream operator
// // Write PackedList to Ostream. // Ostream operator
// friend Ostream& operator<< <nBits> (Ostream&, const PackedList<nBits>&);
// // Write PackedList to Ostream.
// friend Ostream& operator<< <nBits> (Ostream&, const PackedList<nBits>&);
// Iterators and helpers // Iterators and helpers
@ -317,6 +323,7 @@ public:
//- Element index //- Element index
label index_; label index_;
// Protected Member Functions // Protected Member Functions
//- Get value as unsigned, no range-checking //- Get value as unsigned, no range-checking
@ -325,6 +332,7 @@ public:
//- Set value, returning true if changed, no range-checking //- Set value, returning true if changed, no range-checking
inline bool set(unsigned int); inline bool set(unsigned int);
// Constructors // Constructors
//- Construct null //- Construct null
@ -333,6 +341,7 @@ public:
//- Construct from base list and position index //- Construct from base list and position index
inline iteratorBase(const PackedList*, const label); inline iteratorBase(const PackedList*, const label);
public: public:
// Member Operators // Member Operators
@ -370,6 +379,7 @@ public:
//- Disallow assignment from const_iterator - violates const-ness! //- Disallow assignment from const_iterator - violates const-ness!
void operator=(const const_iterator&); void operator=(const const_iterator&);
public: public:
// Constructors // Constructors
@ -385,6 +395,7 @@ public:
//- Construct from base list and position index //- Construct from base list and position index
inline iterator(const PackedList*, const label); inline iterator(const PackedList*, const label);
// Member Operators // Member Operators
//- Compare positions (not values) //- Compare positions (not values)
@ -445,6 +456,7 @@ public:
//- Construct from iterator //- Construct from iterator
inline const_iterator(const iterator&); inline const_iterator(const iterator&);
// Member operators // Member operators
//- Compare positions (not values) //- Compare positions (not values)
@ -466,7 +478,6 @@ public:
inline const_iterator& operator--(); inline const_iterator& operator--();
inline const_iterator operator--(int); inline const_iterator operator--(int);
}; };

View File

@ -334,7 +334,6 @@ inline bool Foam::PackedList<nBits>::iterator::operator!=
} }
template<unsigned nBits> template<unsigned nBits>
inline bool Foam::PackedList<nBits>::const_iterator::operator== inline bool Foam::PackedList<nBits>::const_iterator::operator==
( (
@ -355,7 +354,6 @@ inline bool Foam::PackedList<nBits>::const_iterator::operator!=
} }
template<unsigned nBits> template<unsigned nBits>
inline typename Foam::PackedList<nBits>::iterator& inline typename Foam::PackedList<nBits>::iterator&
Foam::PackedList<nBits>::iterator::operator=(const iteratorBase& iter) Foam::PackedList<nBits>::iterator::operator=(const iteratorBase& iter)
@ -712,16 +710,14 @@ inline void Foam::PackedList<nBits>::shrink()
} }
template<unsigned nBits> template<unsigned nBits>
inline Foam::List<unsigned int>& inline Foam::List<unsigned int>& Foam::PackedList<nBits>::storage()
Foam::PackedList<nBits>::storage()
{ {
return static_cast<StorageList&>(*this); return static_cast<StorageList&>(*this);
} }
template<unsigned nBits> template<unsigned nBits>
inline const Foam::List<unsigned int>& inline const Foam::List<unsigned int>& Foam::PackedList<nBits>::storage() const
Foam::PackedList<nBits>::storage() const
{ {
return static_cast<const StorageList&>(*this); return static_cast<const StorageList&>(*this);
} }
@ -738,8 +734,7 @@ inline void Foam::PackedList<nBits>::transfer(PackedList<nBits>& lst)
template<unsigned nBits> template<unsigned nBits>
inline Foam::Xfer< Foam::PackedList<nBits> > inline Foam::Xfer<Foam::PackedList<nBits> > Foam::PackedList<nBits>::xfer()
Foam::PackedList<nBits>::xfer()
{ {
return xferMove(*this); return xferMove(*this);
} }

View File

@ -130,7 +130,7 @@ public:
PtrList(const PtrList<T>&, const CloneArg&); PtrList(const PtrList<T>&, const CloneArg&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
PtrList(const Xfer< PtrList<T> >&); PtrList(const Xfer<PtrList<T> >&);
//- Construct as copy or re-use as specified. //- Construct as copy or re-use as specified.
PtrList(PtrList<T>&, bool reUse); PtrList(PtrList<T>&, bool reUse);
@ -146,9 +146,8 @@ public:
PtrList(Istream&); PtrList(Istream&);
// Destructor //- Destructor
~PtrList();
~PtrList();
// Member functions // Member functions
@ -196,7 +195,7 @@ public:
void transfer(PtrList<T>&); void transfer(PtrList<T>&);
//- Transfer contents to the Xfer container //- Transfer contents to the Xfer container
inline Xfer< PtrList<T> > xfer(); inline Xfer<PtrList<T> > xfer();
//- Is element set //- Is element set
inline bool set(const label) const; inline bool set(const label) const;

View File

@ -170,30 +170,35 @@ inline Foam::PtrList<T>::iterator::iterator(T** ptr)
ptr_(ptr) ptr_(ptr)
{} {}
template<class T> template<class T>
inline bool Foam::PtrList<T>::iterator::operator==(const iterator& iter) const inline bool Foam::PtrList<T>::iterator::operator==(const iterator& iter) const
{ {
return ptr_ == iter.ptr_; return ptr_ == iter.ptr_;
} }
template<class T> template<class T>
inline bool Foam::PtrList<T>::iterator::operator!=(const iterator& iter) const inline bool Foam::PtrList<T>::iterator::operator!=(const iterator& iter) const
{ {
return ptr_ != iter.ptr_; return ptr_ != iter.ptr_;
} }
template<class T> template<class T>
inline T& Foam::PtrList<T>::iterator::operator*() inline T& Foam::PtrList<T>::iterator::operator*()
{ {
return **ptr_; return **ptr_;
} }
template<class T> template<class T>
inline T& Foam::PtrList<T>::iterator::operator()() inline T& Foam::PtrList<T>::iterator::operator()()
{ {
return operator*(); return operator*();
} }
template<class T> template<class T>
inline typename Foam::PtrList<T>::iterator inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator++() Foam::PtrList<T>::iterator::operator++()
@ -202,6 +207,7 @@ Foam::PtrList<T>::iterator::operator++()
return *this; return *this;
} }
template<class T> template<class T>
inline typename Foam::PtrList<T>::iterator inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator++(int) Foam::PtrList<T>::iterator::operator++(int)
@ -211,6 +217,7 @@ Foam::PtrList<T>::iterator::operator++(int)
return tmp; return tmp;
} }
template<class T> template<class T>
inline typename Foam::PtrList<T>::iterator inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator--() Foam::PtrList<T>::iterator::operator--()
@ -219,6 +226,7 @@ Foam::PtrList<T>::iterator::operator--()
return *this; return *this;
} }
template<class T> template<class T>
inline typename Foam::PtrList<T>::iterator inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator--(int) Foam::PtrList<T>::iterator::operator--(int)
@ -228,6 +236,7 @@ Foam::PtrList<T>::iterator::operator--(int)
return tmp; return tmp;
} }
template<class T> template<class T>
inline typename Foam::PtrList<T>::iterator inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator+=(label n) Foam::PtrList<T>::iterator::operator+=(label n)
@ -236,6 +245,7 @@ Foam::PtrList<T>::iterator::operator+=(label n)
return *this; return *this;
} }
template<class T> template<class T>
inline typename Foam::PtrList<T>::iterator inline typename Foam::PtrList<T>::iterator
Foam::operator+(const typename PtrList<T>::iterator& iter, label n) Foam::operator+(const typename PtrList<T>::iterator& iter, label n)
@ -244,6 +254,7 @@ Foam::operator+(const typename PtrList<T>::iterator& iter, label n)
return tmp += n; return tmp += n;
} }
template<class T> template<class T>
inline typename Foam::PtrList<T>::iterator inline typename Foam::PtrList<T>::iterator
Foam::operator+(label n, const typename PtrList<T>::iterator& iter) Foam::operator+(label n, const typename PtrList<T>::iterator& iter)
@ -252,6 +263,7 @@ Foam::operator+(label n, const typename PtrList<T>::iterator& iter)
return tmp += n; return tmp += n;
} }
template<class T> template<class T>
inline typename Foam::PtrList<T>::iterator inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator-=(label n) Foam::PtrList<T>::iterator::operator-=(label n)
@ -260,6 +272,7 @@ Foam::PtrList<T>::iterator::operator-=(label n)
return *this; return *this;
} }
template<class T> template<class T>
inline typename Foam::PtrList<T>::iterator inline typename Foam::PtrList<T>::iterator
Foam::operator-(const typename PtrList<T>::iterator& iter, label n) Foam::operator-(const typename PtrList<T>::iterator& iter, label n)
@ -268,6 +281,7 @@ Foam::operator-(const typename PtrList<T>::iterator& iter, label n)
return tmp -= n; return tmp -= n;
} }
template<class T> template<class T>
inline Foam::label Foam::operator- inline Foam::label Foam::operator-
( (
@ -278,46 +292,51 @@ inline Foam::label Foam::operator-
return (iter1.ptr_ - iter2.ptr_)/sizeof(T*); return (iter1.ptr_ - iter2.ptr_)/sizeof(T*);
} }
template<class T> template<class T>
inline T& Foam::PtrList<T>::iterator::operator[](label n) inline T& Foam::PtrList<T>::iterator::operator[](label n)
{ {
return *(*this + n); return *(*this + n);
} }
template<class T> template<class T>
inline bool Foam::PtrList<T>::iterator::operator<(const iterator& iter) const inline bool Foam::PtrList<T>::iterator::operator<(const iterator& iter) const
{ {
return ptr_ < iter.ptr_; return ptr_ < iter.ptr_;
} }
template<class T> template<class T>
inline bool Foam::PtrList<T>::iterator::operator>(const iterator& iter) const inline bool Foam::PtrList<T>::iterator::operator>(const iterator& iter) const
{ {
return ptr_ > iter.ptr_; return ptr_ > iter.ptr_;
} }
template<class T> template<class T>
inline bool Foam::PtrList<T>::iterator::operator<=(const iterator& iter) const inline bool Foam::PtrList<T>::iterator::operator<=(const iterator& iter) const
{ {
return ptr_ <= iter.ptr_; return ptr_ <= iter.ptr_;
} }
template<class T> template<class T>
inline bool Foam::PtrList<T>::iterator::operator>=(const iterator& iter) const inline bool Foam::PtrList<T>::iterator::operator>=(const iterator& iter) const
{ {
return ptr_ >= iter.ptr_; return ptr_ >= iter.ptr_;
} }
template<class T> template<class T>
inline typename Foam::PtrList<T>::iterator inline typename Foam::PtrList<T>::iterator Foam::PtrList<T>::begin()
Foam::PtrList<T>::begin()
{ {
return ptrs_.begin(); return ptrs_.begin();
} }
template<class T> template<class T>
inline typename Foam::PtrList<T>::iterator inline typename Foam::PtrList<T>::iterator Foam::PtrList<T>::end()
Foam::PtrList<T>::end()
{ {
return ptrs_.end(); return ptrs_.end();
} }

View File

@ -111,7 +111,7 @@ public:
explicit UPtrList(const label); explicit UPtrList(const label);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
UPtrList(const Xfer< UPtrList<T> >&); UPtrList(const Xfer<UPtrList<T> >&);
//- Construct as copy or re-use as specified. //- Construct as copy or re-use as specified.
UPtrList(UPtrList<T>&, bool reUse); UPtrList(UPtrList<T>&, bool reUse);
@ -160,7 +160,7 @@ public:
void transfer(UPtrList<T>&); void transfer(UPtrList<T>&);
//- Transfer contents to the Xfer container //- Transfer contents to the Xfer container
inline Xfer< UPtrList<T> > xfer(); inline Xfer<UPtrList<T> > xfer();
//- Is element set //- Is element set
inline bool set(const label) const; inline bool set(const label) const;

View File

@ -89,7 +89,7 @@ public:
ITstream ITstream
( (
const string& name, const string& name,
const Xfer< List<token> >& tokens, const Xfer<List<token> >& tokens,
streamFormat format=ASCII, streamFormat format=ASCII,
versionNumber version=currentVersion versionNumber version=currentVersion
) )

View File

@ -283,12 +283,14 @@ public:
//- Return the location of "dir" containing the file "name". //- Return the location of "dir" containing the file "name".
// (eg, used in reading mesh data) // (eg, used in reading mesh data)
// If name is null, search for the directory "dir" only // If name is null, search for the directory "dir" only.
// Does not search beyond stopInstance (if set) or constant.
word findInstance word findInstance
( (
const fileName& dir, const fileName& dir,
const word& name = word::null, const word& name = word::null,
const IOobject::readOption rOpt = IOobject::MUST_READ const IOobject::readOption rOpt = IOobject::MUST_READ,
const word& stopInstance = word::null
) const; ) const;
//- Search the case for valid time directories //- Search the case for valid time directories

View File

@ -39,19 +39,24 @@ Foam::word Foam::Time::findInstance
( (
const fileName& dir, const fileName& dir,
const word& name, const word& name,
const IOobject::readOption rOpt const IOobject::readOption rOpt,
const word& stopInstance
) const ) const
{ {
// Note: if name is empty, just check the directory itself // Note: if name is empty, just check the directory itself
const fileName tPath(path());
const fileName dirPath(tPath/timeName()/dir);
// check the current time directory // check the current time directory
if if
( (
name.empty() name.empty()
? isDir(path()/timeName()/dir) ? isDir(dirPath)
: :
( (
isFile(path()/timeName()/dir/name) isFile(dirPath/name)
&& IOobject(name, timeName(), dir, *this).headerOk() && IOobject(name, timeName(), dir, *this).headerOk()
) )
) )
@ -59,7 +64,8 @@ Foam::word Foam::Time::findInstance
if (debug) if (debug)
{ {
Info<< "Time::findInstance" Info<< "Time::findInstance"
"(const fileName&, const word&, const IOobject::readOption)" "(const fileName&, const word&"
", const IOobject::readOption, const word&)"
<< " : found \"" << name << " : found \"" << name
<< "\" in " << timeName()/dir << "\" in " << timeName()/dir
<< endl; << endl;
@ -88,10 +94,10 @@ Foam::word Foam::Time::findInstance
if if
( (
name.empty() name.empty()
? isDir(path()/ts[instanceI].name()/dir) ? isDir(tPath/ts[instanceI].name()/dir)
: :
( (
isFile(path()/ts[instanceI].name()/dir/name) isFile(tPath/ts[instanceI].name()/dir/name)
&& IOobject(name, ts[instanceI].name(), dir, *this).headerOk() && IOobject(name, ts[instanceI].name(), dir, *this).headerOk()
) )
) )
@ -99,7 +105,8 @@ Foam::word Foam::Time::findInstance
if (debug) if (debug)
{ {
Info<< "Time::findInstance" Info<< "Time::findInstance"
"(const fileName&, const word&, const IOobject::readOption)" "(const fileName&, const word&"
", const IOobject::readOption, const word&)"
<< " : found \"" << name << " : found \"" << name
<< "\" in " << ts[instanceI].name()/dir << "\" in " << ts[instanceI].name()/dir
<< endl; << endl;
@ -107,6 +114,34 @@ Foam::word Foam::Time::findInstance
return ts[instanceI].name(); return ts[instanceI].name();
} }
// Check if hit minimum instance
if (ts[instanceI].name() == stopInstance)
{
if (debug)
{
Info<< "Time::findInstance"
"(const fileName&, const word&"
", const IOobject::readOption, const word&)"
<< " : hit stopInstance " << stopInstance
<< endl;
}
if (rOpt == IOobject::MUST_READ)
{
FatalErrorIn
(
"Time::findInstance"
"(const fileName&, const word&"
", const IOobject::readOption, const word&)"
) << "Cannot find file \"" << name << "\" in directory "
<< dir << " in times " << timeName()
<< " down to " << stopInstance
<< exit(FatalError);
}
return ts[instanceI].name();
}
} }
@ -119,10 +154,10 @@ Foam::word Foam::Time::findInstance
if if
( (
name.empty() name.empty()
? isDir(path()/constant()/dir) ? isDir(tPath/constant()/dir)
: :
( (
isFile(path()/constant()/dir/name) isFile(tPath/constant()/dir/name)
&& IOobject(name, constant(), dir, *this).headerOk() && IOobject(name, constant(), dir, *this).headerOk()
) )
) )
@ -130,7 +165,8 @@ Foam::word Foam::Time::findInstance
if (debug) if (debug)
{ {
Info<< "Time::findInstance" Info<< "Time::findInstance"
"(const fileName&, const word&, const IOobject::readOption)" "(const fileName&, const word&"
", const IOobject::readOption, const word&)"
<< " : found \"" << name << " : found \"" << name
<< "\" in " << constant()/dir << "\" in " << constant()/dir
<< endl; << endl;
@ -144,9 +180,11 @@ Foam::word Foam::Time::findInstance
FatalErrorIn FatalErrorIn
( (
"Time::findInstance" "Time::findInstance"
"(const fileName&, const word&, const IOobject::readOption)" "(const fileName&, const word&"
", const IOobject::readOption, const word&)"
) << "Cannot find file \"" << name << "\" in directory " ) << "Cannot find file \"" << name << "\" in directory "
<< constant()/dir << dir << " in times " << timeName()
<< " down to " << constant()
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -107,7 +107,7 @@ Foam::primitiveEntry::primitiveEntry
Foam::primitiveEntry::primitiveEntry Foam::primitiveEntry::primitiveEntry
( (
const keyType& key, const keyType& key,
const Xfer< List<token> >& tokens const Xfer<List<token> >& tokens
) )
: :
entry(key), entry(key),

View File

@ -114,7 +114,7 @@ public:
primitiveEntry(const keyType&, const UList<token>&); primitiveEntry(const keyType&, const UList<token>&);
//- Construct from keyword and by transferring a list of tokens //- Construct from keyword and by transferring a list of tokens
primitiveEntry(const keyType&, const Xfer< List<token> >&); primitiveEntry(const keyType&, const Xfer<List<token> >&);
//- Construct from keyword and a T //- Construct from keyword and a T
template<class T> template<class T>

View File

@ -38,19 +38,21 @@ const Foam::dimensionSet Foam::dimMoles(0, 0, 0, 0, 1, 0, 0);
const Foam::dimensionSet Foam::dimCurrent(0, 0, 0, 0, 0, 1, 0); const Foam::dimensionSet Foam::dimCurrent(0, 0, 0, 0, 0, 1, 0);
const Foam::dimensionSet Foam::dimLuminousIntensity(0, 0, 0, 0, 0, 0, 1); const Foam::dimensionSet Foam::dimLuminousIntensity(0, 0, 0, 0, 0, 0, 1);
const Foam::dimensionSet Foam::dimArea(0, 2, 0, 0, 0, 0, 0); const Foam::dimensionSet Foam::dimArea(sqr(dimLength));
const Foam::dimensionSet Foam::dimVolume(0, 3, 0, 0, 0, 0, 0); const Foam::dimensionSet Foam::dimVolume(pow3(dimLength));
const Foam::dimensionSet Foam::dimVol(0, 3, 0, 0, 0, 0, 0); const Foam::dimensionSet Foam::dimVol(dimVolume);
const Foam::dimensionSet Foam::dimDensity(1, -3, 0, 0, 0, 0, 0); const Foam::dimensionSet Foam::dimVelocity(dimLength/dimTime);
const Foam::dimensionSet Foam::dimForce(1, 1, -2, 0, 0, 0, 0); const Foam::dimensionSet Foam::dimAcceleration(dimVelocity/dimTime);
const Foam::dimensionSet Foam::dimEnergy(1, 2, -2, 0, 0, 0, 0);
const Foam::dimensionSet Foam::dimVelocity(0, 1, -1, 0, 0, 0, 0); const Foam::dimensionSet Foam::dimDensity(dimMass/dimVolume);
const Foam::dimensionSet Foam::dimAcceleration(0, 1, -2, 0, 0, 0, 0); const Foam::dimensionSet Foam::dimForce(dimMass*dimAcceleration);
const Foam::dimensionSet Foam::dimPressure(1, -1, -2, 0, 0, 0, 0); const Foam::dimensionSet Foam::dimEnergy(dimForce*dimLength);
const Foam::dimensionSet Foam::dimGasConstant(0, 2, -2, -1, 0, 0, 0); const Foam::dimensionSet Foam::dimPower(dimEnergy/dimTime);
const Foam::dimensionSet Foam::dimSpecificHeatCapacity(0, 2, -2, -1, 0, 0, 0);
const Foam::dimensionSet Foam::dimPressure(dimForce/dimArea);
const Foam::dimensionSet Foam::dimGasConstant(dimEnergy/dimMass/dimTemperature);
const Foam::dimensionSet Foam::dimSpecificHeatCapacity(dimGasConstant);
// ************************************************************************* // // ************************************************************************* //

View File

@ -61,6 +61,7 @@ extern const dimensionSet dimVol;
extern const dimensionSet dimDensity; extern const dimensionSet dimDensity;
extern const dimensionSet dimForce; extern const dimensionSet dimForce;
extern const dimensionSet dimEnergy; extern const dimensionSet dimEnergy;
extern const dimensionSet dimPower;
extern const dimensionSet dimVelocity; extern const dimensionSet dimVelocity;
extern const dimensionSet dimAcceleration; extern const dimensionSet dimAcceleration;

View File

@ -345,12 +345,12 @@ public:
); );
//- Construct as copy of tmp<GeometricField> deleting argument //- Construct as copy of tmp<GeometricField> deleting argument
# ifdef ConstructFromTmp #ifdef ConstructFromTmp
GeometricField GeometricField
( (
const tmp<GeometricField<Type, PatchField, GeoMesh> >& const tmp<GeometricField<Type, PatchField, GeoMesh> >&
); );
# endif #endif
//- Construct as copy resetting IO parameters //- Construct as copy resetting IO parameters
GeometricField GeometricField
@ -367,13 +367,13 @@ public:
); );
//- Construct as copy resetting name //- Construct as copy resetting name
# ifdef ConstructFromTmp #ifdef ConstructFromTmp
GeometricField GeometricField
( (
const word& newName, const word& newName,
const tmp<GeometricField<Type, PatchField, GeoMesh> >& const tmp<GeometricField<Type, PatchField, GeoMesh> >&
); );
# endif #endif
//- Construct as copy resetting IO parameters and patch type //- Construct as copy resetting IO parameters and patch type
GeometricField GeometricField
@ -392,9 +392,8 @@ public:
); );
// Destructor //- Destructor
virtual ~GeometricField();
virtual ~GeometricField();
// Member Functions // Member Functions

View File

@ -128,7 +128,20 @@ Foam::plane::plane(const vector& normalVector)
: :
unitVector_(normalVector), unitVector_(normalVector),
basePoint_(vector::zero) basePoint_(vector::zero)
{} {
scalar magUnitVector(mag(unitVector_));
if (magUnitVector > VSMALL)
{
unitVector_ /= magUnitVector;
}
else
{
FatalErrorIn("plane::plane(const point&, const vector&)")
<< "plane normal has zero length"
<< abort(FatalError);
}
}
// Construct from point and normal vector // Construct from point and normal vector
@ -146,8 +159,8 @@ Foam::plane::plane(const point& basePoint, const vector& normalVector)
else else
{ {
FatalErrorIn("plane::plane(const point&, const vector&)") FatalErrorIn("plane::plane(const point&, const vector&)")
<< "plane normal has got zero length" << "plane normal has zero length"
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -217,8 +230,8 @@ Foam::plane::plane(const dictionary& dict)
"plane::plane(const dictionary&)", "plane::plane(const dictionary&)",
dict dict
) )
<< "Invalid plane type: " << planeType << "Invalid plane type: " << planeType
<< abort(FatalIOError); << abort(FatalIOError);
} }
} }
@ -238,7 +251,7 @@ Foam::plane::plane(Istream& is)
else else
{ {
FatalErrorIn("plane::plane(Istream& is)") FatalErrorIn("plane::plane(Istream& is)")
<< "plane normal has got zero length" << "plane normal has zero length"
<< abort(FatalError); << abort(FatalError);
} }
} }

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) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -72,11 +72,17 @@ public:
// Member Functions // Member Functions
//- Conversion to a Scalar //- Access to the Scalar value
operator Scalar() const operator Scalar() const
{ {
return p_; return p_;
} }
//- Access to the Scalar value
operator Scalar&()
{
return 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) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -81,6 +81,7 @@ public:
nComponents = 1 //!< Number of components in bool is 1 nComponents = 1 //!< Number of components in bool is 1
}; };
// Static data members // Static data members
static const char* const typeName; static const char* const typeName;
@ -88,18 +89,26 @@ public:
static const bool zero; static const bool zero;
static const bool one; static const bool one;
// Constructors // Constructors
//- Construct from Istream //- Construct from Istream
pTraits(Istream&); pTraits(Istream&);
// Member Functions // Member Functions
//- Conversion to a bool //- Access to the bool value
operator bool() const operator bool() const
{ {
return p_; return p_;
} }
//- Access to the bool value
operator bool&()
{
return 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) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -153,6 +153,7 @@ public:
nComponents = 1 //!< Number of components in label is 1 nComponents = 1 //!< Number of components in label is 1
}; };
// Static data members // Static data members
static const char* const typeName; static const char* const typeName;
@ -162,18 +163,26 @@ public:
static const label min; static const label min;
static const label max; static const label max;
// Constructors // Constructors
//- Construct from Istream //- Construct from Istream
pTraits(Istream&); pTraits(Istream&);
// Member Functions // Member Functions
//- Conversion to a label //- Access to the label value
operator label() const operator label() const
{ {
return p_; return p_;
} }
//- Access to the label value
operator label&()
{
return 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) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -137,6 +137,7 @@ public:
nComponents = 1 //!< Number of components in uLabel is 1 nComponents = 1 //!< Number of components in uLabel is 1
}; };
// Static data members // Static data members
static const char* const typeName; static const char* const typeName;
@ -146,6 +147,7 @@ public:
static const uLabel max; static const uLabel max;
static const uLabel min; static const uLabel min;
// Constructors // Constructors
//- Construct from Istream //- Construct from Istream
@ -154,11 +156,17 @@ public:
// Member Functions // Member Functions
//- Conversion to a uLabel //- Access to the uLabel value
operator uLabel() const operator uLabel() const
{ {
return p_; return p_;
} }
//- Access to the uLabel value
operator uLabel&()
{
return 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) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -54,15 +54,30 @@ class pTraits
public: public:
pTraits(const PrimitiveType& p) // Constructors
:
PrimitiveType(p)
{}
pTraits(Istream& is) pTraits(const PrimitiveType& p)
: :
PrimitiveType(is) PrimitiveType(p)
{} {}
pTraits(Istream& is)
:
PrimitiveType(is)
{}
// Member operators
operator PrimitiveType() const
{
return *this;
}
operator PrimitiveType&()
{
return *this;
}
}; };

View File

@ -1138,7 +1138,7 @@ void Foam::fvMeshDistribute::sendMesh
{ {
const cellZoneMesh& cellZones = mesh.cellZones(); const cellZoneMesh& cellZones = mesh.cellZones();
labelList rowSizes(pointZoneNames.size(), 0); labelList rowSizes(cellZoneNames.size(), 0);
forAll(cellZoneNames, nameI) forAll(cellZoneNames, nameI)
{ {

View File

@ -77,11 +77,7 @@ void setUpdater::updateSets(const mapPolyMesh& morphMap) const
IOobjectList Objects IOobjectList Objects
( (
morphMap.mesh().time(), morphMap.mesh().time(),
morphMap.mesh().time().findInstance morphMap.mesh().facesInstance(),
(
morphMap.mesh().meshDir(),
"faces"
),
"polyMesh/sets" "polyMesh/sets"
); );

View File

@ -45,7 +45,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of friend functions and operators // Forward declaration of classes
class IFstream; class IFstream;
class Time; class Time;
@ -61,10 +61,13 @@ class edgeFormatsCore
{ {
protected: protected:
// Protected Member Functions
//- Read non-comment line //- Read non-comment line
static string getLineNoComment(IFstream&); static string getLineNoComment(IFstream&);
public: public:
// Static Data // Static Data
//- The file extension corresponding to 'native' edge format //- The file extension corresponding to 'native' edge format

View File

@ -29,7 +29,6 @@ License
#include "IFstream.H" #include "IFstream.H"
#include "clock.H" #include "clock.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fileFormats::EMESHedgeFormat::EMESHedgeFormat Foam::fileFormats::EMESHedgeFormat::EMESHedgeFormat
@ -119,8 +118,7 @@ bool Foam::fileFormats::EMESHedgeFormat::read
} }
Foam::Ostream& Foam::Ostream& Foam::fileFormats::EMESHedgeFormat::write
Foam::fileFormats::EMESHedgeFormat::write
( (
Ostream& os, Ostream& os,
const pointField& pointLst, const pointField& pointLst,

View File

@ -79,6 +79,7 @@ protected:
const edgeList& const edgeList&
); );
public: public:
// Constructors // Constructors

View File

@ -64,7 +64,7 @@ bool Foam::fileFormats::OBJedgeFormat::read
} }
DynamicList<point> dynPoints; DynamicList<point> dynPoints;
DynamicList<edge> dynEdges; DynamicList<edge> dynEdges;
DynamicList<label> dynUsedPoints; DynamicList<label> dynUsedPoints;
while (is.good()) while (is.good())
@ -195,7 +195,7 @@ void Foam::fileFormats::OBJedgeFormat::write
) )
{ {
const pointField& pointLst = mesh.points(); const pointField& pointLst = mesh.points();
const edgeList& edgeLst = mesh.edges(); const edgeList& edgeLst = mesh.edges();
OFstream os(filename); OFstream os(filename);
if (!os.good()) if (!os.good())

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) 2009-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -239,7 +239,7 @@ void Foam::fileFormats::STARCDedgeFormat::write
) )
{ {
const pointField& pointLst = mesh.points(); const pointField& pointLst = mesh.points();
const edgeList& edgeLst = mesh.edges(); const edgeList& edgeLst = mesh.edges();
fileName baseName = filename.lessExt(); fileName baseName = filename.lessExt();

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) 2009-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -60,8 +60,7 @@ void Foam::fileFormats::VTKedgeFormat::writeEdges
const UList<edge>& edgeLst const UList<edge>& edgeLst
) )
{ {
os << "LINES " << edgeLst.size() << ' ' os << "LINES " << edgeLst.size() << ' ' << 3*edgeLst.size() << nl;
<< 3*edgeLst.size() << nl;
forAll(edgeLst, edgeI) forAll(edgeLst, edgeI)
{ {
@ -72,8 +71,6 @@ void Foam::fileFormats::VTKedgeFormat::writeEdges
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fileFormats::VTKedgeFormat::VTKedgeFormat() Foam::fileFormats::VTKedgeFormat::VTKedgeFormat()
@ -104,4 +101,5 @@ void Foam::fileFormats::VTKedgeFormat::write
writeEdges(os, eMesh.edges()); writeEdges(os, eMesh.edges());
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -76,6 +76,7 @@ protected:
//- Write edges //- Write edges
static void writeEdges(Ostream&, const UList<edge>&); static void writeEdges(Ostream&, const UList<edge>&);
public: public:
// Constructors // Constructors

View File

@ -38,11 +38,13 @@ namespace Foam
defineMemberFunctionSelectionTable(edgeMesh,write,fileExtension); defineMemberFunctionSelectionTable(edgeMesh,write,fileExtension);
} }
Foam::wordHashSet Foam::edgeMesh::readTypes() Foam::wordHashSet Foam::edgeMesh::readTypes()
{ {
return wordHashSet(*fileExtensionConstructorTablePtr_); return wordHashSet(*fileExtensionConstructorTablePtr_);
} }
Foam::wordHashSet Foam::edgeMesh::writeTypes() Foam::wordHashSet Foam::edgeMesh::writeTypes()
{ {
return wordHashSet(*writefileExtensionMemberFunctionTablePtr_); return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
@ -66,6 +68,7 @@ bool Foam::edgeMesh::canReadType
); );
} }
bool Foam::edgeMesh::canWriteType bool Foam::edgeMesh::canWriteType
( (
const word& ext, const word& ext,
@ -197,8 +200,8 @@ void Foam::edgeMesh::clear()
void Foam::edgeMesh::reset void Foam::edgeMesh::reset
( (
const Xfer< pointField >& pointLst, const Xfer<pointField>& pointLst,
const Xfer< edgeList >& edgeLst const Xfer<edgeList>& edgeLst
) )
{ {
// Take over new primitive data. // Take over new primitive data.
@ -215,7 +218,6 @@ void Foam::edgeMesh::reset
// connectivity likely changed // connectivity likely changed
pointEdgesPtr_.clear(); pointEdgesPtr_.clear();
} }
} }
@ -227,8 +229,7 @@ void Foam::edgeMesh::transfer(edgeMesh& mesh)
} }
Foam::Xfer< Foam::edgeMesh > Foam::Xfer<Foam::edgeMesh> Foam::edgeMesh::xfer()
Foam::edgeMesh::xfer()
{ {
return xferMove(*this); return xferMove(*this);
} }

View File

@ -101,6 +101,7 @@ public:
//- Runtime type information //- Runtime type information
TypeName("edgeMesh"); TypeName("edgeMesh");
// Static // Static
//- Can we read this file format? //- Can we read this file format?
@ -115,6 +116,7 @@ public:
static wordHashSet readTypes(); static wordHashSet readTypes();
static wordHashSet writeTypes(); static wordHashSet writeTypes();
// Constructors // Constructors
//- Construct null //- Construct null
@ -126,8 +128,8 @@ public:
//- Construct by transferring components (points, edges). //- Construct by transferring components (points, edges).
edgeMesh edgeMesh
( (
const Xfer< pointField >&, const Xfer<pointField>&,
const Xfer< edgeList >& const Xfer<edgeList>&
); );
//- Construct as copy //- Construct as copy
@ -142,6 +144,7 @@ public:
//- Construct from Istream //- Construct from Istream
edgeMesh(Istream&); edgeMesh(Istream&);
// Declare run-time constructor selection table // Declare run-time constructor selection table
declareRunTimeSelectionTable declareRunTimeSelectionTable
@ -155,6 +158,7 @@ public:
(name) (name)
); );
// Selectors // Selectors
//- Select constructed from filename (explicit extension) //- Select constructed from filename (explicit extension)
@ -197,7 +201,7 @@ public:
void transfer(edgeMesh&); void transfer(edgeMesh&);
//- Transfer contents to the Xfer container //- Transfer contents to the Xfer container
Xfer< edgeMesh > xfer(); Xfer<edgeMesh > xfer();
// Read // Read
@ -233,8 +237,8 @@ public:
// Note, optimized to avoid overwriting data (with Xfer::null) // Note, optimized to avoid overwriting data (with Xfer::null)
virtual void reset virtual void reset
( (
const Xfer< pointField >& points, const Xfer<pointField>& points,
const Xfer< edgeList >& edges const Xfer<edgeList>& edges
); );
//- Scale points. A non-positive factor is ignored //- Scale points. A non-positive factor is ignored
@ -248,8 +252,6 @@ public:
void writeStats(Ostream&) const; void writeStats(Ostream&) const;
// Write
//- Generic write routine. Chooses writer based on extension. //- Generic write routine. Chooses writer based on extension.
virtual void write(const fileName& name) const virtual void write(const fileName& name) const
{ {
@ -261,10 +263,10 @@ public:
inline void operator=(const edgeMesh&); inline void operator=(const edgeMesh&);
// Ostream Operator // Ostream Operator
friend Ostream& operator<<(Ostream&, const edgeMesh&); friend Ostream& operator<<(Ostream&, const edgeMesh&);
friend Istream& operator>>(Istream&, edgeMesh&); friend Istream& operator>>(Istream&, edgeMesh&);
}; };

View File

@ -28,7 +28,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::autoPtr< Foam::edgeMesh > Foam::autoPtr< Foam::edgeMesh >
Foam::edgeMesh::New(const fileName& name, const word& ext) Foam::edgeMesh::New(const fileName& name, const word& ext)
{ {
@ -62,4 +61,5 @@ Foam::edgeMesh::New(const fileName& name)
return New(name, ext); return New(name, ext);
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -73,8 +73,8 @@ Foam::featureEdgeMesh::featureEdgeMesh
Foam::featureEdgeMesh::featureEdgeMesh Foam::featureEdgeMesh::featureEdgeMesh
( (
const IOobject& io, const IOobject& io,
const Xfer< pointField >& pointLst, const Xfer<pointField>& pointLst,
const Xfer< edgeList >& edgeLst const Xfer<edgeList>& edgeLst
) )
: :
regIOobject(io), regIOobject(io),

View File

@ -84,7 +84,7 @@ class pressureGradientExplicitSource
//- Name of cell source //- Name of cell source
word cellSource_; word cellSource_;
//- The method by which the cells will be selecetd //- The method by which the cells will be selected
autoPtr<topoSetSource> cellSelector_; autoPtr<topoSetSource> cellSelector_;
//- The set of selected cells //- The set of selected cells

View File

@ -28,7 +28,7 @@ Class
Description Description
Base class for field sources. Provides: Base class for field sources. Provides:
- name - name
- references to mesh and time - references to mesh and time databases
- dimensions - dimensions
- volume type - volume type
- startTime - startTime

View File

@ -77,7 +77,7 @@ void Foam::setRefCell
point refPointi(dict.lookup(refPointName)); point refPointi(dict.lookup(refPointName));
refCelli = field.mesh().findCell(refPointi); refCelli = field.mesh().findCell(refPointi);
label hasRef = (refCelli >= 0 ? 1 : 0); label hasRef = (refCelli >= 0 ? 1 : 0);
label sumHasRef = returnReduce<label>(hasRef, sumOp<label>()); label sumHasRef = returnReduce(hasRef, sumOp<label>());
if (sumHasRef != 1) if (sumHasRef != 1)
{ {
FatalIOErrorIn FatalIOErrorIn
@ -127,7 +127,7 @@ Foam::scalar Foam::getRefCellValue
) )
{ {
scalar refCellValue = (refCelli >= 0 ? field[refCelli] : 0.0); scalar refCellValue = (refCelli >= 0 ? field[refCelli] : 0.0);
return returnReduce<label>(refCellValue, sumOp<scalar>()); return returnReduce(refCellValue, sumOp<scalar>());
} }

View File

@ -84,7 +84,7 @@ activeBaffleVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchVectorField(p, iF), fixedValueFvPatchVectorField(p, iF),
pName_("p"), pName_(dict.lookupOrDefault<word>("p", "p")),
cyclicPatchName_(dict.lookup("cyclicPatch")), cyclicPatchName_(dict.lookup("cyclicPatch")),
cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)), cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)),
orientation_(readLabel(dict.lookup("orientation"))), orientation_(readLabel(dict.lookup("orientation"))),
@ -96,11 +96,6 @@ activeBaffleVelocityFvPatchVectorField
curTimeIndex_(-1) curTimeIndex_(-1)
{ {
fvPatchVectorField::operator=(vector::zero); fvPatchVectorField::operator=(vector::zero);
if (dict.found("p"))
{
dict.lookup("p") >> pName_;
}
} }
@ -219,15 +214,21 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
} }
openFraction_ = openFraction_ =
max(min( max
openFraction_ (
+ max min
( (
this->db().time().deltaTValue()/openingTime_, openFraction_
maxOpenFractionDelta_ + max
) (
*(orientation_*sign(forceDiff)), this->db().time().deltaTValue()/openingTime_,
1 - 1e-6), 1e-6); maxOpenFractionDelta_
)
*(orientation_*sign(forceDiff)),
1 - 1e-6
),
1e-6
);
Info<< "openFraction = " << openFraction_ << endl; Info<< "openFraction = " << openFraction_ << endl;
@ -264,8 +265,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::write(Ostream& os) const
<< maxOpenFractionDelta_ << token::END_STATEMENT << nl; << maxOpenFractionDelta_ << token::END_STATEMENT << nl;
os.writeKeyword("openFraction") os.writeKeyword("openFraction")
<< openFraction_ << token::END_STATEMENT << nl; << openFraction_ << token::END_STATEMENT << nl;
os.writeKeyword("p") writeEntryIfDifferent<word>(os, "p", "p", pName_);
<< pName_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -117,10 +117,14 @@ void buoyantPressureFvPatchScalarField::updateCoeffs()
const fvPatchField<scalar>& rho = const fvPatchField<scalar>& rho =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// If the variable name is "pd" assume it is p - rho*g.h // If the variable name is "pmh" or "pd" assume it is p - rho*g.h
// and set the gradient appropriately. // and set the gradient appropriately.
// Otherwise assume the variable is the static pressure. // Otherwise assume the variable is the static pressure.
if (dimensionedInternalField().name() == "pd") if
(
dimensionedInternalField().name() == "pmh"
|| dimensionedInternalField().name() == "pd"
)
{ {
gradient() = -rho.snGrad()*(g.value() & patch().Cf()); gradient() = -rho.snGrad()*(g.value() & patch().Cf());
} }

View File

@ -46,7 +46,7 @@ directMappedVelocityFluxFixedValueFvPatchField
) )
: :
fixedValueFvPatchVectorField(p, iF), fixedValueFvPatchVectorField(p, iF),
phiName_("undefinedPhi") phiName_("phi")
{} {}
@ -93,22 +93,22 @@ directMappedVelocityFluxFixedValueFvPatchField
) )
: :
fixedValueFvPatchVectorField(p, iF, dict), fixedValueFvPatchVectorField(p, iF, dict),
phiName_(dict.lookup("phi")) phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{ {
if (!isA<directMappedPatchBase>(this->patch().patch())) if (!isA<directMappedPatchBase>(this->patch().patch()))
{ {
FatalErrorIn FatalErrorIn
( (
"directMappedVelocityFluxFixedValueFvPatchField::" "directMappedVelocityFluxFixedValueFvPatchField::"
"directMappedVelocityFluxFixedValueFvPatchField\n" "directMappedVelocityFluxFixedValueFvPatchField"
"(\n" "("
" const fvPatch& p,\n" "const fvPatch&, "
" const DimensionedField<vector, volMesh>& iF,\n" "const DimensionedField<vector, volMesh>& iF, "
" const dictionary& dict\n" "const dictionary&"
")\n" ")"
) << "\n patch type '" << p.type() ) << "patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'" << "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << p.name() << " for patch " << p.name()
<< " of field " << dimensionedInternalField().name() << " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath() << " in file " << dimensionedInternalField().objectPath()
<< exit(FatalError); << exit(FatalError);
@ -274,7 +274,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
void directMappedVelocityFluxFixedValueFvPatchField::write(Ostream& os) const void directMappedVelocityFluxFixedValueFvPatchField::write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
this->writeEntry("value", os); this->writeEntry("value", os);
} }

View File

@ -1,262 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "expDirectionMixedFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
expDirectionMixedFvPatchField<Type>::expDirectionMixedFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
fvPatchField<Type>(p, iF),
refValue_(p.size()),
refGrad_(p.size()),
valueFraction_(p.size())
{}
template<class Type>
expDirectionMixedFvPatchField<Type>::expDirectionMixedFvPatchField
(
const expDirectionMixedFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fvPatchField<Type>(ptf, p, iF, mapper),
refValue_(ptf.refValue_, mapper),
refGrad_(ptf.refGrad_, mapper),
valueFraction_(ptf.valueFraction_, mapper)
{}
template<class Type>
expDirectionMixedFvPatchField<Type>::expDirectionMixedFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fvPatchField<Type>(p, iF, dict),
refValue_("refValue", dict, p.size()),
refGrad_("refGradient", dict, p.size()),
valueFraction_("valueFraction", dict, p.size())
{
evaluate();
}
template<class Type>
expDirectionMixedFvPatchField<Type>::expDirectionMixedFvPatchField
(
const expDirectionMixedFvPatchField<Type>& ptf
)
:
fvPatchField<Type>(ptf),
refValue_(ptf.refValue_),
refGrad_(ptf.refGrad_),
valueFraction_(ptf.valueFraction_)
{}
template<class Type>
expDirectionMixedFvPatchField<Type>::expDirectionMixedFvPatchField
(
const expDirectionMixedFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fvPatchField<Type>(ptf, iF),
refValue_(ptf.refValue_),
refGrad_(ptf.refGrad_),
valueFraction_(ptf.valueFraction_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void expDirectionMixedFvPatchField<Type>::autoMap
(
const fvPatchFieldMapper& m
)
{
fvPatchField<Type>::autoMap(m);
refValue_.autoMap(m);
refGrad_.autoMap(m);
valueFraction_.autoMap(m);
}
// Reverse-map the given fvPatchField onto this fvPatchField
template<class Type>
void expDirectionMixedFvPatchField<Type>::rmap
(
const fvPatchField<Type>& ptf,
const labelList& addr
)
{
fvPatchField<Type>::rmap(ptf, addr);
const expDirectionMixedFvPatchField<Type>& edmptf =
refCast<const expDirectionMixedFvPatchField<Type> >(ptf);
refValue_.rmap(edmptf.refValue_, addr);
refGrad_.rmap(edmptf.refGrad_, addr);
valueFraction_.rmap(edmptf.valueFraction_, addr);
}
template<class Type>
tmp<Field<Type> > expDirectionMixedFvPatchField<Type>::snGrad() const
{
const vectorField& nHat = patch().faceNormals();
Field<Type> gradValue =
patchInternalField() + refGrad_/patch().deltaCoeffs();
Field<Type> mixedValue =
nHat*(nHat & refValue_)
+ gradValue - nHat*(nHat & gradValue);
return
valueFraction_*
(mixedValue - patchInternalField())*patch().deltaCoeffs()
+ (1.0 - valueFraction_)*refGrad_;
}
template<class Type>
void expDirectionMixedFvPatchField<Type>::evaluate(const Pstream::commsTypes)
{
if (!updated())
{
updateCoeffs();
}
const vectorField& nHat = patch().faceNormals();
Field<Type> gradValue =
patchInternalField() + refGrad_/patch().deltaCoeffs();
Field<Type> mixedValue =
nHat*(nHat & refValue_)
+ gradValue - nHat*(nHat & gradValue);
Field<Type>::operator=
(
valueFraction_*mixedValue + (1.0 - valueFraction_)*gradValue
);
fvPatchField<Type>::evaluate();
}
template<class Type>
tmp<Field<Type> > expDirectionMixedFvPatchField<Type>::valueInternalCoeffs
(
const tmp<scalarField>&
) const
{
return Type(pTraits<Type>::one)*(1.0 - valueFraction_);
}
template<class Type>
tmp<Field<Type> > expDirectionMixedFvPatchField<Type>::valueBoundaryCoeffs
(
const tmp<scalarField>&
) const
{
const vectorField& nHat = patch().faceNormals();
Field<Type> gradValue =
patchInternalField() + refGrad_/patch().deltaCoeffs();
Field<Type> mixedValue =
nHat*(nHat & refValue_)
+ gradValue - nHat*(nHat & gradValue);
return
valueFraction_*mixedValue
+ (1.0 - valueFraction_)*refGrad_/patch().deltaCoeffs();
}
template<class Type>
tmp<Field<Type> > expDirectionMixedFvPatchField<Type>::
gradientInternalCoeffs() const
{
return -Type(pTraits<Type>::one)*valueFraction_*patch().deltaCoeffs();
}
template<class Type>
tmp<Field<Type> > expDirectionMixedFvPatchField<Type>::
gradientBoundaryCoeffs() const
{
const vectorField& nHat = patch().faceNormals();
Field<Type> gradValue =
patchInternalField() + refGrad_/patch().deltaCoeffs();
Field<Type> mixedValue =
nHat*(nHat & refValue_)
+ gradValue - nHat*(nHat & gradValue);
return
valueFraction_*patch().deltaCoeffs()*mixedValue
+ (1.0 - valueFraction_)*refGrad_;
}
template<class Type>
void expDirectionMixedFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
refValue_.writeEntry("refValue", os);
refGrad_.writeEntry("refGradient", os);
valueFraction_.writeEntry("valueFraction", os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,271 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::expDirectionMixedFvPatchField
Description
Foam::expDirectionMixedFvPatchField
SourceFiles
expDirectionMixedFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef expDirectionMixedFvPatchField_H
#define expDirectionMixedFvPatchField_H
#include "fvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class expDirectionMixedFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class expDirectionMixedFvPatchField
:
public fvPatchField<Type>
{
// Private data
//- Value field
Field<Type> refValue_;
//- Normal gradient field
Field<Type> refGrad_;
//- Fraction (0-1) of value used for boundary condition
scalarField valueFraction_;
public:
//- Runtime type information
TypeName("expDirectionMixedMixed");
// Constructors
//- Construct from patch and internal field
expDirectionMixedFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
expDirectionMixedFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given expDirectionMixedFvPatchField
// onto a new patch
expDirectionMixedFvPatchField
(
const expDirectionMixedFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
expDirectionMixedFvPatchField
(
const expDirectionMixedFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new expDirectionMixedFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
expDirectionMixedFvPatchField
(
const expDirectionMixedFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new expDirectionMixedFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Access
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesrefValue() const
{
return true;
}
// Return defining fields
virtual Field<Type>& refValue()
{
return refValue_;
}
virtual const Field<Type>& refValue() const
{
return refValue_;
}
virtual Field<Type>& refGrad()
{
return refGrad_;
}
virtual const Field<Type>& refGrad() const
{
return refGrad_;
}
virtual scalarField& valueFraction()
{
return valueFraction_;
}
virtual const scalarField& valueFraction() const
{
return valueFraction_;
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const fvPatchFieldMapper&
);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual void rmap
(
const fvPatchField<Type>&,
const labelList&
);
// Evaluation functions
//- Return gradient at boundary
virtual tmp<Field<Type> > snGrad() const;
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<Field<Type> > valueInternalCoeffs
(
const tmp<scalarField>&
) const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<Field<Type> > valueBoundaryCoeffs
(
const tmp<scalarField>&
) const;
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<Field<Type> > gradientInternalCoeffs() const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<Field<Type> > gradientBoundaryCoeffs() const;
//- Write
virtual void write(Ostream&) const;
// Member operators
virtual void operator=(const fvPatchField<Type>&) {}
virtual void operator+=(const fvPatchField<Type>&) {}
virtual void operator-=(const fvPatchField<Type>&) {}
virtual void operator*=(const fvPatchField<scalar>&) {}
virtual void operator/=(const fvPatchField<scalar>&) {}
virtual void operator=(const Field<Type>&) {}
virtual void operator+=(const Field<Type>&) {}
virtual void operator-=(const Field<Type>&) {}
virtual void operator*=(const Field<scalar>&) {}
virtual void operator/=(const Field<scalar>&) {}
virtual void operator=(const Type&) {}
virtual void operator+=(const Type&) {}
virtual void operator-=(const Type&) {}
virtual void operator*=(const scalar) {}
virtual void operator/=(const scalar) {}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "expDirectionMixedFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -161,18 +161,9 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
if (UName_ != "U") writeEntryIfDifferent<word>(os, "U", "U", UName_);
{ writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl; os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
gradient().writeEntry("gradient", os); gradient().writeEntry("gradient", os);
} }

View File

@ -45,7 +45,7 @@ fixedPressureCompressibleDensityFvPatchScalarField
) )
: :
fixedValueFvPatchField<scalar>(p, iF), fixedValueFvPatchField<scalar>(p, iF),
pName_("pNameIsUndefined") pName_("p")
{} {}
@ -72,7 +72,7 @@ fixedPressureCompressibleDensityFvPatchScalarField
) )
: :
fixedValueFvPatchField<scalar>(p, iF, dict), fixedValueFvPatchField<scalar>(p, iF, dict),
pName_(dict.lookup("p")) pName_(dict.lookupOrDefault<word>("p", "p"))
{} {}
@ -134,7 +134,7 @@ void fixedPressureCompressibleDensityFvPatchScalarField::write
) const ) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
os.writeKeyword("p") << pName_ << token::END_STATEMENT << nl; writeEntryIfDifferent<word>(os, "p", "p", pName_);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -143,14 +143,8 @@ void Foam::fluxCorrectedVelocityFvPatchVectorField::evaluate
void Foam::fluxCorrectedVelocityFvPatchVectorField::write(Ostream& os) const void Foam::fluxCorrectedVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
if (phiName_ != "phi") writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
{ writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -30,8 +30,6 @@ License
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::inletOutletTotalTemperatureFvPatchScalarField:: Foam::inletOutletTotalTemperatureFvPatchScalarField::
@ -193,18 +191,9 @@ void Foam::inletOutletTotalTemperatureFvPatchScalarField::write(Ostream& os)
const const
{ {
fvPatchScalarField::write(os); fvPatchScalarField::write(os);
if (UName_ != "U") writeEntryIfDifferent<word>(os, "U", "U", UName_);
{ writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl; writeEntryIfDifferent<word>(os, "psi", "psi", psiName_);
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "psi")
{
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
T0_.writeEntry("T0", os); T0_.writeEntry("T0", os);
writeEntry("value", os); writeEntry("value", os);

View File

@ -43,7 +43,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
const DimensionedField<vector, volMesh>& iF const DimensionedField<vector, volMesh>& iF
) )
: :
fixedValueFvPatchVectorField(p, iF) fixedValueFvPatchVectorField(p, iF),
UName_("U")
{} {}
@ -55,7 +56,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchVectorField(ptf, p, iF, mapper) fixedValueFvPatchVectorField(ptf, p, iF, mapper),
UName_(ptf.UName_)
{} {}
@ -66,7 +68,8 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
const dictionary& dict const dictionary& dict
) )
: :
fixedValueFvPatchVectorField(p, iF) fixedValueFvPatchVectorField(p, iF),
UName_(dict.lookupOrDefault<word>("U", "U"))
{ {
fvPatchVectorField::operator=(vectorField("value", dict, p.size())); fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
} }
@ -74,20 +77,22 @@ movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
( (
const movingWallVelocityFvPatchVectorField& pivpvf const movingWallVelocityFvPatchVectorField& mwvpvf
) )
: :
fixedValueFvPatchVectorField(pivpvf) fixedValueFvPatchVectorField(mwvpvf),
UName_(mwvpvf.UName_)
{} {}
movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField movingWallVelocityFvPatchVectorField::movingWallVelocityFvPatchVectorField
( (
const movingWallVelocityFvPatchVectorField& pivpvf, const movingWallVelocityFvPatchVectorField& mwvpvf,
const DimensionedField<vector, volMesh>& iF const DimensionedField<vector, volMesh>& iF
) )
: :
fixedValueFvPatchVectorField(pivpvf, iF) fixedValueFvPatchVectorField(mwvpvf, iF),
UName_(mwvpvf.UName_)
{} {}
@ -114,7 +119,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs()
vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaTValue(); vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaTValue();
const volVectorField& U = db().lookupObject<volVectorField>("U"); const volVectorField& U = db().lookupObject<volVectorField>(UName_);
scalarField phip = scalarField phip =
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U)); p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U));
@ -132,6 +137,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs()
void movingWallVelocityFvPatchVectorField::write(Ostream& os) const void movingWallVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -52,6 +52,11 @@ class movingWallVelocityFvPatchVectorField
: :
public fixedValueFvPatchVectorField public fixedValueFvPatchVectorField
{ {
// Private data
//- Name of velocity field
word UName_;
public: public:

View File

@ -196,14 +196,8 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField::
write(Ostream& os) const write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
if (phiName_ != "phi") writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
{ writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
inletDir_.writeEntry("inletDirection", os); inletDir_.writeEntry("inletDirection", os);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -184,14 +184,8 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs()
void pressureDirectedInletVelocityFvPatchVectorField::write(Ostream& os) const void pressureDirectedInletVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
if (phiName_ != "phi") writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
{ writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
inletDir_.writeEntry("inletDirection", os); inletDir_.writeEntry("inletDirection", os);
writeEntry("value", os); writeEntry("value", os);
} }

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