mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
adding ras/les cavitation solvers
This commit is contained in:
@ -0,0 +1,59 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
Global
|
||||
CourantNo
|
||||
|
||||
Description
|
||||
Calculates and outputs the mean and maximum Courant Numbers.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
scalar CoNum = 0.0;
|
||||
scalar meanCoNum = 0.0;
|
||||
scalar acousticCoNum = 0.0;
|
||||
|
||||
if (mesh.nInternalFaces())
|
||||
{
|
||||
surfaceScalarField SfUfbyDelta =
|
||||
mesh.surfaceInterpolation::deltaCoeffs()*mag(phiv);
|
||||
|
||||
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||
.value()*runTime.deltaT().value();
|
||||
|
||||
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||
.value()*runTime.deltaT().value();
|
||||
|
||||
acousticCoNum = max
|
||||
(
|
||||
mesh.surfaceInterpolation::deltaCoeffs()/sqrt(fvc::interpolate(psi))
|
||||
).value()*runTime.deltaT().value();
|
||||
}
|
||||
|
||||
Info<< "phiv Courant Number mean: " << meanCoNum
|
||||
<< " max: " << CoNum
|
||||
<< " acoustic max: " << acousticCoNum
|
||||
<< endl;
|
||||
|
||||
// ************************************************************************* //
|
||||
10
applications/solvers/multiphase/lesCavitatingFoam/Make/files
Normal file
10
applications/solvers/multiphase/lesCavitatingFoam/Make/files
Normal file
@ -0,0 +1,10 @@
|
||||
lesCavitatingFoam.C
|
||||
compressibilityModels/compressibilityModel/compressibilityModel.C
|
||||
compressibilityModels/compressibilityModel/newCompressibilityModel.C
|
||||
compressibilityModels/linear/linear.C
|
||||
compressibilityModels/Wallis/Wallis.C
|
||||
compressibilityModels/Chung/Chung.C
|
||||
|
||||
devOneEqEddy/devOneEqEddy.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/lesCavitatingFoam
|
||||
@ -0,0 +1,15 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/LESmodels \
|
||||
-I$(LIB_SRC)/LESmodels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/LESmodels/LESdeltas/lnInclude \
|
||||
-IcompressibilityModels/compressibilityModel
|
||||
|
||||
EXE_LIBS = \
|
||||
-lincompressibleTransportModels \
|
||||
-lincompressibleLESmodels \
|
||||
-lfiniteVolume
|
||||
|
||||
21
applications/solvers/multiphase/lesCavitatingFoam/UEqn.H
Normal file
21
applications/solvers/multiphase/lesCavitatingFoam/UEqn.H
Normal file
@ -0,0 +1,21 @@
|
||||
surfaceScalarField gammaf = fvc::interpolate(gamma);
|
||||
surfaceScalarField muf
|
||||
(
|
||||
"muf",
|
||||
gammaf*muv + (1.0 - gammaf)*mul
|
||||
+ fvc::interpolate(rho*turbulence->nuSgs())
|
||||
);
|
||||
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
- fvm::laplacian(muf, U)
|
||||
//- (fvc::grad(U) & fvc::grad(muf))
|
||||
- fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
|
||||
);
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
Info << "Calculating averages" << endl;
|
||||
|
||||
scalar alpha =
|
||||
(runTime.value() - timeToStartAveraging - runTime.deltaT().value())
|
||||
/(runTime.value() - timeToStartAveraging);
|
||||
|
||||
scalar onemAlpha = 1.0 - alpha;
|
||||
|
||||
Umean == alpha*Umean + onemAlpha*U;
|
||||
rhoMean == alpha*rhoMean + onemAlpha*rho;
|
||||
pMean == alpha*pMean + onemAlpha*p;
|
||||
gammaMean == alpha*gammaMean + onemAlpha*gamma;
|
||||
@ -0,0 +1,95 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "Chung.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(Chung, 0);
|
||||
addToRunTimeSelectionTable(compressibilityModel, Chung, dictionary);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::compressibilityModels::Chung::Chung
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
)
|
||||
:
|
||||
compressibilityModel(compressibilityProperties, gamma),
|
||||
psiv_(compressibilityProperties_.lookup("psiv")),
|
||||
psil_(compressibilityProperties_.lookup("psil")),
|
||||
rhovSat_(compressibilityProperties_.lookup("rhovSat")),
|
||||
rholSat_(compressibilityProperties_.lookup("rholSat"))
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::compressibilityModels::Chung::correct()
|
||||
{
|
||||
volScalarField sfa = sqrt
|
||||
(
|
||||
(rhovSat_/psiv_)
|
||||
/((scalar(1) - gamma_)*rhovSat_/psiv_ + gamma_*rholSat_/psil_)
|
||||
);
|
||||
|
||||
psi_ = sqr
|
||||
(
|
||||
((scalar(1) - gamma_)/sqrt(psiv_) + gamma_*sfa/sqrt(psil_))
|
||||
*sqrt(psiv_*psil_)/sfa
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::compressibilityModels::Chung::read
|
||||
(
|
||||
const dictionary& compressibilityProperties
|
||||
)
|
||||
{
|
||||
compressibilityModel::read(compressibilityProperties);
|
||||
|
||||
compressibilityProperties_.lookup("psiv") >> psiv_;
|
||||
compressibilityProperties_.lookup("psil") >> psil_;
|
||||
compressibilityProperties_.lookup("rhovSat") >> rhovSat_;
|
||||
compressibilityProperties_.lookup("rholSat") >> rholSat_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,107 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::compressibilityModels::Chung
|
||||
|
||||
Description
|
||||
Chung compressibility model.
|
||||
|
||||
SourceFiles
|
||||
Chung.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Chung_H
|
||||
#define Chung_H
|
||||
|
||||
#include "compressibilityModel.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Chung Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class Chung
|
||||
:
|
||||
public compressibilityModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
dimensionedScalar psiv_;
|
||||
dimensionedScalar psil_;
|
||||
|
||||
dimensionedScalar rhovSat_;
|
||||
dimensionedScalar rholSat_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Chung");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- construct from components
|
||||
Chung
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~Chung()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the Chung compressibility
|
||||
void correct();
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
bool read(const dictionary& compressibilityProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressibilityModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,86 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "Wallis.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(Wallis, 0);
|
||||
addToRunTimeSelectionTable(compressibilityModel, Wallis, dictionary);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::compressibilityModels::Wallis::Wallis
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
)
|
||||
:
|
||||
compressibilityModel(compressibilityProperties, gamma),
|
||||
psiv_(compressibilityProperties_.lookup("psiv")),
|
||||
psil_(compressibilityProperties_.lookup("psil")),
|
||||
rhovSat_(compressibilityProperties_.lookup("rhovSat")),
|
||||
rholSat_(compressibilityProperties_.lookup("rholSat"))
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::compressibilityModels::Wallis::correct()
|
||||
{
|
||||
psi_ = (gamma_*rhovSat_ + (scalar(1) - gamma_)*rholSat_)
|
||||
*(gamma_*psiv_/rhovSat_ + (scalar(1) - gamma_)*psil_/rholSat_);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::compressibilityModels::Wallis::read
|
||||
(
|
||||
const dictionary& compressibilityProperties
|
||||
)
|
||||
{
|
||||
compressibilityModel::read(compressibilityProperties);
|
||||
|
||||
compressibilityProperties_.lookup("psiv") >> psiv_;
|
||||
compressibilityProperties_.lookup("psil") >> psil_;
|
||||
compressibilityProperties_.lookup("rhovSat") >> rhovSat_;
|
||||
compressibilityProperties_.lookup("rholSat") >> rholSat_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,107 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::compressibilityModels::Wallis
|
||||
|
||||
Description
|
||||
Wallis compressibility model.
|
||||
|
||||
SourceFiles
|
||||
Wallis.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Wallis_H
|
||||
#define Wallis_H
|
||||
|
||||
#include "compressibilityModel.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Wallis Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class Wallis
|
||||
:
|
||||
public compressibilityModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
dimensionedScalar psiv_;
|
||||
dimensionedScalar psil_;
|
||||
|
||||
dimensionedScalar rhovSat_;
|
||||
dimensionedScalar rholSat_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Wallis");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- construct from components
|
||||
Wallis
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~Wallis()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the Wallis compressibility
|
||||
void correct();
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
bool read(const dictionary& compressibilityProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressibilityModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,77 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
InClass
|
||||
compressibilityModel
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "compressibilityModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(compressibilityModel, 0);
|
||||
defineRunTimeSelectionTable(compressibilityModel, dictionary);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::compressibilityModel::compressibilityModel
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
)
|
||||
:
|
||||
compressibilityProperties_(compressibilityProperties),
|
||||
psi_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"psi",
|
||||
gamma.mesh().time().timeName(),
|
||||
gamma.mesh()
|
||||
),
|
||||
gamma.mesh(),
|
||||
dimensionedScalar("psi", dimensionSet(0, -2, 2, 0, 0), 0)
|
||||
),
|
||||
gamma_(gamma)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::compressibilityModel::read
|
||||
(
|
||||
const dictionary& compressibilityProperties
|
||||
)
|
||||
{
|
||||
compressibilityProperties_ = compressibilityProperties;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,154 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::compressibilityModel
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
compressibilityModel.C
|
||||
newCompressibilityModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef compressibilityModel_H
|
||||
#define compressibilityModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "typeInfo.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "volFields.H"
|
||||
#include "dimensionedScalar.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class compressibilityModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class compressibilityModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
dictionary compressibilityProperties_;
|
||||
|
||||
volScalarField psi_;
|
||||
const volScalarField& gamma_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
compressibilityModel(const compressibilityModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const compressibilityModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("compressibilityModel");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
compressibilityModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
),
|
||||
(compressibilityProperties, gamma)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected compressibility model
|
||||
static autoPtr<compressibilityModel> New
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
compressibilityModel
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~compressibilityModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the phase transport properties dictionary
|
||||
const dictionary& compressibilityProperties() const
|
||||
{
|
||||
return compressibilityProperties_;
|
||||
}
|
||||
|
||||
//- Return the compressibility
|
||||
const volScalarField& psi() const
|
||||
{
|
||||
return psi_;
|
||||
}
|
||||
|
||||
//- Correct the compressibility
|
||||
virtual void correct() = 0;
|
||||
|
||||
//- Read compressibilityProperties dictionary
|
||||
virtual bool read(const dictionary& compressibilityProperties) = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "compressibilityModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::compressibilityModel> Foam::compressibilityModel::New
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
)
|
||||
{
|
||||
word compressibilityModelTypeName
|
||||
(
|
||||
compressibilityProperties.lookup("compressibilityModel")
|
||||
);
|
||||
|
||||
Info<< "Selecting compressibility model "
|
||||
<< compressibilityModelTypeName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(compressibilityModelTypeName);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"compressibilityModel::New(const volScalarField&)"
|
||||
) << "Unknown compressibilityModel type "
|
||||
<< compressibilityModelTypeName << endl << endl
|
||||
<< "Valid compressibilityModels are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<compressibilityModel>
|
||||
(
|
||||
cstrIter()(compressibilityProperties, gamma)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,82 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "linear.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(linear, 0);
|
||||
addToRunTimeSelectionTable(compressibilityModel, linear, dictionary);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::compressibilityModels::linear::linear
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
)
|
||||
:
|
||||
compressibilityModel(compressibilityProperties, gamma),
|
||||
psiv_(compressibilityProperties_.lookup("psiv")),
|
||||
psil_(compressibilityProperties_.lookup("psil"))
|
||||
{
|
||||
correct();
|
||||
psi_.oldTime();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::compressibilityModels::linear::correct()
|
||||
{
|
||||
psi_ = gamma_*psiv_ + (scalar(1) - gamma_)*psil_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::compressibilityModels::linear::read
|
||||
(
|
||||
const dictionary& compressibilityProperties
|
||||
)
|
||||
{
|
||||
compressibilityModel::read(compressibilityProperties);
|
||||
|
||||
compressibilityProperties_.lookup("psiv") >> psiv_;
|
||||
compressibilityProperties_.lookup("psil") >> psil_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,104 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::compressibilityModels::linear
|
||||
|
||||
Description
|
||||
linear compressibility model.
|
||||
|
||||
SourceFiles
|
||||
linear.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef linear_H
|
||||
#define linear_H
|
||||
|
||||
#include "compressibilityModel.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class linear Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class linear
|
||||
:
|
||||
public compressibilityModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
dimensionedScalar psiv_;
|
||||
dimensionedScalar psil_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("linear");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- construct from components
|
||||
linear
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~linear()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the linear compressibility
|
||||
void correct();
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
bool read(const dictionary& compressibilityProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressibilityModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,22 @@
|
||||
{
|
||||
volScalarField thermoRho = psi*p + (1.0 - gamma)*rhol0;
|
||||
|
||||
dimensionedScalar totalMass = fvc::domainIntegrate(rho);
|
||||
|
||||
scalar sumLocalContErr =
|
||||
(
|
||||
fvc::domainIntegrate(mag(rho - thermoRho))/totalMass
|
||||
).value();
|
||||
|
||||
scalar globalContErr =
|
||||
(
|
||||
fvc::domainIntegrate(rho - thermoRho)/totalMass
|
||||
).value();
|
||||
|
||||
cumulativeContErr += globalContErr;
|
||||
|
||||
Info<< "time step continuity errors : sum local = " << sumLocalContErr
|
||||
<< ", global = " << globalContErr
|
||||
<< ", cumulative = " << cumulativeContErr
|
||||
<< endl;
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
scalar timeToStartAveraging = runTime.value();
|
||||
|
||||
volVectorField Umean
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Umean",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
U
|
||||
);
|
||||
|
||||
volScalarField rhoMean
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoMean",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
rho
|
||||
);
|
||||
|
||||
volScalarField pMean
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pMean",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
p
|
||||
);
|
||||
|
||||
volScalarField gammaMean
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"gammaMean",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
gamma
|
||||
);
|
||||
@ -0,0 +1,84 @@
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
volScalarField gamma
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"gamma",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0))
|
||||
);
|
||||
gamma.oldTime();
|
||||
|
||||
Info<< "Creating compressibilityModel\n" << endl;
|
||||
autoPtr<compressibilityModel> psiModel = compressibilityModel::New
|
||||
(
|
||||
thermodynamicProperties,
|
||||
gamma
|
||||
);
|
||||
|
||||
const volScalarField& psi = psiModel->psi();
|
||||
|
||||
rho == max
|
||||
(
|
||||
psi*p
|
||||
+ (1.0 - gamma)*rhol0
|
||||
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
|
||||
rhoMin
|
||||
);
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
# include "createPhiv.H"
|
||||
# include "compressibleCreatePhi.H"
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
twoPhaseMixture twoPhaseProperties(U, phiv, "gamma");
|
||||
|
||||
// Create LES model
|
||||
autoPtr<LESmodel> turbulence
|
||||
(
|
||||
LESmodel::New(U, phiv, twoPhaseProperties)
|
||||
);
|
||||
@ -0,0 +1,118 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "devOneEqEddy.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace LESmodels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(devOneEqEddy, 0);
|
||||
addToRunTimeSelectionTable(LESmodel, devOneEqEddy, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
devOneEqEddy::devOneEqEddy
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
transportModel& transport
|
||||
)
|
||||
:
|
||||
LESmodel(typeName, U, phi, transport),
|
||||
GenEddyVisc(U, phi, transport),
|
||||
|
||||
k_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"k",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_
|
||||
),
|
||||
|
||||
ck_(LESmodelProperties().lookup("ck"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void devOneEqEddy::correct(const tmp<volTensorField>& gradU)
|
||||
{
|
||||
GenEddyVisc::correct(gradU);
|
||||
|
||||
//volScalarField G = 2*nuSgs_*magSqr(symm(gradU));
|
||||
volScalarField G = 2*nuSgs_*(gradU() && dev(symm(gradU())));
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(k_)
|
||||
+ fvm::div(phi(), k_)
|
||||
- fvm::Sp(fvc::div(phi()), k_)
|
||||
- fvm::laplacian(DkEff(), k_)
|
||||
==
|
||||
G
|
||||
- fvm::Sp(ce_*sqrt(k_)/delta(), k_)
|
||||
);
|
||||
|
||||
bound(k_, k0());
|
||||
|
||||
nuSgs_ = ck_*sqrt(k_)*delta();
|
||||
nuSgs_.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
|
||||
bool devOneEqEddy::read()
|
||||
{
|
||||
if (GenEddyVisc::read())
|
||||
{
|
||||
LESmodelProperties().lookup("ck") >> ck_;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace LESmodels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,145 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
devOneEqEddy
|
||||
|
||||
Description
|
||||
<pre>
|
||||
One Equation Eddy Viscosity Model
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Eddy viscosity SGS model using a modeled balance equation to simulate the
|
||||
behaviour of k, hence,
|
||||
|
||||
d/dt(k) + div(U*k) - div(nuEff*grad(k))
|
||||
=
|
||||
-B*L - ce*k^3/2/delta
|
||||
|
||||
and
|
||||
|
||||
B = 2/3*k*I - 2*nuEff*dev(D)
|
||||
|
||||
where
|
||||
|
||||
D = symm(grad(U));
|
||||
nuSgs = ck*sqrt(k)*delta
|
||||
nuEff = nuSgs + nu
|
||||
</pre>
|
||||
|
||||
SourceFiles
|
||||
devOneEqEddy.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef devOneEqEddy_H
|
||||
#define devOneEqEddy_H
|
||||
|
||||
#include "GenEddyVisc.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace LESmodels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class devOneEqEddy Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class devOneEqEddy
|
||||
:
|
||||
public GenEddyVisc
|
||||
{
|
||||
// Private data
|
||||
|
||||
volScalarField k_;
|
||||
|
||||
dimensionedScalar ck_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
// Disallow default bitwise copy construct and assignment
|
||||
devOneEqEddy(const devOneEqEddy&);
|
||||
devOneEqEddy& operator=(const devOneEqEddy&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("devOneEqEddy");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Constructor from components
|
||||
devOneEqEddy
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
transportModel& transport
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~devOneEqEddy()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return SGS kinetic energy
|
||||
tmp<volScalarField> k() const
|
||||
{
|
||||
return k_;
|
||||
}
|
||||
|
||||
//- Return the effective diffusivity for k
|
||||
tmp<volScalarField> DkEff() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField("DkEff", nuSgs_ + nu())
|
||||
);
|
||||
}
|
||||
|
||||
//- Correct Eddy-Viscosity and related properties
|
||||
void correct(const tmp<volTensorField>& gradU);
|
||||
|
||||
//- Read turbulenceProperties dictionary
|
||||
bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace LESmodels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
10
applications/solvers/multiphase/lesCavitatingFoam/gammaPsi.H
Normal file
10
applications/solvers/multiphase/lesCavitatingFoam/gammaPsi.H
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
gamma = max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0));
|
||||
|
||||
Info<< "max-min gamma: " << max(gamma).value()
|
||||
<< " " << min(gamma).value() << endl;
|
||||
|
||||
psiModel->correct();
|
||||
|
||||
//Info<< "min a: " << 1.0/sqrt(max(psi)).value() << endl;
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
Application
|
||||
rasCavitatingFoam
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "compressibilityModel.H"
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "incompressible/LESmodel/LESmodel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "readThermodynamicProperties.H"
|
||||
# include "readTransportProperties.H"
|
||||
# include "readControls.H"
|
||||
# include "createFields.H"
|
||||
# include "createAverages.H"
|
||||
# include "initContinuityErrs.H"
|
||||
# include "compressibleCourantNo.H"
|
||||
# include "setInitialDeltaT.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
# include "readControls.H"
|
||||
# include "CourantNo.H"
|
||||
# include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
for (int outerCorr=0; outerCorr<nOuterCorr; outerCorr++)
|
||||
{
|
||||
# include "rhoEqn.H"
|
||||
# include "gammaPsi.H"
|
||||
# include "UEqn.H"
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
# include "pEqn.H"
|
||||
}
|
||||
}
|
||||
|
||||
# include "calculateAverages.H"
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "\n end \n";
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
80
applications/solvers/multiphase/lesCavitatingFoam/pEqn.H
Normal file
80
applications/solvers/multiphase/lesCavitatingFoam/pEqn.H
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
if (nOuterCorr == 1)
|
||||
{
|
||||
p =
|
||||
(
|
||||
rho
|
||||
- (1.0 - gamma)*rhol0
|
||||
- ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
|
||||
)/psi;
|
||||
}
|
||||
|
||||
surfaceScalarField rhof = fvc::interpolate(rho, "rhof");
|
||||
|
||||
volScalarField rUA = 1.0/UEqn.A();
|
||||
surfaceScalarField rUAf("rUAf", rhof*fvc::interpolate(rUA));
|
||||
volVectorField HbyA = rUA*UEqn.H();
|
||||
|
||||
phiv = (fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phiv);
|
||||
|
||||
p.boundaryField().updateCoeffs();
|
||||
|
||||
surfaceScalarField phiGradp = rUAf*mesh.magSf()*fvc::snGrad(p);
|
||||
|
||||
phiv -= phiGradp/rhof;
|
||||
|
||||
# include "resetPhivPatches.H"
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
- (rhol0 + (psil - psiv)*pSat)*fvc::ddt(gamma) - pSat*fvc::ddt(psi)
|
||||
+ fvc::div(phiv, rho)
|
||||
+ fvc::div(phiGradp)
|
||||
- fvm::laplacian(rUAf, p)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phiv += (phiGradp + pEqn.flux())/rhof;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "max-min p: " << max(p).value()
|
||||
<< " " << min(p).value() << endl;
|
||||
|
||||
|
||||
U = HbyA - rUA*fvc::grad(p);
|
||||
|
||||
// Remove the swirl component of velocity for "wedge" cases
|
||||
if (piso.found("removeSwirl"))
|
||||
{
|
||||
label swirlCmpt(readLabel(piso.lookup("removeSwirl")));
|
||||
|
||||
Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
|
||||
U.field().replace(swirlCmpt, 0.0);
|
||||
}
|
||||
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
Info<< "max(U) " << max(mag(U)).value() << endl;
|
||||
|
||||
rho == max
|
||||
(
|
||||
psi*p
|
||||
+ (1.0 - gamma)*rhol0
|
||||
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
|
||||
rhoMin
|
||||
);
|
||||
|
||||
Info<< "max-min rho: " << max(rho).value()
|
||||
<< " " << min(rho).value() << endl;
|
||||
|
||||
# include "gammaPsi.H"
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
scalar maxAcousticCo
|
||||
(
|
||||
readScalar(runTime.controlDict().lookup("maxAcousticCo"))
|
||||
);
|
||||
|
||||
|
||||
#include "readPISOControls.H"
|
||||
@ -0,0 +1,27 @@
|
||||
Info<< "Reading thermodynamicProperties\n" << endl;
|
||||
|
||||
IOdictionary thermodynamicProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermodynamicProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar psil(thermodynamicProperties.lookup("psil"));
|
||||
|
||||
dimensionedScalar rholSat(thermodynamicProperties.lookup("rholSat"));
|
||||
|
||||
dimensionedScalar psiv(thermodynamicProperties.lookup("psiv"));
|
||||
|
||||
dimensionedScalar pSat(thermodynamicProperties.lookup("pSat"));
|
||||
|
||||
dimensionedScalar rhovSat("rhovSat", psiv*pSat);
|
||||
|
||||
dimensionedScalar rhol0("rhol0", rholSat - pSat*psil);
|
||||
|
||||
dimensionedScalar rhoMin(thermodynamicProperties.lookup("rhoMin"));
|
||||
@ -0,0 +1,23 @@
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar mul
|
||||
(
|
||||
transportProperties.lookup("mul")
|
||||
);
|
||||
|
||||
dimensionedScalar muv
|
||||
(
|
||||
transportProperties.lookup("muv")
|
||||
);
|
||||
@ -0,0 +1,15 @@
|
||||
fvsPatchScalarFieldField& phiPatches = phi.boundaryField();
|
||||
const fvPatchScalarFieldField& rhoPatches = rho.boundaryField();
|
||||
const fvPatchVectorFieldField& Upatches = U.boundaryField();
|
||||
const fvsPatchVectorFieldField& SfPatches = mesh.Sf().boundaryField();
|
||||
|
||||
forAll(phiPatches, patchI)
|
||||
{
|
||||
if (phi.boundaryField().types()[patchI] == "calculated")
|
||||
{
|
||||
calculatedFvsPatchScalarField& phiPatch =
|
||||
refCast<calculatedFvsPatchScalarField>(phiPatches[patchI]);
|
||||
|
||||
phiPatch == ((rhoPatches[patchI]*Upatches[patchI]) & SfPatches[patchI]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
surfaceScalarField::GeometricBoundaryField& phivPatches = phiv.boundaryField();
|
||||
const volVectorField::GeometricBoundaryField& Upatches = U.boundaryField();
|
||||
const surfaceVectorField::GeometricBoundaryField& SfPatches = mesh.Sf().boundaryField();
|
||||
|
||||
forAll(phivPatches, patchI)
|
||||
{
|
||||
if (phiv.boundaryField().types()[patchI] == "calculated")
|
||||
{
|
||||
calculatedFvsPatchScalarField& phivPatch =
|
||||
refCast<calculatedFvsPatchScalarField>(phivPatches[patchI]);
|
||||
|
||||
phivPatch == (Upatches[patchI] & SfPatches[patchI]);
|
||||
}
|
||||
}
|
||||
16
applications/solvers/multiphase/lesCavitatingFoam/rhoEqn.H
Normal file
16
applications/solvers/multiphase/lesCavitatingFoam/rhoEqn.H
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
fvScalarMatrix rhoEqn
|
||||
(
|
||||
fvm::ddt(rho)
|
||||
+ fvm::div(phiv, rho)
|
||||
);
|
||||
|
||||
rhoEqn.solve();
|
||||
|
||||
phi = rhoEqn.flux();
|
||||
|
||||
Info<< "max-min rho: " << max(rho).value()
|
||||
<< " " << min(rho).value() << endl;
|
||||
|
||||
rho == max(rho, rhoMin);
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
Global
|
||||
setDeltaT
|
||||
|
||||
Description
|
||||
Reset the timestep to maintain a constant maximum courant Number.
|
||||
Reduction of time-step is imediate but increase is damped to avoid
|
||||
unstable oscillations.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
||||
|
||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
min
|
||||
(
|
||||
deltaTFact*runTime.deltaT().value(),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "deltaT = " << runTime.deltaT().value() << endl;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,54 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
Global
|
||||
setInitialDeltaT
|
||||
|
||||
Description
|
||||
Set the initial timestep corresponding to the timestep adjustment
|
||||
algorithm in setDeltaT
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
# include "CourantNo.H"
|
||||
|
||||
if (CoNum > SMALL)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
min
|
||||
(
|
||||
maxDeltaTFact*runTime.deltaT().value(),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,59 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
Global
|
||||
CourantNo
|
||||
|
||||
Description
|
||||
Calculates and outputs the mean and maximum Courant Numbers.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
scalar CoNum = 0.0;
|
||||
scalar meanCoNum = 0.0;
|
||||
scalar acousticCoNum = 0.0;
|
||||
|
||||
if (mesh.nInternalFaces())
|
||||
{
|
||||
surfaceScalarField SfUfbyDelta =
|
||||
mesh.surfaceInterpolation::deltaCoeffs()*mag(phiv);
|
||||
|
||||
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||
.value()*runTime.deltaT().value();
|
||||
|
||||
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||
.value()*runTime.deltaT().value();
|
||||
|
||||
acousticCoNum = max
|
||||
(
|
||||
mesh.surfaceInterpolation::deltaCoeffs()/sqrt(fvc::interpolate(psi))
|
||||
).value()*runTime.deltaT().value();
|
||||
}
|
||||
|
||||
Info<< "phiv Courant Number mean: " << meanCoNum
|
||||
<< " max: " << CoNum
|
||||
<< " acoustic max: " << acousticCoNum
|
||||
<< endl;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,8 @@
|
||||
rasCavitatingFoam.C
|
||||
compressibilityModels/compressibilityModel/compressibilityModel.C
|
||||
compressibilityModels/compressibilityModel/newCompressibilityModel.C
|
||||
compressibilityModels/linear/linear.C
|
||||
compressibilityModels/Wallis/Wallis.C
|
||||
compressibilityModels/Chung/Chung.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/rasCavitatingFoam
|
||||
@ -0,0 +1,13 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-IcompressibilityModels/compressibilityModel
|
||||
|
||||
EXE_LIBS = \
|
||||
-lincompressibleTransportModels \
|
||||
-lincompressibleTurbulenceModels \
|
||||
-lfiniteVolume
|
||||
|
||||
21
applications/solvers/multiphase/rasCavitatingFoam/UEqn.H
Normal file
21
applications/solvers/multiphase/rasCavitatingFoam/UEqn.H
Normal file
@ -0,0 +1,21 @@
|
||||
surfaceScalarField gammaf = fvc::interpolate(gamma);
|
||||
surfaceScalarField muf
|
||||
(
|
||||
"muf",
|
||||
gammaf*muv + (1.0 - gammaf)*mul
|
||||
+ fvc::interpolate(rho*turbulence->nuEff())
|
||||
);
|
||||
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
- fvm::laplacian(muf, U)
|
||||
//- (fvc::grad(U) & fvc::grad(muf))
|
||||
- fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
|
||||
);
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "Chung.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(Chung, 0);
|
||||
addToRunTimeSelectionTable(compressibilityModel, Chung, dictionary);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::compressibilityModels::Chung::Chung
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
)
|
||||
:
|
||||
compressibilityModel(compressibilityProperties, gamma),
|
||||
psiv_(compressibilityProperties_.lookup("psiv")),
|
||||
psil_(compressibilityProperties_.lookup("psil")),
|
||||
rhovSat_(compressibilityProperties_.lookup("rhovSat")),
|
||||
rholSat_(compressibilityProperties_.lookup("rholSat"))
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::compressibilityModels::Chung::correct()
|
||||
{
|
||||
volScalarField sfa = sqrt
|
||||
(
|
||||
(rhovSat_/psiv_)
|
||||
/((scalar(1) - gamma_)*rhovSat_/psiv_ + gamma_*rholSat_/psil_)
|
||||
);
|
||||
|
||||
psi_ = sqr
|
||||
(
|
||||
((scalar(1) - gamma_)/sqrt(psiv_) + gamma_*sfa/sqrt(psil_))
|
||||
*sqrt(psiv_*psil_)/sfa
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::compressibilityModels::Chung::read
|
||||
(
|
||||
const dictionary& compressibilityProperties
|
||||
)
|
||||
{
|
||||
compressibilityModel::read(compressibilityProperties);
|
||||
|
||||
compressibilityProperties_.lookup("psiv") >> psiv_;
|
||||
compressibilityProperties_.lookup("psil") >> psil_;
|
||||
compressibilityProperties_.lookup("rhovSat") >> rhovSat_;
|
||||
compressibilityProperties_.lookup("rholSat") >> rholSat_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,107 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::compressibilityModels::Chung
|
||||
|
||||
Description
|
||||
Chung compressibility model.
|
||||
|
||||
SourceFiles
|
||||
Chung.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Chung_H
|
||||
#define Chung_H
|
||||
|
||||
#include "compressibilityModel.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Chung Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class Chung
|
||||
:
|
||||
public compressibilityModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
dimensionedScalar psiv_;
|
||||
dimensionedScalar psil_;
|
||||
|
||||
dimensionedScalar rhovSat_;
|
||||
dimensionedScalar rholSat_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Chung");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- construct from components
|
||||
Chung
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~Chung()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the Chung compressibility
|
||||
void correct();
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
bool read(const dictionary& compressibilityProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressibilityModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,86 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "Wallis.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(Wallis, 0);
|
||||
addToRunTimeSelectionTable(compressibilityModel, Wallis, dictionary);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::compressibilityModels::Wallis::Wallis
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
)
|
||||
:
|
||||
compressibilityModel(compressibilityProperties, gamma),
|
||||
psiv_(compressibilityProperties_.lookup("psiv")),
|
||||
psil_(compressibilityProperties_.lookup("psil")),
|
||||
rhovSat_(compressibilityProperties_.lookup("rhovSat")),
|
||||
rholSat_(compressibilityProperties_.lookup("rholSat"))
|
||||
{
|
||||
correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::compressibilityModels::Wallis::correct()
|
||||
{
|
||||
psi_ = (gamma_*rhovSat_ + (scalar(1) - gamma_)*rholSat_)
|
||||
*(gamma_*psiv_/rhovSat_ + (scalar(1) - gamma_)*psil_/rholSat_);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::compressibilityModels::Wallis::read
|
||||
(
|
||||
const dictionary& compressibilityProperties
|
||||
)
|
||||
{
|
||||
compressibilityModel::read(compressibilityProperties);
|
||||
|
||||
compressibilityProperties_.lookup("psiv") >> psiv_;
|
||||
compressibilityProperties_.lookup("psil") >> psil_;
|
||||
compressibilityProperties_.lookup("rhovSat") >> rhovSat_;
|
||||
compressibilityProperties_.lookup("rholSat") >> rholSat_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,107 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::compressibilityModels::Wallis
|
||||
|
||||
Description
|
||||
Wallis compressibility model.
|
||||
|
||||
SourceFiles
|
||||
Wallis.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Wallis_H
|
||||
#define Wallis_H
|
||||
|
||||
#include "compressibilityModel.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Wallis Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class Wallis
|
||||
:
|
||||
public compressibilityModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
dimensionedScalar psiv_;
|
||||
dimensionedScalar psil_;
|
||||
|
||||
dimensionedScalar rhovSat_;
|
||||
dimensionedScalar rholSat_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Wallis");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- construct from components
|
||||
Wallis
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~Wallis()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the Wallis compressibility
|
||||
void correct();
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
bool read(const dictionary& compressibilityProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressibilityModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,77 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
InClass
|
||||
compressibilityModel
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "compressibilityModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(compressibilityModel, 0);
|
||||
defineRunTimeSelectionTable(compressibilityModel, dictionary);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::compressibilityModel::compressibilityModel
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
)
|
||||
:
|
||||
compressibilityProperties_(compressibilityProperties),
|
||||
psi_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"psi",
|
||||
gamma.mesh().time().timeName(),
|
||||
gamma.mesh()
|
||||
),
|
||||
gamma.mesh(),
|
||||
dimensionedScalar("psi", dimensionSet(0, -2, 2, 0, 0), 0)
|
||||
),
|
||||
gamma_(gamma)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::compressibilityModel::read
|
||||
(
|
||||
const dictionary& compressibilityProperties
|
||||
)
|
||||
{
|
||||
compressibilityProperties_ = compressibilityProperties;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,154 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::compressibilityModel
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
compressibilityModel.C
|
||||
newCompressibilityModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef compressibilityModel_H
|
||||
#define compressibilityModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "typeInfo.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "volFields.H"
|
||||
#include "dimensionedScalar.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class compressibilityModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class compressibilityModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
dictionary compressibilityProperties_;
|
||||
|
||||
volScalarField psi_;
|
||||
const volScalarField& gamma_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
compressibilityModel(const compressibilityModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const compressibilityModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("compressibilityModel");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
compressibilityModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
),
|
||||
(compressibilityProperties, gamma)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected compressibility model
|
||||
static autoPtr<compressibilityModel> New
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
compressibilityModel
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~compressibilityModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the phase transport properties dictionary
|
||||
const dictionary& compressibilityProperties() const
|
||||
{
|
||||
return compressibilityProperties_;
|
||||
}
|
||||
|
||||
//- Return the compressibility
|
||||
const volScalarField& psi() const
|
||||
{
|
||||
return psi_;
|
||||
}
|
||||
|
||||
//- Correct the compressibility
|
||||
virtual void correct() = 0;
|
||||
|
||||
//- Read compressibilityProperties dictionary
|
||||
virtual bool read(const dictionary& compressibilityProperties) = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,67 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "compressibilityModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::compressibilityModel> Foam::compressibilityModel::New
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
)
|
||||
{
|
||||
word compressibilityModelTypeName
|
||||
(
|
||||
compressibilityProperties.lookup("compressibilityModel")
|
||||
);
|
||||
|
||||
Info<< "Selecting compressibility model "
|
||||
<< compressibilityModelTypeName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(compressibilityModelTypeName);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"compressibilityModel::New(const volScalarField&)"
|
||||
) << "Unknown compressibilityModel type "
|
||||
<< compressibilityModelTypeName << endl << endl
|
||||
<< "Valid compressibilityModels are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<compressibilityModel>
|
||||
(
|
||||
cstrIter()(compressibilityProperties, gamma)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,82 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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 "linear.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(linear, 0);
|
||||
addToRunTimeSelectionTable(compressibilityModel, linear, dictionary);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::compressibilityModels::linear::linear
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
)
|
||||
:
|
||||
compressibilityModel(compressibilityProperties, gamma),
|
||||
psiv_(compressibilityProperties_.lookup("psiv")),
|
||||
psil_(compressibilityProperties_.lookup("psil"))
|
||||
{
|
||||
correct();
|
||||
psi_.oldTime();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::compressibilityModels::linear::correct()
|
||||
{
|
||||
psi_ = gamma_*psiv_ + (scalar(1) - gamma_)*psil_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::compressibilityModels::linear::read
|
||||
(
|
||||
const dictionary& compressibilityProperties
|
||||
)
|
||||
{
|
||||
compressibilityModel::read(compressibilityProperties);
|
||||
|
||||
compressibilityProperties_.lookup("psiv") >> psiv_;
|
||||
compressibilityProperties_.lookup("psil") >> psil_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,104 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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::compressibilityModels::linear
|
||||
|
||||
Description
|
||||
linear compressibility model.
|
||||
|
||||
SourceFiles
|
||||
linear.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef linear_H
|
||||
#define linear_H
|
||||
|
||||
#include "compressibilityModel.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressibilityModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class linear Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class linear
|
||||
:
|
||||
public compressibilityModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
dimensionedScalar psiv_;
|
||||
dimensionedScalar psil_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("linear");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- construct from components
|
||||
linear
|
||||
(
|
||||
const dictionary& compressibilityProperties,
|
||||
const volScalarField& gamma
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~linear()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the linear compressibility
|
||||
void correct();
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
bool read(const dictionary& compressibilityProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressibilityModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,22 @@
|
||||
{
|
||||
volScalarField thermoRho = psi*p + (1.0 - gamma)*rhol0;
|
||||
|
||||
dimensionedScalar totalMass = fvc::domainIntegrate(rho);
|
||||
|
||||
scalar sumLocalContErr =
|
||||
(
|
||||
fvc::domainIntegrate(mag(rho - thermoRho))/totalMass
|
||||
).value();
|
||||
|
||||
scalar globalContErr =
|
||||
(
|
||||
fvc::domainIntegrate(rho - thermoRho)/totalMass
|
||||
).value();
|
||||
|
||||
cumulativeContErr += globalContErr;
|
||||
|
||||
Info<< "time step continuity errors : sum local = " << sumLocalContErr
|
||||
<< ", global = " << globalContErr
|
||||
<< ", cumulative = " << cumulativeContErr
|
||||
<< endl;
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
volScalarField gamma
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"gamma",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0))
|
||||
);
|
||||
gamma.oldTime();
|
||||
|
||||
Info<< "Creating compressibilityModel\n" << endl;
|
||||
autoPtr<compressibilityModel> psiModel = compressibilityModel::New
|
||||
(
|
||||
thermodynamicProperties,
|
||||
gamma
|
||||
);
|
||||
|
||||
const volScalarField& psi = psiModel->psi();
|
||||
|
||||
rho == max
|
||||
(
|
||||
psi*p
|
||||
+ (1.0 - gamma)*rhol0
|
||||
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
|
||||
rhoMin
|
||||
);
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
# include "createPhiv.H"
|
||||
# include "compressibleCreatePhi.H"
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
twoPhaseMixture twoPhaseProperties(U, phiv, "gamma");
|
||||
|
||||
// Create RAS turbulence model
|
||||
autoPtr<turbulenceModel> turbulence
|
||||
(
|
||||
turbulenceModel::New(U, phiv, twoPhaseProperties)
|
||||
);
|
||||
10
applications/solvers/multiphase/rasCavitatingFoam/gammaPsi.H
Normal file
10
applications/solvers/multiphase/rasCavitatingFoam/gammaPsi.H
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
gamma = max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0));
|
||||
|
||||
Info<< "max-min gamma: " << max(gamma).value()
|
||||
<< " " << min(gamma).value() << endl;
|
||||
|
||||
psiModel->correct();
|
||||
|
||||
//Info<< "min a: " << 1.0/sqrt(max(psi)).value() << endl;
|
||||
}
|
||||
80
applications/solvers/multiphase/rasCavitatingFoam/pEqn.H
Normal file
80
applications/solvers/multiphase/rasCavitatingFoam/pEqn.H
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
if (nOuterCorr == 1)
|
||||
{
|
||||
p =
|
||||
(
|
||||
rho
|
||||
- (1.0 - gamma)*rhol0
|
||||
- ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
|
||||
)/psi;
|
||||
}
|
||||
|
||||
surfaceScalarField rhof = fvc::interpolate(rho, "rhof");
|
||||
|
||||
volScalarField rUA = 1.0/UEqn.A();
|
||||
surfaceScalarField rUAf("rUAf", rhof*fvc::interpolate(rUA));
|
||||
volVectorField HbyA = rUA*UEqn.H();
|
||||
|
||||
phiv = (fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phiv);
|
||||
|
||||
p.boundaryField().updateCoeffs();
|
||||
|
||||
surfaceScalarField phiGradp = rUAf*mesh.magSf()*fvc::snGrad(p);
|
||||
|
||||
phiv -= phiGradp/rhof;
|
||||
|
||||
# include "resetPhivPatches.H"
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
- (rhol0 + (psil - psiv)*pSat)*fvc::ddt(gamma) - pSat*fvc::ddt(psi)
|
||||
+ fvc::div(phiv, rho)
|
||||
+ fvc::div(phiGradp)
|
||||
- fvm::laplacian(rUAf, p)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phiv += (phiGradp + pEqn.flux())/rhof;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "max-min p: " << max(p).value()
|
||||
<< " " << min(p).value() << endl;
|
||||
|
||||
|
||||
U = HbyA - rUA*fvc::grad(p);
|
||||
|
||||
// Remove the swirl component of velocity for "wedge" cases
|
||||
if (piso.found("removeSwirl"))
|
||||
{
|
||||
label swirlCmpt(readLabel(piso.lookup("removeSwirl")));
|
||||
|
||||
Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
|
||||
U.field().replace(swirlCmpt, 0.0);
|
||||
}
|
||||
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
Info<< "max(U) " << max(mag(U)).value() << endl;
|
||||
|
||||
rho == max
|
||||
(
|
||||
psi*p
|
||||
+ (1.0 - gamma)*rhol0
|
||||
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
|
||||
rhoMin
|
||||
);
|
||||
|
||||
Info<< "max-min rho: " << max(rho).value()
|
||||
<< " " << min(rho).value() << endl;
|
||||
|
||||
# include "gammaPsi.H"
|
||||
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
Application
|
||||
rasCavitatingFoam
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "compressibilityModel.H"
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "incompressible/turbulenceModel/turbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "readThermodynamicProperties.H"
|
||||
# include "readTransportProperties.H"
|
||||
# include "readControls.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
# include "compressibleCourantNo.H"
|
||||
# include "setInitialDeltaT.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
# include "readControls.H"
|
||||
# include "CourantNo.H"
|
||||
# include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
for (int outerCorr=0; outerCorr<nOuterCorr; outerCorr++)
|
||||
{
|
||||
# include "rhoEqn.H"
|
||||
# include "gammaPsi.H"
|
||||
# include "UEqn.H"
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
# include "pEqn.H"
|
||||
}
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "\n end \n";
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,9 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
scalar maxAcousticCo
|
||||
(
|
||||
readScalar(runTime.controlDict().lookup("maxAcousticCo"))
|
||||
);
|
||||
|
||||
|
||||
#include "readPISOControls.H"
|
||||
@ -0,0 +1,27 @@
|
||||
Info<< "Reading thermodynamicProperties\n" << endl;
|
||||
|
||||
IOdictionary thermodynamicProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermodynamicProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar psil(thermodynamicProperties.lookup("psil"));
|
||||
|
||||
dimensionedScalar rholSat(thermodynamicProperties.lookup("rholSat"));
|
||||
|
||||
dimensionedScalar psiv(thermodynamicProperties.lookup("psiv"));
|
||||
|
||||
dimensionedScalar pSat(thermodynamicProperties.lookup("pSat"));
|
||||
|
||||
dimensionedScalar rhovSat("rhovSat", psiv*pSat);
|
||||
|
||||
dimensionedScalar rhol0("rhol0", rholSat - pSat*psil);
|
||||
|
||||
dimensionedScalar rhoMin(thermodynamicProperties.lookup("rhoMin"));
|
||||
@ -0,0 +1,23 @@
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar mul
|
||||
(
|
||||
transportProperties.lookup("mul")
|
||||
);
|
||||
|
||||
dimensionedScalar muv
|
||||
(
|
||||
transportProperties.lookup("muv")
|
||||
);
|
||||
@ -0,0 +1,15 @@
|
||||
fvsPatchScalarFieldField& phiPatches = phi.boundaryField();
|
||||
const fvPatchScalarFieldField& rhoPatches = rho.boundaryField();
|
||||
const fvPatchVectorFieldField& Upatches = U.boundaryField();
|
||||
const fvsPatchVectorFieldField& SfPatches = mesh.Sf().boundaryField();
|
||||
|
||||
forAll(phiPatches, patchI)
|
||||
{
|
||||
if (phi.boundaryField().types()[patchI] == "calculated")
|
||||
{
|
||||
calculatedFvsPatchScalarField& phiPatch =
|
||||
refCast<calculatedFvsPatchScalarField>(phiPatches[patchI]);
|
||||
|
||||
phiPatch == ((rhoPatches[patchI]*Upatches[patchI]) & SfPatches[patchI]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
surfaceScalarField::GeometricBoundaryField& phivPatches = phiv.boundaryField();
|
||||
const volVectorField::GeometricBoundaryField& Upatches = U.boundaryField();
|
||||
const surfaceVectorField::GeometricBoundaryField& SfPatches = mesh.Sf().boundaryField();
|
||||
|
||||
forAll(phivPatches, patchI)
|
||||
{
|
||||
if (phiv.boundaryField().types()[patchI] == "calculated")
|
||||
{
|
||||
calculatedFvsPatchScalarField& phivPatch =
|
||||
refCast<calculatedFvsPatchScalarField>(phivPatches[patchI]);
|
||||
|
||||
phivPatch == (Upatches[patchI] & SfPatches[patchI]);
|
||||
}
|
||||
}
|
||||
16
applications/solvers/multiphase/rasCavitatingFoam/rhoEqn.H
Normal file
16
applications/solvers/multiphase/rasCavitatingFoam/rhoEqn.H
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
fvScalarMatrix rhoEqn
|
||||
(
|
||||
fvm::ddt(rho)
|
||||
+ fvm::div(phiv, rho)
|
||||
);
|
||||
|
||||
rhoEqn.solve();
|
||||
|
||||
phi = rhoEqn.flux();
|
||||
|
||||
Info<< "max-min rho: " << max(rho).value()
|
||||
<< " " << min(rho).value() << endl;
|
||||
|
||||
rho == max(rho, rhoMin);
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
Global
|
||||
setDeltaT
|
||||
|
||||
Description
|
||||
Reset the timestep to maintain a constant maximum courant Number.
|
||||
Reduction of time-step is imediate but increase is damped to avoid
|
||||
unstable oscillations.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
||||
|
||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
min
|
||||
(
|
||||
deltaTFact*runTime.deltaT().value(),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "deltaT = " << runTime.deltaT().value() << endl;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,54 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 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
|
||||
|
||||
Global
|
||||
setInitialDeltaT
|
||||
|
||||
Description
|
||||
Set the initial timestep corresponding to the timestep adjustment
|
||||
algorithm in setDeltaT
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
# include "CourantNo.H"
|
||||
|
||||
if (CoNum > SMALL)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
min
|
||||
(
|
||||
maxDeltaTFact*runTime.deltaT().value(),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user