Merge commit 'OpenCFD/master' into olesenm

Conflicts:

	src/OpenFOAM/db/IOstreams/Pstreams/IPstream.C
	src/OpenFOAM/db/IOstreams/Pstreams/OPstream.C
This commit is contained in:
Mark Olesen
2009-01-07 09:39:17 +01:00
171 changed files with 2187 additions and 1309 deletions

View File

@ -5,7 +5,7 @@ coupleManager/coupleManager.C
derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C
derivedFvPatchFields/solidWallHeatFluxTemperatureCoupled/solidWallHeatFluxTemperatureCoupledFvPatchScalarField.C
derivedFvPatchFields/solidWallTemperatureCoupled/solidWallTemperatureCoupledFvPatchScalarField.C
derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.C
chtMultiRegionFoam.C

View File

@ -26,6 +26,7 @@ License
#include "coupleManager.H"
#include "OFstream.H"
#include "regionProperties.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -74,6 +75,51 @@ Foam::coupleManager::~coupleManager()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::coupleManager::regionOwner() const
{
const fvMesh& nbrRegion = neighbourRegion();
const regionProperties& props =
localRegion_.objectRegistry::parent().lookupObject<regionProperties>
(
"regionProperties"
);
label myIndex = findIndex(props.fluidRegionNames(), localRegion_.name());
if (myIndex == -1)
{
label i = findIndex(props.solidRegionNames(), localRegion_.name());
if (i == -1)
{
FatalErrorIn("coupleManager::regionOwner() const")
<< "Cannot find region " << localRegion_.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::regionOwner() 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;
}
void Foam::coupleManager::checkCouple() const
{
Info<< "neighbourRegionName_ = " << neighbourRegionName_ << endl;

View File

@ -74,9 +74,6 @@ class coupleManager
// Private Member Functions
//- Disallow default bitwise copy construct
// coupleManager(const coupleManager&);
//- Disallow default bitwise assignment
void operator=(const coupleManager&);
@ -129,6 +126,9 @@ public:
template<class Type>
inline const fvPatchField<Type>& neighbourPatchField() const;
//- Am I owner (= first to evaluate) of this region interface?
bool regionOwner() const;
//- Check that the couple is valid
void checkCouple() const;

View File

@ -115,7 +115,7 @@ void Foam::solidWallHeatFluxTemperatureCoupledFvPatchScalarField::updateCoeffs()
const fvPatchField<scalar>& K =
patch().lookupPatchField<volScalarField, scalar>(KName_);
gradient() = refCast<const solidWallTemperatureCoupledFvPatchScalarField>
gradient() = -refCast<const solidWallTemperatureCoupledFvPatchScalarField>
(neighbourField).flux()/K;
fixedGradientFvPatchScalarField::updateCoeffs();

View File

@ -0,0 +1,252 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 "regionProperties.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(p, iF),
coupleManager_(p),
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),
coupleManager_(ptf.coupleManager_),
KName_(ptf.KName_),
fixesValue_(ptf.fixesValue_)
{}
Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF),
coupleManager_(p, dict),
KName_(dict.lookup("K"))
{
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
refValue() = static_cast<scalarField>(*this);
refGrad() = 0.0;
valueFraction() = 1.0;
fixesValue_ = true;
}
Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const solidWallMixedTemperatureCoupledFvPatchScalarField& wtcsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(wtcsf, iF),
coupleManager_(wtcsf.coupleManager_),
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;
}
tmp<scalarField> intFld = patchInternalField();
label nFixed = 0;
// Like snGrad but bypass switching on refValue/refGrad.
tmp<scalarField> normalGradient =
(*this-intFld())
* patch().deltaCoeffs();
if (debug)
{
Info<< "solidWallMixedTemperatureCoupledFvPatchScalarField::"
<< "updateCoeffs() :"
<< " walltemperature "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< " avg:" << gAverage(*this)
<< endl;
}
forAll(*this, i)
{
// if outgoing flux use fixed value.
if (intFld()[i] > operator[](i))
{
this->refValue()[i] = operator[](i);
this->refGrad()[i] = 0.0; // not used
this->valueFraction()[i] = 1.0;
nFixed++;
}
else
{
this->refValue()[i] = 0.0; // not used
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() : Out of " << nTotSize
<< " fixedBC:" << nFixed
<< " gradient:" << nTotSize-nFixed << endl;
}
mixedFvPatchScalarField::updateCoeffs();
}
void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
if (!this->updated())
{
this->updateCoeffs();
}
if (!coupleManager_.regionOwner())
{
// I am the last one to evaluate.
tmp<scalarField> intFld = patchInternalField();
const fvPatch& nbrPatch = coupleManager_.neighbourPatch();
solidWallMixedTemperatureCoupledFvPatchScalarField& nbrField =
refCast<solidWallMixedTemperatureCoupledFvPatchScalarField>
(
const_cast<fvPatchField<scalar>&>
(
coupleManager_.neighbourPatchField<scalar>()
)
);
tmp<scalarField> nbrIntFld = nbrField.patchInternalField();
tmp<scalarField> myKDelta = K()*patch().deltaCoeffs();
tmp<scalarField> nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
// Calculate common wall temperature and assign to both sides
scalarField::operator=
(
(myKDelta()*intFld + nbrKDelta()*nbrIntFld)
/ (myKDelta() + nbrKDelta())
);
nbrField.scalarField::operator=(*this);
if (debug)
{
Info<< "Setting master and slave to wall temperature "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< " avg:" << gAverage(*this)
<< endl;
}
}
fvPatchScalarField::evaluate();
}
void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::write
(
Ostream& os
) const
{
mixedFvPatchScalarField::write(os);
coupleManager_.writeEntries(os);
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
solidWallMixedTemperatureCoupledFvPatchScalarField
);
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,184 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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;
neighbourRegionName fluid;
neighbourPatchName fluidSolidInterface;
neighbourFieldName T;
K K;
value uniform 300;
}
SourceFiles
solidWallMixedTemperatureCoupledFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef solidWallMixedTemperatureCoupledFvPatchScalarField_H
#define solidWallMixedTemperatureCoupledFvPatchScalarField_H
#include "fvPatchFields.H"
#include "mixedFvPatchFields.H"
#include "coupleManager.H"
#include "fvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class solidWallMixedTemperatureCoupledFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class solidWallMixedTemperatureCoupledFvPatchScalarField
:
public mixedFvPatchScalarField
{
// Private data
//- Couple manager object
coupleManager coupleManager_;
//- Name of thermal conductivity field
word KName_;
bool fixesValue_;
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();
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -136,7 +136,7 @@ Foam::solidWallTemperatureCoupledFvPatchScalarField::flux() const
const fvPatchScalarField& Tw = *this;
return Tw.snGrad()*patch().magSf()*Kw;
return Tw.snGrad()*Kw;
}

View File

@ -138,7 +138,7 @@ public:
// Member functions
//- Flux
//- (intensive) flux
tmp<scalarField> flux() const;
//- Update the coefficients associated with the patch field

View File

@ -82,7 +82,7 @@
IOobject::NO_READ,
IOobject::NO_WRITE
),
thermof[i].rho()*thermof[i].Cp()*thermof[i].alpha()
thermof[i].Cp()*thermof[i].alpha()
)
);

View File

@ -56,5 +56,5 @@
}
// Update thermal conductivity
Kf[i] = rhof[i]*thermof[i].Cp()*turb[i].alphaEff();
Kf[i] = thermof[i].Cp()*turb[i].alphaEff();
}

View File

@ -6,4 +6,7 @@
fvm::ddt(rhosCps[i], Ts[i]) - fvm::laplacian(Ks[i], Ts[i])
);
}
Info<< "Min/max T:" << min(Ts[i]) << ' ' << max(Ts[i])
<< endl;
}

View File

@ -70,6 +70,8 @@ int main(int argc, char *argv[])
+ turbulence->divDevReff(U)
);
UEqn.relax();
if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));

View File

@ -1,7 +1,7 @@
{
if (nOuterCorr == 1)
{
p =
p =
(
rho
- (1.0 - gamma)*rhol0
@ -37,7 +37,14 @@
- fvm::laplacian(rUAf, p)
);
pEqn.solve();
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve(mesh.solver(p.name()));
}
if (nonOrth == nNonOrthCorr)
{

View File

@ -1,13 +1,16 @@
surfaceScalarField muf =
surfaceScalarField muEff
(
"muEff",
twoPhaseProperties.muf()
+ fvc::interpolate(rho*turbulence->nut());
+ fvc::interpolate(rho*turbulence->nut())
);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U)
- fvm::laplacian(muf, U)
- (fvc::grad(U) & fvc::grad(muf))
- fvm::laplacian(muEff, U)
- (fvc::grad(U) & fvc::grad(muEff))
//- fvc::div(muf*(mesh.Sf() & fvc::interpolate(fvc::grad(U)().T())))
);

View File

@ -12,7 +12,9 @@
surfaceScalarField phic = mag(phi/mesh.magSf());
phic = min(interface.cAlpha()*phic, max(phic));
fvc::makeAbsolute(phi, U);
volScalarField divU = fvc::div(phi);
fvc::makeRelative(phi, U);
if (nAlphaSubCycles > 1)
{

View File

@ -30,7 +30,7 @@
- ghf*fvc::snGrad(rho)
)*rUAf*mesh.magSf();
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pdEqnIncomp
(
@ -38,15 +38,36 @@
- fvm::laplacian(rUAf, pd)
);
solve
if
(
oCorr == nOuterCorr-1
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
solve
(
max(alpha1, scalar(0))*(psi1/rho1)
+ max(alpha2, scalar(0))*(psi2/rho2)
)
*pdEqnComp()
+ pdEqnIncomp
);
(
max(alpha1, scalar(0))*(psi1/rho1)
+ max(alpha2, scalar(0))*(psi2/rho2)
)
*pdEqnComp()
+ pdEqnIncomp,
mesh.solver(pd.name() + "Final")
);
}
else
{
solve
(
(
max(alpha1, scalar(0))*(psi1/rho1)
+ max(alpha2, scalar(0))*(psi2/rho2)
)
*pdEqnComp()
+ pdEqnIncomp
);
}
if (nonOrth == nNonOrthCorr)
{
@ -62,7 +83,8 @@
p = max
(
(pd + gh*(alpha1*rho10 + alpha2*rho20))/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
(pd + gh*(alpha1*rho10 + alpha2*rho20))
/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
pMin
);

View File

@ -1,15 +1,18 @@
surfaceScalarField muf =
surfaceScalarField muEff
(
"muEff",
twoPhaseProperties->muf()
+ fvc::interpolate(rho*turbulence->nut());
+ fvc::interpolate(rho*turbulence->nut())
);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U)
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
- fvm::laplacian(muf, U)
- (fvc::grad(U) & fvc::grad(muf))
//- fvc::div(muf*(fvc::interpolate(dev2(fvc::grad(U))) & mesh.Sf()))
- fvm::laplacian(muEff, U)
- (fvc::grad(U) & fvc::grad(muEff))
//- fvc::div(muEff*(fvc::interpolate(dev2(fvc::grad(U))) & mesh.Sf()))
);
UEqn.relax();

View File

@ -167,7 +167,7 @@ Foam::kineticTheoryModel::kineticTheoryModel
IOobject::NO_WRITE
),
Ua_.mesh(),
dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0), 0.0)
dimensionedScalar("zero", dimensionSet(1, -1, -1, 0, 0), 0.0)
),
gs0_
(

View File

@ -28,7 +28,7 @@ Description
#include "writeFuns.H"
#ifdef __mips
#if defined(__mips) && !defined(__SICORTEX__)
#include <standards.h>
#include <sys/endian.h>
#endif

View File

@ -27,7 +27,7 @@ License
#include "writeFuns.H"
#include "vtkTopo.H"
#ifdef __mips
#if defined(__mips) && !defined(__SICORTEX__)
#include <standards.h>
#include <sys/endian.h>
#endif

View File

@ -44,7 +44,14 @@ int main(int argc, char *argv[])
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"
IOprobes sniff(mesh, "probesDict", IOobject::MUST_READ, true);
IOprobes sniff
(
probes::typeName,
mesh,
"probesDict",
IOobject::MUST_READ,
true
);
forAll(timeDirs, timeI)
{

View File

@ -101,8 +101,23 @@ int main(int argc, char *argv[])
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"
IOsampledSets sSets(mesh, "sampleDict", IOobject::MUST_READ, true);
IOsampledSurfaces sSurfs(mesh, "sampleDict", IOobject::MUST_READ, true);
IOsampledSets sSets
(
sampledSets::typeName,
mesh,
"sampleDict",
IOobject::MUST_READ,
true
);
IOsampledSurfaces sSurfs
(
sampledSurfaces::typeName,
mesh,
"sampleDict",
IOobject::MUST_READ,
true
);
forAll(timeDirs, timeI)
{