Go to the documentation of this file.
47 void Foam::cyclicFaPatch::calcTransforms()
53 for (label i=0; i<
size()/2; ++i)
64 scalar maxMatchError = 0;
67 for (label edgei = 0; edgei <
size()/2; ++edgei)
69 half0Normals[edgei] = eN[edgei];
70 label nbrEdgei = edgei +
size()/2;
71 half1Normals[edgei] = eN[nbrEdgei];
73 scalar magLe =
mag(half0Normals[edgei]);
74 scalar nbrMagLe =
mag(half1Normals[edgei]);
75 scalar avLe = (magLe + nbrMagLe)/2.0;
77 if (magLe < ROOTVSMALL && nbrMagLe < ROOTVSMALL)
82 half0Normals[edgei] =
point(1, 0, 0);
83 half1Normals[edgei] = half0Normals[edgei];
94 half0Normals[edgei] /= magLe;
95 half1Normals[edgei] /= nbrMagLe;
102 label nbrEdgei = errorEdge +
size()/2;
103 scalar magLe =
mag(half0Normals[errorEdge]);
104 scalar nbrMagLe =
mag(half1Normals[errorEdge]);
105 scalar avLe = (magLe + nbrMagLe)/2.0;
108 <<
"edge " << errorEdge
109 <<
" area does not match neighbour "
110 << nbrEdgei <<
" by "
111 << 100*
mag(magLe - nbrMagLe)/avLe
112 <<
"% -- possible edge ordering problem." <<
endl
113 <<
"patch:" <<
name()
114 <<
" my area:" << magLe
115 <<
" neighbour area:" << nbrMagLe
118 <<
"Mesh edge:" <<
start() + errorEdge
120 <<
"Neighbour edge:" <<
start() + nbrEdgei
122 <<
"Other errors also exist, only the largest is reported. "
123 <<
"Please rerun with cyclic debug flag set"
142 <<
"Transformation tensor is not constant for the cyclic "
143 <<
"patch. Please reconsider your setup and definition of "
144 <<
"cyclic boundaries." <<
endl;
156 label sizeby2 = deltas.size()/2;
158 scalar maxMatchError = 0;
159 label errorEdge = -1;
161 for (label edgei = 0; edgei < sizeby2; ++edgei)
163 scalar avL = (magL[edgei] + magL[edgei + sizeby2])/2.0;
167 mag(magL[edgei] - magL[edgei + sizeby2])/avL
176 mag(magL[edgei] - magL[edgei + sizeby2])/avL
182 scalar di = deltas[edgei];
183 scalar dni = deltas[edgei + sizeby2];
185 w[edgei] = dni/(di + dni);
186 w[edgei + sizeby2] = 1 - w[edgei];
190 if (maxMatchError > matchTol_)
192 scalar avL = (magL[errorEdge] + magL[errorEdge + sizeby2])/2.0;
195 <<
"edge " << errorEdge <<
" and " << errorEdge + sizeby2
196 <<
" areas do not match by "
197 << 100*
mag(magL[errorEdge] - magL[errorEdge + sizeby2])/avL
198 <<
"% -- possible edge ordering problem." <<
nl
199 <<
"Cyclic area match tolerance = "
200 << matchTol_ <<
" patch: " <<
name()
209 label sizeby2 = deltas.size()/2;
211 for (label edgei = 0; edgei < sizeby2; ++edgei)
213 scalar di = deltas[edgei];
214 scalar dni = deltas[edgei + sizeby2];
216 dc[edgei] = 1.0/(di + dni);
217 dc[edgei + sizeby2] = dc[edgei];
251 label sizeby2 = patchD.size()/2;
259 for (label edgei = 0; edgei < sizeby2; ++edgei)
261 const vector& ddi = patchD[edgei];
262 vector dni = patchD[edgei + sizeby2];
264 pdv[edgei] = ddi - dni;
265 pdv[edgei + sizeby2] = -pdv[edgei];
270 for (label edgei = 0; edgei < sizeby2; ++edgei)
272 const vector& ddi = patchD[edgei];
273 vector dni = patchD[edgei + sizeby2];
275 pdv[edgei] = ddi -
transform(forwardT()[0], dni);
276 pdv[edgei + sizeby2] = -
transform(reverseT()[0], pdv[edgei]);
289 return patchInternalField(internalData);
302 label sizeby2 = this->size()/2;
304 for (label edgei=0; edgei<sizeby2; ++edgei)
306 pnf[edgei] = interfaceData[edgei + sizeby2];
307 pnf[edgei + sizeby2] = interfaceData[edgei];
325 label sizeby2 = this->size()/2;
327 for (label edgei=0; edgei<sizeby2; ++edgei)
329 pnf[edgei] = iF[edgeCells[edgei + sizeby2]];
330 pnf[edgei + sizeby2] = iF[edgeCells[edgei]];
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
vectorField pointField
pointField is a vectorField.
virtual void initMovePoints(const pointField &)
Initialise the patches for moving points.
virtual void calcGeometry()
Calculate the patch geometry.
void makeWeights(scalarField &) const
Make patch weighting factors.
bool parallel() const
Are the cyclic planes parallel.
A class for managing temporary objects.
virtual void movePoints(const pointField &)
Correct patch after moving points.
void makeDeltaCoeffs(scalarField &) const
Make patch face - neighbour cell distances.
virtual void calcGeometry()
Calculate the patch geometry.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
virtual tmp< vectorField > delta() const
Return cell-centre to face-centre vector.
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual void initMovePoints(const pointField &)
Initialise the patches for moving points.
Field< label > labelField
Specialisation of Field<T> for label.
word name(const complex &c)
Return string representation of complex.
const vectorField & edgeCentres() const
Return edge centres.
#define SeriousErrorInFunction
Report an error message using Foam::SeriousError.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to.
static const scalar matchTol_
Relative tolerance (for geometric matching). Is factor of.
virtual void initGeometry()
Initialise the calculation of the patch geometry.
Macros for easy insertion into run-time selection tables.
virtual const tensorField & forwardT() const
Return face transformation tensor.
errorManip< error > abort(error &err)
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
label start() const
Patch start in edge list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
commsTypes
Types of communications.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void calcTransformTensors(const vector &Cf, const vector &Cr, const vector &nf, const vector &nr) const
Calculate the uniform transformation tensors.
const scalarField & magEdgeLengths() const
Return edge length magnitudes.
virtual tmp< labelField > transfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Transfer and return neighbour field.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
virtual void movePoints(const pointField &)
Correct patches after moving points.
const dimensionedScalar e
Elementary charge.
tmp< vectorField > edgeNormals() const
Return edge normals.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
virtual void initGeometry()
Initialise the calculation of the patch geometry.
vector point
Point is a vector.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
defineTypeNameAndDebug(combustionModel, 0)
const word & name() const
The patch name.
Smooth ATC in cells next to a set of patches supplied by type.
virtual label size() const
Patch size.