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

This commit is contained in:
andy
2012-01-31 12:19:56 +00:00
8 changed files with 436 additions and 103 deletions

View File

@ -30,7 +30,7 @@
}
Info<< "Liquid phase volume fraction = "
<< alpha1.weightedAverage(mesh.V()).value()
<< alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(alpha1) = " << min(alpha1).value()
<< " Max(alpha1) = " << max(alpha1).value()
<< endl;

View File

@ -155,7 +155,6 @@
phasei++;
}
Dp = mag(Dp);
adjustPhi(phi0, U, p);
while (pimple.correctNonOrthogonal())
{

View File

@ -203,10 +203,15 @@ void Foam::Time::setControls()
)
);
if (timeDict.readIfPresent("deltaT", deltaT_))
// Read and set the deltaT only if time-step adjustment is active
// otherwise use the deltaT from the controlDict
if (controlDict_.lookupOrDefault<Switch>("adjustTimeStep", false))
{
deltaTSave_ = deltaT_;
deltaT0_ = deltaT_;
if (timeDict.readIfPresent("deltaT", deltaT_))
{
deltaTSave_ = deltaT_;
deltaT0_ = deltaT_;
}
}
timeDict.readIfPresent("deltaT0", deltaT0_);

View File

@ -36,7 +36,6 @@ void Foam::interpolation2DTable<Type>::readTable()
// Read data from file
reader_()(fName, *this);
//IFstream(fName)() >> *this;
if (this->empty())
{
@ -361,7 +360,6 @@ void Foam::interpolation2DTable<Type>::write(Ostream& os) const
{
reader_->write(os);
}
//*this >> os;
}
@ -654,100 +652,6 @@ Type Foam::interpolation2DTable<Type>::operator()
}
}
label loY2 = 0;
label hiY2 = 0;
nY = matrix::operator[](hiX).second().size();
minLimit = matrix::operator[](loX).second()[0].first();
maxLimit = matrix::operator[](loX).second()[nY-1].first();
if (lookupValue < minLimit)
{
switch (boundsHandling_)
{
case interpolation2DTable::ERROR:
{
FatalErrorIn
(
"Foam::interpolation2DTable<Type>::operator[]"
"(const scalar, const scalar) const"
) << "value (" << lookupValue << ") underflow" << nl
<< exit(FatalError);
break;
}
case interpolation2DTable::WARN:
{
WarningIn
(
"Foam::interpolation2DTable<Type>::operator[]"
"(const scalar, const scalar) const"
) << "value (" << lookupValue << ") underflow" << nl
<< " Continuing with the first entry"
<< endl;
// fall-through to 'CLAMP'
}
case interpolation2DTable::CLAMP:
{
loY2 = 0;
loY2 = 1;
break;
}
}
}
else if (lookupValue >= maxLimit)
{
switch (boundsHandling_)
{
case interpolation2DTable::ERROR:
{
FatalErrorIn
(
"Foam::interpolation2DTable<Type>::operator[]"
"(const scalar, const scalar) const"
) << "value (" << lookupValue << ") overflow" << nl
<< exit(FatalError);
break;
}
case interpolation2DTable::WARN:
{
WarningIn
(
"Foam::interpolation2DTable<Type>::operator[]"
"(const scalar, const scalar) const"
) << "value (" << lookupValue << ") overflow" << nl
<< " Continuing with the last entry"
<< endl;
// fall-through to 'CLAMP'
}
case interpolation2DTable::CLAMP:
{
loY2 = nY-1;
loY2 = nY;
break;
}
}
}
else
{
// Finds the lo and hi of Y on the high x
for (label i = 0; i < nY; ++i)
{
if
(
lookupValue >= matrix::operator[](hiX).second()[i].first()
)
{
loY2 = hiY2 = i;
}
else
{
hiY2 = i;
break;
}
}
}
if (loX == hiX)
{
// we are at the end of the table - or there is only a single entry

View File

@ -170,7 +170,7 @@ $(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvP
$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/outletMappedUniformInlet/outletMappedUniformInletFvPatchFields.C
$(derivedFvPatchFields)/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C
$(derivedFvPatchFields)/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C
fvsPatchFields = fields/fvsPatchFields
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C

View File

@ -0,0 +1,202 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "phaseHydrostaticPressureFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "uniformDimensionedFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::phaseHydrostaticPressureFvPatchScalarField::
phaseHydrostaticPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(p, iF),
phaseName_("alpha"),
rho_(0.0),
pRefValue_(0.0),
pRefPoint_(vector::zero)
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
Foam::phaseHydrostaticPressureFvPatchScalarField::
phaseHydrostaticPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF),
phaseName_(dict.lookupOrDefault<word>("phaseName", "alpha")),
rho_(readScalar(dict.lookup("rho"))),
pRefValue_(readScalar(dict.lookup("pRefValue"))),
pRefPoint_(dict.lookup("pRefPoint"))
{
this->refValue() = pRefValue_;
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
}
else
{
fvPatchScalarField::operator=(this->refValue());
}
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
Foam::phaseHydrostaticPressureFvPatchScalarField::
phaseHydrostaticPressureFvPatchScalarField
(
const phaseHydrostaticPressureFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
phaseName_(ptf.phaseName_),
rho_(ptf.rho_),
pRefValue_(ptf.pRefValue_),
pRefPoint_(ptf.pRefPoint_)
{}
Foam::phaseHydrostaticPressureFvPatchScalarField::
phaseHydrostaticPressureFvPatchScalarField
(
const phaseHydrostaticPressureFvPatchScalarField& ptf
)
:
mixedFvPatchScalarField(ptf),
phaseName_(ptf.phaseName_)
{}
Foam::phaseHydrostaticPressureFvPatchScalarField::
phaseHydrostaticPressureFvPatchScalarField
(
const phaseHydrostaticPressureFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(ptf, iF),
phaseName_(ptf.phaseName_),
rho_(ptf.rho_),
pRefValue_(ptf.pRefValue_),
pRefPoint_(ptf.pRefPoint_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::phaseHydrostaticPressureFvPatchScalarField::updateCoeffs()
{
if (this->updated())
{
return;
}
const scalarField& alphap =
patch().lookupPatchField<volScalarField, scalar>
(
phaseName_
);
const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>("g");
// scalar rhor = 1000;
// scalarField alphap1 = max(min(alphap, 1.0), 0.0);
// valueFraction() = alphap1/(alphap1 + rhor*(1.0 - alphap1));
valueFraction() = max(min(alphap, 1.0), 0.0);
refValue() =
pRefValue_
+ rho_*((g.value() & patch().Cf()) - (g.value() & pRefPoint_));
mixedFvPatchScalarField::updateCoeffs();
}
void Foam::phaseHydrostaticPressureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
if (phaseName_ != "alpha")
{
os.writeKeyword("phaseName")
<< phaseName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("rho") << rho_ << token::END_STATEMENT << nl;
os.writeKeyword("pRefValue") << pRefValue_ << token::END_STATEMENT << nl;
os.writeKeyword("pRefPoint") << pRefPoint_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::phaseHydrostaticPressureFvPatchScalarField::operator=
(
const fvPatchScalarField& ptf
)
{
fvPatchScalarField::operator=
(
valueFraction()*refValue()
+ (1 - valueFraction())*ptf
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
phaseHydrostaticPressureFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,223 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::phaseHydrostaticPressureFvPatchScalarField
Description
Phase hydrostatic pressure boundary condition calculated as
pRefValue + rho*g.(x - pRefPoint)
where rho is provided and assumed uniform
applied according to the phase-fraction field provided:
1 -> fix value to that provided
0 -> zero-gradient
SourceFiles
phaseHydrostaticPressureFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef phaseHydrostaticPressureFvPatchScalarField_H
#define phaseHydrostaticPressureFvPatchScalarField_H
#include "mixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class phaseHydrostaticPressureFvPatch Declaration
\*---------------------------------------------------------------------------*/
class phaseHydrostaticPressureFvPatchScalarField
:
public mixedFvPatchScalarField
{
protected:
// Protected data
//- Name of phase-fraction field
word phaseName_;
//- Constant density in the far-field
scalar rho_;
//- Reference pressure
scalar pRefValue_;
//- Reference pressure location
vector pRefPoint_;
public:
//- Runtime type information
TypeName("phaseHydrostaticPressure");
// Constructors
//- Construct from patch and internal field
phaseHydrostaticPressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
phaseHydrostaticPressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// phaseHydrostaticPressureFvPatchScalarField onto a new patch
phaseHydrostaticPressureFvPatchScalarField
(
const phaseHydrostaticPressureFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
phaseHydrostaticPressureFvPatchScalarField
(
const phaseHydrostaticPressureFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField >
(
new phaseHydrostaticPressureFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
phaseHydrostaticPressureFvPatchScalarField
(
const phaseHydrostaticPressureFvPatchScalarField&,
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 phaseHydrostaticPressureFvPatchScalarField(*this, iF)
);
}
// Member functions
// Access
//- Return the phaseName
const word& phaseName() const
{
return phaseName_;
}
//- Return reference to the phaseName to allow adjustment
word& phaseName()
{
return phaseName_;
}
//- Return the constant density in the far-field
scalar rho() const
{
return rho_;
}
//- Return reference to the constant density in the far-field
// to allow adjustment
scalar& rho()
{
return rho_;
}
//- Return the reference pressure
scalar pRefValue() const
{
return pRefValue_;
}
//- Return reference to the reference pressure to allow adjustment
scalar& pRefValue()
{
return pRefValue_;
}
//- Return the pressure reference location
const vector& pRefPoint() const
{
return pRefPoint_;
}
//- Return reference to the pressure reference location
// to allow adjustment
vector& pRefPoint()
{
return pRefPoint_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
// Member operators
virtual void operator=(const fvPatchScalarField& pvf);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -128,7 +128,7 @@ relaxationFactors
}
equations
{
"(U|k|epsilon|omega|R|nuTilda)" 1;
"(U|k|epsilon|omega|R|nuTilda).*" 1;
}
}