Skip to content
Snippets Groups Projects
Commit a82e6efa authored by Mark Olesen's avatar Mark Olesen
Browse files

Merge remote branch 'OpenCFD/master' into olesenm

parents 24e935b1 38a24cfb
No related branches found
No related tags found
No related merge requests found
Showing
with 176 additions and 105 deletions
......@@ -19,7 +19,7 @@ if (transonic)
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
//+ fvc::ddtPhiCorr(rAU, rho, U, phi)
)
);
mrfZones.relativeFlux(fvc::interpolate(psi), phid);
......
......@@ -3,6 +3,6 @@ cd ${0%/*} || exit 1 # run from this directory
set -x
wmake
wmake rhoPorousSimpleFoam
wmake rhoPorousMRFSimpleFoam
# ----------------------------------------------------------------- end-of-file
rhoPorousMRFSimpleFoam.C
EXE = $(FOAM_APPBIN)/rhoPorousMRFSimpleFoam
......@@ -8,6 +8,8 @@
UEqn().relax();
mrfZones.addCoriolis(rho, UEqn());
// Include the porous media resistance and solve the momentum equation
// either implicit in the tensorial resistance or transport using by
// including the spherical part of the resistance in the momentum diagonal
......
MRFZones mrfZones(mesh);
mrfZones.correctBoundaryVelocity(U);
thermalPorousZones pZones(mesh);
Switch pressureImplicitPorosity(false);
......@@ -24,4 +27,3 @@
Info<< "Using pressure explicit porosity" << endl;
}
}
......@@ -9,36 +9,68 @@ else
UEqn.clear();
phi = fvc::interpolate(rho*U) & mesh.Sf();
bool closedVolume = adjustPhi(phi, U, p);
bool closedVolume = false;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
if (transonic)
{
tmp<fvScalarMatrix> tpEqn;
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf())
);
mrfZones.relativeFlux(fvc::interpolate(psi), phid);
if (pressureImplicitPorosity)
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tpEqn = (fvm::laplacian(rho*trTU(), p) == fvc::div(phi));
}
else
{
tpEqn = (fvm::laplacian(rho*trAU(), p) == fvc::div(phi));
}
tmp<fvScalarMatrix> tpEqn;
if (pressureImplicitPorosity)
{
tpEqn = (fvc::div(phid, p) - fvm::laplacian(rho*trTU(), p));
}
else
{
tpEqn = (fvc::div(phid, p) - fvm::laplacian(rho*trAU(), p));
}
tpEqn().setReference(pRefCell, pRefValue);
tpEqn().setReference(pRefCell, pRefValue);
// retain the residual from the first iteration
if (nonOrth == 0)
{
tpEqn().solve();
if (nonOrth == nNonOrthCorr)
{
phi == tpEqn().flux();
}
}
else
}
else
{
phi = fvc::interpolate(rho*U) & mesh.Sf();
mrfZones.relativeFlux(fvc::interpolate(rho), phi);
closedVolume = adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tmp<fvScalarMatrix> tpEqn;
if (pressureImplicitPorosity)
{
tpEqn = (fvm::laplacian(rho*trTU(), p) == fvc::div(phi));
}
else
{
tpEqn = (fvm::laplacian(rho*trAU(), p) == fvc::div(phi));
}
tpEqn().setReference(pRefCell, pRefValue);
tpEqn().solve();
}
if (nonOrth == nNonOrthCorr)
{
phi -= tpEqn().flux();
if (nonOrth == nNonOrthCorr)
{
phi -= tpEqn().flux();
}
}
}
......
......@@ -26,13 +26,15 @@ Application
Description
Steady-state solver for turbulent flow of compressible fluids with
RANS turbulence modelling, and implicit or explicit porosity treatment
RANS turbulence modelling, implicit or explicit porosity treatment
and MRF for HVAC and similar applications.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "basicPsiThermo.H"
#include "RASModel.H"
#include "MRFZones.H"
#include "thermalPorousZones.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -43,7 +45,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "createPorousZones.H"
#include "createZones.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
rhoPorousSimpleFoam.C
EXE = $(FOAM_APPBIN)/rhoPorousSimpleFoam
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
# include "createPhi.H"
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)
);
porousZones pZones(mesh);
Switch pressureImplicitPorosity(false);
// nUCorrectors used for pressureImplicitPorosity
int nUCorr = 0;
if (pZones.size())
{
// nUCorrectors for pressureImplicitPorosity
if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors"))
{
nUCorr = readInt
(
mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors")
);
}
if (nUCorr > 0)
{
pressureImplicitPorosity = true;
Info<< "Using pressure implicit porosity" << endl;
}
else
{
Info<< "Using pressure explicit porosity" << endl;
}
}
......@@ -24,7 +24,7 @@
}
}
# include "continuityErrs.H"
#include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
......
EXE_INC = \
-I../simpleFoam \
-I.. \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
-I$(LIB_SRC)/transportModels \
......
......@@ -43,6 +43,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "createPorousZones.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -26,7 +26,9 @@ FoamFile
// - specify where the faces should come from
// - specify the type of cyclic. If a rotational specify the rotationAxis
// and centre to make matching easier
// - pointSync true to guarantee points to line up.
// - always create both halves in one invocation with correct 'neighbourPatch'
// setting.
// - optionally pointSync true to guarantee points to line up.
// 2. Correct incorrect cyclic:
// This will usually fail upon loading:
......@@ -45,24 +47,23 @@ matchTolerance 1E-3;
// Do a synchronisation of coupled points after creation of any patches.
// Note: this does not work with points that are on multiple coupled patches
// with transformations.
pointSync true;
pointSync false;
// Patches to create.
patches
(
{
// Name of new patch
name sidePatches;
name cyc_half0;
// Type of new patch
// Dictionary to construct new patch from
patchInfo
{
type cyclic;
neighbourPatch cyc_half1;
// Optional: explicitly set transformation tensor.
// Used when matching and synchronising points.
//transform translational;
//separationVector (-2289 0 0);
transform rotational;
rotationAxis (1 0 0);
rotationCentre (0 0 0);
......@@ -72,28 +73,37 @@ patches
constructFrom patches;
// If constructFrom = patches : names of patches. Wildcards allowed.
patches ("periodic.*");
patches (periodic1);
// If constructFrom = set : name of faceSet
set f0;
}
{
name bottom;
// Name of new patch
name cyc_half1;
// Type of new patch
dictionary
// Dictionary to construct new patch from
patchInfo
{
type wall;
type cyclic;
neighbourPatch cyc_half0;
// Optional: explicitly set transformation tensor.
// Used when matching and synchronising points.
transform rotational;
rotationAxis ( 0 0 1 );
rotationCentre ( 0.3 0 0 );
}
constructFrom set;
// How to construct: either from 'patches' or 'set'
constructFrom patches;
patches ();
// If constructFrom = patches : names of patches. Wildcards allowed.
patches (periodic2);
set bottomFaces;
// If constructFrom = set : name of faceSet
set f0;
}
);
// ************************************************************************* //
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -63,7 +63,15 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
volVectorField U(Uheader, mesh);
if (isFile(runTime.constantPath()/"thermophysicalProperties"))
if
(
IOobject
(
"thermophysicalProperties",
runTime.constant(),
mesh
).headerOk()
)
{
// thermophysical Mach
autoPtr<basicPsiThermo> thermo
......
......@@ -37,6 +37,7 @@ usage() {
usage: ${0##*/}
--foamInstall dir specify installation directory (e.g. /opt)
--projectName name specify project name (e.g. openfoam170)
--projectVersion ver specify project version (e.g. 1.7.x)
--archOption arch specify architecture option (only 32 or 64 applicable)
--paraviewInstall dir specify ParaView_DIR (e.g. /opt/paraviewopenfoam380)
......@@ -76,7 +77,7 @@ _inlineSed()
[ -f etc/bashrc ] || usage "Please run from top-level directory of installation"
unset foamInstall projectName archOption paraviewInstall
unset foamInstall projectName projectVersion archOption paraviewInstall
# parse options
while [ "$#" -gt 0 ]
......@@ -102,7 +103,17 @@ do
_inlineSed \
etc/bashrc \
'/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName@" \
"Replacing WM_PROJECT_DIR setting by '$projectName'"
"Replacing WM_PROJECT_DIR setting by $projectName"
shift 2
;;
--projectVersion)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
projectVersion="$2"
# replace WM_PROJECT_VERSION=...
_inlineSed \
etc/bashrc \
'/^[^#]/s@WM_PROJECT_VERSION=.*@WM_PROJECT_VERSION='"$projectVersion@" \
"Replacing WM_PROJECT_VERSION setting by $projectVersion"
shift 2
;;
-archOption | --archOption)
......@@ -142,10 +153,10 @@ _inlineSed \
'/^[^#]/s@export WM_MPLIB=.*@export WM_MPLIB=SYSTEMOPENMPI@' \
"Replacing WM_MPLIB setting by 'SYSTEMOPENMPI'"
# set foamCompiler=system always
_inlineSed \
etc/bashrc \
'/^[^#]/s@foamCompiler=.*@foamCompiler=system@' \
"Replacing foamCompiler setting by 'system'"
## set foamCompiler=system always
#_inlineSed \
# etc/bashrc \
# '/^[^#]/s@foamCompiler=.*@foamCompiler=system@' \
# "Replacing foamCompiler setting by 'system'"
#------------------------------------------------------------------------------
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment