37 Type
sum(
const Type&
x,
const bool global)
51 const Type
s =
sum(
x(), global);
81 void Foam::cyclicTransform::update()
83 if (!transformComplete_)
88 switch (transformType_)
94 transform_ = transformer();
98 if (rotationAngle_ == 0)
100 transform_ = transformer();
105 quaternion(rotationAxis_,
degToRad(rotationAngle_)).R();
107 if (
mag(rotationCentre_) == 0)
122 if (
mag(separation_) == 0)
124 transform_ = transformer();
135 bool Foam::cyclicTransform::set
137 const cyclicTransform& t,
138 const scalar lengthScale,
139 const scalar matchTolerance
143 if (t.transformType_ == UNSPECIFIED)
150 if (transformType_ != UNSPECIFIED)
153 if (transformType_ != t.transformType_)
159 const scalar lengthTolerance = lengthScale*matchTolerance;
164 if (transformType_ == ROTATIONAL)
166 const scalar
dot = rotationAxis_ & t.rotationAxis_;
168 if (
mag(
dot) < 1 - matchTolerance)
175 (rotationAxis_ & (rotationCentre_ - t.rotationCentre_))
182 if (transformComplete_ && t.transformComplete_)
197 if (transformType_ == TRANSLATIONAL)
199 if (transformComplete_ && t.transformComplete_)
201 if (
mag(separation_ - t.separation_) > lengthTolerance)
210 if (!transformComplete_ && t.transformComplete_)
229 const bool defaultIsNone
232 transformType_(defaultIsNone ? NONE : UNSPECIFIED),
237 transformComplete_(transformType_ == NONE),
245 const bool defaultIsNone
252 dict.lookupOrDefaultBackwardsCompatible<
word>
254 {
"transformType",
"transform"},
255 transformTypeNames[defaultIsNone ? NONE : UNSPECIFIED]
261 transformType_ == ROTATIONAL
267 transformType_ == ROTATIONAL
274 transformType_ == TRANSLATIONAL
278 {
"separation",
"separationVector"}
285 transformType_ == NONE
287 transformType_ == ROTATIONAL
291 transformType_ == TRANSLATIONAL
297 if (transformComplete_)
311 const scalar matchTolerance,
321 const scalar lengthScale =
sqrt(
mag(area));
324 if (!transformComplete_ && nbrTransform.transformType_ !=
UNSPECIFIED)
326 if (!set(
inv(nbrTransform), lengthScale, matchTolerance))
330 <<
" and neighbour patch " << nbrName
368 const scalar matchTolerance,
384 if (
sum(areas.
size(), global) == 0 ||
sum(nbrAreas.
size(), global) == 0)
391 const vector nbrArea =
sum(nbrAreas, global);
396 const scalar sumMagAreas =
sum(magAreas, global);
397 const scalar sumMagNbrAreas =
sum(magNbrAreas, global);
398 const point ctr =
sum(ctrs*magAreas, global)/sumMagAreas;
399 const point nbrCtr =
sum(nbrCtrs*magNbrAreas, global)/sumMagNbrAreas;
402 const scalar lengthScale =
sqrt(sumMagAreas);
405 if (!transformComplete_)
415 const scalar
dot = normal & negNbrNormal;
424 :
mag(
delta) > lengthScale*rootSmall
436 if (transformType_ != oldTransformType)
442 normal*(negNbrNormal & midNormal)
443 - negNbrNormal*(normal & midNormal)
447 ^ (normal - negNbrNormal);
452 mag(axis) > lengthScale*rootSmall
462 acos(
min(
max(normalPerpA & negNbrNormalPerpA, -1), 1));
464 -
sign((normalPerpA ^ negNbrNormalPerpA) & rotationAxis_)
469 if (transformType_ != oldTransformType)
480 rotationCentre_ =
inv(
A) &
b;
492 transformComplete_ =
true;
498 Info<<
"Transformation calculated between patches " <<
name
509 const point nbrCtrT =
512 const scalar ctrNbrCtrTDistance =
mag(ctr - nbrCtrT);
514 if (ctrNbrCtrTDistance > lengthScale*matchTolerance)
517 str <<
"Patches " <<
name <<
" and " << nbrName <<
" are potentially "
518 <<
"not geometrically similar enough to be coupled." <<
nl <<
nl
519 <<
"The distance between the transformed centres of these patches "
520 <<
"is " << ctrNbrCtrTDistance <<
", which is greater than the "
521 <<
"patch length scale (" << lengthScale <<
") multiplied by the "
522 <<
"match tolerance (" << matchTolerance <<
")." <<
nl <<
nl
523 <<
"Check that the patches are geometrically similar and that any "
524 <<
"transformations defined between them are correct." <<
nl <<
nl
525 <<
"If the patches and their transformations are defined correctly "
526 <<
"but small irregularities in the mesh mean this geometric test "
527 <<
"is failing, then it might be appropriate to relax the failure "
528 <<
"criteria by increasing the \"matchTolerance\" setting for "
529 <<
"these patches in the \"polyMesh/boundary\" file.";
551 if (transformType_ != UNSPECIFIED)
553 writeEntry(os,
"transformType", transformTypeNames[transformType_]);
556 if (transformType_ == ROTATIONAL)
558 writeEntry(os,
"rotationAxis", rotationAxis_);
559 writeEntry(os,
"rotationCentre", rotationCentre_);
561 if (transformComplete_)
563 writeEntry(os,
"rotationAngle", rotationAngle_);
567 if (transformType_ == TRANSLATIONAL)
569 if (transformComplete_)
592 c1.rotationCentre_ = t.transformPosition(
c1.rotationCentre_);
597 if (
c1.transformComplete_)
599 c1.separation_ = t.transform(
c1.separation_);
603 if (
c1.transformComplete_)
618 if (
c1.transformComplete_)
620 c1.rotationAngle_ = -
c1.rotationAngle_;
626 if (
c1.transformComplete_)
628 c1.separation_ = -
c1.separation_;
632 if (
c1.transformComplete_)
static const Foam::dimensionedScalar A("A", Foam::dimPressure, 611.21)
Istream and Ostream manipulators taking arguments.
#define forAll(list, i)
Loop across all elements in list.
Pre-declare SubField and related Field type.
void size(const label)
Override size to be inconsistent with allocated storage.
Initialise the NamedEnum HashTable from the static list of names.
Output to memory buffer stream.
string str() const
Return the string.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual int precision() const =0
Get precision of output field.
static Form uniform(const Cmpt &s)
Return a VectorSpace with all elements = s.
A list of keyword definitions, which are a keyword followed by any number of values (e....
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
ITstream & lookupBackwardsCompatible(const wordList &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream, trying a list of keywords.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Quaternion class used to perform rotations in 3D space.
tensor R() const
The rotation tensor corresponding the quaternion.
A class for managing temporary objects.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const dimensionedScalar c1
First radiation constant: default SI units: [W/m^2].
string breakIntoIndentedLines(const string &str, const string::size_type nLength=80, const string::size_type nIndent=0)
Break a string up into indented lines.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Type gSum(const FieldField< Field, Type > &f)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
dimensionedScalar sign(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Tensor< scalar > tensor
Tensor of scalars.
label findMax(const ListType &, const label start=0)
Find index of max element (and larger than given element).
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
scalar radToDeg(const scalar rad)
Conversion from radians to degrees.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
dimensionedScalar sqrt(const dimensionedScalar &ds)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensionSet transform(const dimensionSet &)
dimensioned< scalar > mag(const dimensioned< Type > &)
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Form normalised(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
static scalar R(const scalar a, const scalar x)
dimensionSet cmptMag(const dimensionSet &)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
word name(const complex &)
Return a string representation of a complex.
Ostream & indent(Ostream &os)
Indent stream.
dimensionedScalar acos(const dimensionedScalar &ds)
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
Unit conversion functions.