Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
06eb5b74
Commit
06eb5b74
authored
Nov 25, 2009
by
henry
Browse files
Added preliminary version of the rhoSimplecFoam code and tutorial case.
This currently only runs in serial, parallelisation is worked on.
parent
33947e73
Changes
23
Hide whitespace changes
Inline
Side-by-side
applications/solvers/compressible/rhoSimpleFoam/pEqn.H
View file @
06eb5b74
...
...
@@ -27,7 +27,7 @@ if (transonic)
pEqn
.
setReference
(
pRefCell
,
pRefValue
);
//
r
etain the residual from the first iteration
//
R
etain the residual from the first iteration
if
(
nonOrth
==
0
)
{
eqnResidual
=
pEqn
.
solve
().
initialResidual
();
...
...
applications/solvers/compressible/rhoSimplecFoam/Make/files
0 → 100644
View file @
06eb5b74
rhoSimplecFoam.C
EXE = $(FOAM_APPBIN)/rhoSimplecFoam
applications/solvers/compressible/rhoSimplecFoam/Make/options
0 → 100644
View file @
06eb5b74
EXE_INC = \
-I../rhoSimpleFoam \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lfiniteVolume \
-lmeshTools
applications/solvers/compressible/rhoSimplecFoam/UEqn.H
0 → 100644
View file @
06eb5b74
// Solve the Momentum equation
tmp
<
fvVectorMatrix
>
UEqn
(
fvm
::
div
(
phi
,
U
)
-
fvm
::
Sp
(
fvc
::
div
(
phi
),
U
)
+
turbulence
->
divDevRhoReff
(
U
)
);
UEqn
().
relax
();
eqnResidual
=
solve
(
UEqn
()
==
-
fvc
::
grad
(
p
)
).
initialResidual
();
maxResidual
=
max
(
eqnResidual
,
maxResidual
);
applications/solvers/compressible/rhoSimplecFoam/createFields.H
0 → 100644
View file @
06eb5b74
Info
<<
"Reading thermophysical properties
\n
"
<<
endl
;
autoPtr
<
basicPsiThermo
>
pThermo
(
basicPsiThermo
::
New
(
mesh
)
);
basicPsiThermo
&
thermo
=
pThermo
();
volScalarField
rho
(
IOobject
(
"rho"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
thermo
.
rho
()
);
volScalarField
&
p
=
thermo
.
p
();
volScalarField
&
h
=
thermo
.
h
();
const
volScalarField
&
psi
=
thermo
.
psi
();
Info
<<
"Reading field U
\n
"
<<
endl
;
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
#include
"compressibleCreatePhi.H"
label
pRefCell
=
0
;
scalar
pRefValue
=
0
.
0
;
setRefCell
(
p
,
mesh
.
solutionDict
().
subDict
(
"SIMPLE"
),
pRefCell
,
pRefValue
);
dimensionedScalar
pMin
(
mesh
.
solutionDict
().
subDict
(
"SIMPLE"
).
lookup
(
"pMin"
)
);
Info
<<
"Creating turbulence model
\n
"
<<
endl
;
autoPtr
<
compressible
::
RASModel
>
turbulence
(
compressible
::
RASModel
::
New
(
rho
,
U
,
phi
,
thermo
)
);
dimensionedScalar
initialMass
=
fvc
::
domainIntegrate
(
rho
);
applications/solvers/compressible/rhoSimplecFoam/hEqn.H
0 → 100644
View file @
06eb5b74
{
fvScalarMatrix
hEqn
(
fvm
::
div
(
phi
,
h
)
-
fvm
::
Sp
(
fvc
::
div
(
phi
),
h
)
-
fvm
::
laplacian
(
turbulence
->
alphaEff
(),
h
)
==
fvc
::
div
(
phi
/
fvc
::
interpolate
(
rho
)
*
fvc
::
interpolate
(
p
,
"div(U,p)"
))
-
p
*
fvc
::
div
(
phi
/
fvc
::
interpolate
(
rho
))
);
hEqn
.
relax
();
eqnResidual
=
hEqn
.
solve
().
initialResidual
();
maxResidual
=
max
(
eqnResidual
,
maxResidual
);
thermo
.
correct
();
rho
=
thermo
.
rho
();
if
(
!
transonic
)
{
rho
.
relax
();
}
Info
<<
"rho max/min : "
<<
max
(
rho
).
value
()
<<
" "
<<
min
(
rho
).
value
()
<<
endl
;
}
applications/solvers/compressible/rhoSimplecFoam/pEqn.H
0 → 100644
View file @
06eb5b74
volScalarField
p0
=
p
;
volScalarField
AU
=
UEqn
().
A
();
volScalarField
AtU
=
AU
-
UEqn
().
H1
();
U
=
UEqn
().
H
()
/
AU
;
UEqn
.
clear
();
bool
closedVolume
=
false
;
if
(
transonic
)
{
for
(
int
nonOrth
=
0
;
nonOrth
<=
nNonOrthCorr
;
nonOrth
++
)
{
surfaceScalarField
phid
(
"phid"
,
fvc
::
interpolate
(
psi
*
U
)
&
mesh
.
Sf
()
);
surfaceScalarField
phic
(
"phic"
,
fvc
::
interpolate
(
rho
/
AtU
-
rho
/
AU
)
*
fvc
::
snGrad
(
p
)
*
mesh
.
magSf
()
+
phid
*
(
fvc
::
interpolate
(
p
)
-
fvc
::
interpolate
(
p
,
"UD"
))
);
refCast
<
mixedFvPatchScalarField
>
(
p
.
boundaryField
()[
1
]).
refValue
()
=
p
.
boundaryField
()[
1
];
fvScalarMatrix
pEqn
(
fvm
::
div
(
phid
,
p
)
+
fvc
::
div
(
phic
)
-
fvm
::
Sp
(
fvc
::
div
(
phid
),
p
)
+
fvc
::
div
(
phid
)
*
p
-
fvm
::
laplacian
(
rho
/
AtU
,
p
)
);
pEqn
.
setReference
(
pRefCell
,
pRefValue
);
// Retain the residual from the first iteration
if
(
nonOrth
==
0
)
{
eqnResidual
=
pEqn
.
solve
().
initialResidual
();
maxResidual
=
max
(
eqnResidual
,
maxResidual
);
}
else
{
pEqn
.
solve
();
}
if
(
nonOrth
==
nNonOrthCorr
)
{
phi
==
phic
+
pEqn
.
flux
();
}
}
}
else
{
for
(
int
nonOrth
=
0
;
nonOrth
<=
nNonOrthCorr
;
nonOrth
++
)
{
phi
=
fvc
::
interpolate
(
rho
*
U
)
&
mesh
.
Sf
();
closedVolume
=
adjustPhi
(
phi
,
U
,
p
);
phi
+=
fvc
::
interpolate
(
rho
/
AtU
-
rho
/
AU
)
*
fvc
::
snGrad
(
p
)
*
mesh
.
magSf
();
fvScalarMatrix
pEqn
(
fvc
::
div
(
phi
)
//- fvm::laplacian(rho/AU, p)
-
fvm
::
laplacian
(
rho
/
AtU
,
p
)
);
pEqn
.
setReference
(
pRefCell
,
pRefValue
);
// Retain the residual from the first iteration
if
(
nonOrth
==
0
)
{
eqnResidual
=
pEqn
.
solve
().
initialResidual
();
maxResidual
=
max
(
eqnResidual
,
maxResidual
);
}
else
{
pEqn
.
solve
();
}
if
(
nonOrth
==
nNonOrthCorr
)
{
phi
+=
pEqn
.
flux
();
}
}
}
// The incompressibe for of the continuity error check is appropriate for
// steady-state compressible also.
#include
"incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p
.
relax
();
U
-=
(
fvc
::
grad
(
p0
)
*
(
1
.
0
/
AU
-
1
.
0
/
AtU
)
+
fvc
::
grad
(
p
)
/
AtU
);
//U -= fvc::grad(p)/AU;
U
.
correctBoundaryConditions
();
bound
(
p
,
pMin
);
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if
(
closedVolume
)
{
p
+=
(
initialMass
-
fvc
::
domainIntegrate
(
psi
*
p
))
/
fvc
::
domainIntegrate
(
psi
);
}
rho
=
thermo
.
rho
();
if
(
!
transonic
)
{
rho
.
relax
();
}
Info
<<
"rho max/min : "
<<
max
(
rho
).
value
()
<<
" "
<<
min
(
rho
).
value
()
<<
endl
;
applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C
0 → 100644
View file @
06eb5b74
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
rhoSimplecFoam
Description
Steady-state SIMPLEC solver for laminar or turbulent RANS flow of
compressible fluids.
\*---------------------------------------------------------------------------*/
#include
"fvCFD.H"
#include
"basicPsiThermo.H"
#include
"RASModel.H"
#include
"mixedFvPatchFields.H"
#include
"bound.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
#include
"setRootCase.H"
#include
"createTime.H"
#include
"createMesh.H"
#include
"createFields.H"
#include
"initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
for
(
runTime
++
;
!
runTime
.
end
();
runTime
++
)
{
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
#include
"readSIMPLEControls.H"
#include
"initConvergenceCheck.H"
p
.
storePrevIter
();
if
(
!
transonic
)
{
rho
.
storePrevIter
();
}
// Velocity-pressure-enthalpy SIMPLEC corrector
{
#include
"UEqn.H"
#include
"pEqn.H"
#include
"hEqn.H"
}
turbulence
->
correct
();
runTime
.
write
();
Info
<<
"ExecutionTime = "
<<
runTime
.
elapsedCpuTime
()
<<
" s"
<<
" ClockTime = "
<<
runTime
.
elapsedClockTime
()
<<
" s"
<<
nl
<<
endl
;
#include
"convergenceCheck.H"
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
tutorials/compressible/rhoSimplecFoam/squareBend/0/T
0 → 100644
View file @
06eb5b74
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 1000;
boundaryField
{
Default_Boundary_Region
{
type zeroGradient;
}
inlet
{
type fixedValue;
value uniform 1000;
}
outlet
{
type inletOutlet;
//type zeroGradient;
value uniform 1000;
inletValue uniform 1000;
}
}
// ************************************************************************* //
tutorials/compressible/rhoSimplecFoam/squareBend/0/U
0 → 100644
View file @
06eb5b74
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
Default_Boundary_Region
{
type fixedValue;
value uniform (0 0 0);
}
inlet
{
type flowRateInletVelocity;
flowRate 0.5; //0.75;
value uniform (0 0 0);
}
outlet
{
type inletOutlet;
value uniform (0 0 0);
inletValue uniform (0 0 0);
}
}
// ************************************************************************* //
tutorials/compressible/rhoSimplecFoam/squareBend/0/alphat
0 → 100644
View file @
06eb5b74
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object alphat;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
Default_Boundary_Region
{
type alphatWallFunction;
Prt 0.85;
value uniform 0;
}
inlet
{
type calculated;
value uniform 0;
}
outlet
{
type calculated;
value uniform 0;
}
}
// ************************************************************************* //
tutorials/compressible/rhoSimplecFoam/squareBend/0/epsilon
0 → 100644
View file @
06eb5b74
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 200;
boundaryField
{
Default_Boundary_Region
{
type compressible::epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 200;
}
inlet
{
type compressible::turbulentMixingLengthDissipationRateInlet;
mixingLength 0.005;
value uniform 200;
}
outlet
{
type inletOutlet;
inletValue uniform 200;
value uniform 200;
}
}
// ************************************************************************* //
tutorials/compressible/rhoSimplecFoam/squareBend/0/k
0 → 100644
View file @
06eb5b74
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 1;
boundaryField
{
Default_Boundary_Region
{
type compressible::kqRWallFunction;
value uniform 1;
}
inlet
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.05;
value uniform 1;
}
outlet
{
type inletOutlet;
inletValue uniform 1;
value uniform 1;
}
}
// ************************************************************************* //
tutorials/compressible/rhoSimplecFoam/squareBend/0/mut
0 → 100644
View file @
06eb5b74
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object mut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -1 0 0 0 0];
internalField uniform 0;