Feellgood
Public Member Functions | Public Attributes | Private Member Functions | List of all members
Tetra::Tet Class Reference

#include <tetra.h>

Inheritance diagram for Tetra::Tet:
element< N, NPI >

Public Member Functions

 Tet (const std::vector< Nodes::Node > &_p_node, const int _idx, const std::initializer_list< int > _i)
 
void interpolation (const std::function< double(Nodes::Node)> &getter, Eigen::Ref< Eigen::Matrix< double, NPI, 1 >> result) const
 
void interpolation (const std::function< Eigen::Vector3d(Nodes::Node)> &getter, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> result, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> Tx, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> Ty, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> Tz) const
 
void interpolation_field (const std::function< double(Nodes::Node)> &getter, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> X) const
 
void interpolation (const std::function< double(Nodes::Node, Nodes::index)> &getter, const Nodes::index idx, Eigen::Ref< Eigen::Matrix< double, Tetra::NPI, 1 >> result) const
 
void lumping (const Eigen::Ref< const Eigen::Matrix< double, NPI, 1 >> alpha_eff, double prefactor, Eigen::Ref< Eigen::Matrix< double, 3 *N, 3 *N >> AE) const
 
Eigen::Matrix< double, N, N > calcDiagBlock (const double c, const Eigen::Matrix< double, N, 1 > &x) const
 
Eigen::Matrix< double, N, 1 > calcOffDiagBlock (const Nodes::index idx) const
 
void DMI_bulk_OffDiag (timing const &prm_t, const double DMIbulk_bis, Eigen::Ref< Eigen::Matrix< double, 3 *N, 3 *N >> AE) const
 
void DMI_bulk_BE (const double cst, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> U, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dUdx, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dUdy, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dUdz, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, N >> BE) const
 
void add_drift_BE (const Eigen::Ref< const Eigen::Matrix< double, NPI, 1 >> alpha, double s_dt, double Vdrift, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> U, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> V, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dUd_, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dVd_, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, N >> BE) const
 
Eigen::Matrix< double, NPI, 1 > calc_aniso_uniax (const Eigen::Ref< const Eigen::Vector3d > uk, const double Kbis, const double s_dt, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> U, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> V, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> H_aniso) const
 
Eigen::Matrix< double, NPI, 1 > calc_aniso_cub (const Eigen::Ref< const Eigen::Matrix3d > e, const double K3bis, const double s_dt, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> U, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> V, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> H_aniso) const
 
Eigen::Matrix< double, Nodes::DIM, NPI > Hst_order2_contribution (const Eigen::Ref< const Eigen::Matrix< double, Nodes::DIM, NPI >> Hst, const Eigen::Ref< const Eigen::Matrix< double, Nodes::DIM, NPI >> U, const Eigen::Ref< const Eigen::Matrix< double, Nodes::DIM, NPI >> V) const
 
void integrales (const Tetra::prm &param, const timing &prm_t, const std::function< Eigen::Matrix< double, Nodes::DIM, NPI >(void)> &calc_Hext, Nodes::index idx_dir, double Vdrift, const AbsorbingEnds &absorb)
 
double exchangeEnergy (const Tetra::prm &param, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dudx, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dudy, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dudz) const
 
double DMIBulkEnergy (const Tetra::prm &param, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> u, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dudx, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dudy, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dudz) const
 
double uniaxialAnisotropyEnergy (const Tetra::prm &param, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> u) const
 
double cubicAnisotropyEnergy (const Tetra::prm &param, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> u) const
 
Eigen::Matrix< double, Tetra::NPI, 1 > charges (const double &Ms, const std::function< Eigen::Vector3d(const Nodes::Node &)> &getter) const override
 
double demagEnergy (const Tetra::prm &param, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dudx, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dudy, Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> dudz, Eigen::Ref< Eigen::Matrix< double, NPI, 1 >> phi) const
 
double zeemanEnergy (const Tetra::prm &param, const Eigen::Ref< const Eigen::Vector3d > Hext, const Eigen::Ref< const Eigen::Matrix< double, Nodes::DIM, Tetra::NPI >> u) const
 
double zeemanEnergy (const Tetra::prm &param, double fieldAmp, const std::vector< Eigen::Matrix< double, Nodes::DIM, Tetra::NPI >> &spaceField, const Eigen::Ref< const Eigen::Matrix< double, Nodes::DIM, Tetra::NPI >> u) const
 
double Jacobian (Eigen::Ref< Eigen::Matrix3d > J) const
 
double calc_vol (void) const
 
Eigen::Matrix< double, Nodes::DIM, NPI > getPtGauss (void) const override
 
Eigen::Matrix< double, Nodes::DIM, NPI > gradV (const std::vector< double > &V) const
 
- Public Member Functions inherited from element< N, NPI >
 element (const std::vector< Nodes::Node > &_p_node, const int _idx, const std::initializer_list< int > &_i)
 
constexpr int getN (void) const
 
constexpr int getNPI (void) const
 
void buildMatP (Eigen::Ref< Eigen::Matrix< double, 2 *N, 3 *N >> P)
 
void infos (void) const
 
bool existNodes (void) const
 

Public Attributes

Eigen::Matrix< double, N, Nodes::DIM > da
 
int idx
 
std::function< void(Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >> H)> extraField
 
- Public Attributes inherited from element< N, NPI >
std::array< int, N > ind
 
int idxPrm
 
Eigen::Matrix< double, NPI, 1 > weight
 
Eigen::Matrix< double, 2 *N, 2 *N > Kp
 
Eigen::Matrix< double, 2 *N, 1 > Lp
 

Private Member Functions

void orientate (void) override
 

Additional Inherited Members

- Protected Member Functions inherited from element< N, NPI >
const Nodes::Node & getNode (const int i) const
 

Detailed Description

Tet is a tetrahedron. It must not be flat. The list of its nodes is ordered in a way that enforces this spatial orientation:

0───1
│╲ ╱│
│ ╲ │
│╱ ╲│
3───2

The face (0, 1, 2) is oriented inwards: the nodes are arranged counterclockwise when seen from inside the tetrahedron. The orientation of the other faces are:

Constructor & Destructor Documentation

◆ Tet()

Tetra::Tet::Tet ( const std::vector< Nodes::Node > &  _p_node,
const int  _idx,
const std::initializer_list< int >  _i 
)
inline

constructor. It initializes weight hat function with weights \( w_i = |J| p_i \) with \( p_i = pds[i] = (D,E,E,E,E) \) and dad(x|y|z) if \( | detJ | < \epsilon \) jacobian is considered degenerated If NPI=1 (single Gauss point) then w[0] is the tetrahedron volume unit tests : Tet_constructor; Tet_inner_tables

Parameters
_p_nodevector of nodes
[in]_idxregion index in region vector
[in]_inode index

Member Function Documentation

◆ add_drift_BE()

void Tet::add_drift_BE ( const Eigen::Ref< const Eigen::Matrix< double, NPI, 1 >>  alpha,
double  s_dt,
double  Vdrift,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  U,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  V,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dUd_,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dVd_,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, N >>  BE 
) const

add drift contribution due to eventual recentering to vectors BE, Vdrift is the drift velocity in reduced time (physical velocity divided by gamma0), alpha is the damping at the Gauss points

◆ calc_aniso_cub()

Eigen::Matrix< double, NPI, 1 > Tet::calc_aniso_cub ( const Eigen::Ref< const Eigen::Matrix3d >  e,
const double  K3bis,
const double  s_dt,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  U,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  V,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  H_aniso 
) const

append(+=) H_aniso for cubic anisotropy contribution, returns contribution to uHeff (used to compute the stabilizing effective damping)

Parameters
[in]ebase vectors
[in]K3biscubic anisotropy coefficient
[in]s_dtTHETA*dt
[in]Umagnetization
[in]V
[out]H_anisoeffective cubic anisotropy field

◆ calc_aniso_uniax()

Eigen::Matrix< double, NPI, 1 > Tet::calc_aniso_uniax ( const Eigen::Ref< const Eigen::Vector3d >  uk,
const double  Kbis,
const double  s_dt,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  U,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  V,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  H_aniso 
) const

append(+=) H_aniso for uniaxial anisotropy contribution, returns contribution to uHeff (used to compute the stabilizing effective damping)

◆ calc_vol()

double Tet::calc_vol ( void  ) const

returns volume of the tetrahedron ; unit test Tet_calc_vol

◆ calcDiagBlock()

Eigen::Matrix< double, N, N > Tet::calcDiagBlock ( const double  c,
const Eigen::Matrix< double, N, 1 > &  x 
) const

computes elementary N*N matrix block returns Id⊗x + c Sum_i w_i da*transpose(da)

◆ calcOffDiagBlock()

Eigen::Matrix< double, N, 1 > Tet::calcOffDiagBlock ( const Nodes::index  idx) const

computes elementary diagonal elementary block (stored in a N vector) returns m(idx) on the nodes, with m(idx) a component of the magnetization

◆ charges()

Eigen::Matrix< double, Tetra::NPI, 1 > Tet::charges ( const double &  Ms,
const std::function< Eigen::Vector3d(const Nodes::Node &)> &  getter 
) const
overridevirtual

computes volume charges, the divergence of the magnetization, returns result

Implements element< N, NPI >.

◆ cubicAnisotropyEnergy()

double Tet::cubicAnisotropyEnergy ( const Tetra::prm &  param,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  u 
) const

cubic anisotropy energy of the tetrahedron

◆ demagEnergy()

double Tet::demagEnergy ( const Tetra::prm &  param,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dudx,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dudy,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dudz,
Eigen::Ref< Eigen::Matrix< double, NPI, 1 >>  phi 
) const

demagnetizing energy of the tetrahedron

◆ DMI_bulk_BE()

void Tet::DMI_bulk_BE ( const double  cst,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  U,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dUdx,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dUdy,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dUdz,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, N >>  BE 
) const

add DMI bulk contribution to BE

◆ DMI_bulk_OffDiag()

void Tet::DMI_bulk_OffDiag ( timing const &  prm_t,
const double  DMIbulk_bis,
Eigen::Ref< Eigen::Matrix< double, 3 *N, 3 *N >>  AE 
) const

computes off diagonal DMI bulk contributions and add them to matrix AE

◆ DMIBulkEnergy()

double Tet::DMIBulkEnergy ( const Tetra::prm &  param,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  u,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dudx,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dudy,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dudz 
) const

DMI bulk energy of the tetrahedron

◆ exchangeEnergy()

double Tet::exchangeEnergy ( const Tetra::prm &  param,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dudx,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dudy,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  dudz 
) const

exchange energy of the tetrahedron

◆ getPtGauss()

Eigen::Matrix<double,Nodes::DIM,NPI> Tetra::Tet::getPtGauss ( void  ) const
inlineoverridevirtual

returns gauss points

Implements element< N, NPI >.

◆ gradV()

Eigen::Matrix< double, Nodes::DIM, NPI > Tet::gradV ( const std::vector< double > &  V) const

returns grad(V)

◆ Hst_order2_contribution()

Eigen::Matrix< double, Nodes::DIM, NPI > Tet::Hst_order2_contribution ( const Eigen::Ref< const Eigen::Matrix< double, Nodes::DIM, NPI >>  Hst,
const Eigen::Ref< const Eigen::Matrix< double, Nodes::DIM, NPI >>  U,
const Eigen::Ref< const Eigen::Matrix< double, Nodes::DIM, NPI >>  V 
) const

return the second order term of the spin accumulation field Hst: the derivative of its tangent part in the direction V, -(U.Hst) V; and V the velocity du/dtau, both in reduced time

Parameters
[in]Hst
[in]Umagnetization
[in]V

◆ integrales()

void Tet::integrales ( const Tetra::prm &  param,
const timing &  prm_t,
const std::function< Eigen::Matrix< double, Nodes::DIM, NPI >(void)> &  calc_Hext,
Nodes::index  idx_dir,
double  Vdrift,
const AbsorbingEnds &  absorb 
)

computes the integral contribution of the tetrahedron to the evolution of the magnetization calc_Hext is a function that returns external H field defined on gauss points, absorb are the absorbing ends of the settings, used if param.absorbing is true

◆ interpolation() [1/3]

void Tetra::Tet::interpolation ( const std::function< double(Nodes::Node)> &  getter,
Eigen::Ref< Eigen::Matrix< double, NPI, 1 >>  result 
) const
inline

interpolation for scalar field : the getter function is given as a parameter in order to know what part of the node you want to interpolate If single Gauss point evaluates scalar at barycenter

◆ interpolation() [2/3]

void Tetra::Tet::interpolation ( const std::function< double(Nodes::Node, Nodes::index)> &  getter,
const Nodes::index  idx,
Eigen::Ref< Eigen::Matrix< double, Tetra::NPI, 1 >>  result 
) const
inline

interpolation for the component idx of a field : the getter function is given as a parameter in order to know what part of the node you want to interpolate

◆ interpolation() [3/3]

void Tetra::Tet::interpolation ( const std::function< Eigen::Vector3d(Nodes::Node)> &  getter,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  result,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  Tx,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  Ty,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  Tz 
) const
inline

interpolation for 3D vector field and a tensor : getter function is given as a parameter to know what part of the node you want to interpolate

◆ interpolation_field()

void Tetra::Tet::interpolation_field ( const std::function< double(Nodes::Node)> &  getter,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  X 
) const
inline

interpolation for components of a field : the getter function is given as a parameter in order to know what part of the node you want to interpolate Computes gradient at single Gauss point, constant for linear tetrahedron

◆ Jacobian()

double Tet::Jacobian ( Eigen::Ref< Eigen::Matrix3d >  J) const
Returns
\( |J| \) build Jacobian \( J \)

◆ lumping()

void Tet::lumping ( const Eigen::Ref< const Eigen::Matrix< double, NPI, 1 >>  alpha_eff,
double  prefactor,
Eigen::Ref< Eigen::Matrix< double, 3 *N, 3 *N >>  AE 
) const

AE matrix filling with exchange contributions, diagonal contributions and magnetization contribution AE has a block structure: ( E -Z +Y) ( +Z E -X) ( -Y +X E) E X Y Z are N*N matrices E is the sum of the exchange contribution and modified alpha (scheme stabilizer) on its diagonal X Y Z are diagonal matrices with magnetization component contributions

◆ orientate()

void Tet::orientate ( void  )
overrideprivatevirtual

Enforce the correct orientation by swapping nodes if needed.

Implements element< N, NPI >.

◆ uniaxialAnisotropyEnergy()

double Tet::uniaxialAnisotropyEnergy ( const Tetra::prm &  param,
Eigen::Ref< Eigen::Matrix< double, Nodes::DIM, NPI >>  u 
) const

uniaxial anisotropy energy of the tetrahedron

◆ zeemanEnergy() [1/2]

double Tet::zeemanEnergy ( const Tetra::prm &  param,
const Eigen::Ref< const Eigen::Vector3d >  Hext,
const Eigen::Ref< const Eigen::Matrix< double, Nodes::DIM, Tetra::NPI >>  u 
) const

zeeman energy of the tetrahedron for a constant Hext

Parameters
[in]param
[in]Hextconstant applied field
[in]u

◆ zeemanEnergy() [2/2]

double Tet::zeemanEnergy ( const Tetra::prm &  param,
double  fieldAmp,
const std::vector< Eigen::Matrix< double, Nodes::DIM, Tetra::NPI >> &  spaceField,
const Eigen::Ref< const Eigen::Matrix< double, Nodes::DIM, Tetra::NPI >>  u 
) const

zeeman energy of the tetrahedron for a varying Hext

Parameters
[in]param
[in]fieldAmpapplied field amplitude, may be time dependant
[in]spaceFieldspace varying applied field
[in]umagnetization at Gauss points

Member Data Documentation

◆ da

Eigen::Matrix<double,N,Nodes::DIM> Tetra::Tet::da

local hat functions matrix, initialized by constructor: da = dadu * inverse(Jacobian) For linear tetrahedron, gradients are constant in the element

◆ extraField

std::function<void( Eigen::Ref<Eigen::Matrix<double,Nodes::DIM,NPI>> H)> Tetra::Tet::extraField

do a += to the effective field H, to add contributions as spin transfert torque Hst

◆ idx

int Tetra::Tet::idx

idx is the index of the tetrahedron in the vector of tetrahedron


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