Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
henry 2009-10-30 17:24:05 +00:00
commit 51bb18ce78
36 changed files with 475 additions and 42 deletions

View File

@ -13,6 +13,14 @@ PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.contains(inertSpecie))
{
FatalErrorIn(args.executable())
<< "Specified inert specie '" << inertSpecie << "' not found in "
<< "species list. Available species:" << composition.species()
<< exit(FatalError);
}
volScalarField rho
(
IOobject

View File

@ -14,7 +14,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection
label inertIndex = -1;
volScalarField Yt = 0.0*Y[0];
for (label i=0; i<Y.size(); i++)
forAll(Y, i)
{
if (Y[i].name() != inertSpecie)
{

View File

@ -13,6 +13,14 @@
word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.contains(inertSpecie))
{
FatalErrorIn(args.executable())
<< "Specified inert specie '" << inertSpecie << "' not found in "
<< "species list. Available species:" << composition.species()
<< exit(FatalError);
}
volScalarField& p = thermo.p();
volScalarField& h = thermo.h();
const volScalarField& T = thermo.T();

View File

@ -15,7 +15,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection
label inertIndex = -1;
volScalarField Yt = 0.0*Y[0];
for (label i=0; i<Y.size(); i++)
forAll(Y, i)
{
if (Y[i].name() != inertSpecie)
{

View File

@ -13,6 +13,14 @@
word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.contains(inertSpecie))
{
FatalErrorIn(args.executable())
<< "Specified inert specie '" << inertSpecie << "' not found in "
<< "species list. Available species:" << composition.species()
<< exit(FatalError);
}
volScalarField& p = thermo.p();
volScalarField& h = thermo.h();
const volScalarField& T = thermo.T();

View File

@ -14,7 +14,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection
label inertIndex = -1;
volScalarField Yt = 0.0*Y[0];
for (label i=0; i<Y.size(); i++)
forAll(Y, i)
{
if (Y[i].name() != inertSpecie)
{

View File

@ -13,6 +13,14 @@
word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.contains(inertSpecie))
{
FatalErrorIn(args.executable())
<< "Specified inert specie '" << inertSpecie << "' not found in "
<< "species list. Available species:" << composition.species()
<< exit(FatalError);
}
volScalarField& p = thermo.p();
volScalarField& h = thermo.h();
const volScalarField& T = thermo.T();

View File

@ -121,7 +121,7 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues
return;
}
// Far field gas molar fractions
// Far field carrier molar fractions
scalarField Xinf(Y_.size());
forAll(Xinf, i)
@ -135,7 +135,7 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues
// Molar fraction of far field species at particle surface
const scalar Xsff = 1.0 - min(sum(Cs)*specie::RR*this->T_/pc_, 1.0);
// Surface gas total molar concentration
// Surface carrier total molar concentration
const scalar CsTot = pc_/(specie::RR*this->T_);
// Surface carrier composition (molar fraction)
@ -171,10 +171,10 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues
cbrt(td.cloud().mcCarrierThermo().speciesData()[i].W());
rhos += Xs[i]*td.cloud().mcCarrierThermo().speciesData()[i].W();
cps += Xs[i]*td.cloud().mcCarrierThermo().speciesData()[i].Cp(T);
mus += Ys[i]*sqrtW*td.cloud().mcCarrierThermo().speciesData()[i].mu(T);
kappa +=
Ys[i]*cbrtW*td.cloud().mcCarrierThermo().speciesData()[i].kappa(T);
cps += Xs[i]*td.cloud().mcCarrierThermo().speciesData()[i].Cp(T);
sumYiSqrtW += Ys[i]*sqrtW;
sumYiCbrtW += Ys[i]*cbrtW;
@ -417,7 +417,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
const scalarField& YComponents,
scalarField& dMassPC,
scalar& Sh,
scalar& dhsTrans,
scalar& dhsTrans, // TODO: not used
scalar& N,
scalar& NCpW,
scalarField& Cs

View File

@ -233,7 +233,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
if (mag(htc) < ROOTVSMALL && !td.cloud().radiation())
{
return T + dt*Sh/(this->volume(d)*rho*cp);
return max(T + dt*Sh/(this->volume(d)*rho*cp), td.constProps().TMin());
}
const scalar As = this->areaS(d);
@ -256,9 +256,11 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
IntegrationScheme<scalar>::integrationResult Tres =
td.cloud().TIntegrator().integrate(T, dt, ap, bp);
dhsTrans += dt*htc*As*(Tres.average() - Tc_);
scalar Tnew = max(Tres.value(), td.constProps().TMin());
return Tres.value();
dhsTrans += dt*htc*As*(0.5*(T + Tnew) - Tc_);
return Tnew;
}

View File

@ -71,15 +71,12 @@ bool Foam::Rebound<CloudType>::correct
nw /= mag(nw);
scalar Un = U & nw;
vector Ut = U - Un*nw;
if (Un > 0.0)
{
U -= UFactor_*2.0*Un*nw;
}
U -= Ut;
return true;
}

View File

@ -7,10 +7,10 @@ fieldMinMax/fieldMinMax.C
fieldMinMax/fieldMinMaxFunctionObject.C
fieldValues/fieldValue/fieldValue.C
fieldValues/face/faceSource.C
fieldValues/face/faceSourceFunctionObject.C
fieldValues/cell/cellSource.C
fieldValues/cell/cellSourceFunctionObject.C
fieldValues/faceSource/faceSource.C
fieldValues/faceSource/faceSourceFunctionObject.C
fieldValues/cellSource/cellSource.C
fieldValues/cellSource/cellSourceFunctionObject.C
streamLine/streamLine.C
streamLine/streamLineParticle.C

View File

@ -50,10 +50,13 @@ namespace Foam
fieldValues::faceSource::sourceTypeNames_;
template<>
const char* NamedEnum<fieldValues::faceSource::operationType, 4>::
names[] = {"none", "sum", "areaAverage", "areaIntegrate"};
const char* NamedEnum<fieldValues::faceSource::operationType, 5>::
names[] =
{
"none", "sum", "areaAverage", "areaIntegrate", "weightedAverage"
};
const NamedEnum<fieldValues::faceSource::operationType, 4>
const NamedEnum<fieldValues::faceSource::operationType, 5>
fieldValues::faceSource::operationTypeNames_;
}
@ -68,7 +71,9 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
if (zoneId < 0)
{
FatalErrorIn("faceSource::faceSource::setFaceZoneFaces()")
<< "Unknown face zone name: " << sourceName_
<< type() << " " << name_ << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Unknown face zone name: " << sourceName_
<< ". Valid face zones are: " << mesh().faceZones().names()
<< nl << exit(FatalError);
}
@ -164,7 +169,9 @@ void Foam::fieldValues::faceSource::setPatchFaces()
if (patchId < 0)
{
FatalErrorIn("faceSource::constructFaceAddressing()")
<< "Unknown patch name: " << sourceName_
<< type() << " " << name_ << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Unknown patch name: " << sourceName_
<< ". Valid patch names are: "
<< mesh().boundaryMesh().names() << nl
<< exit(FatalError);
@ -197,7 +204,7 @@ void Foam::fieldValues::faceSource::setPatchFaces()
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::fieldValues::faceSource::initialise()
void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
{
switch (source_)
{
@ -214,15 +221,40 @@ void Foam::fieldValues::faceSource::initialise()
default:
{
FatalErrorIn("faceSource::constructFaceAddressing()")
<< "Unknown source type. Valid source types are:"
<< type() << " " << name_ << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
<< nl << " Unknown source type. Valid source types are:"
<< sourceTypeNames_ << nl << exit(FatalError);
}
}
Info<< type() << " " << name_ << ":" << nl
<< " total faces = " << faceId_.size() << nl
<< " total area = " << sum(filterField(mesh().magSf()))
<< nl << endl;
<< " total faces = " << faceId_.size() << nl
<< " total area = " << sum(filterField(mesh().magSf())) << nl;
if (operation_ == opWeightedAverage)
{
dict.lookup("weightField") >> weightFieldName_;
if
(
obr().foundObject<volScalarField>(weightFieldName_)
|| obr().foundObject<surfaceScalarField>(weightFieldName_)
)
{
Info<< " weight field = " << weightFieldName_;
}
else
{
FatalErrorIn("faceSource::constructFaceAddressing()")
<< type() << " " << name_ << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
<< nl << " Weight field " << weightFieldName_
<< " must be either a " << volScalarField::typeName << " or "
<< surfaceScalarField::typeName << nl << exit(FatalError);
}
}
Info<< nl << endl;
}
@ -302,12 +334,13 @@ Foam::fieldValues::faceSource::faceSource
faceId_(),
facePatchId_(),
flipMap_(),
outputFilePtr_(NULL)
outputFilePtr_(NULL),
weightFieldName_("undefinedWeightedFieldName")
{
initialise();
if (active_)
{
initialise(dict);
// Create the output file if not already created
makeFile();
}
@ -327,7 +360,7 @@ void Foam::fieldValues::faceSource::read(const dictionary& dict)
if (active_)
{
fieldValue::read(dict);
initialise();
initialise(dict);
}
}

View File

@ -39,7 +39,7 @@ Description
valueOutput true; // Write values at run-time output times?
source faceZone; // Type of face source: faceZone, patch
sourceName f0;
operation sum; // none, sum, areaAverage, areaIntegrate
operation sum;
fields
(
p
@ -48,6 +48,13 @@ Description
);
}
where operation is one of:
- none
- sum
- areaAverage
- areaIntegrate
- weightedAverage
SourceFiles
faceSource.C
@ -100,11 +107,12 @@ public:
opNone,
opSum,
opAreaAverage,
opAreaIntegrate
opAreaIntegrate,
opWeightedAverage
};
//- Operation type names
static const NamedEnum<operationType, 4> operationTypeNames_;
static const NamedEnum<operationType, 5> operationTypeNames_;
private:
@ -143,11 +151,14 @@ protected:
//- Output file pointer
autoPtr<OFstream> outputFilePtr_;
//- Weight field name - only used for opWeightedAverage mode
word weightFieldName_;
// Protected member functions
//- Initialise, e.g. face addressing
void initialise();
void initialise(const dictionary& dict);
//- Insert field values into values list
template<class Type>

View File

@ -129,6 +129,47 @@ Type Foam::fieldValues::faceSource::processValues
result = sum(values*filterField(mesh().magSf()));
break;
}
case opWeightedAverage:
{
if (mesh().foundObject<volScalarField>(weightFieldName_))
{
tmp<scalarField> wField =
filterField
(
mesh().lookupObject<volScalarField>(weightFieldName_)
);
result = sum(values*wField())/sum(wField());
}
else if (mesh().foundObject<surfaceScalarField>(weightFieldName_))
{
tmp<scalarField> wField =
filterField
(
mesh().lookupObject<surfaceScalarField>
(
weightFieldName_
)
);
result = sum(values*wField())/sum(wField());
}
else
{
FatalErrorIn
(
"fieldValues::faceSource::processValues"
"("
"List<Type>&"
") const"
) << type() << " " << name_ << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
<< nl
<< " Weight field " << weightFieldName_
<< " must be either a " << volScalarField::typeName
<< " or " << surfaceScalarField::typeName << nl
<< abort(FatalError);
}
break;
}
default:
{
// Do nothing

View File

@ -137,7 +137,7 @@ public:
//- Return the output field values flag
const Switch& valueOutput() const;
//- Helper funvction to return the reference to the mesh
//- Helper function to return the reference to the mesh
const fvMesh& mesh() const;

View File

@ -63,10 +63,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
cpPolynomial_(pt.cpPolynomial_),
dhPolynomial_(pt.dhPolynomial_),
dsPolynomial_(pt.dsPolynomial_)
{
// Offset dh poly so that it is relative to the enthalpy at Tstd
dhPolynomial_[0] -= dhPolynomial_.evaluate(specie::Tstd);
}
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -56,7 +56,7 @@ inline Foam::janafThermo<equationOfState>::janafThermo
template<class equationOfState>
inline void Foam::janafThermo<equationOfState>::checkT(const scalar T) const
{
if (T < Tlow_ || T > Thigh_)
if (T < Tlow_ || T > Thigh_)
{
FatalErrorIn
(

View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
stationaryWalls
{
type fixedValue;
value uniform (0 0 0);
}
atmosphere
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
floatingObject
{
type movingWallVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object alpha1;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
stationaryWalls
{
type zeroGradient;
}
atmosphere
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
floatingObject
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 0.1;
boundaryField
{
stationaryWalls
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0.1;
}
atmosphere
{
type inletOutlet;
inletValue uniform 0.1;
value uniform 0.1;
}
floatingObject
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0.1;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0.1;
boundaryField
{
stationaryWalls
{
type kqRWallFunction;
value uniform 0.1;
}
atmosphere
{
type inletOutlet;
inletValue uniform 0.1;
value uniform 0.1;
}
floatingObject
{
type kqRWallFunction;
value uniform 0.1;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
stationaryWalls
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
atmosphere
{
type calculated;
value uniform 0;
}
floatingObject
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object pd;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
stationaryWalls
{
type buoyantPressure;
value uniform 0;
}
atmosphere
{
type totalPressure;
p0 uniform 0;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
value uniform 0;
}
floatingObject
{
type buoyantPressure;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class pointVectorField;
location "0.01";
object pointDisplacement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 0 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
stationaryWalls
{
type fixedValue;
value uniform (0 0 0);
}
atmosphere
{
type fixedValue;
value uniform (0 0 0);
}
floatingObject
{
type sixDoFRigidBodyDisplacement;
centreOfMass (0.5 0.5 0.5);
momentOfInertia (0.08622222 0.8622222 0.144);
mass 9.6;
rhoInf 1;
Q (1 0 0 0 1 0 0 0 1);
v (0 0 0);
a (0 0 0);
pi (0 0 0);
tau (0 0 0);
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -20,7 +20,7 @@ makeMeshByCellSet()
runApplication blockMesh
makeMeshByCellSet 1 2
runApplication subsetMesh -overwrite c0 -patch floatingObject
cp -r 0.orig 0 > /dev/null 2>&1
cp -r 0.org 0 > /dev/null 2>&1
runApplication setFields
runApplication $application