OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
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 498 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 1162 of file frameChangeF3D.hh.

1165 : AnalyticalF3D<T, S>(3),
1166 _car2cyl(car2cyl),
1167 _length(length),
1168 _radWire(radWire),
1169 _cutoff(cutoff),
1170 _Mw(Mw),
1171 _Mp(Mp),
1172 _radParticle(radParticle),
1173 _mu0(mu0)
1174{
1175 // Field direction H_0 parallel to fluid flow direction, if not: *(-1)
1177}
#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
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

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 1180 of file frameChangeF3D.hh.

1181{
1182
1183 Vector<T, 3> magneticForcePolar;
1184 T outputTmp[3] = {T(), T(), T()};
1185 Vector<T, 3> normalAxis(_car2cyl.getAxisDirection());
1186 normalAxis = normalize(normalAxis);
1187
1188 Vector<T, 3> relPosition;
1189 relPosition[0] = (x[0] - _car2cyl.getCartesianOrigin()[0]);
1190 relPosition[1] = (x[1] - _car2cyl.getCartesianOrigin()[1]);
1191 relPosition[2] = (x[2] - _car2cyl.getCartesianOrigin()[2]);
1192
1193 T tmp[3] = {T(),T(),T()};
1194 _car2cyl(tmp,x);
1195 T rad = tmp[0];
1196 T phi = tmp[1];
1197
1198 T test = relPosition * normalAxis;
1199
1200 if ( (rad > _radWire && rad <= _cutoff*_radWire) &&
1201 (T(0) <= test && test <= _length) ) {
1202
1203 magneticForcePolar[0] = _factor/util::pow(rad, 3)
1204 *(util::pow(_radWire, 2)/util::pow(rad, 2) + util::cos(2*phi));
1205 magneticForcePolar[1] = _factor/util::pow(rad, 3)*util::sin(2*phi);
1206
1207 // changes radial and angular force components to cartesian components.
1208 outputTmp[0] = magneticForcePolar[0]*util::cos(phi)
1209 - magneticForcePolar[1]*util::sin(phi);
1210 outputTmp[1] = magneticForcePolar[0]*util::sin(phi)
1211 + magneticForcePolar[1]*util::cos(phi);
1212
1213 // if not in standard axis direction
1214 if ( !( util::nearZero(normalAxis[0]) && util::nearZero(normalAxis[1]) && util::nearZero(normalAxis[2]-1) ) ) {
1215 Vector<T, 3> e3(T(), T(), T(1));
1216 Vector<T, 3> orientation =
1217 crossProduct3D(Vector<T,3>(_car2cyl.getAxisDirection()),e3);
1218
1219 AngleBetweenVectors3D<T,S> angle(util::fromVector3(e3), util::fromVector3(orientation));
1220 T alpha[1] = {T()};
1221 T tmp2[3] = {T(),T(),T()};
1222 for (int i = 0; i<3; ++i) {
1223 tmp2[i] = _car2cyl.getAxisDirection()[i];
1224 }
1225 angle(alpha,tmp2);
1226
1227 std::vector<T> origin(3, T());
1228 RotationRoundAxis3D<T, S> rotRAxis(origin, util::fromVector3(orientation), alpha[0]);
1229 rotRAxis(output,outputTmp);
1230 }
1231 else {
1232 output[0] = outputTmp[0];
1233 output[1] = outputTmp[1];
1234 output[2] = T();
1235 }
1236 }
1237 else {
1238 output[0] = outputTmp[0];
1239 output[1] = outputTmp[1];
1240 output[2] = outputTmp[1];
1241 }
1242 return true;
1243}
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::MagneticForceFromCylinder3D< T, S >::_car2cyl
protected

Definition at line 500 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 506 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 516 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 502 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 510 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 514 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 508 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 512 of file frameChangeF3D.h.

◆ _radWire

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

wire radius

Definition at line 504 of file frameChangeF3D.h.


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