Merge branch 'master' into cvm

This commit is contained in:
graham
2009-07-10 11:39:45 +01:00
297 changed files with 1097 additions and 566 deletions

View File

@ -32,7 +32,6 @@ template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial()
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
name_("unknownPolynomialName"),
logActive_(false),
logCoeff_(0.0)
{}
@ -42,16 +41,17 @@ template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial(const word& name, Istream& is)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
name_(is),
logActive_(false),
logCoeff_(0.0)
{
if (name_ != name)
word isName(is);
if (isName != name)
{
FatalErrorIn
(
"Polynomial<PolySize>::Polynomial(const word&, Istream&)"
) << "Expected polynomial name " << name << " but read " << name_
) << "Expected polynomial name " << name << " but read " << isName
<< nl << exit(FatalError);
}
@ -63,7 +63,7 @@ Foam::Polynomial<PolySize>::Polynomial(const word& name, Istream& is)
FatalErrorIn
(
"Polynomial<PolySize>::Polynomial(const word&, Istream&)"
) << "Polynomial coefficients for entry " << name_
) << "Polynomial coefficients for entry " << isName
<< " are invalid (empty)" << nl << exit(FatalError);
}
}
@ -72,12 +72,10 @@ Foam::Polynomial<PolySize>::Polynomial(const word& name, Istream& is)
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial
(
const word& name,
const Polynomial<PolySize>& poly
)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(poly),
name_(name),
logActive_(poly.logActive_),
logCoeff_(poly.logCoeff_)
{}
@ -85,13 +83,6 @@ Foam::Polynomial<PolySize>::Polynomial
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<int PolySize>
const Foam::word& Foam::Polynomial<PolySize>::name() const
{
return name_;
}
template<int PolySize>
bool& Foam::Polynomial<PolySize>::logActive()
{

View File

@ -82,9 +82,6 @@ class Polynomial
{
// Private data
//- Polynomial name
word name_;
//- Include the log term? - only activated using integrateMinus1()
bool logActive_;
@ -107,17 +104,14 @@ public:
//- Construct from name and Istream
Polynomial(const word& name, Istream& is);
//- Copy constructor with name
Polynomial(const word& name, const Polynomial& poly);
//- Copy constructor
Polynomial(const Polynomial& poly);
// Member Functions
// Access
//- Return const access to the polynomial name
const word& name() const;
//- Return access to the log term active flag
bool& logActive();

View File

@ -35,8 +35,7 @@ Foam::Ostream& Foam::operator<<
const Polynomial<PolySize>& poly
)
{
os << poly.name_ << token::SPACE
<< static_cast
os << static_cast
<VectorSpace<Polynomial<PolySize>, scalar, PolySize> >(poly);
// Check state of Ostream

View File

@ -100,6 +100,12 @@ Foam::label Foam::meshRefinement::createBaffle
<< " ownPatch:" << ownPatch << abort(FatalError);
}
bool reverseFlip = false;
if (zoneID >= 0)
{
reverseFlip = !zoneFlip;
}
dupFaceI = meshMod.setAction
(
polyAddFace
@ -113,7 +119,7 @@ Foam::label Foam::meshRefinement::createBaffle
true, // face flip
neiPatch, // patch for face
zoneID, // zone for face
!zoneFlip // face flip in zone
reverseFlip // face flip in zone
)
);
}

View File

@ -104,6 +104,7 @@ $(constraintFvPatchFields)/wedge/wedgeFvPatchFields.C
$(constraintFvPatchFields)/wedge/wedgeFvPatchScalarField.C
derivedFvPatchFields = $(fvPatchFields)/derived
$(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/advective/advectiveFvPatchFields.C
$(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C

View File

@ -111,7 +111,7 @@ protected:
const PtrList<volScalarField>& carrierFields_;
//- Active flag
bool active_;
Switch active_;
//- List of point source properties
List<pointSourceProperties> pointSources_;

View File

@ -0,0 +1,274 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "activeBaffleVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::activeBaffleVelocityFvPatchVectorField::
activeBaffleVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(p, iF),
pName_("p"),
cyclicPatchName_(),
cyclicPatchLabel_(-1),
orientation_(1),
initWallSf_(0),
initCyclicSf_(0),
openFraction_(0),
openingTime_(0),
maxOpenFractionDelta_(0),
curTimeIndex_(-1)
{}
Foam::activeBaffleVelocityFvPatchVectorField::
activeBaffleVelocityFvPatchVectorField
(
const activeBaffleVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
pName_(ptf.pName_),
cyclicPatchName_(ptf.cyclicPatchName_),
cyclicPatchLabel_(ptf.cyclicPatchLabel_),
orientation_(ptf.orientation_),
initWallSf_(ptf.initWallSf_),
initCyclicSf_(ptf.initCyclicSf_),
openFraction_(ptf.openFraction_),
openingTime_(ptf.openingTime_),
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
curTimeIndex_(-1)
{}
Foam::activeBaffleVelocityFvPatchVectorField::
activeBaffleVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchVectorField(p, iF),
pName_("p"),
cyclicPatchName_(dict.lookup("cyclicPatch")),
cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)),
orientation_(readLabel(dict.lookup("orientation"))),
initWallSf_(p.Sf()),
initCyclicSf_(p.boundaryMesh()[cyclicPatchLabel_].Sf()),
openFraction_(readScalar(dict.lookup("openFraction"))),
openingTime_(readScalar(dict.lookup("openingTime"))),
maxOpenFractionDelta_(readScalar(dict.lookup("maxOpenFractionDelta"))),
curTimeIndex_(-1)
{
fvPatchVectorField::operator=(vector::zero);
if (dict.found("p"))
{
dict.lookup("p") >> pName_;
}
}
Foam::activeBaffleVelocityFvPatchVectorField::
activeBaffleVelocityFvPatchVectorField
(
const activeBaffleVelocityFvPatchVectorField& ptf
)
:
fixedValueFvPatchVectorField(ptf),
pName_(ptf.pName_),
cyclicPatchName_(ptf.cyclicPatchName_),
cyclicPatchLabel_(ptf.cyclicPatchLabel_),
orientation_(ptf.orientation_),
initWallSf_(ptf.initWallSf_),
initCyclicSf_(ptf.initCyclicSf_),
openFraction_(ptf.openFraction_),
openingTime_(ptf.openingTime_),
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
curTimeIndex_(-1)
{}
Foam::activeBaffleVelocityFvPatchVectorField::
activeBaffleVelocityFvPatchVectorField
(
const activeBaffleVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchVectorField(ptf, iF),
pName_(ptf.pName_),
cyclicPatchName_(ptf.cyclicPatchName_),
cyclicPatchLabel_(ptf.cyclicPatchLabel_),
orientation_(ptf.orientation_),
initWallSf_(ptf.initWallSf_),
initCyclicSf_(ptf.initCyclicSf_),
openFraction_(ptf.openFraction_),
openingTime_(ptf.openingTime_),
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
curTimeIndex_(-1)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::activeBaffleVelocityFvPatchVectorField::autoMap
(
const fvPatchFieldMapper& m
)
{
fixedValueFvPatchVectorField::autoMap(m);
//- Note: cannot map field from cyclic patch anyway so just recalculate
// Areas should be consistent when doing autoMap except in case of
// topo changes.
initWallSf_ = patch().Sf();
initCyclicSf_ = patch().boundaryMesh()[cyclicPatchLabel_].Sf();
}
void Foam::activeBaffleVelocityFvPatchVectorField::rmap
(
const fvPatchVectorField& ptf,
const labelList& addr
)
{
fixedValueFvPatchVectorField::rmap(ptf, addr);
//- Note: cannot map field from cyclic patch anyway so just recalculate
// Areas should be consistent when doing rmap (mainly reconstructPar)
initWallSf_ = patch().Sf();
initCyclicSf_ = patch().boundaryMesh()[cyclicPatchLabel_].Sf();
}
void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
// Execute the change to the openFraction only once per time-step
if (curTimeIndex_ != this->db().time().timeIndex())
{
const volScalarField& p = db().lookupObject<volScalarField>
(
pName_
);
const fvPatch& cyclicPatch = patch().boundaryMesh()[cyclicPatchLabel_];
const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
label nCyclicFaces = cyclicFaceCells.size();
label nCyclicFacesPerSide = nCyclicFaces/2;
scalar forceDiff = 0;
for (label facei=0; facei<nCyclicFacesPerSide; facei++)
{
forceDiff += p[cyclicFaceCells[facei]]*mag(initCyclicSf_[facei]);
}
for (label facei=nCyclicFacesPerSide; facei<nCyclicFaces; facei++)
{
forceDiff -= p[cyclicFaceCells[facei]]*mag(initCyclicSf_[facei]);
}
openFraction_ =
max(min(
openFraction_
+ max
(
this->db().time().deltaT().value()/openingTime_,
maxOpenFractionDelta_
)
*(orientation_*sign(forceDiff)),
1 - 1e-6), 1e-6);
Info<< "openFraction = " << openFraction_ << endl;
vectorField::subField Sfw = patch().patch().faceAreas();
vectorField newSfw = (1 - openFraction_)*initWallSf_;
forAll(Sfw, facei)
{
Sfw[facei] = newSfw[facei];
}
const_cast<scalarField&>(patch().magSf()) = mag(patch().Sf());
const_cast<vectorField&>(cyclicPatch.Sf()) =
openFraction_*initCyclicSf_;
const_cast<scalarField&>(cyclicPatch.magSf()) =
mag(cyclicPatch.Sf());
curTimeIndex_ = this->db().time().timeIndex();
}
fixedValueFvPatchVectorField::updateCoeffs();
}
void Foam::activeBaffleVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("cyclicPatch")
<< cyclicPatchName_ << token::END_STATEMENT << nl;
os.writeKeyword("orientation")
<< orientation_ << token::END_STATEMENT << nl;
os.writeKeyword("openingTime")
<< openingTime_ << token::END_STATEMENT << nl;
os.writeKeyword("maxOpenFractionDelta")
<< maxOpenFractionDelta_ << token::END_STATEMENT << nl;
os.writeKeyword("openFraction")
<< openFraction_ << token::END_STATEMENT << nl;
os.writeKeyword("p")
<< pName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
activeBaffleVelocityFvPatchVectorField
);
}
// ************************************************************************* //

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
Foam::activeBaffleVelocityFvPatchVectorField
Description
Boundary condition that modifies mesh areas based on velocity.
SourceFiles
activeBaffleVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef activeBaffleVelocityFvPatchVectorField_H
#define activeBaffleVelocityFvPatchVectorField_H
#include "fvPatchFields.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class activeBaffleVelocityFvPatch Declaration
\*---------------------------------------------------------------------------*/
class activeBaffleVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Name of the pressure field used to calculate the force
// on the active baffle
word pName_;
//- Name of the cyclic patch used when the active baffle is open
word cyclicPatchName_;
//- Index of the cyclic patch used when the active baffle is open
label cyclicPatchLabel_;
//- Orientation (1 or -1) of the active baffle patch.
// Used to change the direction of opening without the need for
// reordering the patch faces
label orientation_;
//- Initial wall patch areas
vectorField initWallSf_;
//- Initial cyclic patch areas
vectorField initCyclicSf_;
//- Current fraction of the active baffle which is open
scalar openFraction_;
//- Time taken for the active baffle to open
scalar openingTime_;
//- Maximum fractional change to the active baffle openness
// per time-step
scalar maxOpenFractionDelta_;
label curTimeIndex_;
public:
//- Runtime type information
TypeName("activeBaffleVelocity");
// Constructors
//- Construct from patch and internal field
activeBaffleVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
activeBaffleVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given activeBaffleVelocityFvPatchVectorField
// onto a new patch
activeBaffleVelocityFvPatchVectorField
(
const activeBaffleVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
activeBaffleVelocityFvPatchVectorField
(
const activeBaffleVelocityFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new activeBaffleVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
activeBaffleVelocityFvPatchVectorField
(
const activeBaffleVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new activeBaffleVelocityFvPatchVectorField(*this, iF)
);
}
// Member functions
// 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 fvPatchVectorField&,
const labelList&
);
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -37,7 +37,7 @@ Foam::molecule::molecule
bool readFields
)
:
Particle<molecule>(cloud, is, true),
Particle<molecule>(cloud, is, readFields),
Q_(tensor::zero),
v_(vector::zero),
a_(vector::zero),

View File

@ -30,14 +30,17 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class EquationOfState, int PolySize>
Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo(Istream& is)
Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
(
Istream& is
)
:
EquationOfState(is),
Hf_(readScalar(is)),
Sf_(readScalar(is)),
cpPolynomial_("cpPolynomial", is),
dhPolynomial_("dhPolynomial", cpPolynomial_.integrate()),
sPolynomial_("sPolynomial", cpPolynomial_.integrateMinus1())
dhPolynomial_(cpPolynomial_.integrate()),
sPolynomial_(cpPolynomial_.integrateMinus1())
{}