OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::MagneticForceFromCylinder3D< T, S > Class Template Referencefinal

Magnetic field that creates magnetization in wire has to be orthogonal to the wire. More...

#include <frameChangeF3D.h>

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

Public Member Functions

 MagneticForceFromCylinder3D (CartesianToCylinder3D< T, S > &car2cyl, T length, T radWire, T cutoff, T Mw, T Mp=T(1), T radParticle=T(1), T mu0=4 *3.14159265e-7)
 Magnetic field that creates magnetization in wire has to be orthogonal to the wire.
 
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
 
_Mp
 magnetization particle, linear scaling factor
 
_radParticle
 particle radius, cubic scaling factor
 
_mu0
 permeability constant, 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::MagneticForceFromCylinder3D< T, S >

Magnetic field that creates magnetization in wire has to be orthogonal to the wire.

To calculate the magnetic force on particles around a cylinder (J. Lindner et al. / Computers and Chemical Engineering 54 (2013) 111-121) Fm = mu0*4/3.*PI*radParticle^3*_Mp*radWire^2/r^3 * [radWire^2/r^2+util::cos(2*theta), util::sin(2*theta), 0]

Definition at line 537 of file frameChangeF3D.h.

Constructor & Destructor Documentation

◆ MagneticForceFromCylinder3D()

template<typename T , typename S >
olb::MagneticForceFromCylinder3D< T, S >::MagneticForceFromCylinder3D ( CartesianToCylinder3D< T, S > & car2cyl,
T length,
T radWire,
T cutoff,
T Mw,
T Mp = T(1),
T radParticle = T(1),
T mu0 = 4*3.14159265e-7 )

Magnetic field that creates magnetization in wire has to be orthogonal to the wire.

To calculate the magnetic force on particles around a cylinder (J. Lindner et al. / Computers and Chemical Engineering 54 (2013) 111-121) Fm = mu0*4/3.*PI*radParticle^3*_Mp*radWire^2/r^3 * [radWire^2/r^2+util::cos(2*theta), util::sin(2*theta), 0]

Definition at line 1188 of file frameChangeF3D.hh.

1192 _car2cyl(car2cyl),
1193 _length(length),
1194 _radWire(radWire),
1195 _cutoff(cutoff),
1196 _Mw(Mw),
1197 _Mp(Mp),
1198 _radParticle(radParticle),
1199 _mu0(mu0)
1200{
1201 // Field direction H_0 parallel to fluid flow direction, if not: *(-1)
1203}
#define M_PI
T _factor
factor = mu0*4/3.*PI*radParticle^3*_Mp*radWire^2/r^3
CartesianToCylinder3D< T, S > & _car2cyl
T _radParticle
particle radius, cubic scaling factor
T _Mw
saturation magnetization wire, linear scaling factor
T _cutoff
maximal distance from wire cutoff/threshold
T _length
length of the wire, from origin to _car2cyl.axisDirection
T _Mp
magnetization particle, linear scaling factor
T _mu0
permeability constant, linear scaling factor
Expr pow(Expr base, Expr exp)
Definition expr.cpp:235
AnalyticalF< 3, T, S > AnalyticalF3D

References olb::MagneticForceFromCylinder3D< T, S >::_factor, olb::MagneticForceFromCylinder3D< T, S >::_Mp, olb::MagneticForceFromCylinder3D< T, S >::_mu0, olb::MagneticForceFromCylinder3D< T, S >::_Mw, olb::MagneticForceFromCylinder3D< T, S >::_radParticle, olb::MagneticForceFromCylinder3D< T, S >::_radWire, M_PI, and olb::util::pow().

+ Here is the call graph for this function:

Member Function Documentation

◆ operator()()

template<typename T , typename S >
bool olb::MagneticForceFromCylinder3D< 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 1206 of file frameChangeF3D.hh.

1207{
1208
1209 Vector<T, 3> magneticForcePolar;
1210 T outputTmp[3] = {T(), T(), T()};
1211 Vector<T, 3> normalAxis(_car2cyl.getAxisDirection());
1212 normalAxis = normalize(normalAxis);
1213
1214 Vector<T, 3> relPosition;
1215 relPosition[0] = (x[0] - _car2cyl.getCartesianOrigin()[0]);
1216 relPosition[1] = (x[1] - _car2cyl.getCartesianOrigin()[1]);
1217 relPosition[2] = (x[2] - _car2cyl.getCartesianOrigin()[2]);
1218
1219 T tmp[3] = {T(),T(),T()};
1220 _car2cyl(tmp,x);
1221 T rad = tmp[0];
1222 T phi = tmp[1];
1223
1224 T test = relPosition * normalAxis;
1225
1226 if ( (rad > _radWire && rad <= _cutoff*_radWire) &&
1227 (T(0) <= test && test <= _length) ) {
1228
1229 magneticForcePolar[0] = _factor/util::pow(rad, 3)
1230 *(util::pow(_radWire, 2)/util::pow(rad, 2) + util::cos(2*phi));
1231 magneticForcePolar[1] = _factor/util::pow(rad, 3)*util::sin(2*phi);
1232
1233 // changes radial and angular force components to cartesian components.
1234 outputTmp[0] = magneticForcePolar[0]*util::cos(phi)
1235 - magneticForcePolar[1]*util::sin(phi);
1236 outputTmp[1] = magneticForcePolar[0]*util::sin(phi)
1237 + magneticForcePolar[1]*util::cos(phi);
1238
1239 // if not in standard axis direction
1240 if ( !( util::nearZero(normalAxis[0]) && util::nearZero(normalAxis[1]) && util::nearZero(normalAxis[2]-1) ) ) {
1241 Vector<T, 3> e3(T(), T(), T(1));
1242 Vector<T, 3> orientation =
1243 crossProduct3D(Vector<T,3>(_car2cyl.getAxisDirection()),e3);
1244
1245 AngleBetweenVectors3D<T,S> angle(util::fromVector3(e3), util::fromVector3(orientation));
1246 T alpha[1] = {T()};
1247 T tmp2[3] = {T(),T(),T()};
1248 for (int i = 0; i<3; ++i) {
1249 tmp2[i] = _car2cyl.getAxisDirection()[i];
1250 }
1251 angle(alpha,tmp2);
1252
1253 std::vector<T> origin(3, T());
1254 RotationRoundAxis3D<T, S> rotRAxis(origin, util::fromVector3(orientation), alpha[0]);
1255 rotRAxis(output,outputTmp);
1256 }
1257 else {
1258 output[0] = outputTmp[0];
1259 output[1] = outputTmp[1];
1260 output[2] = T();
1261 }
1262 }
1263 else {
1264 output[0] = outputTmp[0];
1265 output[1] = outputTmp[1];
1266 output[2] = outputTmp[1];
1267 }
1268 return true;
1269}
std::vector< T > fromVector3(const Vector< T, 3 > &vec)
ADf< T, DIM > sin(const ADf< T, DIM > &a)
Definition aDiff.h:569
bool nearZero(T a) any_platform
return true if a is close to zero
Definition util.h:402
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:263
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:284

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::MagneticForceFromCylinder3D< T, S >::_car2cyl
protected

Definition at line 539 of file frameChangeF3D.h.

◆ _cutoff

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

maximal distance from wire cutoff/threshold

Definition at line 545 of file frameChangeF3D.h.

◆ _factor

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

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

Definition at line 555 of file frameChangeF3D.h.

◆ _length

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

length of the wire, from origin to _car2cyl.axisDirection

Definition at line 541 of file frameChangeF3D.h.

◆ _Mp

template<typename T , typename S >
T olb::MagneticForceFromCylinder3D< T, S >::_Mp
protected

magnetization particle, linear scaling factor

Definition at line 549 of file frameChangeF3D.h.

◆ _mu0

template<typename T , typename S >
T olb::MagneticForceFromCylinder3D< T, S >::_mu0
protected

permeability constant, linear scaling factor

Definition at line 553 of file frameChangeF3D.h.

◆ _Mw

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

saturation magnetization wire, linear scaling factor

Definition at line 547 of file frameChangeF3D.h.

◆ _radParticle

template<typename T , typename S >
T olb::MagneticForceFromCylinder3D< T, S >::_radParticle
protected

particle radius, cubic scaling factor

Definition at line 551 of file frameChangeF3D.h.

◆ _radWire

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

wire radius

Definition at line 543 of file frameChangeF3D.h.


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