Feellgood
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
spinAcc Class Reference

#include <spinAccumulationSolver.h>

Inheritance diagram for spinAcc:
solver< DIM_PB_SPIN_ACC >

Public Member Functions

 spinAcc (const Settings &mySettings, Mesh::mesh &_msh, const double _tol, const int max_iter)
 
void boundaryConditions (void)
 
bool compute (const Nodes::step k=Nodes::NEXT)
 
std::vector< double > potential (const double factor) const
 
void checkBoundaryConditions (void) const override
 
- Public Member Functions inherited from solver< DIM_PB_SPIN_ACC >
 solver (Mesh::mesh &_msh, const std::vector< Tetra::prm > &_pTetra, const std::vector< Triangle::prm > &_pTri, const std::string &name, const double _tol, const bool v, const int max_iter, const std::function< bool(Mesh::Edge)> &edge_filter=[](Mesh::Edge) { return true;})
 

Public Attributes

double jn_multiplier = 1.0
 
std::vector< Eigen::Vector3d > s
 

Private Member Functions

void fillDirichletData (const int k, Eigen::Vector3d &s_value)
 
double getMs (const Tetra::Tet &tet) const
 
double getSigma (const Tetra::Tet &tet) const
 
double getPolarizationRate (const Tetra::Tet &tet) const
 
double getDiffusionCst (const Tetra::Tet &tet) const
 
double getLsd (const Tetra::Tet &tet) const
 
double getLsf (const Tetra::Tet &tet) const
 
Eigen::Matrix< double, Nodes::DIM, Tetra::N > calc_u_nod (const Tetra::Tet &tet) const
 
void prepareExtraField (void) const
 
bool solve (void)
 
void integrales (const Tetra::Tet &tet, Eigen::Matrix< double, DIM_PB *Tetra::N, DIM_PB *Tetra::N > &AE) const
 
void integrales (const Tetra::Tet &tet, std::vector< double > &BE) const
 

Private Attributes

std::vector< double > valDirichlet
 
std::vector< int > idxDirichlet
 
std::vector< double > V
 
double V_D = 0.0
 
const int precision = 8
 
Nodes::step uStep = Nodes::NEXT
 

Additional Inherited Members

- Protected Member Functions inherited from solver< DIM_PB_SPIN_ACC >
algebra::MatrixShape build_shape (const std::function< bool(Mesh::Edge)> &edge_filter) const
 
void buildMat (std::array< int, N > &ind, Eigen::Matrix< double, DIM_PROBLEM *N, DIM_PROBLEM *N > &Ke)
 
void buildVect (std::array< int, N > &ind, std::vector< double > &Le)
 
- Protected Attributes inherited from solver< DIM_PB_SPIN_ACC >
Mesh::mesh * msh
 
const int NOD
 
const std::vector< Tetra::prm > & paramTet
 
const std::vector< Triangle::prm > & paramTri
 
const bool verbose
 
algebra::iteration< double > iter
 
algebra::SparseMatrix K
 
std::vector< double > L_rhs
 
- Static Protected Attributes inherited from solver< DIM_PB_SPIN_ACC >
static const int DIM_PB
 

Detailed Description

container for Spin Accumulation constants, solver and related datas. The model obeys the diffusive spin equation. User has to provide through mesh and settings at least one surface where spin diffusion vector s is a constant (zero recommended): Dirichlet boundary condition, and at least one surface where the current density jn is defined; if a spin polarization uP is also given on such a surface (and no s), the spin injection is a flux (Neumann) boundary condition. These surfaces are the ones given to the potential solver for its own boundary conditions. A surface may have both jn and s (s is then imposed on it).

Constructor & Destructor Documentation

◆ spinAcc()

spinAcc::spinAcc ( const Settings &  mySettings,
Mesh::mesh &  _msh,
const double  _tol,
const int  max_iter 
)

spin accumulation constructor if mySettings.spin_acc bool is false it is a do nothing constructor

Parameters
[in]mySettings
[in]_mshref to the mesh
[in]_toltolerance for bicg_dir solver
[in]max_itermaximum number of iterations

Member Function Documentation

◆ boundaryConditions()

void spinAcc::boundaryConditions ( void  )

Dirichlet boundary conditions: all the surfaces with a fixed s (the surface with fixed normal current density J and polarization vector P, without s, is a flux condition, added to the RHS in solve()) set valDirichlet values and fill vector of indices idxDirichlet

◆ calc_u_nod()

Eigen::Matrix< double, Nodes::DIM, Tetra::N > spinAcc::calc_u_nod ( const Tetra::Tet &  tet) const
private

nodal magnetization of the tetrahedron (step uStep, see compute()) used by the spin diffusion problem, columns are the nodes

◆ checkBoundaryConditions()

void spinAcc::checkBoundaryConditions ( void  ) const
overridevirtual

check boundary conditions: mesh and settings have to define at least one surface with a normal current density jn and at least one surface where the spin diffusion s is given

Implements solver< DIM_PB_SPIN_ACC >.

◆ compute()

bool spinAcc::compute ( const Nodes::step  k = Nodes::NEXT)

call solver and update spin diffusion solution, with the magnetization of step k: NEXT (the latest one, default) or CURRENT (the one of the start of the time step, u_n, used at each attempt of a time step: a rejected attempt leaves its own u_{n+1} in NEXT); returns true if solver succeeded

◆ fillDirichletData()

void spinAcc::fillDirichletData ( const int  k,
Eigen::Vector3d &  s_value 
)
private

fill valDirichlet and idxDirichlet vectors with k, a node index from tri.ind and the corresponding spin diffusion s value

◆ getDiffusionCst()

double spinAcc::getDiffusionCst ( const Tetra::Tet &  tet) const
private

diffusion constant, units: s^-1 m^2

◆ getLsd()

double spinAcc::getLsd ( const Tetra::Tet &  tet) const
private

length s-d : only in magnetic material

◆ getLsf()

double spinAcc::getLsf ( const Tetra::Tet &  tet) const
private

spin flip length : exists in both non-magnetic and magnetic metals

◆ getMs()

double spinAcc::getMs ( const Tetra::Tet &  tet) const
private

returns Ms

◆ getPolarizationRate()

double spinAcc::getPolarizationRate ( const Tetra::Tet &  tet) const
private

\( P \) is polarization rate of the current density

◆ getSigma()

double spinAcc::getSigma ( const Tetra::Tet &  tet) const
private

returns sigma of the tetraedron, (conductivity in (Ohm.m)^-1

◆ integrales() [1/2]

void spinAcc::integrales ( const Tetra::Tet &  tet,
Eigen::Matrix< double, DIM_PB *Tetra::N, DIM_PB *Tetra::N > &  AE 
) const
private

computes all contributions to matrix AE from tetrahedron tet (LHS) all = non magnetic metal + magnetic metal

◆ integrales() [2/2]

void spinAcc::integrales ( const Tetra::Tet &  tet,
std::vector< double > &  BE 
) const
private

computes magnetic metal contributions to spin diffusion from tetrahedron tet (RHS)

Parameters
[in]tet
[out]BE

◆ potential()

std::vector< double > spinAcc::potential ( const double  factor) const

electrostatic potential on the nodes [V], indexed as s: V_D + factor V, V being solved with V = 0 on the surface with V and V_D the imposed V (the electrokinetics being linear, the potential at time t follows the current density); factor is Settings::jnMultiplier(t) at the time t of the potential

◆ prepareExtraField()

void spinAcc::prepareExtraField ( void  ) const
private

affect extraField member function of all tetrahedrons extraField is computing the contribution from the spin diffusion s to llg

◆ solve()

bool spinAcc::solve ( void  )
private

solver, using biconjugate stabilized gradient, with diagonal preconditionner and Dirichlet boundary conditions

Member Data Documentation

◆ idxDirichlet

std::vector<int> spinAcc::idxDirichlet
private

list of the indices for Dirichlet boundary conditions, it contains the indices of the nodes where s is given by the user to be a constant on a surface

◆ jn_multiplier

double spinAcc::jn_multiplier = 1.0

dimensionless multiplier of all the normal current densities jn at the time of the solve (Settings::jnMultiplier, 1 by default). The electrokinetics being linear, the potential is solved once with the jn of the settings, and grad V -> jn_multiplier grad V, jn -> jn_multiplier jn (the constant imposed V does not change grad V). It multiplies the source terms (polarized current, injection through the surfaces with jn and uP), not the imposed s

◆ precision

const int spinAcc::precision = 8
private

number of digits in the optional output file

◆ s

std::vector<Eigen::Vector3d> spinAcc::s

solution of the spin diffusion vector s over the nodes

◆ uStep

Nodes::step spinAcc::uStep = Nodes::NEXT
private

step of the magnetization read by the solve (calc_u_nod()), set by compute()

◆ V

std::vector<double> spinAcc::V
private

electrostatic potential on the nodes, solved once with V = 0 on the surface with V (V_D is added by potential()), for the jn of the settings; grad V -> jn_multiplier grad V at time t unit [V] = Volt = kg A^-1 s^-3

◆ V_D

double spinAcc::V_D = 0.0
private

potential imposed on the surface with V (Dirichlet condition of the electrostatic problem) [V]

◆ valDirichlet

std::vector<double> spinAcc::valDirichlet
private

Dirichlet values of the components of s on the nodes, it is zero if the node is not in idxDirichlet


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