Commit 881b3daf authored by Mark Olesen's avatar Mark Olesen
Browse files

Merge remote branch 'OpenCFD/master' into olesenm

Conflicts:
	applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C
	applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C
	applications/utilities/surface/surfaceCheck/surfaceCheck.C
	src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C
	src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C
	src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C

NOTE: also needed to strip trailing space/lines in various files
parents 6abfeb88 255b9c02
......@@ -184,6 +184,8 @@
+ =setSet=: allows time range (e.g. 0:100) in combination with -batch argument
to execute the commands for multiple times.
* Post-processing
+ =paraFoam=, =foamToVTK=: full support for polyhedral cell type in recent
Paraview versions.
+ =foamToEnsight=: parallel continuous data. new =-nodeValues= option to generate and output nodal
field data.
+ =singleCellMesh=: new utility to convert mesh and fields to a single cell
......
......@@ -27,6 +27,7 @@ PDRModels/XiGModels/basicXiSubG/basicXiSubG.C
laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C
/* PDRFoamAutoRefine.C */
PDRFoam.C
EXE = $(FOAM_APPBIN)/PDRFoam
......@@ -25,8 +25,8 @@ Application
PDRFoam
Description
Compressible premixed/partially-premixed combustion solver with turbulence
modelling.
Solver for compressible premixed/partially-premixed combustion with
turbulence modelling.
Combusting RANS code using the b-Xi two-equation model.
Xi may be obtained by either the solution of the Xi transport
......@@ -35,7 +35,7 @@ Description
to be appropriate by comparison with the results from the
spectral model.
Strain effects are encorporated directly into the Xi equation
Strain effects are incorporated directly into the Xi equation
but not in the algebraic approximation. Further work need to be
done on this issue, particularly regarding the enhanced removal rate
caused by flame compression. Analysis using results of the spectral
......@@ -78,9 +78,9 @@ int main(int argc, char *argv[])
#include "readCombustionProperties.H"
#include "readGravitationalAcceleration.H"
#include "createFields.H"
#include "readPISOControls.H"
#include "initContinuityErrs.H"
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
scalar StCoNum = 0.0;
......@@ -94,7 +94,6 @@ int main(int argc, char *argv[])
#include "readTimeControls.H"
#include "readPISOControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
runTime++;
......
......@@ -185,7 +185,7 @@ int main(int argc, char *argv[])
+ aSf*p_pos - aSf*p_neg
);
volTensorField tauMC("tauMC", mu*dev2(fvc::grad(U)().T()));
volTensorField tauMC("tauMC", mu*dev2(Foam::T(fvc::grad(U))));
// --- Solve density
Info<< max(rho) << " " << min(rho) << endl;
......
......@@ -167,7 +167,7 @@ int main(int argc, char *argv[])
+ aSf*p_pos - aSf*p_neg
);
volTensorField tauMC("tauMC", mu*dev2(fvc::grad(U)().T()));
volTensorField tauMC("tauMC", mu*dev2(Foam::T(fvc::grad(U))));
// --- Solve density
solve(fvm::ddt(rho) + fvc::div(phi));
......
......@@ -5,6 +5,7 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude
......
......@@ -7,6 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
......
......@@ -4,7 +4,7 @@
tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho();
tmp<volScalarField> tcp = thermo.cp();
tmp<volScalarField> tcp = thermo.Cp();
const volScalarField& cp = tcp();
tmp<volScalarField> tK = thermo.K();
......
......@@ -4,11 +4,12 @@
tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho();
tmp<volScalarField> tcp = thermo.cp();
tmp<volScalarField> tcp = thermo.Cp();
const volScalarField& cp = tcp();
tmp<volScalarField> tK = thermo.K();
//tmp<volSymmTensorField> tK = thermo.directionalK();
const volScalarField& K = tK();
//const volSymmTensorField& K = tK();
volScalarField& T = thermo.T();
......@@ -57,4 +57,35 @@ Foam::scalar Foam::solidRegionDiffNo
}
Foam::scalar Foam::solidRegionDiffNo
(
const fvMesh& mesh,
const Time& runTime,
const volScalarField& Cprho,
const volSymmTensorField& Kdirectional
)
{
scalar DiNum = 0.0;
scalar meanDiNum = 0.0;
volScalarField K = mag(Kdirectional);
//- Take care: can have fluid domains with 0 cells so do not test for
// zero internal faces.
surfaceScalarField KrhoCpbyDelta =
mesh.surfaceInterpolation::deltaCoeffs()
* fvc::interpolate(K)
/ fvc::interpolate(Cprho);
DiNum = gMax(KrhoCpbyDelta.internalField())*runTime.deltaT().value();
meanDiNum = (average(KrhoCpbyDelta)).value()*runTime.deltaT().value();
Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum
<< " max: " << DiNum << endl;
return DiNum;
}
// ************************************************************************* //
......@@ -41,6 +41,15 @@ namespace Foam
const volScalarField& Cprho,
const volScalarField& K
);
scalar solidRegionDiffNo
(
const fvMesh& mesh,
const Time& runTime,
const volScalarField& Cprho,
const volSymmTensorField& K
);
}
#endif
......
......@@ -18,6 +18,8 @@ if (finalIter)
Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
}
thermo.correct();
if (finalIter)
{
mesh.data::remove("finalIteration");
......
......@@ -10,8 +10,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -33,8 +33,8 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -10,8 +10,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -32,8 +32,8 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -5,8 +5,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
......@@ -26,8 +26,8 @@ EXE_LIBS = \
-lcompressibleLESModels \
-lspecie \
-lbasicThermophysicalModels \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -9,8 +9,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -31,8 +31,8 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -10,8 +10,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
......@@ -32,8 +32,8 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \
......
......@@ -218,7 +218,7 @@ void Foam::kineticTheoryModel::solve(const volTensorField& gradUat)
// The solution is higly unstable close to the packing limit.
gs0_ = radialModel_->g0
(
min(max(alpha_, 1e-6), alphaMax_ - 0.01),
min(max(alpha_, scalar(1e-6)), alphaMax_ - 0.01),
alphaMax_
);
......@@ -261,7 +261,7 @@ void Foam::kineticTheoryModel::solve(const volTensorField& gradUat)
volScalarField J2
(
0.25*sqr(betaPrim)*da_*sqr(Ur)
/ (max(alpha_, 1e-6)*rhoa_*sqrtPi*(ThetaSqrt + TsmallSqrt))
/(max(alpha_, scalar(1e-6))*rhoa_*sqrtPi*(ThetaSqrt + TsmallSqrt))
);
// bulk viscosity p. 45 (Lun et al. 1984).
......@@ -321,7 +321,13 @@ void Foam::kineticTheoryModel::solve(const volTensorField& gradUat)
volScalarField t1(K1*alpha_ + rhoa_);
volScalarField l1(-t1*trD);
volScalarField l2(sqr(t1)*tr2D);
volScalarField l3(4.0*K4*max(alpha_, 1e-6)*(2.0*K3*trD2 + K2*tr2D));
volScalarField l3
(
4.0
*K4
*max(alpha_, scalar(1e-6))
*(2.0*K3*trD2 + K2*tr2D)
);
Theta_ = sqr((l1 + sqrt(l2 + l3))/(2.0*(alpha_ + 1.0e-4)*K4));
}
......
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude
EXE_LIBS = \
-lmeshTools
......@@ -26,180 +26,38 @@ Application
Description
Calculates the inertia tensor and principal axes and moments of a
test face and tetrahedron.
test face, tetrahedron and mesh.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "polyMesh.H"
#include "ListOps.H"
#include "face.H"
#include "tetPointRef.H"
#include "triFaceList.H"
#include "OFstream.H"
#include "meshTools.H"
#include "momentOfInertia.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
using namespace Foam;
void massPropertiesSolid
(
const pointField& pts,
const triFaceList triFaces,
scalar density,
scalar& mass,
vector& cM,
tensor& J
)
int main(int argc, char *argv[])
{
// Reimplemented from: Wm4PolyhedralMassProperties.cpp
// File Version: 4.10.0 (2009/11/18)
// Geometric Tools, LC
// Copyright (c) 1998-2010
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
// Boost Software License - Version 1.0 - August 17th, 2003
// Permission is hereby granted, free of charge, to any person or
// organization obtaining a copy of the software and accompanying
// documentation covered by this license (the "Software") to use,
// reproduce, display, distribute, execute, and transmit the
// Software, and to prepare derivative works of the Software, and
// to permit third-parties to whom the Software is furnished to do
// so, all subject to the following:
// The copyright notices in the Software and this entire
// statement, including the above license grant, this restriction
// and the following disclaimer, must be included in all copies of
// the Software, in whole or in part, and all derivative works of
// the Software, unless such copies or derivative works are solely
// in the form of machine-executable object code generated by a
// source language processor.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
// NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
// ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR
// OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
const scalar r6 = 1.0/6.0;
const scalar r24 = 1.0/24.0;
const scalar r60 = 1.0/60.0;
const scalar r120 = 1.0/120.0;
// order: 1, x, y, z, x^2, y^2, z^2, xy, yz, zx
scalarField integrals(10, 0.0);
forAll(triFaces, i)
{
const triFace& tri(triFaces[i]);
// vertices of triangle i
vector v0 = pts[tri[0]];
vector v1 = pts[tri[1]];
vector v2 = pts[tri[2]];
// cross product of edges
vector eA = v1 - v0;
vector eB = v2 - v0;
vector n = eA ^ eB;
// compute integral terms
scalar tmp0, tmp1, tmp2;
scalar f1x, f2x, f3x, g0x, g1x, g2x;
tmp0 = v0.x() + v1.x();
f1x = tmp0 + v2.x();
tmp1 = v0.x()*v0.x();
tmp2 = tmp1 + v1.x()*tmp0;
f2x = tmp2 + v2.x()*f1x;
f3x = v0.x()*tmp1 + v1.x()*tmp2 + v2.x()*f2x;
g0x = f2x + v0.x()*(f1x + v0.x());
g1x = f2x + v1.x()*(f1x + v1.x());
g2x = f2x + v2.x()*(f1x + v2.x());
scalar f1y, f2y, f3y, g0y, g1y, g2y;
tmp0 = v0.y() + v1.y();
f1y = tmp0 + v2.y();
tmp1 = v0.y()*v0.y();
tmp2 = tmp1 + v1.y()*tmp0;
f2y = tmp2 + v2.y()*f1y;
f3y = v0.y()*tmp1 + v1.y()*tmp2 + v2.y()*f2y;
g0y = f2y + v0.y()*(f1y + v0.y());
g1y = f2y + v1.y()*(f1y + v1.y());
g2y = f2y + v2.y()*(f1y + v2.y());
scalar f1z, f2z, f3z, g0z, g1z, g2z;
tmp0 = v0.z() + v1.z();
f1z = tmp0 + v2.z();
tmp1 = v0.z()*v0.z();
tmp2 = tmp1 + v1.z()*tmp0;
f2z = tmp2 + v2.z()*f1z;
f3z = v0.z()*tmp1 + v1.z()*tmp2 + v2.z()*f2z;
g0z = f2z + v0.z()*(f1z + v0.z());
g1z = f2z + v1.z()*(f1z + v1.z());
g2z = f2z + v2.z()*(f1z + v2.z());
// update integrals
integrals[0] += n.x()*f1x;
integrals[1] += n.x()*f2x;
integrals[2] += n.y()*f2y;
integrals[3] += n.z()*f2z;
integrals[4] += n.x()*f3x;
integrals[5] += n.y()*f3y;
integrals[6] += n.z()*f3z;
integrals[7] += n.x()*(v0.y()*g0x + v1.y()*g1x + v2.y()*g2x);
integrals[8] += n.y()*(v0.z()*g0y + v1.z()*g1y + v2.z()*g2y);
integrals[9] += n.z()*(v0.x()*g0z + v1.x()*g1z + v2.x()*g2z);
}
integrals[0] *= r6;
integrals[1] *= r24;
integrals[2] *= r24;
integrals[3] *= r24;
integrals[4] *= r60;
integrals[5] *= r60;
integrals[6] *= r60;
integrals[7] *= r120;
integrals[8] *= r120;
integrals[9] *= r120;
// mass
mass = integrals[0];
// center of mass
cM = vector(integrals[1], integrals[2], integrals[3])/mass;
// inertia relative to origin
J.xx() = integrals[5] + integrals[6];
J.xy() = -integrals[7];
J.xz() = -integrals[9];
J.yx() = J.xy();
J.yy() = integrals[4] + integrals[6];
J.yz() = -integrals[8];
J.zx() = J.xz();
J.zy() = J.yz();
J.zz() = integrals[4] + integrals[5];
// inertia relative to center of mass
J -= mass*((cM & cM)*I - cM*cM);
// Apply density
mass *= density;
J *= density;
}
argList::addOption
(
"cell",
"label",
"cell to use for inertia calculation, defaults to 0"
);
#include "setRootCase.H"
#include "createTime.H"
#include "createPolyMesh.H"
int main(int argc, char *argv[])
{
scalar density = 1.0;
{
......@@ -286,16 +144,7 @@ int main(int argc, char *argv[])
vector cM = vector::zero;
tensor J = tensor::zero;
massPropertiesSolid
(
pts,
tetFaces,
density,
m,
cM,
J
);
momentOfInertia::massPropertiesSolid(pts, tetFaces, density, m, cM, J);
vector eVal = eigenValues(J);
......@@ -344,7 +193,50 @@ int main(int argc, char *argv[])
{
str << "l " << nPts + 1 << ' ' << i + 1 << endl;
}
}
{
const label cellI = args.optionLookupOrDefault("cell", 0);
tensorField mI = momentOfInertia::meshInertia(mesh);
tensor& J = mI[cellI];
vector eVal = eigenValues(J);
Info<< nl
<< "Inertia tensor of cell " << cellI << " " << J << nl
<< "eigenValues (principal moments) " << eVal << endl;
J /= cmptMax(eVal);
tensor eVec = eigenVectors(J);
Info<< "eigenVectors (principal axes, from normalised inertia) " << eVec
<< endl;
OFstream str("cell_" + name(cellI) + "_inertia.obj");
Info<< nl << "Writing scaled principal axes of cell " << cellI << " to "
<< str.name() << endl;
const point& cC = mesh.cellCentres()[cellI];
scalar scale = mag
(
(cC - mesh.faceCentres()[mesh.cells()[cellI][0]])
/eVal.component(findMin(eVal))
);
meshTools::writeOBJ(str, cC);
meshTools::writeOBJ(str, cC + scale*eVal.x()*eVec.x());