31 #define TEMPLATE template<class GeoMesh> 41 template<
class GeoMesh>
51 "stabilise(" + dsf.
name() +
',' + ds.
name() +
')',
62 template<
class GeoMesh>
63 tmp<DimensionedField<scalar, GeoMesh>>
stabilise 65 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf,
66 const dimensioned<scalar>& ds
69 const DimensionedField<scalar, GeoMesh>& dsf = tdsf();
71 tmp<DimensionedField<scalar, GeoMesh>> tres =
New 74 "stabilise(" + dsf.name() +
',' + ds.name() +
')',
75 dsf.dimensions() + ds.dimensions()
78 stabilise(tres.ref().field(), dsf.field(), ds.value());
108 && (!f1.dimensions().dimensionless() || !f2.dimensions().dimensionless())
112 <<
"pow() expects dimensionless parameters, but found" <<
nl;
114 if (!f1.dimensions().dimensionless())
117 <<
" Base field dimensions: " << f1.dimensions() <<
nl;
119 if (!f2.dimensions().dimensionless())
122 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
130 "pow(" + f1.name() +
',' + f2.name() +
')',
135 pow(tresult.ref().field(), f1.field(), f2.field());
141 template<
class GeoMesh>
142 tmp<DimensionedField<scalar, GeoMesh>>
pow 144 const tmp<DimensionedField<scalar, GeoMesh>>& tf1,
145 const DimensionedField<scalar, GeoMesh>& f2
148 const auto& f1 = tf1();
157 <<
"pow() expects dimensionless parameters, but found" <<
nl;
164 if (!f2.dimensions().dimensionless())
167 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
172 tmp<DimensionedField<scalar, GeoMesh>> tresult =
New 175 "pow(" + f1.
name() +
',' + f2.name() +
')',
179 pow(tresult.ref().field(), f1.
field(), f2.field());
187 template<
class GeoMesh>
188 tmp<DimensionedField<scalar, GeoMesh>>
pow 190 const DimensionedField<scalar, GeoMesh>& f1,
191 const tmp<DimensionedField<scalar, GeoMesh>>& tf2
194 const auto& f2 = tf2();
199 && (!f1.dimensions().dimensionless() || !f2.dimensions().dimensionless())
203 <<
"pow() expects dimensionless parameters, but found" <<
nl;
205 if (!f1.dimensions().dimensionless())
208 <<
" Base field dimensions: " << f1.dimensions() <<
nl;
210 if (!f2.dimensions().dimensionless())
213 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
218 tmp<DimensionedField<scalar, GeoMesh>> tresult =
New 221 "pow(" + f1.name() +
',' + f2.name() +
')',
225 pow(tresult.ref().field(), f1.field(), f2.field());
233 template<
class GeoMesh>
234 tmp<DimensionedField<scalar, GeoMesh>>
pow 236 const tmp<DimensionedField<scalar, GeoMesh>>& tf1,
237 const tmp<DimensionedField<scalar, GeoMesh>>& tf2
240 const auto& f1 = tf1();
241 const auto& f2 = tf2();
246 && (!f1.dimensions().dimensionless() || !f2.dimensions().dimensionless())
250 <<
"pow() expects dimensionless parameters, but found" <<
nl;
252 if (!f1.dimensions().dimensionless())
255 <<
" Base field dimensions: " << f1.dimensions() <<
nl;
257 if (!f2.dimensions().dimensionless())
260 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
271 "pow(" + f1.name() +
',' + f2.name() +
')',
275 pow(tresult.ref().field(), f1.field(), f2.field());
284 template<
class GeoMesh>
285 tmp<DimensionedField<scalar, GeoMesh>>
pow 287 const DimensionedField<scalar, GeoMesh>& f1,
294 && (!ds.dimensions().dimensionless())
298 <<
"pow() expects dimensionless parameters, but found" <<
nl 299 <<
" Exponent dimensions: " << ds.dimensions() <<
nl 306 "pow(" + f1.name() +
',' + ds.name() +
')',
308 pow(f1.dimensions(), ds)
311 pow(tresult.ref().field(), f1.field(), ds.value());
317 template<
class GeoMesh>
318 tmp<DimensionedField<scalar, GeoMesh>>
pow 320 const tmp<DimensionedField<scalar, GeoMesh>>& tf1,
324 const auto& f1 = tf1();
329 && (!ds.dimensions().dimensionless())
333 <<
"pow() expects dimensionless parameters, but found" <<
nl 334 <<
" Exponent dimensions: " << ds.dimensions() <<
nl 338 tmp<DimensionedField<scalar, GeoMesh>> tresult =
New 341 "pow(" + f1.name() +
',' + ds.name() +
')',
342 pow(f1.dimensions(), ds)
345 pow(tresult.ref().field(), f1.field(), ds.value());
353 template<
class GeoMesh>
354 tmp<DimensionedField<scalar, GeoMesh>>
pow 356 const DimensionedField<scalar, GeoMesh>& dsf,
364 template<
class GeoMesh>
365 tmp<DimensionedField<scalar, GeoMesh>>
pow 367 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf,
375 template<
class GeoMesh>
376 tmp<DimensionedField<scalar, GeoMesh>>
pow 379 const DimensionedField<scalar, GeoMesh>& f2
385 && (!ds.dimensions().dimensionless() || !f2.dimensions().dimensionless())
389 <<
"pow() expects dimensionless parameters, but found" <<
nl;
391 if (!ds.dimensions().dimensionless())
394 <<
" Base scalar dimensions: " << ds.dimensions() <<
nl;
396 if (!f2.dimensions().dimensionless())
399 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
407 "pow(" + ds.name() +
',' + f2.name() +
')',
412 pow(tresult.ref().field(), ds.value(), f2.field());
418 template<
class GeoMesh>
419 tmp<DimensionedField<scalar, GeoMesh>>
pow 422 const tmp<DimensionedField<scalar, GeoMesh>>& tf2
425 const auto& f2 = tf2();
430 && (!ds.dimensions().dimensionless() || !f2.dimensions().dimensionless())
434 <<
"pow() expects dimensionless parameters, but found" <<
nl;
436 if (!ds.dimensions().dimensionless())
439 <<
" Base scalar dimensions: " << ds.dimensions() <<
nl;
441 if (!f2.dimensions().dimensionless())
444 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
450 tmp<DimensionedField<scalar, GeoMesh>> tresult =
New 453 "pow(" + ds.name() +
',' + f2.name() +
')',
457 pow(tresult.ref().field(), ds.value(), f2.field());
464 template<
class GeoMesh>
465 tmp<DimensionedField<scalar, GeoMesh>>
pow 468 const DimensionedField<scalar, GeoMesh>& dsf
474 template<
class GeoMesh>
475 tmp<DimensionedField<scalar, GeoMesh>>
pow 478 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf
487 template<
class GeoMesh>
488 tmp<DimensionedField<scalar, GeoMesh>>
atan2 490 const DimensionedField<scalar, GeoMesh>& dsf1,
491 const DimensionedField<scalar, GeoMesh>& dsf2
497 "atan2(" + dsf1.name() +
',' + dsf2.name() +
')',
499 atan2(dsf1.dimensions(), dsf2.dimensions())
502 atan2(tres.ref().field(), dsf1.field(), dsf2.field());
508 template<
class GeoMesh>
509 tmp<DimensionedField<scalar, GeoMesh>>
atan2 511 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf1,
512 const DimensionedField<scalar, GeoMesh>& dsf2
515 const DimensionedField<scalar, GeoMesh>& dsf1 = tdsf1();
517 tmp<DimensionedField<scalar, GeoMesh>> tres =
New 520 "atan2(" + dsf1.name() +
',' + dsf2.name() +
')',
521 atan2(dsf1.dimensions(), dsf2.dimensions())
524 atan2(tres.ref().field(), dsf1.field(), dsf2.field());
532 template<
class GeoMesh>
533 tmp<DimensionedField<scalar, GeoMesh>>
atan2 535 const DimensionedField<scalar, GeoMesh>& dsf1,
536 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf2
539 const DimensionedField<scalar, GeoMesh>& dsf2 = tdsf2();
541 tmp<DimensionedField<scalar, GeoMesh>> tres =
New 544 "atan2(" + dsf1.name() +
',' + dsf2.name() +
')',
545 atan2(dsf1.dimensions(), dsf2.dimensions())
548 atan2(tres.ref().field(), dsf1.field(), dsf2.field());
555 template<
class GeoMesh>
556 tmp<DimensionedField<scalar, GeoMesh>>
atan2 558 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf1,
559 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf2
562 const DimensionedField<scalar, GeoMesh>& dsf1 = tdsf1();
563 const DimensionedField<scalar, GeoMesh>& dsf2 = tdsf2();
571 "atan2(" + dsf1.name() +
',' + dsf2.name() +
')',
572 atan2(dsf1.dimensions(), dsf2.dimensions())
575 atan2(tres.ref().field(), dsf1.field(), dsf2.field());
584 template<
class GeoMesh>
585 tmp<DimensionedField<scalar, GeoMesh>>
atan2 587 const DimensionedField<scalar, GeoMesh>& dsf,
594 "atan2(" + dsf.name() +
',' + ds.name() +
')',
596 atan2(dsf.dimensions(), ds)
599 atan2(tres.ref().field(), dsf.field(), ds.value());
604 template<
class GeoMesh>
605 tmp<DimensionedField<scalar, GeoMesh>>
atan2 607 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf,
611 const DimensionedField<scalar, GeoMesh>& dsf = tdsf();
613 tmp<DimensionedField<scalar, GeoMesh>> tres =
New 616 "atan2(" + dsf.name() +
',' + ds.name() +
')',
617 atan2(dsf.dimensions(), ds)
620 atan2(tres.ref().field(), dsf.field(), ds.value());
627 template<
class GeoMesh>
628 tmp<DimensionedField<scalar, GeoMesh>>
atan2 630 const DimensionedField<scalar, GeoMesh>& dsf,
637 template<
class GeoMesh>
638 tmp<DimensionedField<scalar, GeoMesh>>
atan2 640 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf,
648 template<
class GeoMesh>
649 tmp<DimensionedField<scalar, GeoMesh>>
atan2 652 const DimensionedField<scalar, GeoMesh>& dsf
658 "atan2(" + ds.name() +
',' + dsf.name() +
')',
660 atan2(ds, dsf.dimensions())
663 atan2(tres.ref().field(), ds.value(), dsf.field());
669 template<
class GeoMesh>
670 tmp<DimensionedField<scalar, GeoMesh>>
atan2 673 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf
676 const DimensionedField<scalar, GeoMesh>& dsf = tdsf();
678 tmp<DimensionedField<scalar, GeoMesh>> tres =
New 681 "atan2(" + ds.name() +
',' + dsf.name() +
')',
682 atan2(ds, dsf.dimensions())
685 atan2(tres.ref().field(), ds.value(), dsf.field());
692 template<
class GeoMesh>
693 tmp<DimensionedField<scalar, GeoMesh>>
atan2 696 const DimensionedField<scalar, GeoMesh>& dsf
702 template<
class GeoMesh>
703 tmp<DimensionedField<scalar, GeoMesh>>
atan2 706 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf
756 #define BesselFunc(func) \ 758 template<class GeoMesh> \ 759 tmp<DimensionedField<scalar, GeoMesh>> func \ 762 const DimensionedField<scalar, GeoMesh>& dsf \ 765 if (dimensionSet::checking() && !dsf.dimensions().dimensionless()) \ 767 FatalErrorInFunction \ 768 << "Field is not dimensionless: " << dsf.dimensions() << nl \ 769 << abort(FatalError); \ 773 DimensionedField<scalar, GeoMesh>::New \ 775 #func "(" + name(n) + ',' + dsf.name() + ')', \ 780 func(tres.ref().field(), n, dsf.field()); \ 786 template<class GeoMesh> \ 787 tmp<DimensionedField<scalar, GeoMesh>> func \ 790 const tmp<DimensionedField<scalar, GeoMesh>>& tdsf \ 793 const auto& dsf = tdsf(); \ 795 if (dimensionSet::checking() && !dsf.dimensions().dimensionless()) \ 797 FatalErrorInFunction \ 798 << "Field is not dimensionless: " << dsf.dimensions() << nl \ 799 << abort(FatalError); \ 802 tmp<DimensionedField<scalar, GeoMesh>> tres \ 807 #func "(" + name(n) + ',' + dsf.name() + ')', \ 812 func(tres.ref().field(), n, dsf.field()); \ dimensionedScalar sign(const dimensionedScalar &ds)
dimensionedScalar tanh(const dimensionedScalar &ds)
const Type & value() const noexcept
Return const reference to value.
dimensionedScalar acos(const dimensionedScalar &ds)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
void divide(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
dimensionedScalar log(const dimensionedScalar &ds)
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc)
const word & name() const noexcept
Return the object name.
constexpr char nl
The newline '\n' character (0x0a)
dimensionedScalar yn(const int n, const dimensionedScalar &ds)
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensionedScalar pow025(const dimensionedScalar &ds)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
dimensionedScalar stabilise(const dimensionedScalar &x, const dimensionedScalar &y)
static tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< Type1, GeoMesh >> &tf1, const tmp< DimensionedField< Type2, GeoMesh >> &tf2, const word &name, const dimensionSet &dimensions)
dimensionedScalar y0(const dimensionedScalar &ds)
const dimensionSet dimless
Dimensionless.
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedScalar posPart(const dimensionedScalar &ds)
dimensionedScalar neg(const dimensionedScalar &ds)
dimensionedScalar asin(const dimensionedScalar &ds)
dimensionedScalar pow5(const dimensionedScalar &ds)
dimensionedScalar j1(const dimensionedScalar &ds)
dimensionedScalar pos(const dimensionedScalar &ds)
dimensionedScalar acosh(const dimensionedScalar &ds)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar exp(const dimensionedScalar &ds)
dimensionedScalar asinh(const dimensionedScalar &ds)
dimensionedScalar jn(const int n, const dimensionedScalar &ds)
dimensionedScalar cbrt(const dimensionedScalar &ds)
dimensionedScalar neg0(const dimensionedScalar &ds)
dimensionedScalar atanh(const dimensionedScalar &ds)
const dimensionSet & dimensions() const noexcept
Return const reference to dimensions.
dimensionedScalar y1(const dimensionedScalar &ds)
const Mesh & mesh() const noexcept
Return mesh.
dimensionedScalar pos0(const dimensionedScalar &ds)
dimensionedScalar sin(const dimensionedScalar &ds)
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dimensionedScalar erf(const dimensionedScalar &ds)
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
dimensionSet trans(const dimensionSet &ds)
Check the argument is dimensionless (for transcendental functions)
const Field< Type > & field() const noexcept
Return const-reference to the field values.
const word & name() const noexcept
Return const reference to name.
dimensionedScalar lgamma(const dimensionedScalar &ds)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensionedScalar pow3(const dimensionedScalar &ds)
dimensionedScalar erfc(const dimensionedScalar &ds)
static bool checking() noexcept
True if dimension checking is enabled (the usual default)
dimensionedScalar sinh(const dimensionedScalar &ds)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensionedScalar atan(const dimensionedScalar &ds)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensionedScalar pow4(const dimensionedScalar &ds)
dimensionedScalar pow6(const dimensionedScalar &ds)
Scalar specific part of the implementation of DimensionedField.
dimensionedScalar cosh(const dimensionedScalar &ds)
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
A class for managing temporary objects.
void multiply(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensionedScalar tan(const dimensionedScalar &ds)
dimensionedScalar j0(const dimensionedScalar &ds)
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
bool dimensionless() const
Return true if it is dimensionless.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &iField)
Return tmp field from name, mesh, dimensions, copy of internal field.
dimensionedScalar log10(const dimensionedScalar &ds)
dimensionedScalar negPart(const dimensionedScalar &ds)
const dimensionSet & dimensions() const noexcept
Return dimensions.