OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
olb::MagneticFieldFromCylinder3D< T, S > Class Template Referencefinal

#include <frameChangeF3D.h>

+ Inheritance diagram for olb::MagneticFieldFromCylinder3D< T, S >:
+ Collaboration diagram for olb::MagneticFieldFromCylinder3D< T, S >:

Public Member Functions

 MagneticFieldFromCylinder3D (CartesianToCylinder3D< T, S > &car2cyl, T length, T radWire, T cutoff, T Mw)
 
bool operator() (T output[], const S x[]) override
 operator writes the magnetic force in a point x util::round a cylindrical wire into output field
 
- Public Member Functions inherited from olb::AnalyticalF< D, T, S >
AnalyticalF< D, T, S > & operator- (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator+ (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator* (AnalyticalF< D, T, S > &rhs)
 
AnalyticalF< D, T, S > & operator/ (AnalyticalF< D, T, S > &rhs)
 
- Public Member Functions inherited from olb::GenericF< T, S >
virtual ~GenericF ()=default
 
int getSourceDim () const
 read only access to member variable _m
 
int getTargetDim () const
 read only access to member variable _n
 
std::string & getName ()
 read and write access to name
 
std::string const & getName () const
 read only access to name
 
bool operator() (T output[])
 wrapper that call the pure virtual operator() (T output[], const S input[]) from above
 
bool operator() (T output[], S input0)
 
bool operator() (T output[], S input0, S input1)
 
bool operator() (T output[], S input0, S input1, S input2)
 
bool operator() (T output[], S input0, S input1, S input2, S input3)
 

Protected Attributes

CartesianToCylinder3D< T, S > & _car2cyl
 
_length
 length of the wire, from origin to _car2cyl.axisDirection
 
_radWire
 wire radius
 
_cutoff
 maximal distance from wire cutoff/threshold
 
_Mw
 saturation magnetization wire, linear scaling factor
 
_factor
 factor = mu0*4/3.*PI*radParticle^3*_Mp*radWire^2/r^3
 

Additional Inherited Members

- Public Types inherited from olb::AnalyticalF< D, T, S >
using identity_functor_type = AnalyticalIdentity<D,T,S>
 
- Public Types inherited from olb::GenericF< T, S >
using targetType = T
 
using sourceType = S
 
- Public Attributes inherited from olb::GenericF< T, S >
std::shared_ptr< GenericF< T, S > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Static Public Attributes inherited from olb::AnalyticalF< D, T, S >
static constexpr unsigned dim = D
 
- Protected Member Functions inherited from olb::AnalyticalF< D, T, S >
 AnalyticalF (int n)
 
- Protected Member Functions inherited from olb::GenericF< T, S >
 GenericF (int targetDim, int sourceDim)
 

Detailed Description

template<typename T, typename S>
class olb::MagneticFieldFromCylinder3D< T, S >

Definition at line 526 of file frameChangeF3D.h.

Constructor & Destructor Documentation

◆ MagneticFieldFromCylinder3D()

template<typename T , typename S >
olb::MagneticFieldFromCylinder3D< T, S >::MagneticFieldFromCylinder3D ( CartesianToCylinder3D< T, S > & car2cyl,
T length,
T radWire,
T cutoff,
T Mw )

Definition at line 1246 of file frameChangeF3D.hh.

1249 : AnalyticalF3D<T, S>(3),
1250 _car2cyl(car2cyl),
1251 _length(length),
1252 _radWire(radWire),
1253 _cutoff(cutoff),
1254 _Mw(Mw)
1255{
1256 // Field direction H_0 parallel to fluid flow direction, if not: *(-1)
1257 _factor = - _Mw * util::pow(_radWire, 2);
1258}
T _factor
factor = mu0*4/3.*PI*radParticle^3*_Mp*radWire^2/r^3
T _cutoff
maximal distance from wire cutoff/threshold
CartesianToCylinder3D< T, S > & _car2cyl
T _length
length of the wire, from origin to _car2cyl.axisDirection
T _Mw
saturation magnetization wire, linear scaling factor
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

References olb::MagneticFieldFromCylinder3D< T, S >::_factor, olb::MagneticFieldFromCylinder3D< T, S >::_Mw, olb::MagneticFieldFromCylinder3D< T, S >::_radWire, and olb::util::pow().

+ Here is the call graph for this function:

Member Function Documentation

◆ operator()()

template<typename T , typename S >
bool olb::MagneticFieldFromCylinder3D< T, S >::operator() ( T output[],
const S x[] )
overridevirtual

operator writes the magnetic force in a point x util::round a cylindrical wire into output field

Implements olb::GenericF< T, S >.

Definition at line 1261 of file frameChangeF3D.hh.

1262{
1263
1264 Vector<T, 3> magneticFieldPolar;
1265 T outputTmp[3] = {T(), T(), T()};
1266 Vector<T, 3> normalAxis(_car2cyl.getAxisDirection());
1267 normalAxis = normalize(normalAxis);
1268
1269 Vector<T, 3> relPosition;
1270 relPosition[0] = (x[0] - _car2cyl.getCartesianOrigin()[0]);
1271 relPosition[1] = (x[1] - _car2cyl.getCartesianOrigin()[1]);
1272 relPosition[2] = (x[2] - _car2cyl.getCartesianOrigin()[2]);
1273
1274 T tmp[3] = {T(), T(), T()};
1275 _car2cyl(tmp, x);
1276 T rad = tmp[0];
1277 T phi = tmp[1];
1278
1279 T test = relPosition * normalAxis;
1280
1281 if ( (rad > _radWire && rad <= _cutoff * _radWire) &&
1282 (T(0) <= test && test <= _length) ) {
1283
1284 magneticFieldPolar[0] = _factor / util::pow(rad, 2)
1285 * (util::cos(phi));
1286 magneticFieldPolar[1] = _factor / util::pow(rad, 2) * util::sin(phi);
1287
1288 // changes radial and angular force components to cartesian components.
1289 outputTmp[0] = magneticFieldPolar[0] * util::cos(phi)
1290 - magneticFieldPolar[1] * util::sin(phi);
1291 outputTmp[1] = magneticFieldPolar[0] * util::sin(phi)
1292 + magneticFieldPolar[1] * util::cos(phi);
1293
1294 // if not in standard axis direction
1295 if ( !( util::nearZero(normalAxis[0]) && util::nearZero(normalAxis[1]) && util::nearZero(normalAxis[2] - 1) ) ) {
1296 Vector<T, 3> e3(T(), T(), T(1));
1297 Vector<T, 3> orientation =
1298 crossProduct3D(Vector<T, 3>(_car2cyl.getAxisDirection()), e3);
1299
1300 AngleBetweenVectors3D<T, S> angle(util::fromVector3(e3), util::fromVector3(orientation));
1301 T alpha[1] = {T()};
1302 T tmp2[3] = {T(), T(), T()};
1303 for (int i = 0; i < 3; ++i) {
1304 tmp2[i] = _car2cyl.getAxisDirection()[i];
1305 }
1306 angle(alpha, tmp2);
1307
1308 std::vector<T> origin(3, T());
1309 RotationRoundAxis3D<T, S> rotRAxis(origin, util::fromVector3(orientation), alpha[0]);
1310 rotRAxis(output, outputTmp);
1311 }
1312 else {
1313 output[0] = outputTmp[0];
1314 output[1] = outputTmp[1];
1315 output[2] = T();
1316 }
1317 }
1318 else {
1319 output[0] = outputTmp[0];
1320 output[1] = outputTmp[1];
1321 output[2] = outputTmp[1];
1322 }
1323
1324 return true;
1325}
std::vector< T > fromVector3(const Vector< T, 3 > &vec)
ADf< T, DIM > sin(const ADf< T, DIM > &a)
Definition aDiff.h:569
bool nearZero(const ADf< T, DIM > &a)
Definition aDiff.h:1087
ADf< T, DIM > cos(const ADf< T, DIM > &a)
Definition aDiff.h:578
constexpr Vector< T, 3 > crossProduct3D(const ScalarVector< T, 3, IMPL > &a, const ScalarVector< T, 3, IMPL_ > &b) any_platform
Definition vector.h:224
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:245

References olb::util::cos(), olb::crossProduct3D(), olb::util::fromVector3(), olb::util::nearZero(), olb::normalize(), olb::util::pow(), and olb::util::sin().

+ Here is the call graph for this function:

Member Data Documentation

◆ _car2cyl

template<typename T , typename S >
CartesianToCylinder3D<T, S>& olb::MagneticFieldFromCylinder3D< T, S >::_car2cyl
protected

Definition at line 528 of file frameChangeF3D.h.

◆ _cutoff

template<typename T , typename S >
T olb::MagneticFieldFromCylinder3D< T, S >::_cutoff
protected

maximal distance from wire cutoff/threshold

Definition at line 534 of file frameChangeF3D.h.

◆ _factor

template<typename T , typename S >
T olb::MagneticFieldFromCylinder3D< T, S >::_factor
protected

factor = mu0*4/3.*PI*radParticle^3*_Mp*radWire^2/r^3

Definition at line 538 of file frameChangeF3D.h.

◆ _length

template<typename T , typename S >
T olb::MagneticFieldFromCylinder3D< T, S >::_length
protected

length of the wire, from origin to _car2cyl.axisDirection

Definition at line 530 of file frameChangeF3D.h.

◆ _Mw

template<typename T , typename S >
T olb::MagneticFieldFromCylinder3D< T, S >::_Mw
protected

saturation magnetization wire, linear scaling factor

Definition at line 536 of file frameChangeF3D.h.

◆ _radWire

template<typename T , typename S >
T olb::MagneticFieldFromCylinder3D< T, S >::_radWire
protected

wire radius

Definition at line 532 of file frameChangeF3D.h.


The documentation for this class was generated from the following files: