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

This commit is contained in:
mattijs
2011-11-18 11:35:08 +00:00
48 changed files with 1993 additions and 109 deletions

View File

@ -157,7 +157,7 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
surfaceScalarField phi("phi", aphiv_pos*rho_pos + aphiv_neg*rho_neg);
phi = aphiv_pos*rho_pos + aphiv_neg*rho_neg;
surfaceVectorField phiUp
(

View File

@ -15,8 +15,3 @@ if (pimple.momentumPredictor())
{
solve(UEqn() == -fvc::grad(p));
}
else
{
U = rAU*(UEqn().H() - fvc::grad(p));
U.correctBoundaryConditions();
}

View File

@ -19,8 +19,3 @@ if (pimple.momentumPredictor())
{
solve(UEqn() == -fvc::grad(p));
}
else
{
U = rAU*(UEqn().H() - fvc::grad(p));
U.correctBoundaryConditions();
}

View File

@ -19,8 +19,3 @@ if (pimple.momentumPredictor())
{
solve(UEqn() == -fvc::grad(p));
}
else
{
U = rAU*(UEqn().H() - fvc::grad(p));
U.correctBoundaryConditions();
}

View File

@ -15,8 +15,3 @@ if (pimple.momentumPredictor())
{
solve(UEqn() == -fvc::grad(p));
}
else
{
U = rAU*(UEqn().H() - fvc::grad(p));
U.correctBoundaryConditions();
}

View File

@ -0,0 +1,3 @@
potentialFreeSurfaceFoam.C
EXE = $(FOAM_APPBIN)/potentialFreeSurfaceFoam

View File

@ -0,0 +1,14 @@
EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \
-lincompressibleLESModels \
-lfiniteVolume \
-lmeshTools

View File

@ -0,0 +1,18 @@
tmp<fvVectorMatrix> UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
==
sources(U)
);
UEqn().relax();
sources.constrain(UEqn());
if (pimple.momentumPredictor())
{
solve(UEqn() == -fvc::grad(p_gh));
}

View File

@ -0,0 +1,121 @@
Info<< "Reading field p (kinematic)\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "createPhi.H"
singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::turbulenceModel> turbulence
(
incompressible::turbulenceModel::New(U, phi, laminarTransport)
);
#include "readGravitationalAcceleration.H"
Info<< "\nReading freeSurfaceProperties\n" << endl;
IOdictionary freeSurfaceProperties
(
IOobject
(
"freeSurfaceProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
word freeSurfacePatch(freeSurfaceProperties.lookup("freeSurfacePatch"));
label freeSurfacePatchI = mesh.boundaryMesh().findPatchID(freeSurfacePatch);
if (freeSurfacePatchI < 0)
{
FatalErrorIn(args.executable())
<< "Patch " << freeSurfacePatch << " not found. "
<< "Available patches are:" << mesh.boundaryMesh().names()
<< exit(FatalError);
}
Info<< "Creating field refLevel\n" << endl;
volVectorField refLevel
(
IOobject
(
"refLevel",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedVector("zero", dimLength, vector::zero)
);
refLevel.boundaryField()[freeSurfacePatchI]
== mesh.C().boundaryField()[freeSurfacePatchI];
Info<< "Creating field zeta\n" << endl;
volVectorField zeta
(
IOobject
(
"zeta",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector("zero", dimLength, vector::zero)
);
Info<< "Creating field p_gh\n" << endl;
volScalarField p_gh
(
IOobject
(
"p_gh",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
// Force p_gh to be consistent with p
// Height is made relative to field 'refLevel'
p_gh = p - (g & (mesh.C() + zeta - refLevel));
label p_ghRefCell = 0;
scalar p_ghRefValue = 0.0;
setRefCell(p_gh, pimple.dict(), p_ghRefCell, p_ghRefValue);
IObasicSourceList sources(mesh);

View File

@ -0,0 +1,43 @@
volScalarField rAU(1.0/UEqn().A());
surfaceScalarField rAUf(rAU.name() + 'f', fvc::interpolate(rAU));
U = rAU*UEqn().H();
if (pimple.nCorrPISO() <= 1)
{
UEqn.clear();
}
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, U, phi);
adjustPhi(phi, U, p_gh);
// Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix p_ghEqn
(
fvm::laplacian(rAUf, p_gh) == fvc::div(phi)
);
p_ghEqn.setReference(p_ghRefCell, p_ghRefValue);
p_ghEqn.solve(mesh.solver(p_gh.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
{
phi -= p_ghEqn.flux();
}
}
#include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p_gh.relax();
p = p_gh + (g & (mesh.C() + zeta - refLevel));
U -= rAU*fvc::grad(p_gh);
U.correctBoundaryConditions();

View File

@ -0,0 +1,101 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
Application
potentialFreeSurfaceFoam
Description
Incompressible Navier-Stokes solver with inclusion of a wave height field
to enable single-phase free-surface approximations
Wave height field, zeta, used by pressure boundary conditions
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "turbulenceModel.H"
#include "pimpleControl.H"
#include "IObasicSourceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
pimpleControl pimple(mesh);
#include "createFields.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "UEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.turbCorr())
{
turbulence->correct();
}
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -393,9 +393,6 @@ void Foam::cyclicPolyPatch::calcTransforms
}
// Given a split of faces into left and right half calculate the centres
// and anchor points. Transform the left points so they align with the
// right ones.
void Foam::cyclicPolyPatch::getCentresAndAnchors
(
const primitivePatch& pp0,
@ -984,6 +981,7 @@ void Foam::cyclicPolyPatch::initMovePoints
polyPatch::initMovePoints(pBufs, p);
}
void Foam::cyclicPolyPatch::movePoints
(
PstreamBuffers& pBufs,
@ -994,11 +992,13 @@ void Foam::cyclicPolyPatch::movePoints
calcTransforms();
}
void Foam::cyclicPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
polyPatch::initUpdateMesh(pBufs);
}
void Foam::cyclicPolyPatch::updateMesh(PstreamBuffers& pBufs)
{
polyPatch::updateMesh(pBufs);
@ -1249,10 +1249,6 @@ void Foam::cyclicPolyPatch::initOrder
}
// Return new ordering. Ordering is -faceMap: for every face index
// the new face -rotation:for every new face the clockwise shift
// of the original face. Return false if nothing changes (faceMap
// is identity, rotation is 0)
bool Foam::cyclicPolyPatch::order
(
PstreamBuffers& pBufs,

View File

@ -118,7 +118,9 @@ class cyclicPolyPatch
// Face ordering
//- Calculate geometric factors of the two halves.
// Given a split of faces into left and right half calculate the
// centres and anchor points. Transform the left points so they
// align with the right ones
void getCentresAndAnchors
(
const primitivePatch& pp0,

View File

@ -108,8 +108,17 @@ public:
Type integrate(const scalar x1, const scalar x2) const;
//- Ostream Operator
friend Ostream& operator<< <Type>(Ostream&, const Constant<Type>&);
// I/O
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const Constant<Type>& cnst
);
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};

View File

@ -59,4 +59,14 @@ Foam::Ostream& Foam::operator<<
}
template<class Type>
void Foam::Constant<Type>::writeData(Ostream& os) const
{
DataEntry<Type>::writeData(os);
os << token::SPACE << value_ << token::END_STATEMENT << nl;
}
// ************************************************************************* //

View File

@ -142,12 +142,17 @@ public:
virtual Type integrate(const scalar x1, const scalar x2) const;
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream&,
const DataEntry<Type>&
);
// I/O
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const DataEntry<Type>& de
);
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};

View File

@ -31,7 +31,7 @@ template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const DataEntry<Type>&
const DataEntry<Type>& de
)
{
// Check state of Ostream
@ -40,8 +40,17 @@ Foam::Ostream& Foam::operator<<
"Ostream& operator<<(Ostream&, const DataEntry<Type>&)"
);
os << de.name_;
return os;
}
template<class Type>
void Foam::DataEntry<Type>::writeData(Ostream& os) const
{
os.writeKeyword(name_) << type();
}
// ************************************************************************* //

View File

@ -118,12 +118,17 @@ public:
Type integrate(const scalar x1, const scalar x2) const;
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream&,
const Table<Type>&
);
// I/O
//- Ostream Operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const Table<Type>& cnst
);
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};

View File

@ -59,4 +59,13 @@ Foam::Ostream& Foam::operator<<
}
template<class Type>
void Foam::Table<Type>::writeData(Ostream& os) const
{
DataEntry<Type>::writeData(os);
os << nl << indent << table_ << token::END_STATEMENT << nl;
}
// ************************************************************************* //

View File

@ -119,8 +119,17 @@ public:
scalar integrate(const scalar x1, const scalar x2) const;
//- Ostream Operator
friend Ostream& operator<<(Ostream&, const polynomial&);
// I/O
//- Ostream Operator
friend Ostream& operator<<
(
Ostream& os,
const polynomial& cnst
);
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};

View File

@ -58,4 +58,12 @@ Foam::Ostream& Foam::operator<<
}
void Foam::polynomial::writeData(Ostream& os) const
{
DataEntry<scalar>::writeData(os);
os << nl << indent << coeffs_ << token::END_STATEMENT << nl;
}
// ************************************************************************* //

View File

@ -146,6 +146,7 @@ $(derivedFvPatchFields)/pressureDirectedInletOutletVelocity/pressureDirectedInle
$(derivedFvPatchFields)/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C
@ -170,6 +171,7 @@ $(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrosta
$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/outletMappedUniformInlet/outletMappedUniformInletFvPatchFields.C
$(derivedFvPatchFields)/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C
fvsPatchFields = fields/fvsPatchFields

View File

@ -36,10 +36,11 @@ namespace Foam
template<class Type>
scalar oscillatingFixedValueFvPatchField<Type>::currentScale() const
{
return
1.0
+ amplitude_
*sin(constant::mathematical::twoPi*frequency_*this->db().time().value());
const scalar t = this->db().time().value();
const scalar a = amplitude_->value(t);
const scalar f = frequency_->value(t);
return 1.0 + a*sin(constant::mathematical::twoPi*f*t);
}
@ -54,8 +55,9 @@ oscillatingFixedValueFvPatchField<Type>::oscillatingFixedValueFvPatchField
:
fixedValueFvPatchField<Type>(p, iF),
refValue_(p.size()),
amplitude_(0.0),
frequency_(0.0),
offset_(pTraits<Type>::zero),
amplitude_(),
frequency_(),
curTimeIndex_(-1)
{}
@ -71,8 +73,9 @@ oscillatingFixedValueFvPatchField<Type>::oscillatingFixedValueFvPatchField
:
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
refValue_(ptf.refValue_, mapper),
amplitude_(ptf.amplitude_),
frequency_(ptf.frequency_),
offset_(ptf.offset_),
amplitude_(ptf.amplitude_().clone().ptr()),
frequency_(ptf.frequency_().clone().ptr()),
curTimeIndex_(-1)
{}
@ -87,8 +90,9 @@ oscillatingFixedValueFvPatchField<Type>::oscillatingFixedValueFvPatchField
:
fixedValueFvPatchField<Type>(p, iF),
refValue_("refValue", dict, p.size()),
amplitude_(readScalar(dict.lookup("amplitude"))),
frequency_(readScalar(dict.lookup("frequency"))),
offset_(dict.lookupOrDefault<Type>("offset", pTraits<Type>::zero)),
amplitude_(DataEntry<scalar>::New("amplitude", dict)),
frequency_(DataEntry<scalar>::New("frequency", dict)),
curTimeIndex_(-1)
{
if (dict.found("value"))
@ -113,8 +117,9 @@ oscillatingFixedValueFvPatchField<Type>::oscillatingFixedValueFvPatchField
:
fixedValueFvPatchField<Type>(ptf),
refValue_(ptf.refValue_),
amplitude_(ptf.amplitude_),
frequency_(ptf.frequency_),
offset_(ptf.offset_),
amplitude_(ptf.amplitude_().clone().ptr()),
frequency_(ptf.frequency_().clone().ptr()),
curTimeIndex_(-1)
{}
@ -128,8 +133,9 @@ oscillatingFixedValueFvPatchField<Type>::oscillatingFixedValueFvPatchField
:
fixedValueFvPatchField<Type>(ptf, iF),
refValue_(ptf.refValue_),
amplitude_(ptf.amplitude_),
frequency_(ptf.frequency_),
offset_(ptf.offset_),
amplitude_(ptf.amplitude_().clone().ptr()),
frequency_(ptf.frequency_().clone().ptr()),
curTimeIndex_(-1)
{}
@ -175,7 +181,7 @@ void oscillatingFixedValueFvPatchField<Type>::updateCoeffs()
{
Field<Type>& patchField = *this;
patchField = refValue_*currentScale();
patchField = refValue_*currentScale() + offset_;
curTimeIndex_ = this->db().time().timeIndex();
}
@ -189,10 +195,9 @@ void oscillatingFixedValueFvPatchField<Type>::write(Ostream& os) const
{
fixedValueFvPatchField<Type>::write(os);
refValue_.writeEntry("refValue", os);
os.writeKeyword("amplitude")
<< amplitude_ << token::END_STATEMENT << nl;
os.writeKeyword("frequency")
<< frequency_ << token::END_STATEMENT << nl;
os.writeKeyword("offset") << offset_ << token::END_STATEMENT << nl;
amplitude_->writeData(os);
frequency_->writeData(os);
}

View File

@ -37,6 +37,7 @@ SourceFiles
#include "Random.H"
#include "fixedValueFvPatchFields.H"
#include "DataEntry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,11 +58,14 @@ class oscillatingFixedValueFvPatchField
//- Reference value
Field<Type> refValue_;
//- Offset
Type offset_;
//- Amplitude
scalar amplitude_;
autoPtr<DataEntry<scalar> > amplitude_;
//- Frequency
scalar frequency_;
autoPtr<DataEntry<scalar> > frequency_;
//- Current time index
label curTimeIndex_;

View File

@ -0,0 +1,204 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "pressureInletOutletParSlipVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::
pressureInletOutletParSlipVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
mixedFvPatchVectorField(p, iF),
phiName_("phi"),
rhoName_("rho")
{
refValue() = *this;
refGrad() = vector::zero;
valueFraction() = 0.0;
}
Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::
pressureInletOutletParSlipVelocityFvPatchVectorField
(
const pressureInletOutletParSlipVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchVectorField(ptf, p, iF, mapper),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{}
Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::
pressureInletOutletParSlipVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchVectorField(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
refValue() = *this;
refGrad() = vector::zero;
valueFraction() = 0.0;
}
Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::
pressureInletOutletParSlipVelocityFvPatchVectorField
(
const pressureInletOutletParSlipVelocityFvPatchVectorField& pivpvf
)
:
mixedFvPatchVectorField(pivpvf),
phiName_(pivpvf.phiName_),
rhoName_(pivpvf.rhoName_)
{}
Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::
pressureInletOutletParSlipVelocityFvPatchVectorField
(
const pressureInletOutletParSlipVelocityFvPatchVectorField& pivpvf,
const DimensionedField<vector, volMesh>& iF
)
:
mixedFvPatchVectorField(pivpvf, iF),
phiName_(pivpvf.phiName_),
rhoName_(pivpvf.rhoName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
const label patchI = patch().index();
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
tmp<vectorField> n = patch().nf();
const Field<scalar>& magS = patch().magSf();
const volVectorField& U = db().lookupObject<volVectorField>("U");
vectorField Uc = U.boundaryField()[patchI].patchInternalField();
Uc -= n()*(Uc & n());
if (phi.dimensions() == dimVelocity*dimArea)
{
refValue() = Uc + n*phip/magS;
}
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
refValue() = Uc + n*phip/(rhop*magS);
}
else
{
FatalErrorIn
(
"pressureInletOutletParSlipVelocityFvPatchVectorField::"
"updateCoeffs()"
) << "dimensions of phi are not correct" << nl
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
}
valueFraction() = 1.0 - pos(phip);
mixedFvPatchVectorField::updateCoeffs();
}
void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::write
(
Ostream& os
) const
{
fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::operator=
(
const fvPatchField<vector>& pvf
)
{
fvPatchField<vector>::operator=
(
valueFraction()*(patch().nf()*(patch().nf() & pvf))
+ (1 - valueFraction())*pvf
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
pressureInletOutletParSlipVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,191 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::pressureInletOutletParSlipVelocityFvPatchVectorField
Description
Velocity inlet/outlet boundary condition for pressure boundary where the
pressure is specified. zero-gradient is applied for outflow (as defined
by the flux) and for inflow the velocity is obtained from the flux with
the specified `inletDirection'.
Slip condition applied tangential to the patch.
SourceFiles
pressureInletOutletParSlipVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef pressureInletOutletParSlipVelocityFvPatchVectorField_H
#define pressureInletOutletParSlipVelocityFvPatchVectorField_H
#include "fvPatchFields.H"
#include "mixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pressureInletOutletParSlipVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class pressureInletOutletParSlipVelocityFvPatchVectorField
:
public mixedFvPatchVectorField
{
// Private data
word phiName_;
word rhoName_;
public:
//- Runtime type information
TypeName("pressureInletOutletParSlipVelocity");
// Constructors
//- Construct from patch and internal field
pressureInletOutletParSlipVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct by mapping given
// pressureInletOutletParSlipVelocityFvPatchVectorField
// onto a new patch
pressureInletOutletParSlipVelocityFvPatchVectorField
(
const pressureInletOutletParSlipVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct from patch, internal field and dictionary
pressureInletOutletParSlipVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct as copy
pressureInletOutletParSlipVelocityFvPatchVectorField
(
const pressureInletOutletParSlipVelocityFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new pressureInletOutletParSlipVelocityFvPatchVectorField
(
*this
)
);
}
//- Construct as copy setting internal field reference
pressureInletOutletParSlipVelocityFvPatchVectorField
(
const pressureInletOutletParSlipVelocityFvPatchVectorField&,
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 pressureInletOutletParSlipVelocityFvPatchVectorField
(
*this,
iF
)
);
}
// Member functions
// Access
//- Return the name of rho
const word& rhoName() const
{
return rhoName_;
}
//- Return reference to the name of rho to allow adjustment
word& rhoName()
{
return rhoName_;
}
//- Return the name of phi
const word& phiName() const
{
return phiName_;
}
//- Return reference to the name of phi to allow adjustment
word& phiName()
{
return phiName_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
// Member operators
virtual void operator=(const fvPatchField<vector>& pvf);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,240 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "waveSurfacePressureFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "uniformDimensionedFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::waveSurfacePressureFvPatchScalarField::
waveSurfacePressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
phiName_("phi"),
rhoName_("rho"),
zetaName_("zeta"),
zeta0_(p.size(), vector::zero),
curTimeIndex_(-1)
{}
Foam::waveSurfacePressureFvPatchScalarField::
waveSurfacePressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
zetaName_(dict.lookupOrDefault<word>("zeta", "zeta")),
zeta0_(p.size(), vector::zero),
curTimeIndex_(-1)
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
Foam::waveSurfacePressureFvPatchScalarField::
waveSurfacePressureFvPatchScalarField
(
const waveSurfacePressureFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_),
zetaName_(ptf.zetaName_),
zeta0_(ptf.zeta0_),
curTimeIndex_(-1)
{}
Foam::waveSurfacePressureFvPatchScalarField::
waveSurfacePressureFvPatchScalarField
(
const waveSurfacePressureFvPatchScalarField& wspsf
)
:
fixedValueFvPatchScalarField(wspsf),
phiName_(wspsf.phiName_),
rhoName_(wspsf.rhoName_),
zetaName_(wspsf.zetaName_),
zeta0_(wspsf.zeta0_),
curTimeIndex_(wspsf.curTimeIndex_)
{}
Foam::waveSurfacePressureFvPatchScalarField::
waveSurfacePressureFvPatchScalarField
(
const waveSurfacePressureFvPatchScalarField& wspsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(wspsf, iF),
phiName_(wspsf.phiName_),
rhoName_(wspsf.rhoName_),
zetaName_(wspsf.zetaName_),
zeta0_(wspsf.zeta0_),
curTimeIndex_(wspsf.curTimeIndex_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::waveSurfacePressureFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
fixedValueFvPatchScalarField::autoMap(m);
zeta0_.autoMap(m);
}
void Foam::waveSurfacePressureFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
)
{
fixedValueFvPatchScalarField::rmap(ptf, addr);
const waveSurfacePressureFvPatchScalarField& wspsf =
refCast<const waveSurfacePressureFvPatchScalarField>(ptf);
zeta0_.rmap(wspsf.zeta0_, addr);
}
void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const scalar dt = db().time().deltaTValue();
const scalar timeI = db().time().timeIndex();
const scalar patchI = patch().index();
volVectorField& zeta =
const_cast<volVectorField&>
(
db().lookupObject<volVectorField>(zetaName_)
);
vectorField& zetap = zeta.boundaryField()[patchI];
if (curTimeIndex_ != timeI)
{
zeta0_ = zetap;
curTimeIndex_ = timeI;
}
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
const scalarField& phip = phi.boundaryField()[patchI];
const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>("g");
tmp<vectorField> nf(patch().nf());
if (phi.dimensions() == dimVelocity*dimArea)
{
zetap = zeta0_ + nf()*dt*phip/patch().magSf();
operator==(-g.value() & zetap);
}
else if (phi.dimensions() = dimDensity*dimVelocity*dimArea)
{
const scalarField& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
zetap = zeta0_ + nf()*dt*phip/rhop/patch().magSf();
operator==(-rhop*(g.value() & zetap));
}
else
{
FatalErrorIn
(
"waveSurfacePressureFvPatchScalarField::updateCoeffs()"
)
<< "dimensions of phi are incorrect" << nl
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
}
Info<< "min/max mag(zetap) = " << min(zetap & nf()) << ", "
<< max(zetap & nf()) << endl;
fixedValueFvPatchScalarField::updateCoeffs();
}
void Foam::waveSurfacePressureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
writeEntryIfDifferent<word>(os, "zeta", "zeta", zetaName_);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
waveSurfacePressureFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,191 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::waveSurfacePressureFvPatchScalarField
Description
Applies the surface wave pressure, based on the wave height
p = -rho.g.zeta
Where
p = pressure - kinematic of dynamic depending on the flux units
zeta = wave height vector [m]
g = acceleration due to gravity [m/s2]
Note:
This boundary also updates the wave height boundary field, which
is accessed via lookup from the database
SourceFiles
waveSurfacePressureFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef waveSurfacePressureFvPatchScalarField_H
#define waveSurfacePressureFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class waveSurfacePressureFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class waveSurfacePressureFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
//- Flux field name
word phiName_;
//- Density field name (if compressible)
word rhoName_;
//- Wave height field name
word zetaName_;
//- Old-time zeta patch value
vectorField zeta0_;
//- Current time index used to store ms0_
label curTimeIndex_;
public:
//- Runtime type information
TypeName("waveSurfacePressure");
// Constructors
//- Construct from patch and internal field
waveSurfacePressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
waveSurfacePressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given waveSurfacePressureFvPatchScalarField
// onto a new patch
waveSurfacePressureFvPatchScalarField
(
const waveSurfacePressureFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
waveSurfacePressureFvPatchScalarField
(
const waveSurfacePressureFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new waveSurfacePressureFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
waveSurfacePressureFvPatchScalarField
(
const waveSurfacePressureFvPatchScalarField&,
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 waveSurfacePressureFvPatchScalarField(*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 fvPatchScalarField&,
const labelList&
);
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,8 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "AMIInterpolation.H"
#include "treeDataPrimitivePatch.H"
#include "indexedOctree.H"
#include "meshTools.H"
#include "mergePoints.H"
#include "mapDistribute.H"
@ -155,6 +153,36 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::checkPatches
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::resetTree
(
const primitivePatch& tgtPatch
)
{
// Clear the old octree
treePtr_.clear();
treeBoundBox bb(tgtPatch.points());
bb.inflate(0.01);
if (!treePtr_.valid())
{
treePtr_.reset
(
new indexedOctree<treeType>
(
treeType(false, tgtPatch),
bb, // overall search domain
8, // maxLevel
10, // leaf size
3.0 // duplicity
)
);
}
}
template<class SourcePatch, class TargetPatch>
Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution
(
@ -162,6 +190,8 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution
const primitivePatch& tgtPatch
)
{
label procI = 0;
if (Pstream::parRun())
{
List<label> facesPresentOnProc(Pstream::nProcs(), 0);
@ -181,16 +211,27 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution
if (nHaveFaces > 1)
{
return -1;
procI = -1;
if (debug)
{
Info<< "AMIInterpolation::calcDistribution: "
<< "AMI split across multiple processors" << endl;
}
}
else if (nHaveFaces == 1)
{
return findIndex(facesPresentOnProc, 1);
procI = findIndex(facesPresentOnProc, 1);
if (debug)
{
Info<< "AMIInterpolation::calcDistribution: "
<< "AMI local to processor" << procI << endl;
}
}
}
// Either not parallel or no faces on any processor
return 0;
return procI;
}
@ -644,33 +685,18 @@ template<class SourcePatch, class TargetPatch>
Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::findTargetFace
(
const label srcFaceI,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch
const primitivePatch& srcPatch
) const
{
label targetFaceI = -1;
treeBoundBox bb(tgtPatch.points());
bb.inflate(0.01);
typedef treeDataPrimitivePatch<face, SubList, const pointField&> treeType;
indexedOctree<treeType> tree
(
treeType(false, tgtPatch),
bb, // overall search domain
8, // maxLevel
10, // leaf size
3.0 // duplicity
);
const pointField& srcPts = srcPatch.points();
const face& srcFace = srcPatch[srcFaceI];
const point& srcPt = srcFace.centre(srcPts);
const scalar srcFaceArea = srcFace.mag(srcPts);
// pointIndexHit sample = tree.findNearest(srcPt, sqr(0.1*bb.mag()));
pointIndexHit sample = tree.findNearest(srcPt, 10.0*srcFaceArea);
// pointIndexHit sample = treePtr_->findNearest(srcPt, sqr(0.1*bb.mag()));
pointIndexHit sample = treePtr_->findNearest(srcPt, 10.0*srcFaceArea);
if (debug)
@ -828,7 +854,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::setNextFaces
}
srcFaceI = faceI;
tgtFaceI = findTargetFace(srcFaceI, srcPatch0, tgtPatch0);
tgtFaceI = findTargetFace(srcFaceI, srcPatch0);
if (tgtFaceI >= 0)
{
@ -932,6 +958,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing
return;
}
resetTree(tgtPatch);
// temporary storage for addressing and weights
List<DynamicList<label> > srcAddr(srcPatch.size());
List<DynamicList<scalar> > srcWght(srcPatch.size());
@ -948,7 +976,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing
bool foundFace = false;
forAll(srcPatch, faceI)
{
tgtFaceI = findTargetFace(faceI, srcPatch, tgtPatch);
tgtFaceI = findTargetFace(faceI, srcPatch);
if (tgtFaceI >= 0)
{
srcFaceI = faceI;
@ -1799,7 +1827,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
if (debug)
{
Info<< "AMIInterpolation : Constructed addressing and weights." << nl
Info<< "AMIInterpolation : Constructed addressing and weights" << nl
<< " triMode :" << triMode_ << nl
<< " singlePatchProc:" << singlePatchProc_ << nl
<< " srcMagSf :" << gSum(srcMagSf_) << nl

View File

@ -50,7 +50,8 @@ SourceFiles
#include "boolList.H"
#include "primitivePatch.H"
#include "faceAreaIntersect.H"
#include "treeBoundBox.H"
#include "indexedOctree.H"
#include "treeDataPrimitivePatch.H"
#include "treeBoundBoxList.H"
#include "globalIndex.H"
#include "ops.H"
@ -76,6 +77,8 @@ class AMIInterpolation
:
public AMIInterpolationName
{
//- local typedef to octree tree-type
typedef treeDataPrimitivePatch<face, SubList, const pointField&> treeType;
//- Helper class for list
template<class T>
@ -135,6 +138,9 @@ class AMIInterpolation
scalarListList tgtWeights_;
//- Octree used to find face seeds
autoPtr<indexedOctree<treeType> > treePtr_;
//- Starting face seed index
label startSeedI_;
@ -176,6 +182,10 @@ class AMIInterpolation
const primitivePatch& tgtPatch
);
//- Reset the octree for the traget patch face search
void resetTree(const primitivePatch& tgtPatch);
// Parallel functionality
@ -236,8 +246,7 @@ class AMIInterpolation
label findTargetFace
(
const label srcFaceI,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch
const primitivePatch& srcPatch
) const;
//- Add faces neighbouring faceI to the ID list

View File

@ -78,8 +78,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
fixedGradientFvPatchScalarField(p, iF),
heatSource_(hsPower),
q_(p.size(), 0.0),
alphaEffName_("undefinedAlphaEff"),
CpName_("undefinedCp")
alphaEffName_("undefinedAlphaEff")
{}
@ -95,8 +94,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
heatSource_(ptf.heatSource_),
q_(ptf.q_, mapper),
alphaEffName_(ptf.alphaEffName_),
CpName_(ptf.CpName_)
alphaEffName_(ptf.alphaEffName_)
{}
@ -111,8 +109,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
fixedGradientFvPatchScalarField(p, iF),
heatSource_(heatSourceTypeNames_.read(dict.lookup("heatSource"))),
q_("q", dict, p.size()),
alphaEffName_(dict.lookup("alphaEff")),
CpName_(dict.lookup("Cp"))
alphaEffName_(dict.lookup("alphaEff"))
{
fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0;
@ -128,8 +125,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
fixedGradientFvPatchScalarField(thftpsf),
heatSource_(thftpsf.heatSource_),
q_(thftpsf.q_),
alphaEffName_(thftpsf.alphaEffName_),
CpName_(thftpsf.CpName_)
alphaEffName_(thftpsf.alphaEffName_)
{}
@ -143,8 +139,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
fixedGradientFvPatchScalarField(thftpsf, iF),
heatSource_(thftpsf.heatSource_),
q_(thftpsf.q_),
alphaEffName_(thftpsf.alphaEffName_),
CpName_(thftpsf.CpName_)
alphaEffName_(thftpsf.alphaEffName_)
{}

View File

@ -98,9 +98,6 @@ private:
//- Name of effective thermal diffusivity field
word alphaEffName_;
//- Name of specific heat capacity field
word CpName_;
public:

View File

@ -0,0 +1,55 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
freeSurface
{
type pressureInletOutletParSlipVelocity;
value uniform (0 0 0);
}
walls
{
type fixedValue;
value uniform (0 0 0);
}
floatingObject
{
type oscillatingFixedValue;
refValue uniform (0 1 0);
offset (0 -1 0);
amplitude table
(
( 0 0)
( 10 0.025)
(1000 0.025)
);
frequency constant 1;
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
freeSurface
{
type calculated;
value uniform 0;
}
walls
{
type calculated;
value uniform 0;
}
floatingObject
{
type calculated;
value uniform 0;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p_gh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
freeSurface
{
type waveSurfacePressure;
value uniform 0;
}
walls
{
type zeroGradient;
}
floatingObject
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf 0
rm -rf poolHeight poolHeight_vs_time

View File

@ -0,0 +1,17 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Set application name
application=`getApplication`
runApplication blockMesh
runApplication topoSet
runApplication subsetMesh -overwrite c0 -patch floatingObject
cp -r 0.org 0 > /dev/null 2>&1
runApplication $application
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object freeSurfaceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
freeSurfacePatch freeSurface;
// ************************************************************************* //

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value ( 0 -9.81 0 );
// ************************************************************************* //

View File

@ -0,0 +1,82 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
( 0 0 0)
(10 0 0)
(10 1 0)
( 0 1 0)
( 0 0 0.1)
(10 0 0.1)
(10 1 0.1)
( 0 1 0.1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (200 20 1) simpleGrading (10 0.1 1)
);
edges
(
);
boundary
(
freeSurface
{
type wall;
faces
(
(3 7 6 2)
);
}
walls
{
type wall;
faces
(
(0 4 7 3)
(2 6 5 1)
(1 5 4 0)
);
}
floatingObject
{
type wall;
faces
(
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(4 5 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
4
(
freeSurface
{
type wall;
nFaces 181;
startFace 7429;
}
walls
{
type wall;
nFaces 240;
startFace 7610;
}
floatingObject
{
type wall;
nFaces 37;
startFace 7850;
}
frontAndBack
{
type empty;
nFaces 7658;
startFace 7887;
}
)
// ************************************************************************* //

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 1e-06;
// ************************************************************************* //

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,2 @@
awk '{print $1 " " $4}' poolHeight/0/faceSource.dat > poolHeight_vs_time

View File

@ -0,0 +1,91 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application potentialFreeSurfaceFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 20;
deltaT 0.001;
writeControl adjustableRunTime;
writeInterval 0.02;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.4;
maxDeltaT 1;
functions
{
forces
{
type forces;
functionObjectLibs ("libforces.so");
outputControl outputTime;
outputInterval 1;
patches (floatingObject);
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1000;
CofR (0 0 0);
}
poolHeight
{
type faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");
enabled true;
outputControl timeStep;
timeInteval 1;
log true;
valueOutput false;
source faceZone;
sourceName f0;
operation areaAverage;
fields
(
zeta
);
}
};
// ************************************************************************* //

View File

@ -0,0 +1,60 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
grad(U) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss upwind;
div((nuEff*dev(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
interpolate(U) linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
p_gh;
}
// ************************************************************************* //

View File

@ -0,0 +1,67 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p_gh
{
solver GAMG;
tolerance 1e-7;
relTol 0.1;
smoother DICGaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
maxIter 100;
}
p_ghFinal
{
$p_gh;
tolerance 1e-7;
relTol 0;
}
U
{
solver smoothSolver;
smoother GaussSeidel;
tolerance 1e-7;
relTol 0.1;
}
UFinal
{
$U;
tolerance 1e-7;
relTol 0;
}
}
PIMPLE
{
momentumPredictor no;
nOuterCorrectors 1;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,71 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name c0;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (0.1 0.8 -100) (0.4 100 100);
}
}
{
name c0;
type cellSet;
action invert;
}
{
name f0;
type faceSet;
action new;
source patchToFace;
sourceInfo
{
name freeSurface;
}
}
{
name f0;
type faceSet;
action subset;
source boxToFace;
sourceInfo
{
box (-100 0.9 -100) (0.2 100 100);
}
}
{
name f0;
type faceZoneSet;
action new;
source setToFaceZone;
sourceInfo
{
faceSet f0;
}
}
);
// ************************************************************************* //