Commit 91fca60f authored by Andrew Heather's avatar Andrew Heather
Browse files
parents 98bd768d 4575c332
......@@ -14,4 +14,3 @@
).initialResidual();
maxResidual = max(eqnResidual, maxResidual);
......@@ -12,6 +12,7 @@
- fvm::laplacian(muEff, U)
- (fvc::grad(U) & fvc::grad(muEff))
//- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
//- fvc::div(rho*turbulence->nuEff()*dev(fvc::grad(U)().T()))
);
if (oCorr == nOuterCorr-1)
......
......@@ -53,18 +53,18 @@ patches
name sidePatches;
// Type of new patch
dictionary
{
dictionary
{
type cyclic;
// Optional: explicitly set transformation tensor.
// Optional: explicitly set transformation tensor.
// Used when matching and synchronising points.
//transform translational;
//separationVector (-2289 0 0);
transform rotational;
rotationAxis (1 0 0);
transform rotational;
rotationAxis (1 0 0);
rotationCentre (0 0 0);
}
}
// How to construct: either from 'patches' or 'set'
constructFrom patches;
......@@ -80,10 +80,10 @@ patches
name bottom;
// Type of new patch
dictionary
{
dictionary
{
type wall;
}
}
constructFrom set;
......
......@@ -105,6 +105,8 @@ int main(int argc, char *argv[])
Foam::argList::validOptions.insert("overwrite", "");
Foam::argList::validOptions.insert("toleranceDict", "file with tolerances");
# include "setRootCase.H"
# include "createTime.H"
runTime.functionObjects().off();
......@@ -168,6 +170,22 @@ int main(int argc, char *argv[])
<< "If this is not the case use the -partial option" << nl << endl;
}
// set up the tolerances for the sliding mesh
dictionary slidingTolerances;
if (args.options().found("toleranceDict"))
{
IOdictionary toleranceFile(
IOobject(
args.options()["toleranceDict"],
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
slidingTolerances += toleranceFile;
}
// Check for non-empty master and slave patches
checkPatch(mesh.boundaryMesh(), masterPatchName);
checkPatch(mesh.boundaryMesh(), slavePatchName);
......@@ -320,6 +338,11 @@ int main(int argc, char *argv[])
true // couple/decouple mode
)
);
static_cast<slidingInterface&>(stitcher[0]).setTolerances
(
slidingTolerances,
true
);
}
......
......@@ -452,5 +452,6 @@ done
#-----------------------------
myEcho "Generated XY files for:"
getAllQueries $DBFILE $LOG
myEcho "End"
#------------------------------------------------------------------------------
......@@ -1305,7 +1305,7 @@ bool Foam::cyclicPolyPatch::order
{
label baffleI = 0;
forAll(*this, faceI)
forAll(pp, faceI)
{
const face& f = pp.localFaces()[faceI];
const labelList& pFaces = pp.pointFaces()[f[0]];
......
......@@ -43,7 +43,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::scalar Foam::slidingInterface::edgeCoPlanarTol_ = 0.8;
const Foam::scalar Foam::slidingInterface::edgeCoPlanarTolDefault_ = 0.8;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
......
......@@ -27,10 +27,8 @@ License
#include "slidingInterface.H"
#include "polyTopoChanger.H"
#include "polyMesh.H"
#include "primitiveMesh.H"
#include "polyTopoChange.H"
#include "addToRunTimeSelectionTable.H"
#include "triPointRef.H"
#include "plane.H"
// Index of debug signs:
......@@ -173,6 +171,14 @@ Foam::slidingInterface::slidingInterface
attached_(false),
projectionAlgo_(algo),
trigger_(false),
pointMergeTol_(pointMergeTolDefault_),
edgeMergeTol_(edgeMergeTolDefault_),
nFacesPerSlaveEdge_(nFacesPerSlaveEdgeDefault_),
edgeFaceEscapeLimit_(edgeFaceEscapeLimitDefault_),
integralAdjTol_(integralAdjTolDefault_),
edgeMasterCatchFraction_(edgeMasterCatchFractionDefault_),
edgeCoPlanarTol_(edgeCoPlanarTolDefault_),
edgeEndCutoffTol_(edgeEndCutoffTolDefault_),
cutFaceMasterPtr_(NULL),
cutFaceSlavePtr_(NULL),
masterFaceCellsPtr_(NULL),
......@@ -280,6 +286,9 @@ Foam::slidingInterface::slidingInterface
masterPointEdgeHitsPtr_(NULL),
projectedSlavePointsPtr_(NULL)
{
// Optionally default tolerances from dictionary
setTolerances(dict);
checkDefinition();
// If the interface is attached, the master and slave face zone addressing
......@@ -686,6 +695,63 @@ const Foam::pointField& Foam::slidingInterface::pointProjection() const
return *projectedSlavePointsPtr_;
}
void Foam::slidingInterface::setTolerances(const dictionary&dict, bool report)
{
pointMergeTol_ = dict.lookupOrDefault<scalar>
(
"pointMergeTol",
pointMergeTol_
);
edgeMergeTol_ = dict.lookupOrDefault<scalar>
(
"edgeMergeTol",
edgeMergeTol_
);
nFacesPerSlaveEdge_ = dict.lookupOrDefault<scalar>
(
"nFacesPerSlaveEdge",
nFacesPerSlaveEdge_
);
edgeFaceEscapeLimit_ = dict.lookupOrDefault<scalar>
(
"edgeFaceEscapeLimit",
edgeFaceEscapeLimit_
);
integralAdjTol_ = dict.lookupOrDefault<scalar>
(
"integralAdjTol",
integralAdjTol_
);
edgeMasterCatchFraction_ = dict.lookupOrDefault<scalar>
(
"edgeMasterCatchFraction",
edgeMasterCatchFraction_
);
edgeCoPlanarTol_ = dict.lookupOrDefault<scalar>
(
"edgeCoPlanarTol",
edgeCoPlanarTol_
);
edgeEndCutoffTol_ = dict.lookupOrDefault<scalar>
(
"edgeEndCutoffTol",
edgeEndCutoffTol_
);
if (report)
{
Info<< "Sliding interface parameters:" << nl
<< "pointMergeTol : " << pointMergeTol_ << nl
<< "edgeMergeTol : " << edgeMergeTol_ << nl
<< "nFacesPerSlaveEdge : " << nFacesPerSlaveEdge_ << nl
<< "edgeFaceEscapeLimit : " << edgeFaceEscapeLimit_ << nl
<< "integralAdjTol : " << integralAdjTol_ << nl
<< "edgeMasterCatchFraction : " << edgeMasterCatchFraction_ << nl
<< "edgeCoPlanarTol : " << edgeCoPlanarTol_ << nl
<< "edgeEndCutoffTol : " << edgeEndCutoffTol_ << endl;
}
}
void Foam::slidingInterface::write(Ostream& os) const
{
......@@ -703,6 +769,14 @@ void Foam::slidingInterface::write(Ostream& os) const
}
// To write out all those tolerances
#define WRITE_NON_DEFAULT(name) \
if( name ## _ != name ## Default_ )\
{ \
os << " " #name " " << name ## _ << token::END_STATEMENT << nl; \
}
void Foam::slidingInterface::writeDict(Ostream& os) const
{
os << nl << name() << nl << token::BEGIN_BLOCK << nl
......@@ -743,6 +817,15 @@ void Foam::slidingInterface::writeDict(Ostream& os) const
<< token::END_STATEMENT << nl;
}
WRITE_NON_DEFAULT(pointMergeTol)
WRITE_NON_DEFAULT(edgeMergeTol)
WRITE_NON_DEFAULT(nFacesPerSlaveEdge)
WRITE_NON_DEFAULT(edgeFaceEscapeLimit)
WRITE_NON_DEFAULT(integralAdjTol)
WRITE_NON_DEFAULT(edgeMasterCatchFraction)
WRITE_NON_DEFAULT(edgeCoPlanarTol)
WRITE_NON_DEFAULT(edgeEndCutoffTol)
os << token::END_BLOCK << endl;
}
......
......@@ -129,6 +129,32 @@ private:
//- Trigger topological change
mutable bool trigger_;
// Tolerances. Initialised to static ones below.
//- Point merge tolerance
scalar pointMergeTol_;
//- Edge merge tolerance
scalar edgeMergeTol_;
//- Estimated number of faces an edge goes through
label nFacesPerSlaveEdge_;
//- Edge-face interaction escape limit
label edgeFaceEscapeLimit_;
//- Integral match point adjustment tolerance
scalar integralAdjTol_;
//- Edge intersection master catch fraction
scalar edgeMasterCatchFraction_;
//- Edge intersection co-planar tolerance
scalar edgeCoPlanarTol_;
//- Edge end cut-off tolerance
scalar edgeEndCutoffTol_;
// Private addressing data.
......@@ -256,28 +282,28 @@ private:
// Static data members
//- Point merge tolerance
static const scalar pointMergeTol_;
static const scalar pointMergeTolDefault_;
//- Edge merge tolerance
static const scalar edgeMergeTol_;
static const scalar edgeMergeTolDefault_;
//- Estimated number of faces an edge goes through
static const label nFacesPerSlaveEdge_;
static const label nFacesPerSlaveEdgeDefault_;
//- Edge-face interaction escape limit
static const label edgeFaceEscapeLimit_;
static const label edgeFaceEscapeLimitDefault_;
//- Integral match point adjustment tolerance
static const scalar integralAdjTol_;
static const scalar integralAdjTolDefault_;
//- Edge intersection master catch fraction
static const scalar edgeMasterCatchFraction_;
static const scalar edgeMasterCatchFractionDefault_;
//- Edge intersection co-planar tolerance
static const scalar edgeCoPlanarTol_;
static const scalar edgeCoPlanarTolDefault_;
//- Edge end cut-off tolerance
static const scalar edgeEndCutoffTol_;
static const scalar edgeEndCutoffTolDefault_;
public:
......@@ -350,6 +376,8 @@ public:
//- Return projected points for a slave patch
const pointField& pointProjection() const;
//- Set the tolerances from the values in a dictionary
void setTolerances(const dictionary&, bool report=false);
//- Write
virtual void write(Ostream&) const;
......
......@@ -26,22 +26,19 @@ License
#include "slidingInterface.H"
#include "polyMesh.H"
#include "primitiveMesh.H"
#include "line.H"
#include "triPointRef.H"
#include "plane.H"
#include "polyTopoChanger.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::scalar Foam::slidingInterface::pointMergeTol_ = 0.05;
const Foam::scalar Foam::slidingInterface::edgeMergeTol_ = 0.01;
const Foam::label Foam::slidingInterface::nFacesPerSlaveEdge_ = 5;
const Foam::label Foam::slidingInterface::edgeFaceEscapeLimit_ = 10;
const Foam::scalar Foam::slidingInterface::pointMergeTolDefault_ = 0.05;
const Foam::scalar Foam::slidingInterface::edgeMergeTolDefault_ = 0.01;
const Foam::label Foam::slidingInterface::nFacesPerSlaveEdgeDefault_ = 5;
const Foam::label Foam::slidingInterface::edgeFaceEscapeLimitDefault_ = 10;
const Foam::scalar Foam::slidingInterface::integralAdjTol_ = 0.05;
const Foam::scalar Foam::slidingInterface::edgeMasterCatchFraction_ = 0.4;
const Foam::scalar Foam::slidingInterface::edgeEndCutoffTol_ = 0.0001;
const Foam::scalar Foam::slidingInterface::integralAdjTolDefault_ = 0.05;
const Foam::scalar Foam::slidingInterface::edgeMasterCatchFractionDefault_ = 0.4;
const Foam::scalar Foam::slidingInterface::edgeEndCutoffTolDefault_ = 0.0001;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
......
......@@ -79,7 +79,6 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
<< " (Actual type " << actualTypeName_ << ")" << nl
<< "\n Please add the 'value' entry to the write function "
"of the user-defined boundary-condition\n"
" or link the boundary-condition into libfoamUtil.so"
<< exit(FatalIOError);
}
......
......@@ -61,7 +61,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
const incompressible::RASModel& ras
= obr_.lookupObject<incompressible::RASModel>("RASProperties");
return rhoRef_*ras.devReff();
return rho()*ras.devReff();
}
else if (obr_.foundObject<compressible::LESModel>("LESProperties"))
{
......@@ -75,7 +75,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
const incompressible::LESModel& les
= obr_.lookupObject<incompressible::LESModel>("LESProperties");
return rhoRef_*les.devBeff();
return rho()*les.devBeff();
}
else if (obr_.foundObject<basicThermo>("thermophysicalProperties"))
{
......@@ -97,7 +97,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
return -rhoRef_*laminarT.nu()*dev(twoSymm(fvc::grad(U)));
return -rho()*laminarT.nu()*dev(twoSymm(fvc::grad(U)));
}
else if (obr_.foundObject<dictionary>("transportProperties"))
{
......@@ -108,7 +108,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
return -rhoRef_*nu*dev(twoSymm(fvc::grad(U)));
return -rho()*nu*dev(twoSymm(fvc::grad(U)));
}
else
{
......@@ -121,6 +121,34 @@ Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
}
Foam::tmp<Foam::volScalarField> Foam::forces::rho() const
{
if (rhoName_ == "rhoInf")
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"rho",
mesh.time().timeName(),
mesh
),
mesh,
dimensionedScalar("rho", dimDensity, rhoRef_)
)
);
}
else
{
return(obr_.lookupObject<volScalarField>(rhoName_));
}
}
Foam::scalar Foam::forces::rho(const volScalarField& p) const
{
if (p.dimensions() == dimPressure)
......@@ -129,6 +157,13 @@ Foam::scalar Foam::forces::rho(const volScalarField& p) const
}
else
{
if (rhoName_ != "rhoInf")
{
FatalErrorIn("forces::rho(const volScalarField& p)")
<< "Dynamic pressure is expected but kinematic is provided."
<< exit(FatalError);
}
return rhoRef_;
}
}
......@@ -149,11 +184,12 @@ Foam::forces::forces
active_(true),
log_(false),
patchSet_(),
pName_(""),
UName_(""),
pName_(word::null),
UName_(word::null),
rhoName_(word::null),
directForceDensity_(false),
fDName_(""),
rhoRef_(0),
rhoRef_(VGREAT),
CofR_(vector::zero),
forcesFilePtr_(NULL)
{
......@@ -175,6 +211,12 @@ Foam::forces::forces
}
read(dict);
if (active_)
{
// Create the forces file if not already created
makeFile();
}
}
......@@ -222,18 +264,31 @@ void Foam::forces::read(const dictionary& dict)
// Optional entries U and p
pName_ = dict.lookupOrDefault<word>("pName", "p");
UName_ = dict.lookupOrDefault<word>("UName", "U");
rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho");
// Check whether UName and pName exists, if not deactivate forces
// Check whether UName, pName and rhoName exists,
// if not deactivate forces
if
(
!obr_.foundObject<volVectorField>(UName_)
|| !obr_.foundObject<volScalarField>(pName_)
|| (
rhoName_ != "rhoInf"
&& !obr_.foundObject<volScalarField>(rhoName_)
)
)
{
active_ = false;
WarningIn("void forces::read(const dictionary& dict)")
<< "Could not find " << UName_ << " or "
<< pName_ << " in database." << nl
<< "Could not find " << UName_ << ", " << pName_;
if (rhoName_ != "rhoInf")
{
Info<< " or " << rhoName_;
}
Info<< " in database." << nl
<< " De-activating forces."
<< endl;
}
......
......@@ -132,6 +132,9 @@ protected:
//- Name of velocity field
word UName_;
//- Name of density field (optional)
word rhoName_;
//- Is the force density being supplied directly?
Switch directForceDensity_;
......@@ -157,6 +160,9 @@ protected:
//- Return the effective viscous stress (laminar + turbulent).
tmp<volSymmTensorField> devRhoReff() const;
//- Return rho if rhoName is specified otherwise rhoRef
tmp<volScalarField> rho() const;
//- Return rhoRef if the pressure field is dynamic, i.e. p/rho
// otherwise return 1
scalar rho(const volScalarField& p) const;
......
......@@ -70,7 +70,7 @@ class alphatWallFunctionFvPatchScalarField
public:
//- Runtime type information
TypeName("compressible::alphatWallFunction");
TypeName("alphatWallFunction");
// Constructors
......
......@@ -32,13 +32,13 @@ boundaryField
upperWall
{
type compressible::alphaSgsJayatillekeWallFunction;
type alphaSgsJayatillekeWallFunction;
value uniform 0;
}
lowerWall
{
type compressible::alphaSgsJayatillekeWallFunction;
type alphaSgsJayatillekeWallFunction;
value uniform 0;
}
......
......@@ -32,13 +32,13 @@ boundaryField
upperWall
{
type compressible::muSgsWallFunction;
type muSgsUSpaldingWallFunction;
value uniform 0;
}
lowerWall
{
type compressible::muSgsWallFunction;
type muSgsUSpaldingWallFunction;
value uniform 0;
}
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
......
......@@ -32,13 +32,13 @@ boundaryField
upperWall
{
type compressible::alphaSgsJayatillekeWallFunction;
type alphaSgsJayatillekeWallFunction;
value uniform 0;
}
lowerWall
{
type compressible::alphaSgsJayatillekeWallFunction;