31#define TEMPLATE template<template<class> class PatchField, class GeoMesh>
41template<
template<
class>
class PatchField,
class GeoMesh>
54template<
template<
class>
class PatchField,
class GeoMesh>
55tmp<GeometricField<scalar, PatchField, GeoMesh>>
stabilise
57 const GeometricField<scalar, PatchField, GeoMesh>& gsf,
58 const dimensioned<scalar>& ds
63 "stabilise(" + gsf.name() +
',' + ds.name() +
')',
65 ds.dimensions() + gsf.dimensions()
74template<
template<
class>
class PatchField,
class GeoMesh>
75tmp<GeometricField<scalar, PatchField, GeoMesh>>
stabilise
77 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf,
78 const dimensioned<scalar>& ds
81 const GeometricField<scalar, PatchField, GeoMesh>& gsf = tgsf();
83 tmp<GeometricField<scalar, PatchField, GeoMesh>> tRes
88 "stabilise(" + gsf.name() +
',' + ds.name() +
')',
89 ds.dimensions() + gsf.dimensions()
114template<template<class> class PatchField, class
GeoMesh>
122 pow(Pow.primitiveFieldRef(), gsf1.primitiveField(), gsf2.primitiveField());
123 pow(Pow.boundaryFieldRef(), gsf1.boundaryField(), gsf2.boundaryField());
124 Pow.correctLocalBoundaryConditions();
127 Pow.boundaryField().check();
132template<
template<
class>
class PatchField,
class GeoMesh>
142 && (!f1.dimensions().dimensionless() || !f2.dimensions().dimensionless())
146 <<
"pow() expects dimensionless parameters, but found" <<
nl;
148 if (!f1.dimensions().dimensionless())
151 <<
" Base field dimensions: " << f1.dimensions() <<
nl;
153 if (!f2.dimensions().dimensionless())
156 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
163 "pow(" + f1.name() +
',' + f2.name() +
')',
168 pow(tresult.ref(), f1, f2);
174template<
template<
class>
class PatchField,
class GeoMesh>
175tmp<GeometricField<scalar, PatchField, GeoMesh>>
pow
177 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tf1,
178 const GeometricField<scalar, PatchField, GeoMesh>& f2
181 const auto& f1 = tf1();
186 && (!f1.dimensions().dimensionless() || !f2.dimensions().dimensionless())
190 <<
"pow() expects dimensionless parameters, but found" <<
nl;
192 if (!f1.dimensions().dimensionless())
195 <<
" Base field dimensions: " << f1.dimensions() <<
nl;
197 if (!f2.dimensions().dimensionless())
200 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
210 "pow(" + f1.name() +
',' + f2.name() +
')',
215 pow(tresult.ref(), f1, f2);
223template<
template<
class>
class PatchField,
class GeoMesh>
224tmp<GeometricField<scalar, PatchField, GeoMesh>>
pow
226 const GeometricField<scalar, PatchField, GeoMesh>& f1,
227 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tf2
230 const auto& f2 = tf2();
235 && (!f1.dimensions().dimensionless() || !f2.dimensions().dimensionless())
239 <<
"pow() expects dimensionless parameters, but found" <<
nl;
241 if (!f1.dimensions().dimensionless())
244 <<
" Base field dimensions: " << f1.dimensions() <<
nl;
246 if (!f2.dimensions().dimensionless())
249 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
259 "pow(" + f1.name() +
',' + f2.name() +
')',
264 pow(tresult.ref(), f1, f2);
271template<
template<
class>
class PatchField,
class GeoMesh>
272tmp<GeometricField<scalar, PatchField, GeoMesh>>
pow
274 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tf1,
275 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tf2
278 const auto& f1 = tf1();
279 const auto& f2 = tf2();
284 && (!f1.dimensions().dimensionless() || !f2.dimensions().dimensionless())
288 <<
"pow() expects dimensionless parameters, but found" <<
nl;
290 if (!f1.dimensions().dimensionless())
293 <<
" Base field dimensions: " << f1.dimensions() <<
nl;
295 if (!f2.dimensions().dimensionless())
298 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
306 <scalar, scalar, scalar, scalar, PatchField,
GeoMesh>
::New
310 "pow(" + f1.name() +
',' + f2.name() +
')',
315 pow(tresult.ref(), f1, f2);
324template<
template<
class>
class PatchField,
class GeoMesh>
327 GeometricField<scalar, PatchField, GeoMesh>& tPow,
328 const GeometricField<scalar, PatchField, GeoMesh>& gsf,
329 const dimensioned<scalar>& ds
332 pow(tPow.primitiveFieldRef(), gsf.primitiveField(), ds.value());
333 pow(tPow.boundaryFieldRef(), gsf.boundaryField(), ds.value());
334 tPow.correctLocalBoundaryConditions();
337 tPow.boundaryField().check();
342template<
template<
class>
class PatchField,
class GeoMesh>
352 && (!ds.dimensions().dimensionless())
356 <<
"pow() expects dimensionless parameters, but found" <<
nl
357 <<
" Exponent dimensions: " << ds.dimensions() <<
nl
363 "pow(" + f1.name() +
',' + ds.name() +
')',
365 pow(f1.dimensions(), ds)
368 pow(tresult.ref(), f1, ds);
373template<
template<
class>
class PatchField,
class GeoMesh>
374tmp<GeometricField<scalar, PatchField, GeoMesh>>
pow
376 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tf1,
380 const auto& f1 = tf1();
385 && (!ds.dimensions().dimensionless())
389 <<
"pow() expects dimensionless parameters, but found" <<
nl
390 <<
" Exponent dimensions: " << ds.dimensions() <<
nl
399 "pow(" + f1.name() +
',' + ds.name() +
')',
400 pow(f1.dimensions(), ds)
404 pow(tresult.ref(), f1, ds);
411template<
template<
class>
class PatchField,
class GeoMesh>
412tmp<GeometricField<scalar, PatchField, GeoMesh>>
pow
414 const GeometricField<scalar, PatchField, GeoMesh>& gsf,
421template<
template<
class>
class PatchField,
class GeoMesh>
422tmp<GeometricField<scalar, PatchField, GeoMesh>>
pow
424 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf,
432template<
template<
class>
class PatchField,
class GeoMesh>
435 GeometricField<scalar, PatchField, GeoMesh>& tPow,
436 const dimensioned<scalar>& ds,
437 const GeometricField<scalar, PatchField, GeoMesh>& gsf
440 pow(tPow.primitiveFieldRef(), ds.value(), gsf.primitiveField());
441 pow(tPow.boundaryFieldRef(), ds.value(), gsf.boundaryField());
442 tPow.correctLocalBoundaryConditions();
445 tPow.boundaryField().check();
450template<
template<
class>
class PatchField,
class GeoMesh>
460 && (!ds.dimensions().dimensionless() || !f2.dimensions().dimensionless())
464 <<
"pow() expects dimensionless parameters, but found" <<
nl;
466 if (!ds.dimensions().dimensionless())
469 <<
" Base scalar dimensions: " << ds.dimensions() <<
nl;
471 if (!f2.dimensions().dimensionless())
474 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
481 "pow(" + ds.name() +
',' + f2.name() +
')',
486 pow(tresult.ref(), ds, f2);
492template<
template<
class>
class PatchField,
class GeoMesh>
493tmp<GeometricField<scalar, PatchField, GeoMesh>>
pow
496 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tf2
499 const auto& f2 = tf2();
504 && (!ds.dimensions().dimensionless() || !f2.dimensions().dimensionless())
508 <<
"pow() expects dimensionless parameters, but found" <<
nl;
510 if (!ds.dimensions().dimensionless())
513 <<
" Base scalar dimensions: " << ds.dimensions() <<
nl;
515 if (!f2.dimensions().dimensionless())
518 <<
" Exponent field dimensions: " << f2.dimensions() <<
nl;
528 "pow(" + ds.name() +
',' + f2.name() +
')',
533 pow(tresult.ref(), ds, f2);
540template<
template<
class>
class PatchField,
class GeoMesh>
541tmp<GeometricField<scalar, PatchField, GeoMesh>>
pow
550template<
template<
class>
class PatchField,
class GeoMesh>
551tmp<GeometricField<scalar, PatchField, GeoMesh>>
pow
554 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf
563template<
template<
class>
class PatchField,
class GeoMesh>
566 GeometricField<scalar, PatchField, GeoMesh>& Atan2,
567 const GeometricField<scalar, PatchField, GeoMesh>& gsf1,
568 const GeometricField<scalar, PatchField, GeoMesh>& gsf2
573 Atan2.primitiveFieldRef(),
574 gsf1.primitiveField(),
575 gsf2.primitiveField()
579 Atan2.boundaryFieldRef(),
580 gsf1.boundaryField(),
584 Atan2.correctLocalBoundaryConditions();
588 Atan2.boundaryField().check();
593template<
template<
class>
class PatchField,
class GeoMesh>
602 "atan2(" + gsf1.name() +
',' + gsf2.name() +
')',
604 atan2(gsf1.dimensions(), gsf2.dimensions())
613template<
template<
class>
class PatchField,
class GeoMesh>
614tmp<GeometricField<scalar, PatchField, GeoMesh>>
atan2
616 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf1,
617 const GeometricField<scalar, PatchField, GeoMesh>& gsf2
620 const GeometricField<scalar, PatchField, GeoMesh>& gsf1 = tgsf1();
622 tmp<GeometricField<scalar, PatchField, GeoMesh>> tAtan2
627 "atan2(" + gsf1.name() +
',' + gsf2.name() +
')',
628 atan2(gsf1.dimensions(), gsf2.dimensions())
632 atan2(tAtan2.ref(), gsf1, gsf2);
640template<
template<
class>
class PatchField,
class GeoMesh>
641tmp<GeometricField<scalar, PatchField, GeoMesh>>
atan2
643 const GeometricField<scalar, PatchField, GeoMesh>& gsf1,
644 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf2
647 const GeometricField<scalar, PatchField, GeoMesh>& gsf2 = tgsf2();
649 tmp<GeometricField<scalar, PatchField, GeoMesh>> tAtan2
654 "atan2(" + gsf1.name() +
',' + gsf2.name() +
')',
655 atan2( gsf1.dimensions(), gsf2.dimensions())
659 atan2(tAtan2.ref(), gsf1, gsf2);
666template<
template<
class>
class PatchField,
class GeoMesh>
667tmp<GeometricField<scalar, PatchField, GeoMesh>>
atan2
669 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf1,
670 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf2
673 const GeometricField<scalar, PatchField, GeoMesh>& gsf1 = tgsf1();
674 const GeometricField<scalar, PatchField, GeoMesh>& gsf2 = tgsf2();
676 tmp<GeometricField<scalar, PatchField, GeoMesh>> tAtan2
678 reuseTmpTmpGeometricField
679 <scalar, scalar, scalar, scalar, PatchField, GeoMesh>
::New
683 "atan2(" + gsf1.name() +
',' + gsf2.name() +
')',
684 atan2(gsf1.dimensions(), gsf2.dimensions())
688 atan2(tAtan2.ref(), gsf1, gsf2);
697template<
template<
class>
class PatchField,
class GeoMesh>
700 GeometricField<scalar, PatchField, GeoMesh>& tAtan2,
701 const GeometricField<scalar, PatchField, GeoMesh>& gsf,
702 const dimensioned<scalar>& ds
705 atan2(tAtan2.primitiveFieldRef(), gsf.primitiveField(), ds.value());
706 atan2(tAtan2.boundaryFieldRef(), gsf.boundaryField(), ds.value());
707 tAtan2.correctLocalBoundaryConditions();
710 tAtan2.boundaryField().check();
715template<
template<
class>
class PatchField,
class GeoMesh>
724 "atan2(" + gsf.name() +
',' + ds.name() +
')',
726 atan2(gsf.dimensions(), ds)
729 atan2(tAtan2.ref(), gsf, ds);
734template<
template<
class>
class PatchField,
class GeoMesh>
735tmp<GeometricField<scalar, PatchField, GeoMesh>>
atan2
737 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf,
741 const GeometricField<scalar, PatchField, GeoMesh>& gsf = tgsf();
743 tmp<GeometricField<scalar, PatchField, GeoMesh>> tAtan2
748 "atan2(" + gsf.name() +
',' + ds.name() +
')',
749 atan2(gsf.dimensions(), ds)
753 atan2(tAtan2.ref(), gsf, ds);
760template<
template<
class>
class PatchField,
class GeoMesh>
761tmp<GeometricField<scalar, PatchField, GeoMesh>>
atan2
763 const GeometricField<scalar, PatchField, GeoMesh>& gsf,
770template<
template<
class>
class PatchField,
class GeoMesh>
771tmp<GeometricField<scalar, PatchField, GeoMesh>>
atan2
773 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf,
781template<
template<
class>
class PatchField,
class GeoMesh>
784 GeometricField<scalar, PatchField, GeoMesh>& tAtan2,
785 const dimensioned<scalar>& ds,
786 const GeometricField<scalar, PatchField, GeoMesh>& gsf
789 atan2(tAtan2.primitiveFieldRef(), ds.value(), gsf.primitiveField());
790 atan2(tAtan2.boundaryFieldRef(), ds.value(), gsf.boundaryField());
791 tAtan2.correctLocalBoundaryConditions();
794 tAtan2.boundaryField().check();
799template<
template<
class>
class PatchField,
class GeoMesh>
808 "atan2(" + ds.name() +
',' + gsf.name() +
')',
810 atan2(ds, gsf.dimensions())
819template<
template<
class>
class PatchField,
class GeoMesh>
820tmp<GeometricField<scalar, PatchField, GeoMesh>>
atan2
823 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf
826 const GeometricField<scalar, PatchField, GeoMesh>& gsf = tgsf();
828 tmp<GeometricField<scalar, PatchField, GeoMesh>> tAtan2
833 "atan2(" + ds.name() +
',' + gsf.name() +
')',
834 atan2(ds, gsf.dimensions())
838 atan2(tAtan2.ref(), ds, gsf);
845template<
template<
class>
class PatchField,
class GeoMesh>
846tmp<GeometricField<scalar, PatchField, GeoMesh>>
atan2
855template<
template<
class>
class PatchField,
class GeoMesh>
856tmp<GeometricField<scalar, PatchField, GeoMesh>>
atan2
859 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf
909#define BesselFunc(func) \
911template<template<class> class PatchField, class GeoMesh> \
914 GeometricField<scalar, PatchField, GeoMesh>& gsf, \
916 const GeometricField<scalar, PatchField, GeoMesh>& gsf1 \
919 func(gsf.primitiveFieldRef(), n, gsf1.primitiveField()); \
920 func(gsf.boundaryFieldRef(), n, gsf1.boundaryField()); \
921 gsf.correctLocalBoundaryConditions(); \
922 if (GeometricBoundaryField<scalar, PatchField, GeoMesh>::debug) \
924 gsf.boundaryField().check(); \
928template<template<class> class PatchField, class GeoMesh> \
929tmp<GeometricField<scalar, PatchField, GeoMesh>> func \
932 const GeometricField<scalar, PatchField, GeoMesh>& gsf \
935 if (dimensionSet::checking() && !gsf.dimensions().dimensionless()) \
937 FatalErrorInFunction \
938 << "Field is not dimensionless: " << gsf.dimensions() << nl \
939 << abort(FatalError); \
942 auto tFunc = GeometricField<scalar, PatchField, GeoMesh>::New \
944 #func "(" + gsf.name() + ')', \
949 func(tFunc.ref(), n, gsf); \
954template<template<class> class PatchField, class GeoMesh> \
955tmp<GeometricField<scalar, PatchField, GeoMesh>> func \
958 const tmp<GeometricField<scalar, PatchField, GeoMesh>>& tgsf \
961 const auto& gsf = tgsf(); \
963 if (dimensionSet::checking() && !gsf.dimensions().dimensionless()) \
965 FatalErrorInFunction \
966 << "Field is not dimensionless: " << gsf.dimensions() << nl \
967 << abort(FatalError); \
970 tmp<GeometricField<scalar, PatchField, GeoMesh>> tFunc \
975 #func "(" + gsf.name() + ')', \
980 func(tFunc.ref(), n, gsf); \
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc)
Scalar specific part of the implementation of GeometricField.
const Mesh & mesh() const noexcept
Return const reference to mesh.
const dimensionSet & dimensions() const noexcept
Return dimensions.
Generic mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
bool check() const
Helper: check if field has been evaluated. See instantiations.
static int debug
Enable debug.
Generic GeometricField class.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=PatchField< Type >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
void correctLocalBoundaryConditions()
Correct boundary conditions after a purely local operation.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
const word & name() const noexcept
Return the object name.
static bool checking(bool on) noexcept
Turn dimension checking on/off.
static bool checking() noexcept
True if dimension checking is enabled (the usual default).
bool dimensionless() const
Return true if it is dimensionless.
Generic dimensioned Type class.
const dimensionSet & dimensions() const noexcept
Return const reference to dimensions.
const word & name() const noexcept
Return const reference to name.
const Type & value() const noexcept
Return const reference to value.
A class for managing temporary objects.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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 pow6(const dimensionedScalar &ds)
dimensionedScalar pos(const dimensionedScalar &ds)
dimensionedScalar pow5(const dimensionedScalar &ds)
dimensionedScalar erfc(const dimensionedScalar &ds)
dimensionedScalar asin(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 exp(const dimensionedScalar &ds)
const dimensionSet dimless
Dimensionless.
dimensionedScalar tan(const dimensionedScalar &ds)
dimensionedScalar pos0(const dimensionedScalar &ds)
dimensionedScalar sign(const dimensionedScalar &ds)
dimensionedScalar lgamma(const dimensionedScalar &ds)
void subtract(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
dimensionedScalar j1(const dimensionedScalar &ds)
dimensionedScalar pow3(const dimensionedScalar &ds)
dimensionedScalar y0(const dimensionedScalar &ds)
dimensionedScalar cosh(const dimensionedScalar &ds)
dimensionedScalar sin(const dimensionedScalar &ds)
dimensionedScalar tanh(const dimensionedScalar &ds)
dimensionedScalar erf(const dimensionedScalar &ds)
dimensionedScalar sinh(const dimensionedScalar &ds)
void divide(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
dimensionedScalar log10(const dimensionedScalar &ds)
dimensionedScalar yn(const int n, const dimensionedScalar &ds)
dimensionedScalar log(const dimensionedScalar &ds)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
dimensionedScalar y1(const dimensionedScalar &ds)
dimensionedScalar negPart(const dimensionedScalar &ds)
dimensionedScalar acosh(const dimensionedScalar &ds)
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensionedScalar pow4(const dimensionedScalar &ds)
dimensionedScalar jn(const int n, const dimensionedScalar &ds)
dimensionSet trans(const dimensionSet &ds)
Check the argument is dimensionless (for transcendental functions).
dimensionedScalar neg(const dimensionedScalar &ds)
dimensionedScalar atanh(const dimensionedScalar &ds)
dimensionedScalar stabilise(const dimensionedScalar &x, const dimensionedScalar &y)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
dimensionedScalar neg0(const dimensionedScalar &ds)
dimensionedScalar cbrt(const dimensionedScalar &ds)
dimensionedScalar atan(const dimensionedScalar &ds)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
void multiply(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar posPart(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)
dimensionedScalar j0(const dimensionedScalar &ds)
dimensionedScalar pow025(const dimensionedScalar &ds)
constexpr char nl
The newline '\n' character (0x0a).
dimensionedScalar asinh(const dimensionedScalar &ds)