C++ mpi module for stochmagnet_main Package
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
SM_MacroCellsDemagnetizedField Class Referenceabstract

This class is describes a demagnetized operator. More...

#include <SM_MacroCellsDemagnetizedField.h>

Inheritance diagram for SM_MacroCellsDemagnetizedField:
Inheritance graph
[legend]
Collaboration diagram for SM_MacroCellsDemagnetizedField:
Collaboration graph
[legend]

Public Member Functions

virtual tMemSize getMemorySize () const
 return the memory size of the class and the memory size of all its attributes/associations More...
 
virtual tMemSize getContentsMemorySize () const
 return the memory size of the included associations More...
 
virtual CORE_UniquePointer< SM_MacroCellsDemagnetizedFieldnewInstance () const =0
 create a New instance of this More...
 
void setStorage (const tFlag &f)
 set storage type More...
 
const tFlag & getStorage () const
 yet storage type in {NO_STORAGE,PACKED_STORAGE}
 
const SM_RealFieldgetField () const
 get the demagnetized field on macro cells
 
SM_RealFieldgetField ()
 get the demagnetized field on macro cells
 
tBoolean hasMatrix () const
 return true if the matrix exists
 
void setMatrix (CORE_UniquePointer< SM_PackedBlockMatrix< tReal, SM_Constants::DIM >> matrix)
 set matrix
 
SM_PackedBlockMatrix< tReal, SM_Constants::DIM > & getMatrix ()
 get matrix
 
const SM_PackedBlockMatrix< tReal, SM_Constants::DIM > & getMatrix () const
 get matrix
 
const tReal & getLambdaH () const
 get lambda H More...
 
const tReal & getLambdaHs () const
 get self lambda Hs More...
 
virtual void discretize (const SM_Material &material, const SM_MacroCellsNetwork &network)
 discretize the field More...
 
virtual void computeMatrix (const SM_Material &material, const SM_MacroCellsNetwork &network)=0
 compute the matrix ot he demagnetized operator More...
 
virtual void computeField (const SM_MacroCellsNetwork &network, const SM_MacroCellsMagnetizationField &M)=0
 compute the demagnetized field on macro cells network More...
 
void computeSeparatedFieldSlice (const tReal &lambdaH, const tReal &lambdaHs, const tReal *P, const tReal *eP, const tReal *M_P, const tInteger &nMacroCells, const tReal *X, tReal *H) const
 compute Hdem[X]=F_{P,M}(X) More...
 
virtual tString toString () const override
 return string representaton of the operator
 
- Public Member Functions inherited from SM_Object
 SM_Object (void)
 create
 
virtual ~SM_Object (void)
 destroy
 
- Public Member Functions inherited from CORE_Object
template<class T >
std::shared_ptr< T > getSharedPointer ()
 return the shared pointer for this More...
 
template<class T >
std::shared_ptr< const T > getConstSharedPointer () const
 return a const shared pointer for this More...
 
template<class T >
tBoolean isInstanceOf () const
 test if the clas T is an instance of this class More...
 
tString getClassName () const
 return the name of the class More...
 
tString getPointerString () const
 retrun the pointer of the class as a string More...
 
tString getIdentityString () const
 retrun the string identification of the class More...
 

Static Public Attributes

static constexpr tFlag PACKED_STORAGE =1
 the storage if in a packed matrix
 
static constexpr tFlag NO_STORAGE =0
 no storage
 

Protected Member Functions

 SM_MacroCellsDemagnetizedField (void)
 create a network class
 
virtual ~SM_MacroCellsDemagnetizedField (void)
 destroy
 
void computeBlocksSymmetricMatrix (const tReal &lambdaH, const tReal &lambdaHs, const tReal *vMCsVolume, const tReal *vMCsX, const tInteger &start, const tInteger &end, tReal *supBlocksValues, tReal *diagBlocksValues) const
 compute the column blocks matrix (i,j) j in [start,end] and j in [0,i] More...
 
void computeBlocksGeneralMatrix (const tReal &lambdaH, const tReal &lambdaHs, const tReal *vMCsVolumes, const tInteger &nX, const tReal *vX, const tInteger &nP, const tReal *vP, tReal *supBlocksValues) const
 compute the column blocks matrix (i,j) j in [start,end] and j in [0,i] More...
 
void computeFieldSlice (const tReal &lambdaH, const tReal &lambdaHs, const tReal *P, const tReal *eP, const tReal *M_P, const tInteger &nMacroCells, const tReal *X, const tReal *M_X, const tReal *iMCsVolume, tReal *H) const
 compute Hdem[X]=F_{P,M}(X) More...
 
- Protected Member Functions inherited from CORE_Object
 CORE_Object ()
 build an instance of the object
 
virtual ~CORE_Object ()
 destroy the instance of object std

 

Static Protected Member Functions

static void BuildPackedBlockMatrix (tReal lambdaH, const tReal &lambdaHs, const tReal &Wi, tInteger i, tInteger j, const tReal *Xi, const tReal *Xj, tReal *vBij, tReal &rij, std::array< tReal, SM_Constants::DIM > &U)
 build the symmetric block element of the superior matrix in a packed storage More...
 
static void BuildPackedSupBlockMatrix (tReal lambdaH, tInteger i, tInteger j, const tReal *Xi, const tReal *Xj, tReal *vBij, tReal &rij, std::array< tReal, SM_Constants::DIM > &U)
 build the symmetric block element of the superior matrix in a packed storage More...
 
static void BuildDiagonalBlockMatrix (const tReal &V, const tReal &lambdaHs, tReal &diag)
 build the diagonal block element of the matrix More...
 
static void BuildPackedDiagonalBlockMatrix (const tReal &V, const tReal &lambdaHs, tReal *iDiag)
 build the diagonal block element of the matrix More...
 

Additional Inherited Members

- Static Public Member Functions inherited from CORE_Object
static tBoolean EnableMemoryStack (const tBoolean &isMemoryChecked)
 enable the memory stack More...
 
static void EnableMemoryStack ()
 enable the memory stack
 
static void DisableMemoryStack ()
 disable the memory stack
 
static tBoolean IsMemoryStackEnabled ()
 return trur if the memory stack is enabled
 
static tString MemoryStackToString ()
 get the memory stack in string More...
 
static tIndex GetRegisteredClassesNumber ()
 get the memory stack in string More...
 

Detailed Description

This class is describes a demagnetized operator.

To improve the simulation accuracy and time computing of the dipolar field done by EMM_DipolarOperator, an other approach consists in discretizing the network in macro cells with a fixed cell size with is prefered to be a multiple of the unit cell size.

The position of each macro cell \(p_{mc}\) is defined from the magnetic center of mass of the particles of the macro cell: \( p_{mc}=\frac{\sum_{p_j \in \omega_{mc}} \tilde \mu^j_s . p_j}{\sum_{p_j \in \omega_{mc}} \tilde \mu^j} \) where \(\omega_{mc} \) is the domain of the macro cell at index \(mc\).

The magnetization of the macro cell is the sum of the atomic moments of the particles in the macro cell: \( M_{mc}=\sum_{p_j \in \omega_{mc}} \tilde \mu^j_s . S_j \)

The demagnetized field within each macro cell p is

\( H^p_{dem}=\frac{\mu_0}{4.\pi} \left ( \sum_{q\neq p} \frac{3 <M^q,u_{pq}>_3.u_{pq} - M^q}{r^3_{pq}} \right) - \frac{\mu_0}{3.V_p} M^p \)

where \(r_{pq}\) if the vector direction from macro cell \(p\) to macro cell \(q\) and the unit vector \(u_{pq}=\frac{r_{pq}}{|r_{pq}|}\) and \(V_p\) is the effective volume of the macro cell defined by:

\( V_p = n^a_p . \frac{a^3}{N_a} \)

when \(n^a_p\) is the number of particles inside the macro cell, \(a\) is the unit cell size and \(N_a\) the number of atoms in the unit cell size. The last term of the equation represents the demagnetized field generated by the particles in the macro cell to themselves.

The dipolar field of each particle is the demagnetized field defined of the macro cell to which it belongs.

Author
Stephane Despreaux
Version
2.0

Member Function Documentation

◆ BuildDiagonalBlockMatrix()

static void SM_MacroCellsDemagnetizedField::BuildDiagonalBlockMatrix ( const tReal &  V,
const tReal &  lambdaHs,
tReal &  diag 
)
inlinestaticprotected

build the diagonal block element of the matrix

Parameters
[in]Vvolume of the macro cells
[in]lambdaHsdemagnetized factor for the iteraction between the macro cell and itself
[out]diag: value of the diagonal block

◆ BuildPackedBlockMatrix()

static void SM_MacroCellsDemagnetizedField::BuildPackedBlockMatrix ( tReal  lambdaH,
const tReal &  lambdaHs,
const tReal &  Wi,
tInteger  i,
tInteger  j,
const tReal *  Xi,
const tReal *  Xj,
tReal *  vBij,
tReal &  rij,
std::array< tReal, SM_Constants::DIM > &  U 
)
inlinestaticprotected

build the symmetric block element of the superior matrix in a packed storage

Parameters
[in]lambdaH: demagnatized interaction factor for 2 different macro cells
[in]lambdaHs: demagnatized interaction factor for a macro cell with itself
[in]Wi: weight of the macro cell i
[in]iindex of the macro cell in interaction
[in]jindex of the macro cell in interaction
[in]Ximass center of the macro cell i
[in]Xjmass center of the macro cell j
[out]vBijvalues of the block (i,j) of the demagnetized matrix
[out]rijdistance between the 2 mass centers
[out]Uorrientation between the 2 mass centers

◆ BuildPackedDiagonalBlockMatrix()

static void SM_MacroCellsDemagnetizedField::BuildPackedDiagonalBlockMatrix ( const tReal &  V,
const tReal &  lambdaHs,
tReal *  iDiag 
)
inlinestaticprotected

build the diagonal block element of the matrix

Parameters
[in]Vvolume of the macro cell
[in]lambdaHsdemagnetized factor for the iteraction between the macro cell and itself
[out]iDiag: iterator on values of the diagonal block of size dim x (dim-1) / 2

◆ BuildPackedSupBlockMatrix()

static void SM_MacroCellsDemagnetizedField::BuildPackedSupBlockMatrix ( tReal  lambdaH,
tInteger  i,
tInteger  j,
const tReal *  Xi,
const tReal *  Xj,
tReal *  vBij,
tReal &  rij,
std::array< tReal, SM_Constants::DIM > &  U 
)
inlinestaticprotected

build the symmetric block element of the superior matrix in a packed storage

Parameters
[in]lambdaH: demagnatized factor for 2 different macro cells
[in]iindex of the macro cell in interaction
[in]jindex of the macro cell in interaction
[in]Ximass center of the macro cell i
[in]Xjmass center of the macro cell j
[out]vBijvalues of the block (i,j) of the demagnetized matrix
[out]rijdistance between the 2 mass centers
[out]Uorrientation between the 2 mass centers

◆ computeBlocksGeneralMatrix()

void SM_MacroCellsDemagnetizedField::computeBlocksGeneralMatrix ( const tReal &  lambdaH,
const tReal &  lambdaHs,
const tReal *  vMCsVolumes,
const tInteger &  nX,
const tReal *  vX,
const tInteger &  nP,
const tReal *  vP,
tReal *  supBlocksValues 
) const
protected

compute the column blocks matrix (i,j) j in [start,end] and j in [0,i]

Parameters
[in]lambdaH: coefficient foer interactive Hdem between 2 differents macro cell
[in]lambdaHs: coefficient for interactive Hdem between one macro cell and itself
[in]vMCsVolumesiterator on volume of macro cells
[in]nXnumber of values of X for all macro cells
[in]vXvalues of X for all macro cells
[in]nPnumber of values of P for all macro cells
[in]vPvalues of P mass center for all macro cells
[out]supBlocksValuessup block values of the whole matrix

◆ computeBlocksSymmetricMatrix()

void SM_MacroCellsDemagnetizedField::computeBlocksSymmetricMatrix ( const tReal &  lambdaH,
const tReal &  lambdaHs,
const tReal *  vMCsVolume,
const tReal *  vMCsX,
const tInteger &  start,
const tInteger &  end,
tReal *  supBlocksValues,
tReal *  diagBlocksValues 
) const
protected

compute the column blocks matrix (i,j) j in [start,end] and j in [0,i]

Parameters
[in]lambdaH: coefficient foer interactive Hdem between 2 differents macro cell
[in]lambdaHs: coefficient foer interactive Hdem between one macro cell and itself
[in]vMCsVolumevolume of each macro cell
[in]vMCsXmass center for each macro cell
[in]startindex of start block
[in]end: index of end block
[out]supBlocksValuesiterator on sup block values of the whole matrix
[out]diagBlocksValuesiterator on diagonal block values of the whole matrix

◆ computeField()

virtual void SM_MacroCellsDemagnetizedField::computeField ( const SM_MacroCellsNetwork network,
const SM_MacroCellsMagnetizationField M 
)
pure virtual

compute the demagnetized field on macro cells network

Parameters
[in]networknetwork of macro cell
[in]M: magnetezation fieldl on macro cell

Implemented in SMOMPI_OneMasterMacroCellsDemagnetizedField, SMOMPI_AllMasterMacroCellsDemagnetizedField, and SMOMPI_NoMasterMacroCellsDemagnetizedField.

◆ computeFieldSlice()

void SM_MacroCellsDemagnetizedField::computeFieldSlice ( const tReal &  lambdaH,
const tReal &  lambdaHs,
const tReal *  P,
const tReal *  eP,
const tReal *  M_P,
const tInteger &  nMacroCells,
const tReal *  X,
const tReal *  M_X,
const tReal *  iMCsVolume,
tReal *  H 
) const
protected

compute Hdem[X]=F_{P,M}(X)

Parameters
[in]lambdaHphysical parameter for interaction between M at 2 different macro cells
[in]lambdaHsphysical parameter for interaction between M and itself (0 if \( P \cap X = \emptyset \))
[in]P: iterator on start macro cell P
[in]eP: iterator on end macro cell P
[in]M_P: iterator on M at start macro cell P for all macro cells P
[in]nMacroCells: number of macro cells X to compute Hdem[X]
[in]X: iterator on start macro cell X. The number of X macro cell (m) is nMacroCells
[in]M_X: iterator on M at start macro cell X for all macro cells X of number nMacroCells
[in]iMCsVolumeiterator at volume in Angstrom of start macro cell
[out]H: hdem[X] \( \forall x \in X, H_{dip)(x)+= \lambda_H . \sum_{y \in P } (3*<U_{xy},M_y>*U_{xy}}-M_y))/|y-x|^3 - \frac{\lambda_{H_s}}{N_x}.M_x \) with
  • \( U=\frac{1}{|y-x|}. (y-x) \) and
  • \( N_x \), the number of spins in x

◆ computeMatrix()

virtual void SM_MacroCellsDemagnetizedField::computeMatrix ( const SM_Material material,
const SM_MacroCellsNetwork network 
)
pure virtual

compute the matrix ot he demagnetized operator

Parameters
[in]material: material used to build the matrix
[in]networkmacro cells network of the part of the domaain of core coreId

Implemented in SMOMPI_OneMasterMacroCellsDemagnetizedField, SMOMPI_AllMasterMacroCellsDemagnetizedField, and SMOMPI_NoMasterMacroCellsDemagnetizedField.

◆ computeSeparatedFieldSlice()

void SM_MacroCellsDemagnetizedField::computeSeparatedFieldSlice ( const tReal &  lambdaH,
const tReal &  lambdaHs,
const tReal *  P,
const tReal *  eP,
const tReal *  M_P,
const tInteger &  nMacroCells,
const tReal *  X,
tReal *  H 
) const

compute Hdem[X]=F_{P,M}(X)

Parameters
[in]lambdaHphysical parameter for interaction between M at 2 different macro cells
[in]lambdaHsphysical parameter for interaction between M and itself (0 if \( P \cap X = \emptyset \))
[in]P: iterator on start macro cell P
[in]eP: iterator on end macro cell P
[in]M_P: iterator on M at start macro cell P for all macro cells P
[in]nMacroCells: number of macro cells X to compute Hdem[X]
[in]X: iterator on start macro cell X. The number of X macro cell (m) is nMacroCells
[out]H: hdem[X] \( \forall x \in X, H_{dip)(x)+= \lambda_H . \sum_{y \in P } (3*<U_{xy},M_y>*U_{xy}}-M_y))/|y-x|^3 \) with
  • \( U=\frac{1}{|y-x|}. (y-x) \)

◆ discretize()

void SM_MacroCellsDemagnetizedField::discretize ( const SM_Material material,
const SM_MacroCellsNetwork network 
)
virtual

discretize the field

Parameters
[in]material: material of the network
[in]network: macro cells network of the part of the domaain of core coreId
  • It allocates :
    • the local Hdem field
  • It computes :
    • lambdaH : demagnatized factor for 2 different macro cells
    • lambdaHs : demagnetized factor for interaction of a macro cell with itself
    • the matrix of the demagnetized operator

Reimplemented in SMOMPI_OneMasterMacroCellsDemagnetizedField, SMOMPI_NoMasterMacroCellsDemagnetizedField, and SMOMPI_AllMasterMacroCellsDemagnetizedField.

◆ getContentsMemorySize()

virtual tMemSize SM_MacroCellsDemagnetizedField::getContentsMemorySize ( ) const
inlinevirtual

return the memory size of the included associations

Returns
the memory size of the storage in bytes 1 Kb = 1024 bytes 1 Mb = 1024 Kb 1 Gb = 1024 Mb 1 Tb = 1024 Gb 1 Hb = 1024 Tb

Reimplemented from CORE_Object.

Reimplemented in SMOMPI_OneMasterMacroCellsDemagnetizedField, SMOMPI_NoMasterMacroCellsDemagnetizedField, and SMOMPI_AllMasterMacroCellsDemagnetizedField.

◆ getLambdaH()

const tReal& SM_MacroCellsDemagnetizedField::getLambdaH ( ) const
inline

get lambda H

Returns
\( lambda_H=\frac{\mu_0}{4.\pi} \) computed in discretize method

◆ getLambdaHs()

const tReal& SM_MacroCellsDemagnetizedField::getLambdaHs ( ) const
inline

get self lambda Hs

Returns
\( lambda_Hs=\frac{\mu_0}{3.V_p} \) and \( V_p=V_{uc}/N{uc}\) computed in discretize method

◆ getMemorySize()

virtual tMemSize SM_MacroCellsDemagnetizedField::getMemorySize ( ) const
inlinevirtual

return the memory size of the class and the memory size of all its attributes/associations

Returns
the memory size of the class and the memory size of its attributes/associations in bytes The mamory size is :
  • the added size of the base classes which contains:
    • the primary attributes size depends on the order: (first delare the smallest attributes size
    • all virtual functions costs <pointer-size> (4 32xor 8 64x) bytes by virtual function
    • virtual inherihtance will increase of (4 or 8) bytes
  • we add the size of the contains values of the attributes : for example the size of a string is the length of the string 1 octet = 1 byte 1 Ko = 1024 bytes 1 Mo = 1024 Ko 1 Go = 1024 Mo

Reimplemented from SM_Object.

Reimplemented in SMOMPI_OneMasterMacroCellsDemagnetizedField, SMOMPI_NoMasterMacroCellsDemagnetizedField, and SMOMPI_AllMasterMacroCellsDemagnetizedField.

◆ newInstance()

virtual CORE_UniquePointer<SM_MacroCellsDemagnetizedField> SM_MacroCellsDemagnetizedField::newInstance ( ) const
pure virtual

create a New instance of this

Returns
an unique pointer to the instance

Implemented in SMOMPI_OneMasterMacroCellsDemagnetizedField, SMOMPI_NoMasterMacroCellsDemagnetizedField, and SMOMPI_AllMasterMacroCellsDemagnetizedField.

◆ setStorage()

void SM_MacroCellsDemagnetizedField::setStorage ( const tFlag &  f)
inline

set storage type

Parameters
[in]fstorage type in {NO_STORAGE,PACKED_STORAGE}

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