Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
sergio
2011-03-02 16:18:42 +00:00
9 changed files with 137 additions and 79 deletions

View File

@ -270,7 +270,7 @@ addLayersControls
//- If points get not extruded do nGrow layers of connected faces that are //- If points get not extruded do nGrow layers of connected faces that are
// also not grown. This helps convergence of the layer addition process // also not grown. This helps convergence of the layer addition process
// close to features. // close to features.
// Note: changed(corrected) w.r.t 16x! (didn't do anything in 16x) // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x)
nGrow 0; nGrow 0;
@ -301,7 +301,7 @@ addLayersControls
maxThicknessToMedialRatio 0.3; maxThicknessToMedialRatio 0.3;
// Angle used to pick up medial axis points // Angle used to pick up medial axis points
// Note: changed(corrected) w.r.t 16x! 90 degrees corresponds to 130 in 16x. // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
minMedianAxisAngle 90; minMedianAxisAngle 90;
// Create buffer region for new layer terminations // Create buffer region for new layer terminations

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -86,18 +86,25 @@ void Foam::Time::adjustDeltaT()
(outputTimeIndex_ + 1)*writeInterval_ - (value() - startTime_) (outputTimeIndex_ + 1)*writeInterval_ - (value() - startTime_)
); );
label nStepsToNextWrite = label(timeToNextWrite/deltaT_ - SMALL) + 1; scalar nSteps = timeToNextWrite/deltaT_ - SMALL;
scalar newDeltaT = timeToNextWrite/nStepsToNextWrite;
// Control the increase of the time step to within a factor of 2 // For tiny deltaT the label can overflow!
// and the decrease within a factor of 5. if (nSteps < labelMax)
if (newDeltaT >= deltaT_)
{ {
deltaT_ = min(newDeltaT, 2.0*deltaT_); label nStepsToNextWrite = label(nSteps) + 1;
}
else scalar newDeltaT = timeToNextWrite/nStepsToNextWrite;
{
deltaT_ = max(newDeltaT, 0.2*deltaT_); // Control the increase of the time step to within a factor of 2
// and the decrease within a factor of 5.
if (newDeltaT >= deltaT_)
{
deltaT_ = min(newDeltaT, 2.0*deltaT_);
}
else
{
deltaT_ = max(newDeltaT, 0.2*deltaT_);
}
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,9 +30,24 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::coupledPolyPatch, 0); namespace Foam
{
defineTypeNameAndDebug(coupledPolyPatch, 0);
Foam::scalar Foam::coupledPolyPatch::matchTol = 1E-3; scalar coupledPolyPatch::matchTol = 1E-3;
template<>
const char* NamedEnum<coupledPolyPatch::transformType, 4>::names[] =
{
"unknown",
"rotational",
"translational",
"noOrdering"
};
const NamedEnum<coupledPolyPatch::transformType, 4>
coupledPolyPatch::transformTypeNames;
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
@ -204,12 +219,14 @@ void Foam::coupledPolyPatch::calcTransformTensors
const vectorField& nf, const vectorField& nf,
const vectorField& nr, const vectorField& nr,
const scalarField& smallDist, const scalarField& smallDist,
const scalar absTol const scalar absTol,
const transformType transform
) const ) const
{ {
if (debug) if (debug)
{ {
Pout<< "coupledPolyPatch::calcTransformTensors : " << name() << endl Pout<< "coupledPolyPatch::calcTransformTensors : " << name() << endl
<< " transform:" << transformTypeNames[transform] << nl
<< " (half)size:" << Cf.size() << nl << " (half)size:" << Cf.size() << nl
<< " absTol:" << absTol << nl << " absTol:" << absTol << nl
<< " smallDist min:" << min(smallDist) << nl << " smallDist min:" << min(smallDist) << nl
@ -242,9 +259,16 @@ void Foam::coupledPolyPatch::calcTransformTensors
Pout<< " error:" << error << endl; Pout<< " error:" << error << endl;
} }
if (sum(mag(nf & nr)) < Cf.size()-error) if
(
transform == ROTATIONAL
|| (
transform != TRANSLATIONAL
&& (sum(mag(nf & nr)) < Cf.size()-error)
)
)
{ {
// Rotation, no separation // Type is rotation or unknown and normals not aligned
// Assume per-face differing transformation, correct later // Assume per-face differing transformation, correct later
@ -284,7 +308,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
} }
else else
{ {
// No rotation, possible separation // Translational or (unknown and normals aligned)
forwardT_.setSize(0); forwardT_.setSize(0);
reverseT_.setSize(0); reverseT_.setSize(0);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -53,6 +53,20 @@ class coupledPolyPatch
: :
public polyPatch public polyPatch
{ {
public:
enum transformType
{
UNKNOWN, // unspecified; automatic ordering
ROTATIONAL, // rotation along coordinate axis
TRANSLATIONAL, // translation
NOORDERING // unspecified, no automatic ordering
};
static const NamedEnum<transformType, 4> transformTypeNames;
private:
// Private data // Private data
//- offset (distance) vector from one side of the couple to the other //- offset (distance) vector from one side of the couple to the other
@ -82,6 +96,8 @@ protected:
//- Calculate the transformation tensors //- Calculate the transformation tensors
// smallDist : matching distance per face // smallDist : matching distance per face
// absTol : absolute error in normal // absTol : absolute error in normal
// if transformType = unknown it first tries rotational, then
// translational transform
void calcTransformTensors void calcTransformTensors
( (
const vectorField& Cf, const vectorField& Cf,
@ -89,7 +105,8 @@ protected:
const vectorField& nf, const vectorField& nf,
const vectorField& nr, const vectorField& nr,
const scalarField& smallDist, const scalarField& smallDist,
const scalar absTol = matchTol const scalar absTol = matchTol,
const transformType = UNKNOWN
) const; ) const;
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry

View File

@ -44,24 +44,8 @@ namespace Foam
addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, word); addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, word);
addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, dictionary); addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, dictionary);
template<>
const char* Foam::NamedEnum
<
Foam::cyclicPolyPatch::transformType,
4
>::names[] =
{
"unknown",
"rotational",
"translational",
"noOrdering"
};
} }
const Foam::NamedEnum<Foam::cyclicPolyPatch::transformType, 4>
Foam::cyclicPolyPatch::transformTypeNames;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -271,7 +255,9 @@ void Foam::cyclicPolyPatch::calcTransforms
static_cast<const pointField&>(half1Ctrs), static_cast<const pointField&>(half1Ctrs),
half0Normals, half0Normals,
half1Normals, half1Normals,
half0Tols half0Tols,
matchTol,
transform_
); );
if (transform_ == ROTATIONAL && !parallel() && forwardT().size() > 1) if (transform_ == ROTATIONAL && !parallel() && forwardT().size() > 1)

View File

@ -64,20 +64,6 @@ class cyclicPolyPatch
: :
public coupledPolyPatch public coupledPolyPatch
{ {
public:
enum transformType
{
UNKNOWN, // unspecified; automatic ordering
ROTATIONAL, // rotation along coordinate axis
TRANSLATIONAL, // translation
NOORDERING // unspecified, no automatic ordering
};
static const NamedEnum<transformType, 4> transformTypeNames;
private:
// Private data // Private data
//- Name of other half //- Name of other half

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -709,16 +709,17 @@ Foam::directMappedPatchBase::directMappedPatchBase
} }
else else
{ {
FatalErrorIn FatalIOErrorIn
( (
"directMappedPatchBase::directMappedPatchBase\n" "directMappedPatchBase::directMappedPatchBase\n"
"(\n" "(\n"
" const polyPatch& pp,\n" " const polyPatch& pp,\n"
" const dictionary& dict\n" " const dictionary& dict\n"
")\n" ")\n",
dict
) << "Please supply the offsetMode as one of " ) << "Please supply the offsetMode as one of "
<< NamedEnum<offsetMode, 3>::words() << NamedEnum<offsetMode, 3>::words()
<< exit(FatalError); << exit(FatalIOError);
} }
} }

View File

@ -81,17 +81,18 @@ Foam::radiationCoupledBase::radiationCoupledBase
{ {
if (!isA<directMappedPatchBase>(patch_.patch())) if (!isA<directMappedPatchBase>(patch_.patch()))
{ {
FatalErrorIn FatalIOErrorIn
( (
"radiationCoupledBase::radiationCoupledBase\n" "radiationCoupledBase::radiationCoupledBase\n"
"(\n" "(\n"
" const fvPatch& p,\n" " const fvPatch& p,\n"
" const dictionary& dict\n" " const dictionary& dict\n"
")\n" ")\n",
dict
) << "\n patch type '" << patch_.type() ) << "\n patch type '" << patch_.type()
<< "' not type '" << directMappedPatchBase::typeName << "'" << "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << patch_.name() << "\n for patch " << patch_.name()
<< exit(FatalError); << exit(FatalIOError);
} }
emissivity_ = scalarField(patch_.size(), 0.0); emissivity_ = scalarField(patch_.size(), 0.0);
@ -102,16 +103,17 @@ Foam::radiationCoupledBase::radiationCoupledBase
{ {
if(!dict.found("emissivity")) if(!dict.found("emissivity"))
{ {
FatalErrorIn FatalIOErrorIn
( (
"radiationCoupledBase::radiationCoupledBase\n" "radiationCoupledBase::radiationCoupledBase\n"
"(\n" "(\n"
" const fvPatch& p,\n" " const fvPatch& p,\n"
" const dictionary& dict\n" " const dictionary& dict\n"
")\n" ")\n",
dict
) << "\n emissivity key does not exist for patch " ) << "\n emissivity key does not exist for patch "
<< patch_.name() << patch_.name()
<< exit(FatalError); << exit(FatalIOError);
} }
else else
{ {

View File

@ -70,45 +70,80 @@ edges
arc 23 19 ( 0.034 0.094 2.000 ) arc 23 19 ( 0.034 0.094 2.000 )
); );
patches boundary
( (
patch inlet inlet
( {
type patch;
faces
(
(13 12 21 16) (13 12 21 16)
(14 13 16 18) (14 13 16 18)
(15 14 18 20) (15 14 18 20)
(17 22 12 13) (17 22 12 13)
(23 19 14 15) (23 19 14 15)
) );
patch outlet }
( outlet
{
type patch;
faces
(
(1 4 9 0) (1 4 9 0)
(2 6 4 1) (2 6 4 1)
(3 8 6 2) (3 8 6 2)
(5 1 0 10) (5 1 0 10)
(11 3 2 7) (11 3 2 7)
) );
wall innerWall }
( innerWall
{
type wall;
faces
(
(2 1 13 14) (2 1 13 14)
(5 10 22 17) (5 10 22 17)
(5 17 13 1) (5 17 13 1)
(11 7 19 23) (11 7 19 23)
(7 2 14 19) (7 2 14 19)
) );
wall outerWall }
( outerWall
{
type wall;
faces
(
(4 16 21 9) (4 16 21 9)
(6 18 16 4) (6 18 16 4)
(8 20 18 6) (8 20 18 6)
) );
cyclic cyclic }
( cyclic_half0
{
type cyclic;
neighbourPatch cyclic_half1;
transform rotational;
rotationAxis (0 0 1);
rotationCentre (0 0 0);
faces
(
(0 9 21 12) (0 9 21 12)
(10 0 12 22) (10 0 12 22)
);
}
cyclic_half1
{
type cyclic;
neighbourPatch cyclic_half0;
transform rotational;
rotationAxis (0 0 1);
rotationCentre (0 0 0);
faces
(
(3 15 20 8) (3 15 20 8)
(11 23 15 3) (11 23 15 3)
) );
}
); );
mergeMatchPairs mergeMatchPairs