C++ main module for emicrom Package  1.0
EMM_DisplacementFVMOperator.h
Go to the documentation of this file.
1 #ifndef EMM_DisplacementFVMOperator_H
2 #define EMM_DisplacementFVMOperator_H
3 
6 
7 
91 
93  // ATTRIBUTES
94 
95 
96 
97 
98 private:
99  //segments number
101 
102  //periodicity
104 
105  //Boundary elements construction
106  //===============================
107 
108  //mNeighborsIndices[e][f]=i
109  // - e is a magnetized elements
110  // - f : index of faces in [0,EMM_Grid3D::FACES_NUMBER_PER_ELEMENT[
111  // - i :
112  // - index of the neighbor cell if i in [0,EMM_Grid3D::UNMAGNETIZED_ELEMENT[
113  // - i-UNMAGNETIZED_ELEMENT is the index of the boundary surface in [0,
114 
116 
117 
118  //dirichlet boundary values
119  SP::EMM_RealField mU0;
120 
121  //for boundary faces
123 
124 
125 
126 protected:
127 
128  // METHODS
129 
130  // CONSTRUCTORS
131 
135 
136  // DESTRUCTORS
137 
140  virtual ~EMM_DisplacementFVMOperator(void);
141 
142 
145  virtual void toDoAfterThisSetting() {
147  }
148 public:
149 
150  //limit conditions input data
151  //===========================
152 
153 
154  public:
155 
166  virtual void buildDataOnBoundaryFaces(const EMM_Grid3D& mesh,
167  const EMM_LimitConditionArray& limitConditionOnPoints,
168  const EMM_RealField& U0,
169  EMM_RealField& DnU0) {
170  buildDataOnDirichletBoundaryFaces(limitConditionOnPoints,
171  U0,
172  *mU0.get());
173 
174  buildDataOnNeumannBoundaryFaces(limitConditionOnPoints,
175  DnU0);
176 
177  //set the limit type for all boundary faces.
178  setBoundaryFaceTypes(mesh,limitConditionOnPoints,mNeighborsIndices);
179 
180  }
181 
189  return *mU0.get();
190  }
198  return *mU0.get();
199  }
200 private:
211  void buildDataOnDirichletBoundaryFaces(const EMM_LimitConditionArray& limitConditionOnPoints,
212  const EMM_RealField& Ut,//U0 on points
213  EMM_RealField& U0) const;
224  void buildDataOnNeumannBoundaryFaces(const EMM_LimitConditionArray& limitConditionOnPoints,
225  EMM_RealField& C) const;
226 
237  void setBoundaryFaceTypes(const EMM_Grid3D& mesh,
238  const EMM_LimitConditionArray& limitConditionOnPoints,
239  CORE_UIndexMorseArray& neighborsIndices) const ;
240 
241 
242 
243 protected:
244 
245 
246 
247 
248  //discretization mehods
249  //======================
250 public:
251 
261  virtual tBoolean discretize(const EMM_LandauLifschitzSystem& system);
262 
271 
280  virtual tULLInt getMemorySize() const;
281 
286  return mNeighborsIndices;
287  }
292  return mNeighborsIndices;
293  }
294 
298  inline const tUInteger* getSegmentsNumber() const {
299  return mSegmentsNumber;
300  }
304  inline const tBoolean* isDirectionPeriodic() const {
305  return mPeriodicDirections;
306  }
310  inline void setIsGhostCellOn(const tBoolean& isOn) {
311  mIsGhostCellOn=isOn;
312  }
313 
317  inline const tBoolean& isGhostCellOn() const {
318  return mIsGhostCellOn;
319  }
320 
321 
322  //Backup & restore
323  //==================
324 
325 public:
335  virtual tBoolean backup(const tString& prefix,const tString& suffix,const tString& ext) const;
336 
347  virtual tBoolean restore(const EMM_LandauLifschitzSystem& system,
348  const tString& prefix,const tString& suffix,const tString& ext);
349 
350  //output data
351  //=============
352 
353 
368  virtual tBoolean getDataFieldSpace(const tUSInt& index,tString& dataName,tFlag& supportType,tString& dFieldType,tUIndex& n,tDimension& dim) const {
369  supportType=EMM_Grid3D::ELEMENT;
370  dFieldType=CORE_Object::getTypeName<tReal>();
371  switch(index) {
372  case 0:
374  dataName="U";
375  n=getDisplacement().getSize();
376  return true;
377  break;
378  case 1:
379  dataName="dU_dt";
380  dim=getVelocity().getDimension();
381  n=getVelocity().getSize();
382  return true;
383  break;
384  case 2:
385  dataName="acc";
387  n=getAccelerator().getSize();
388  return true;
389  break;
390  }
391  return false;
392  }
393 
394  //time evolutions of fields for unsteady state
395  //=============================================
396 protected:
397 
407  return true;
408  }
409 
417  virtual void spaceProjection(EMM_RealField& V) const {
418  }
419 
428  virtual void spaceProjection(const EMM_RealField& V0, EMM_RealField& V) const {
429  }
430 
431 public:
442  virtual void spaceProjection(const tUIndex& nPoints, const tDimension& dim,const tReal* V0,tReal *V) const {
443  }
444 
445  protected:
453  virtual void spaceRelevant(EMM_RealField& V) const{
454  };
455 
456  //steady state method
457  //===================
458 
459 
460 
461 public:
462 
471  virtual void setSolver(const tString& solverName);
472 
478 
479 
480 public:
481 
482  //GradU reconstruction methods
483  //=============================
484 
508  virtual void computeGradUAtCell(const tBoolean& withConstraints,const tReal *h,
509  const tUInteger& xCell, const tUInteger& yCell,const tUInteger& zCell,
510  const tUInteger& Px, const tUInteger& Py,const tUInteger& Pz,
511  const tBoolean* periodicity,
512  const tUIndex* Ni,
513  const tDimension& dim,
514  const tReal *Ucells,const tReal *Ui,
515  const tLimitCondition* lc,const tBoolean& incU0, const tReal* U0,
516  tReal gradU[9]) const=0;
517 
518 
546  virtual void computeGradUAtFace(const tBoolean& withConstraints,
547  const tReal *h,
548  const tUInteger& xCell,const tUInteger& yCell,const tUInteger& zCell,
549  const tUCInt& f,const tUIndex& nextCell,
550  const tUInteger& Px,const tUInteger& Py,const tUInteger& Pz,
551  const tBoolean *periodicity,
552  const CORE_UIndexMorseArray& neighborsIndices,
553  const tDimension& dim,
554  const tReal * Ucells,
555  const tReal* Ui,
556  const tLimitCondition* lc,const tBoolean& incU0, const tReal* U0,
557  tReal gradU[9]) const=0;
558 
559 protected:
582  virtual void computeGradAlmostNullUAtFace(const tReal *h,
583  const tUInteger& xCell,const tUInteger& yCell,const tUInteger& zCell,
584  const tUCInt& f,
585  const tUIndex& nextCell,
586  const tUInteger& Px,const tUInteger& Py,const tUInteger& Pz,
587  const tBoolean *periodicity,
588  const CORE_UIndexMorseArray& neighborsIndices,
589  const tLimitCondition* lc,
590  const tDimension& dim,
591  const tReal* Ui,
592  tReal gradU[9]) const=0;
593 
594  //elastic tensor methods
595  //======================
596 
597 public:
608  }
609 
610 
611 protected:
612 
613 
626  virtual void computeElasticTensor(const tUIndex& nData,
627  const tDimension& dim,
628  const tReal* U,
629  EMM_2PackedSymmetricTensors& eTensor) const;
630 
631 
632 
633  //stress methods
634  //==============
635 
636 protected:
654  virtual void computeElasticStress(const tBoolean& withConstraints,const tReal& beta,
655  const tUIndex& nData,const tDimension& dim, const tReal* U,tReal* S) const;
656 
657 
678  virtual void computeMagneticStress(const tReal& alpha,const tReal& beta,
679  const tUIndex& nCells,const tDimension& dim, const EMM_RealArray& sigma,
680  const tReal* M,
681  const tUIndex& nData,
682  tReal* D) const;
683 
684 
685 
686  //energy methods
687  //==============
688 public:
694  virtual tReal computeCineticEnergy(const EMM_RealField& V) const;
695 
696  /* ! \brief compute the potential energy to the space variation of the displacement
697  * @param U: displacement field
698  * @return potential energy value \f$ \int_\omega (\lambda^e:\varepsilon(u)):\varepsilon(u) d\omega \f$
699  *
700  */
701  virtual tReal computePotentialEnergy(const EMM_RealField& U) const;
702 
710  return 0;
711  }
712 
713 
714 
715 
716  //STRING representation
717  //=======================
718 
721  virtual tString toString() const {
723  return ret;
724  }
725 
726 
727 
728 };
729 
730 #endif
731 
This class describes a grid3d mesh.
Definition: EMM_Grid3D.h:48
SP_OBJECT(EMM_DisplacementFVMOperator)
virtual tString toString() const
turn the class into string
Definition: EMM_DisplacementFVMOperator.h:721
const tUInteger * getSegmentsNumber() const
get number of segments in each direction
Definition: EMM_DisplacementFVMOperator.h:298
virtual tUIndex getSize() const =0
return the size of the field
#define tLimitCondition
Definition: EMM_Types.h:19
#define tUInteger
Definition: types.h:91
virtual tBoolean discretize(const EMM_LandauLifschitzSystem &system)
discretize and initialize the operator
Definition: EMM_DisplacementFVMOperator.cpp:440
virtual tBoolean solveAcceleratorSystem(EMM_RealField &V)
solve the velocity from the mass matrix : M.X=V V:=X
Definition: EMM_DisplacementFVMOperator.h:406
This class describes the displacement operator defined on the cells of the mesh.
Definition: EMM_DisplacementFVMOperator.h:90
tBoolean mIsGhostCellOn
Definition: EMM_DisplacementFVMOperator.h:122
virtual tBoolean resetToInitialState(const EMM_LandauLifschitzSystem &system)
reset the operator to initial step
Definition: EMM_DisplacementFVMOperator.cpp:503
void setIsGhostCellOn(const tBoolean &isOn)
set true to considered ghost cells on boundary faces
Definition: EMM_DisplacementFVMOperator.h:310
EMM_RealField & getAccelerator()
get the accelerator for writing
Definition: EMM_DisplacementOperator.h:970
virtual void setSolver(const tString &solverName)
set the solver
Definition: EMM_DisplacementFVMOperator.cpp:587
EMM_RealField & getDisplacement()
get the displacement for writing
Definition: EMM_DisplacementOperator.h:911
virtual tBoolean restore(const EMM_LandauLifschitzSystem &system, const tString &prefix, const tString &suffix, const tString &ext)
restore the operator data from file(s)
Definition: EMM_DisplacementFVMOperator.cpp:568
SP::EMM_RealField mU0
Definition: EMM_DisplacementFVMOperator.h:119
virtual ~EMM_DisplacementFVMOperator(void)
destroy
Definition: EMM_DisplacementFVMOperator.cpp:38
#define tUCInt
Definition: types.h:21
#define tUSInt
Definition: types.h:28
virtual void spaceProjection(EMM_RealField &V) const
make the projection of the vector B into the solving linear space
Definition: EMM_DisplacementFVMOperator.h:417
#define tBoolean
Definition: types.h:139
virtual tULLInt getMemorySize() const
return the memory size in byte
Definition: EMM_DisplacementFVMOperator.cpp:538
tBoolean mPeriodicDirections[3]
Definition: EMM_DisplacementFVMOperator.h:103
virtual void computeElasticTensor(const EMM_RealField &U, EMM_2PackedSymmetricTensors &eTensor)
compute the elastic tensor for all cells
Definition: EMM_DisplacementOperator.cpp:1623
virtual tString toString() const
turn the martix into string
Definition: EMM_DisplacementOperator.h:1655
static const tFlag ELEMENT
Definition: EMM_Grid3D.h:69
CORE_UIndexMorseArray mNeighborsIndices
Definition: EMM_DisplacementFVMOperator.h:115
#define tDimension
Definition: EMM_Types.h:10
virtual void spaceRelevant(EMM_RealField &V) const
make the relevment of the vector B from the solving linear space.
Definition: EMM_DisplacementFVMOperator.h:453
const CORE_UIndexMorseArray & getNeighborsIndices() const
get the index of the neighbor cells for each cell of the mesh for reading
Definition: EMM_DisplacementFVMOperator.h:285
virtual void computeMagneticStress(const tReal &alpha, const tReal &beta, const tUIndex &nCells, const tDimension &dim, const EMM_RealArray &sigma, const tReal *M, const tUIndex &nData, tReal *D) const
compute the magnetic stress to elastic stress S
Definition: EMM_DisplacementFVMOperator.cpp:1427
This class describes a morse array of symmetric tensors of 2 order in packed form.
Definition: EMM_2PackedSymmetricTensors.h:20
void buildDataOnDirichletBoundaryFaces(const EMM_LimitConditionArray &limitConditionOnPoints, const EMM_RealField &Ut, EMM_RealField &U0) const
build the data on Dirichlet boundary faces
Definition: EMM_DisplacementFVMOperator.cpp:44
This class describes the displacement operator defined on the data of the mesh.
Definition: EMM_DisplacementOperator.h:193
const tBoolean * isDirectionPeriodic() const
get priodic directions
Definition: EMM_DisplacementFVMOperator.h:304
tReal computeStressConstraintEnergy(const EMM_RealField &Uf) const
compute the stress constraint energy on boundary
Definition: EMM_DisplacementFVMOperator.h:709
virtual tReal computePotentialEnergy(const EMM_RealField &U) const
compute the potential energy to the space variation of the displacement
Definition: EMM_DisplacementFVMOperator.cpp:1715
This class describes a resolution of landau-lifschitz system of the Core Package for E-MicroM...
Definition: EMM_LandauLifschitzSystem.h:88
Definition: EMM_DisplacementFVM_Interpolator.h:16
tUInteger mSegmentsNumber[3]
Definition: EMM_DisplacementFVMOperator.h:100
This class describes a masked vector.
Definition: MATH_Vector.h:16
virtual void computeElasticStress(const tBoolean &withConstraints, const tReal &beta, const tUIndex &nData, const tDimension &dim, const tReal *U, tReal *S) const
compute the elastic stress
Definition: EMM_DisplacementFVMOperator.cpp:1067
virtual void computeGradUAtCell(const tBoolean &withConstraints, const tReal *h, const tUInteger &xCell, const tUInteger &yCell, const tUInteger &zCell, const tUInteger &Px, const tUInteger &Py, const tUInteger &Pz, const tBoolean *periodicity, const tUIndex *Ni, const tDimension &dim, const tReal *Ucells, const tReal *Ui, const tLimitCondition *lc, const tBoolean &incU0, const tReal *U0, tReal gradU[9]) const =0
compute the value of Grad U on cell
#define tUIndex
Definition: types.h:126
This class describes a real array.
Definition: EMM_RealArray.h:16
virtual void computeGradAlmostNullUAtFace(const tReal *h, const tUInteger &xCell, const tUInteger &yCell, const tUInteger &zCell, const tUCInt &f, const tUIndex &nextCell, const tUInteger &Px, const tUInteger &Py, const tUInteger &Pz, const tBoolean *periodicity, const CORE_UIndexMorseArray &neighborsIndices, const tLimitCondition *lc, const tDimension &dim, const tReal *Ui, tReal gradU[9]) const =0
compute the gradient U at the center of the face f of a cell when U is almost null ...
const tDimension & getDimension() const
get the dimension
Definition: EMM_RealField.h:553
const EMM_RealField & getDisplacementOnDirichletBoundary() const
get the displacement field at boundary for reading
Definition: EMM_DisplacementFVMOperator.h:188
virtual tBoolean backup(const tString &prefix, const tString &suffix, const tString &ext) const
backup of the operator data into file(s) used for restoring
Definition: EMM_DisplacementFVMOperator.cpp:549
virtual tReal computeCineticEnergy(const EMM_RealField &V) const
compute the energy of the magnetostriction operator at current displacement and velocity ...
Definition: EMM_DisplacementFVMOperator.cpp:1721
#define tString
Definition: types.h:135
virtual void computeElasticTensor(const EMM_RealField &U, EMM_2PackedSymmetricTensors &eTensor)
compute the elastic tensor for all cells
Definition: EMM_DisplacementFVMOperator.h:606
virtual void toDoAfterThisSetting()
method called after the setting of the shared pointer this method can only be called once...
Definition: EMM_DisplacementOperator.h:345
CORE_UIndexMorseArray & getNeighborsIndices()
get the index of the neighbor cells for each cell of the mesh
Definition: EMM_DisplacementFVMOperator.h:291
EMM_RealField & getVelocity()
get the velocity for writing
Definition: EMM_DisplacementOperator.h:949
virtual void spaceProjection(const EMM_RealField &V0, EMM_RealField &V) const
make the projection of the vector B into the solving linear space
Definition: EMM_DisplacementFVMOperator.h:428
const tBoolean & isGhostCellOn() const
get true to considered ghost cells on boundary faces
Definition: EMM_DisplacementFVMOperator.h:317
void setBoundaryFaceTypes(const EMM_Grid3D &mesh, const EMM_LimitConditionArray &limitConditionOnPoints, CORE_UIndexMorseArray &neighborsIndices) const
set the boundary face type into indices
Definition: EMM_DisplacementFVMOperator.cpp:305
virtual void spaceProjection(const tUIndex &nPoints, const tDimension &dim, const tReal *V0, tReal *V) const
make the projection of the vector B into the solving linear space
Definition: EMM_DisplacementFVMOperator.h:442
virtual void computeEquilibriumMatrixDiagonalConditioner(MATH_Vector &D) const
compute the diagonal conditioner
Definition: EMM_DisplacementFVMOperator.cpp:600
void buildDataOnNeumannBoundaryFaces(const EMM_LimitConditionArray &limitConditionOnPoints, EMM_RealField &C) const
build the data on Neumann boundary faces
Definition: EMM_DisplacementFVMOperator.cpp:167
EMM_DisplacementFVMOperator(void)
create
Definition: EMM_DisplacementFVMOperator.cpp:11
virtual void computeGradUAtFace(const tBoolean &withConstraints, const tReal *h, const tUInteger &xCell, const tUInteger &yCell, const tUInteger &zCell, const tUCInt &f, const tUIndex &nextCell, const tUInteger &Px, const tUInteger &Py, const tUInteger &Pz, const tBoolean *periodicity, const CORE_UIndexMorseArray &neighborsIndices, const tDimension &dim, const tReal *Ucells, const tReal *Ui, const tLimitCondition *lc, const tBoolean &incU0, const tReal *U0, tReal gradU[9]) const =0
compute the gradient U at the center of the face f of a cell. f is either an interior face or a Diric...
#define tULLInt
Definition: types.h:45
virtual void buildDataOnBoundaryFaces(const EMM_Grid3D &mesh, const EMM_LimitConditionArray &limitConditionOnPoints, const EMM_RealField &U0, EMM_RealField &DnU0)
build the data on boundary faces Dirichlet and Neumann
Definition: EMM_DisplacementFVMOperator.h:166
This class describes a real field.
Definition: EMM_RealField.h:21
DEFINE_SPTR(EMM_DisplacementFVMOperator)
#define tReal
Definition: types.h:118
virtual void toDoAfterThisSetting()
to to after thios setting
Definition: EMM_DisplacementFVMOperator.h:145
EMM_RealField & getDisplacementOnDirichletBoundary()
get the displacement field at boundary for writing
Definition: EMM_DisplacementFVMOperator.h:197
virtual tBoolean getDataFieldSpace(const tUSInt &index, tString &dataName, tFlag &supportType, tString &dFieldType, tUIndex &n, tDimension &dim) const
get the data field at index for saving data in vtk,txt,... files.
Definition: EMM_DisplacementFVMOperator.h:368
#define tFlag
Definition: types.h:74