Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
Andrew Heather
2016-12-16 13:26:39 +00:00
35 changed files with 224 additions and 170 deletions

View File

@ -2,7 +2,6 @@
(
fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U)
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
+ turbulence->divDevRhoReff(rho, U)
);

View File

@ -1,12 +0,0 @@
volScalarField contErr(fvc::ddt(rho) + fvc::div(rhoPhi));
scalar sumLocalContErr = runTime.deltaTValue()*
mag(contErr)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaTValue()*
contErr.weightedAverage(mesh.V()).value();
Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< endl;

View File

@ -28,20 +28,6 @@
#include "createPhi.H"
// Create p before the thermo
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p_rgh
);
// Creating e based thermo
autoPtr<twoPhaseMixtureEThermo> thermo;
thermo.set(new twoPhaseMixtureEThermo(U, phi));
@ -54,9 +40,10 @@
volScalarField& T = thermo->T();
volScalarField& e = thermo->he();
e.oldTime();
// Correct e from T and alpha
thermo->correct();
//thermo->correct();
volScalarField& alpha1(thermo->alpha1());
volScalarField& alpha2(thermo->alpha2());
@ -80,7 +67,6 @@
);
rho.oldTime();
// Construct interface from alpha1 distribution
interfaceProperties interface
(
@ -100,8 +86,7 @@
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", g & mesh.Cf());
//Update p with rho
p = p_rgh + rho*gh;
volScalarField& p = thermo->p();
label pRefCell = 0;
scalar pRefValue = 0.0;

View File

@ -14,9 +14,7 @@
fvScalarMatrix eEqn
(
fvm::ddt(rho, e)
+ fvc::ddt(rho, K) + fvc::div(rhoPhi, K)
+ fvm::div(rhoPhi, e)
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), e)
- fvm::laplacian(kappaEff/cp, e)
+ pDivU
);

View File

@ -63,20 +63,21 @@ int main(int argc, char *argv[])
pimpleControl pimple(mesh);
#include "readGravitationalAcceleration.H"
#include "initContinuityErrs.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "createTimeControls.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readTimeControls.H"
#include "createTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
@ -101,9 +102,12 @@ int main(int argc, char *argv[])
dimensionedScalar("0", dimMass/dimTime, 0)
);
#include "alphaEqnSubCycle.H"
mixture->correct();
#include "alphaEqnSubCycle.H"
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
#include "UEqn.H"
#include "eEqn.H"
@ -113,14 +117,14 @@ int main(int argc, char *argv[])
#include "pEqn.H"
}
#include "continuityError.H"
if (pimple.turbCorr())
{
turbulence->correct();
}
}
rho = alpha1*rho1 + alpha2*rho2;
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -1,9 +1,7 @@
{
volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
surfaceScalarField phiHbyA
(
"phiHbyA",
@ -53,8 +51,7 @@
}
}
p == p_rgh + rho*gh;
p = p_rgh + rho*gh;
if (p_rgh.needReference())
{

View File

@ -78,8 +78,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotAlphal() const
return Pair<tmp<volScalarField>>
(
coeffC_*mixture_.rho2()*max(TSat - T, T0),
-coeffE_*mixture_.rho1()*max(T - TSat, T0)
coeffC_*mixture_.rho2()*max(TSat - T.oldTime(), T0),
-coeffE_*mixture_.rho1()*max(T.oldTime() - TSat, T0)
);
}
@ -112,8 +112,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const
return Pair<tmp<volScalarField>>
(
coeffC_*mixture_.rho2()*limitedAlpha2*max(TSat - T, T0),
coeffE_*mixture_.rho1()*limitedAlpha1*max(T - TSat, T0)
coeffC_*mixture_.rho2()*limitedAlpha2*max(TSat - T.oldTime(), T0),
coeffE_*mixture_.rho1()*limitedAlpha1*max(T.oldTime() - TSat, T0)
);
}
@ -144,8 +144,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotDeltaT() const
return Pair<tmp<volScalarField>>
(
coeffC_*mixture_.rho2()*limitedAlpha2*pos(TSat - T),
coeffE_*mixture_.rho1()*limitedAlpha1*pos(T - TSat)
coeffC_*mixture_.rho2()*limitedAlpha2*pos(TSat - T.oldTime()),
coeffE_*mixture_.rho1()*limitedAlpha1*pos(T.oldTime() - TSat)
);
}

View File

@ -702,6 +702,7 @@ int main(int argc, char *argv[])
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
Info<< "Writing polyMesh" << endl;
pShapeMesh.removeFiles();
pShapeMesh.write();
Info<< nl << "end" << endl;

View File

@ -753,6 +753,7 @@ int main(int argc, char *argv[])
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
Info<< "Writing polyMesh" << endl;
pShapeMesh.removeFiles();
pShapeMesh.write();
Info<< "End\n" << endl;

View File

@ -1177,6 +1177,9 @@ int main(int argc, char *argv[])
patchPhysicalTypes
);
// Remove files now, to ensure all mesh files written are consistent.
pShapeMesh.removeFiles();
//dont write mesh yet, otherwise preservePatchTypes will be broken
//and zones wont be written
//checkmesh done after patch addition as well

View File

@ -865,6 +865,7 @@ int main(int argc, char *argv[])
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
Info<< "Writing polyMesh" << endl;
pShapeMesh.removeFiles();
pShapeMesh.write();
Info<< "\nEnd\n" << endl;

View File

@ -942,6 +942,9 @@ int main(int argc, char *argv[])
boundaryPatchPhysicalTypes
);
// Remove files now, to ensure all mesh files written are consistent.
mesh.removeFiles();
repatchPolyTopoChanger repatcher(mesh);
// Now use the patchFaces to patch up the outside faces of the mesh.
@ -1140,6 +1143,9 @@ int main(int argc, char *argv[])
repatcher.changePatches(newPatchPtrList);
}
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
mesh.write();
Info<< "End\n" << endl;

View File

@ -1158,8 +1158,6 @@ int main(int argc, char *argv[])
Info<< endl;
// Construct mesh
polyMesh mesh
(
@ -1179,8 +1177,10 @@ int main(int argc, char *argv[])
wordList(0) // boundaryPatchPhysicalTypes
);
// Remove files now, to ensure all mesh files written are consistent.
mesh.removeFiles();
if (faceZones.size() > 0 || cellZones.size() > 0)
if (faceZones.size() || cellZones.size())
{
Info << "Adding cell and face zones" << endl;
@ -1188,7 +1188,7 @@ int main(int argc, char *argv[])
List<faceZone*> fZones(faceZones.size());
List<cellZone*> cZones(cellZones.size());
if (cellZones.size() > 0)
if (cellZones.size())
{
forAll(cellZones.toc(), cnt)
{
@ -1205,7 +1205,7 @@ int main(int argc, char *argv[])
);
}
}
if (faceZones.size() > 0)
if (faceZones.size())
{
const labelList& own = mesh.faceOwner();
const labelList& nei = mesh.faceNeighbour();
@ -1289,6 +1289,9 @@ int main(int argc, char *argv[])
Info << endl;
}
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
mesh.write();
Info<< "End\n" << endl;

View File

@ -574,7 +574,11 @@ polyMesh pShapeMesh
defaultFacesType
);
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
Info << "Writing polyMesh" << endl;
pShapeMesh.removeFiles();
pShapeMesh.write();
fileName czPath

View File

@ -154,11 +154,14 @@ int main(int argc, char *argv[])
wordList(0)
);
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
Info<< "Writing mesh ..." << endl;
mesh.removeFiles();
mesh.write();
Info<< "End\n" << endl;
return 0;

View File

@ -313,11 +313,13 @@ int main(int argc, char *argv[])
patchPhysicalTypes
);
Info<< "Writing mesh to " << runTime.constant() << endl << endl;
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
Info<< "Writing mesh ..." << endl;
mesh.removeFiles();
mesh.write();
Info<< "End\n" << endl;
return 0;

View File

@ -262,6 +262,7 @@ int main(int argc, char *argv[])
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
Info<< "Writing polyMesh" << endl;
pShapeMesh.removeFiles();
pShapeMesh.write();
Info<< "End\n" << endl;

View File

@ -342,7 +342,6 @@ int main(int argc, char *argv[])
const polyMesh& mesh = meshPtr;
if (readFaceFile)
{
label nPatches = 0;
@ -474,7 +473,7 @@ int main(int argc, char *argv[])
boundaryPatch.setSize(facei);
// Print region to patch mapping
// Print region to patch mapping
Info<< "Regions:" << endl;
forAllConstIter(Map<label>, regionToPatch, iter)
@ -545,9 +544,12 @@ int main(int argc, char *argv[])
);
}
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
Info<< "Writing mesh to " << runTime.constant() << endl << endl;
meshPtr().removeFiles();
meshPtr().write();
Info<< "End\n" << endl;

View File

@ -78,11 +78,14 @@ int main(int argc, char *argv[])
wordList(0)
);
// Set the precision of the points data to 10
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
Info<< "Writing mesh ..." << endl;
mesh.removeFiles();
mesh.write();
Info<< "End\n" << endl;
return 0;

View File

@ -31,24 +31,25 @@ Description
Checks geometric and topological quality of a surface.
Usage
- surfaceCheck surfaceFile [OPTION]
\b surfaceCheck [OPTION] surfaceFile
\param -checkSelfIntersection \n
Check for self-intersection.
Options:
- \par -checkSelfIntersection
Check for self-intersection.
\param -splitNonManifold \n
Split surface along non-manifold edges.
- \par -splitNonManifold
Split surface along non-manifold edges.
\param -verbose \n
Extra verbosity.
- \par -verbose
Extra verbosity.
\param -blockMesh \n
Write vertices/blocks for tight-fitting 1 cell blockMeshDict.
- \par -blockMesh
Write vertices/blocks for tight-fitting 1 cell blockMeshDict.
\param -outputThreshold \<num files\> \n
Specifies upper limit for the number of files written. This is useful to
prevent surfaces with lots of disconnected parts to write lots of files.
Default is 10. A special case is 0 which prevents writing any files.
- \par -outputThreshold \<num files\>
Upper limit on the number of files written.
Prevent surfaces with many disconnected parts from writing many files.
The default is 10. A value of 0 suppresses file writing.
\*---------------------------------------------------------------------------*/
@ -300,14 +301,21 @@ int main(int argc, char *argv[])
"blockMesh",
"write vertices/blocks for blockMeshDict"
);
argList::addOption
(
"outputThreshold",
"number",
"upper limit on the number of files written."
" Default is 10, using 0 suppresses file writing."
);
argList args(argc, argv);
const fileName surfFileName = args[1];
const bool checkSelfIntersect = args.optionFound("checkSelfIntersection");
const bool splitNonManifold = args.optionFound("splitNonManifold");
label outputThreshold = 10;
args.optionReadIfPresent("outputThreshold", outputThreshold);
const label outputThreshold =
args.optionLookupOrDefault("outputThreshold", 10);
Info<< "Reading surface from " << surfFileName << " ..." << nl << endl;

View File

@ -530,9 +530,6 @@ Foam::polyMesh::polyMesh
Info<<"Constructing polyMesh from cell and boundary shapes." << endl;
}
// Remove all of the old mesh files if they exist
removeFiles(instance());
// Calculate faces and cells
labelList patchSizes;
labelList patchStarts;
@ -814,9 +811,6 @@ Foam::polyMesh::polyMesh
Info<<"Constructing polyMesh from cell and boundary shapes." << endl;
}
// Remove all of the old mesh files if they exist
removeFiles(instance());
// Calculate faces and cells
labelList patchSizes;
labelList patchStarts;

View File

@ -331,54 +331,6 @@ Foam::fvMesh::fvMesh(const IOobject& io)
}
Foam::fvMesh::fvMesh
(
const IOobject& io,
const Xfer<pointField>& points,
const cellShapeList& shapes,
const faceListList& boundaryFaces,
const wordList& boundaryPatchNames,
const PtrList<dictionary>& boundaryDicts,
const word& defaultBoundaryPatchName,
const word& defaultBoundaryPatchType,
const bool syncPar
)
:
polyMesh
(
io,
points,
shapes,
boundaryFaces,
boundaryPatchNames,
boundaryDicts,
defaultBoundaryPatchName,
defaultBoundaryPatchType,
syncPar
),
surfaceInterpolation(*this),
fvSchemes(static_cast<const objectRegistry&>(*this)),
fvSolution(static_cast<const objectRegistry&>(*this)),
data(static_cast<const objectRegistry&>(*this)),
boundary_(*this, boundaryMesh()),
lduPtr_(nullptr),
curTimeIndex_(time().timeIndex()),
VPtr_(nullptr),
V0Ptr_(nullptr),
V00Ptr_(nullptr),
SfPtr_(nullptr),
magSfPtr_(nullptr),
CPtr_(nullptr),
CfPtr_(nullptr),
phiPtr_(nullptr)
{
if (debug)
{
InfoInFunction << "Constructing fvMesh from cellShapes" << endl;
}
}
Foam::fvMesh::fvMesh
(
const IOobject& io,

View File

@ -157,10 +157,10 @@ class fvMesh
//- Disallow construct as copy
fvMesh(const fvMesh&);
fvMesh(const fvMesh&) = delete;
//- Disallow assignment
void operator=(const fvMesh&);
void operator=(const fvMesh&) = delete;
public:
@ -180,20 +180,6 @@ public:
//- Construct from IOobject
explicit fvMesh(const IOobject& io);
//- Construct from cellShapes with boundary.
fvMesh
(
const IOobject& io,
const Xfer<pointField>& points,
const cellShapeList& shapes,
const faceListList& boundaryFaces,
const wordList& boundaryPatchNames,
const PtrList<dictionary>& boundaryDicts,
const word& defaultBoundaryPatchName,
const word& defaultBoundaryPatchType,
const bool syncPar = true
);
//- Construct from components without boundary.
// Boundary is added using addFvPatches() member function
fvMesh

View File

@ -1,4 +1,5 @@
EXE_INC = \
${c++LESSWARN} \
-I$(BOOST_ARCH_PATH)/include \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \

View File

@ -16,7 +16,7 @@ FoamFile
dimensions [0 0 0 1 0 0 0];
internalField uniform 368;
internalField uniform 375;
boundaryField
{
@ -32,12 +32,8 @@ boundaryField
}
left
{
type compressible::turbulentHeatFluxTemperature;
heatSource flux;
q uniform -40e3;
kappaMethod fluidThermo;
kappa none;
value $internalField;
type fixedValue;
value uniform 360;
}
right
{

View File

@ -0,0 +1,56 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 1;
boundaryField
{
bottom
{
type epsilonWallFunction;
value $internalField;
}
top
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
left
{
type epsilonWallFunction;
value $internalField;
}
right
{
type epsilonWallFunction;
value $internalField;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -17,7 +17,7 @@ FoamFile
dimensions [ 0 2 -2 0 0 0 0 ];
internalField uniform 2e-3;
internalField uniform 0.1;
boundaryField
{

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 1 -1 -2 0 0 0 0 ];
internalField uniform 1e5;
boundaryField
{
bottom
{
type calculated;
value $internalField;
}
top
{
type calculated;
value $internalField;
}
left
{
type calculated;
value $internalField;
}
right
{
type calculated;
value $internalField;
}
frontAndBack
{
type empty;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -4,7 +4,9 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application=$(getApplication)
runApplication blockMesh
runApplication $(getApplication)
runApplication $application
#------------------------------------------------------------------------------

View File

@ -16,6 +16,6 @@ FoamFile
TSat TSat [0 0 0 1 0] 366; // saturation temperature
pDivU true;
pDivU false;
// ************************************************************************* //

View File

@ -17,7 +17,7 @@ FoamFile
phases (liquid vapour);// FC-72
sigma sigma [1 0 -2 0 0 0 0] 0.07;
sigma sigma [1 0 -2 0 0 0 0] 0.0;
liquid
{

View File

@ -19,7 +19,7 @@ simulationType RAS;
RAS
{
RASModel kOmega;
RASModel kOmegaSST;
turbulence on;
printCoeffs on;

View File

@ -25,11 +25,11 @@ stopAt endTime;
endTime 4;
deltaT 1e-5;
deltaT 1e-4;
writeControl adjustableRunTime;
writeInterval 1e-1;
writeInterval 0.1;
purgeWrite 0;
@ -45,11 +45,9 @@ timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
adjustTimeStep no;
maxCo 6.0;
maxAlphaCo 6.0;
maxCo 1.0;
maxDeltaT 1e-2;

View File

@ -29,10 +29,11 @@ divSchemes
{
default none;
div(rhoPhi,U) Gauss linear;
div(phi,omega) Gauss linear;
div(phi,k) Gauss linear;
div(rhoPhi,e) Gauss linear;
div(rhoPhi,U) Gauss upwind;
div(phi,omega) Gauss upwind;
div(phi,epsilon) Gauss upwind;
div(phi,k) Gauss upwind;
div(rhoPhi,e) Gauss upwind;
div(rhoPhi,K) Gauss upwind;
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear;
@ -42,7 +43,7 @@ divSchemes
laplacianSchemes
{
default Gauss linear orthogonal;
default Gauss linear corrected;
}
interpolationSchemes
@ -52,7 +53,7 @@ interpolationSchemes
snGradSchemes
{
default orthogonal;
default corrected;
}
wallDist

View File

@ -17,9 +17,14 @@ FoamFile
solvers
{
".*(rho|rhoFinal)"
{
solver diagonal;
}
"alpha.liquid.*"
{
cAlpha 1;
cAlpha 0;
nAlphaCorr 2;
nAlphaSubCycles 2;
@ -55,6 +60,7 @@ solvers
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
maxIter 100;
};
p_rghFinal
@ -111,7 +117,7 @@ PIMPLE
{
momentumPredictor false;
nOuterCorrectors 1;
nCorrectors 3;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}