Memosa-FVM  0.2
StructureModel< T >::Impl Class Reference

#include <StructureModel_impl.h>

Collaboration diagram for StructureModel< T >::Impl:

Public Types

typedef Array< T > TArray
 
typedef Vector< T, 3 > VectorT3
 
typedef VectorTranspose< T, 3 > VectorT3T
 
typedef Array< VectorT3VectorT3Array
 
typedef SquareTensor< T, 3 > DiagTensorT3
 
typedef CRMatrix< DiagTensorT3,
DiagTensorT3, VectorT3
VVMatrix
 
typedef VVMatrix::DiagArray VVDiagArray
 
typedef Gradient< VectorT3VGradType
 
typedef Array< Gradient
< VectorT3 > > 
VGradArray
 

Public Member Functions

 Impl (const GeomFields &geomFields, StructureFields &structureFields, const MeshList &meshes)
 
void init ()
 
StructureBCMapgetBCMap ()
 
StructureVCMapgetVCMap ()
 
StructureModelOptions< T > & getOptions ()
 
void updateTime ()
 
void creepInit ()
 
void computeVMStress ()
 
void initDeformationLinearization (LinearSystem &ls)
 
void applyBC (LinearSystem &ls, bool explicitMode)
 
void linearizeDeformation (LinearSystem &ls, bool explicitMode)
 
MFRPtr solveDeformation ()
 
void initExplicitAdvance ()
 
void finishExplicitAdvance ()
 
void advanceExplicit (const int nSteps, const double deltaT)
 
bool advance (const int niter)
 
void getTraction (const Mesh &mesh)
 
void getStrain (const Mesh &mesh)
 
void getPlasticDiagStrain (const Mesh &mesh)
 
void updateForceOnBoundary (const StorageSite &faceSite, const ArrayBase &bforceA, const map< int, int > &commonFacesMap, ArrayBase &fxA, ArrayBase &fyA, ArrayBase &fzA)
 

Private Attributes

const MeshList _meshes
 
const GeomFields_geomFields
 
StructureFields_structureFields
 
StructureBCMap _bcMap
 
StructureVCMap _vcMap
 
StructureModelOptions< T > _options
 
GradientModel< VectorT3_deformationGradientModel
 
MFRPtr _initialDeformationNorm
 
int _niters
 
shared_ptr< LinearSystem_lsK
 

Detailed Description

template<class T>
class StructureModel< T >::Impl

Definition at line 270 of file StructureModel_impl.h.

Member Typedef Documentation

template<class T>
typedef SquareTensor<T,3> StructureModel< T >::Impl::DiagTensorT3

Definition at line 280 of file StructureModel_impl.h.

template<class T>
typedef Array<T> StructureModel< T >::Impl::TArray

Definition at line 273 of file StructureModel_impl.h.

template<class T>
typedef Vector<T,3> StructureModel< T >::Impl::VectorT3

Definition at line 274 of file StructureModel_impl.h.

template<class T>
typedef Array<VectorT3> StructureModel< T >::Impl::VectorT3Array

Definition at line 277 of file StructureModel_impl.h.

template<class T>
typedef VectorTranspose<T,3> StructureModel< T >::Impl::VectorT3T

Definition at line 275 of file StructureModel_impl.h.

template<class T>
typedef Array<Gradient<VectorT3> > StructureModel< T >::Impl::VGradArray

Definition at line 287 of file StructureModel_impl.h.

template<class T>
typedef Gradient<VectorT3> StructureModel< T >::Impl::VGradType

Definition at line 286 of file StructureModel_impl.h.

template<class T>
typedef VVMatrix::DiagArray StructureModel< T >::Impl::VVDiagArray

Definition at line 283 of file StructureModel_impl.h.

Definition at line 282 of file StructureModel_impl.h.

Constructor & Destructor Documentation

template<class T>
StructureModel< T >::Impl::Impl ( const GeomFields geomFields,
StructureFields structureFields,
const MeshList meshes 
)
inline

Definition at line 289 of file StructureModel_impl.h.

References Model::_meshes, StructureBC< T >::bcType, Mesh::getAllFaceGroups(), Mesh::getID(), FaceGroup::groupType, FaceGroup::id, and StructureVC< T >::vcType.

291  :
292  _meshes(meshes),
293  _geomFields(geomFields),
294  _structureFields(structureFields),
298  _niters(0)
299  {
300  const int numMeshes = _meshes.size();
301  for (int n=0; n<numMeshes; n++)
302  {
303  const Mesh& mesh = *_meshes[n];
304 
305  StructureVC<T> *vc(new StructureVC<T>());
306  vc->vcType = "structure";
307  _vcMap[mesh.getID()] = vc;
308  foreach(const FaceGroupPtr fgPtr, mesh.getAllFaceGroups())
309  {
310  const FaceGroup& fg = *fgPtr;
311  if ((_bcMap.find(fg.id) == _bcMap.end())&&(fg.groupType != "interior"))
312  {
313  StructureBC<T> *bc(new StructureBC<T>());
314 
315  _bcMap[fg.id] = bc;
316  if (fg.groupType == "wall")
317  {
318  bc->bcType = "SpecifiedTraction";
319  }
320  else if (fg.groupType == "interface")
321  {
322  bc->bcType = "Interface";
323  }
324  else if (fg.groupType == "symmetry")
325  {
326  bc->bcType = "Symmetry";
327  }
328  else if ((fg.groupType == "velocity-inlet") ||
329  (fg.groupType == "pressure-inlet"))
330  {
331  bc->bcType = "SpecifiedDeformation";
332  }
333  else if (fg.groupType == "pressure-outlet")
334  {
335  bc->bcType = "SpecifiedForce";
336  }
337  else
338  throw CException("StructuralModel: unknown face group type "
339  + fg.groupType);
340  }
341  }
342  }
343  }
shared_ptr< FaceGroup > FaceGroupPtr
Definition: Mesh.h:46
Definition: Mesh.h:28
const FaceGroupList & getAllFaceGroups() const
Definition: Mesh.h:193
Definition: Mesh.h:49
GradientModel< VectorT3 > _deformationGradientModel
string groupType
Definition: Mesh.h:42
StructureFields & _structureFields
const int id
Definition: Mesh.h:41
const GeomFields & _geomFields
int getID() const
Definition: Mesh.h:106

Member Function Documentation

template<class T>
bool StructureModel< T >::Impl::advance ( const int  niter)
inline

Definition at line 1185 of file StructureModel_impl.h.

1186  {
1187 
1188  for(int n=0; n<niter; n++)
1189  {
1190  MFRPtr dNorm = solveDeformation();
1191 
1192  if (_niters < 5)
1193  {
1194  _initialDeformationNorm->setMax(*dNorm);
1195  }
1196 
1197  MFRPtr dNormRatio(dNorm->normalize(*_initialDeformationNorm));
1198 
1199 
1200 #ifdef FVM_PARALLEL
1201  if ( MPI::COMM_WORLD.Get_rank() == 0 ){ //only root process
1202  if (_options.printNormalizedResiduals)
1203  cout << _niters << ": " << *dNormRatio << endl;
1204  else
1205  cout << _niters << ": " << *dNorm << endl;
1206  }
1207 #endif
1208 
1209 #ifndef FVM_PARALLEL
1210  if (_options.printNormalizedResiduals)
1211  cout << _niters << ": " << *dNormRatio << endl;
1212  else
1213  cout << _niters << ": " << *dNorm << endl;
1214 #endif
1215 
1216 
1217  _niters++;
1218  if (*dNormRatio < _options.deformationTolerance)
1219  return true;
1220  }
1221  return false;
1222  }
StructureModelOptions< T > _options
shared_ptr< MultiFieldReduction > MFRPtr
template<class T>
void StructureModel< T >::Impl::advanceExplicit ( const int  nSteps,
const double  deltaT 
)
inline

Definition at line 1110 of file StructureModel_impl.h.

References Model::_meshes, LinearSystem::getB(), LinearSystem::getDelta(), LinearSystem::getMatrix(), LinearSystem::getX(), MultiFieldMatrix::multiply(), LinearSystem::postSolve(), LinearSystem::updateSolution(), StructureModel< T >::updateTime(), and MultiField::zero().

1111  {
1112  const int nMeshes = this->_meshes.size();
1113  LinearSystem& ls = *(this->_lsK);
1114 
1116  <VectorT3,DiagTensorT3,DiagTensorT3>
1117  td(_meshes,_geomFields,
1124  _options.variableTimeStep,
1125  deltaT,
1126  _options.timeStepN1,
1127  _options.timeStepN2);
1128 
1129 
1130  for(int n=0; n<nSteps; n++)
1131  {
1132 
1133  ls.getMatrix().multiply(ls.getB(), ls.getX());
1134 
1135 
1136  applyBC(ls, true);
1137 
1138  ls.getDelta().zero();
1139 
1140  for(int n=0; n<nMeshes; n++)
1141  {
1142  const Mesh& mesh = *(this->_meshes[n]);
1143  td.explicitAdvance(mesh,ls.getX(),ls.getB(),ls.getDelta());
1144  }
1145 
1146  // this will update the boundary delta's
1147  ls.postSolve();
1148 
1149  ls.updateSolution();
1150 
1151  updateTime();
1152  }
1153  }
SquareTensor< T, 3 > DiagTensorT3
Definition: Mesh.h:49
virtual void zero()
Definition: MultiField.cpp:115
MultiField & getDelta()
Definition: LinearSystem.h:34
StructureFields & _structureFields
void updateSolution()
void applyBC(LinearSystem &ls, bool explicitMode)
const GeomFields & _geomFields
shared_ptr< LinearSystem > _lsK
MultiField & getB()
Definition: LinearSystem.h:33
StructureModelOptions< T > _options
MultiField & getX()
Definition: LinearSystem.h:32
virtual void multiply(IContainer &yB, const IContainer &xB) const
MultiFieldMatrix & getMatrix()
Definition: LinearSystem.h:37
template<class T>
void StructureModel< T >::Impl::applyBC ( LinearSystem ls,
bool  explicitMode 
)
inline

Definition at line 808 of file StructureModel_impl.h.

References Model::_meshes, StructureBCS< X, Diag, OffDiag >::applyDirichletBC(), StructureBCS< X, Diag, OffDiag >::applyNeumannBC(), StructureBC< T >::bcType, Mesh::getAllFaceGroups(), LinearSystem::getB(), Mesh::getCells(), StorageSite::getCount(), LinearSystem::getMatrix(), MultiFieldMatrix::getMatrix(), FloatVarDict< T >::getVal(), LinearSystem::getX(), FaceGroup::groupType, FaceGroup::id, CRMatrix< T_Diag, T_OffDiag, X >::setDirichlet(), and FaceGroup::site.

809  {
810  bool allNeumann = true;
811 
812  const int numMeshes = _meshes.size();
813  for (int n=0; n<numMeshes; n++)
814  {
815  const Mesh& mesh = *_meshes[n];
816 
817  foreach(const FaceGroupPtr fgPtr, mesh.getAllFaceGroups())
818  {
819  const FaceGroup& fg = *fgPtr;
820  if (fg.groupType != "interior")
821  {
822  const StorageSite& faces = fg.site;
823  const int nFaces = faces.getCount();
824  const TArray& faceAreaMag =
825  dynamic_cast<const TArray&>(_geomFields.areaMag[faces]);
826  const StructureBC<T>& bc = *_bcMap[fg.id];
827 
828 
830  _geomFields,
832  ls.getMatrix(), ls.getX(), ls.getB(),
833  explicitMode);
834 
836 
837  if (bc.bcType == "SpecifiedDeformation")
838  {
840  bDeformation(bc.getVal("specifiedXDeformation"),
841  bc.getVal("specifiedYDeformation"),
842  bc.getVal("specifiedZDeformation"),
843  faces);
844  fluxB = gbc.applyDirichletBC(bDeformation);
845 
846  allNeumann = false;
847  }
848  else if (bc.bcType == "Symmetry")
849  {
850  gbc.applySymmetryBC();
851  allNeumann = false;
852  }
853  else if (bc.bcType == "Interface")
854  {
855  gbc.applyInterfaceBC();
856  }
857  else if (bc.bcType == "ZeroDerivative")
858  {
859  gbc.applyZeroDerivativeBC();
860  }
861  else if (bc.bcType == "SpecifiedTraction")
862  {
864  bTraction(bc.getVal("specifiedXXTraction"),
865  bc.getVal("specifiedXYTraction"),
866  bc.getVal("specifiedXZTraction"),
867  bc.getVal("specifiedYXTraction"),
868  bc.getVal("specifiedYYTraction"),
869  bc.getVal("specifiedYZTraction"),
870  bc.getVal("specifiedZXTraction"),
871  bc.getVal("specifiedZYTraction"),
872  bc.getVal("specifiedZZTraction"),
873  _geomFields,
874  faces);
875  for(int f=0; f<nFaces; f++)
876  {
877 
878  fluxB += gbc.applyNeumannBC(f,bTraction[f]);
879 
880  }
881  }
882  else if (bc.bcType == "SpecifiedForce")
883  {
885  bForce(bc.getVal("specifiedXForce"),
886  bc.getVal("specifiedYForce"),
887  bc.getVal("specifiedZForce"),
888  faces);
889  for(int f=0; f<nFaces; f++)
890  {
891 
892  fluxB += gbc.applyNeumannBC(f,bForce[f]/faceAreaMag[f]);
893 
894  }
895  }
896  else if (bc.bcType == "SpecifiedDistForce")
897  {
899  bDistForce(bc.getVal("specifiedXDistForce"),
900  bc.getVal("specifiedYDistForce"),
901  bc.getVal("specifiedZDistForce"),
902  faces);
903  for(int f=0; f<nFaces; f++)
904  {
905  fluxB += gbc.applyNeumannBC(f,bDistForce[f]);
906 
907  }
908  }
909  else
910  throw CException(bc.bcType + " not implemented for StructureModel");
911  //cout << "force sum for " << fg.id << " = " << fluxB << endl;
912  }
913  }
914  /*
915  foreach(const FaceGroupPtr fgPtr, mesh.getInterfaceGroups())
916  {
917  const FaceGroup& fg = *fgPtr;
918  const StorageSite& faces = fg.site;
919  GenericBCS<VectorT3,DiagTensorT3,DiagTensorT3> gbc(faces,mesh,
920  _geomFields,
921  _structureFields.deformation,
922  _structureFields.deformationFlux,
923  ls.getMatrix(), ls.getX(), ls.getB());
924 
925  gbc.applyInterfaceBC();
926  }
927  */
928  }
929 
930 
931 #ifdef FVM_PARALLEL
932  int count = 1;
933  int allNeumannInt = int( allNeumann);
934  MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &allNeumannInt, count, MPI::INT, MPI::PROD);
935  allNeumann = bool(allNeumannInt);
936 #endif
937 
938 
939  if(allNeumann && !explicitMode)
940  {
941  const Mesh& mesh = *_meshes[0];
942  const StorageSite& cells = mesh.getCells();
943  MultiField& b = ls.getB();
944  MultiFieldMatrix& matrix = ls.getMatrix();
946  VectorT3Array& rCell = dynamic_cast<VectorT3Array&>(b[wIndex]);
947  VectorT3Array& w = dynamic_cast<VectorT3Array&>
948  (_structureFields.deformation[cells]);
949  VVMatrix& vvMatrix =
950  dynamic_cast<VVMatrix&>(matrix.getMatrix(wIndex,wIndex));
951  rCell[0] = T(0);
952  w[0] = T(0);
953  vvMatrix.setDirichlet(0);
954  }
955 
956  }
CRMatrix< DiagTensorT3, DiagTensorT3, VectorT3 > VVMatrix
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
shared_ptr< FaceGroup > FaceGroupPtr
Definition: Mesh.h:46
Definition: Mesh.h:28
const FaceGroupList & getAllFaceGroups() const
Definition: Mesh.h:193
Definition: Mesh.h:49
string groupType
Definition: Mesh.h:42
FloatVal< T > getVal(const string varName) const
Definition: FloatVarDict.h:85
StructureFields & _structureFields
const int id
Definition: Mesh.h:41
pair< const Field *, const StorageSite * > ArrayIndex
Definition: MultiField.h:21
string bcType
Definition: StructureBC.h:34
const StorageSite & getCells() const
Definition: Mesh.h:109
const GeomFields & _geomFields
int getCount() const
Definition: StorageSite.h:39
MultiField & getB()
Definition: LinearSystem.h:33
MultiField & getX()
Definition: LinearSystem.h:32
Field areaMag
Definition: GeomFields.h:25
MultiFieldMatrix & getMatrix()
Definition: LinearSystem.h:37
StorageSite site
Definition: Mesh.h:40
template<class T>
void StructureModel< T >::Impl::computeVMStress ( )
inline

Definition at line 626 of file StructureModel_impl.h.

References Model::_meshes, Mesh::getCells(), StorageSite::getCount(), Mesh::getDimension(), and sqrt().

627  {
628  const int numMeshes = _meshes.size();
629  for (int n=0; n<numMeshes; n++)
630  {
631  const Mesh& mesh = *_meshes[n];
632 
633  const StorageSite& cells = mesh.getCells();
634  VectorT3Array& w =
635  dynamic_cast<VectorT3Array&>(_structureFields.deformation[cells]);
636  _deformationGradientModel.compute();
637  const VGradArray& wGradCell =
638  dynamic_cast<const VGradArray&>(_structureFields.deformationGradient[cells]);
639 
640  const TArray& muCell =
641  dynamic_cast<const TArray&>(_structureFields.eta[cells]);
642 
643  const TArray& lambdaCell =
644  dynamic_cast<const TArray&>(_structureFields.eta1[cells]);
645 
646  VGradArray& devStress =
647  dynamic_cast<VGradArray&>(_structureFields.devStress[cells]);
648  const VGradArray& plasticStrainCell =
649  dynamic_cast<VGradArray&>(_structureFields.plasticStrain[cells]);
650  TArray& VMStress =
651  dynamic_cast<TArray&>(_structureFields.VMStress[cells]);
652 
653  const int nCells = cells.getCount();
654  const T onethird(1.0/3.0);
655  const T half(0.5);
656  const T twothirds(2.0/3.0);
657  const T two(2.0);
658  const T three(3.0);
659  const T six(6.0);
660  const T zero(0.0);
661 
662  if (mesh.getDimension() == 3)
663  {
664  for(int k=0; k<nCells; k++)
665  {
666  const VGradType& wg = wGradCell[k];
667  VGradType wgPlusTranspose = wGradCell[k];
668  VGradType stress = wGradCell[k];
669  const VGradType pS = plasticStrainCell[k];
670 
671  for(int i=0;i<3;i++)
672  for(int j=0;j<3;j++)
673  wgPlusTranspose[i][j] += wg[j][i];
674 
675  stress[0][0] = wgPlusTranspose[0][0]*muCell[k]-
676  two*pS[0][0]*muCell[k]+
677  (wg[0][0]+wg[1][1]+wg[2][2])*lambdaCell[k];
678  stress[0][1] = wgPlusTranspose[0][1]*muCell[k]-
679  two*pS[0][1]*muCell[k];
680  stress[0][2] = wgPlusTranspose[0][2]*muCell[k]-
681  two*pS[0][2]*muCell[k];
682 
683  stress[1][0] = wgPlusTranspose[1][0]*muCell[k]-
684  two*pS[1][0]*muCell[k];
685  stress[1][1] = wgPlusTranspose[1][1]*muCell[k]-
686  two*pS[1][1]*muCell[k]+
687  (wg[0][0]+wg[1][1]+wg[2][2])*lambdaCell[k];
688  stress[1][2] = wgPlusTranspose[1][2]*muCell[k]-
689  two*pS[1][2]*muCell[k];
690 
691  stress[2][0] = wgPlusTranspose[2][0]*muCell[k]-
692  two*pS[2][0]*muCell[k];
693  stress[2][1] = wgPlusTranspose[2][1]*muCell[k]-
694  two*pS[2][1]*muCell[k];
695  stress[2][2] = wgPlusTranspose[2][2]*muCell[k]-
696  two*pS[2][2]*muCell[k]+
697  (wg[0][0]+wg[1][1]+wg[2][2])*lambdaCell[k];
698 
699  if(_options.creepModel!=3)
700  {
701  stress[0][0]-=(pS[0][0]+pS[1][1]+pS[2][2])*lambdaCell[k];
702  stress[1][1]-=(pS[0][0]+pS[1][1]+pS[2][2])*lambdaCell[k];
703  stress[2][2]-=(pS[0][0]+pS[1][1]+pS[2][2])*lambdaCell[k];
704  }
705 
706  devStress[k] = stress;
707  const T trace = stress[0][0]+stress[1][1]+stress[2][2];
708  (devStress[k])[0][0] = (devStress[k])[0][0] - onethird*trace;
709  (devStress[k])[1][1] = (devStress[k])[1][1] - onethird*trace;
710  (devStress[k])[2][2] = (devStress[k])[2][2] - onethird*trace;
711 
712  VMStress[k] = sqrt(half*(pow((stress[0][0]-stress[1][1]),2.0) +
713  pow((stress[1][1]-stress[2][2]),2.0) +
714  pow((stress[2][2]-stress[0][0]),2.0) +
715  six*(pow((stress[0][1]),2.0) +
716  pow((stress[1][2]),2.0) +
717  pow((stress[2][0]),2.0))));
718  }
719  }
720  else
721  {
722  for(int k=0; k<nCells; k++)
723  {
724  const VGradType& wg = wGradCell[k];
725  VGradType wgPlusTranspose = wGradCell[k];
726  VGradType stress = wGradCell[k];
727  const VGradType pS = plasticStrainCell[k];
728 
729  for(int i=0;i<3;i++)
730  for(int j=0;j<3;j++)
731  wgPlusTranspose[i][j] += wg[j][i];
732 
733  stress[0][0] = wgPlusTranspose[0][0]*muCell[k]-
734  two*pS[0][0]*muCell[k]+
735  (wg[0][0]+wg[1][1]+wg[2][2])*lambdaCell[k];
736  stress[0][1] = wgPlusTranspose[0][1]*muCell[k]-
737  two*pS[0][1]*muCell[k];
738  stress[0][2] = wgPlusTranspose[0][2]*muCell[k]-
739  two*pS[0][2]*muCell[k];
740 
741  stress[1][0] = wgPlusTranspose[1][0]*muCell[k]-
742  two*pS[1][0]*muCell[k];
743  stress[1][1] = wgPlusTranspose[1][1]*muCell[k]-
744  two*pS[1][1]*muCell[k]+
745  (wg[0][0]+wg[1][1]+wg[2][2])*lambdaCell[k];
746  stress[1][2] = wgPlusTranspose[1][2]*muCell[k]-
747  two*pS[1][2]*muCell[k];
748 
749 
750  if(_options.creepModel!=3)
751  {
752  stress[0][0]+=(pS[2][2])*lambdaCell[k];
753  stress[1][1]+=(pS[2][2])*lambdaCell[k];
754  }
755 
756  stress[2][0] = zero;
757  stress[2][1] = zero;
758  stress[2][2] = zero;
759 
760  devStress[k] = stress;
761  const T trace = stress[0][0]+stress[1][1]+stress[2][2];
762  (devStress[k])[0][0] = (devStress[k])[0][0] - onethird*trace;
763  (devStress[k])[1][1] = (devStress[k])[1][1] - onethird*trace;
764  (devStress[k])[2][2] = (devStress[k])[2][2] - onethird*trace;
765  //devStress[k][2][2] = zero;
766  /*
767  VMStress[k] = sqrt((three/two)*(pow(devStress[k][0][0],2.0) +
768  pow(devStress[k][1][1],2.0) +
769  pow(devStress[k][2][2],2.0) +
770  two*(pow((devStress[k][0][1]),2.0) +
771  pow((devStress[k][1][2]),2.0) +
772  pow((devStress[k][2][0]),2.0))));
773  */
774  VMStress[k] = sqrt(half*(pow((stress[0][0]-stress[1][1]),2.0) +
775  pow((stress[1][1]-stress[2][2]),2.0) +
776  pow((stress[2][2]-stress[0][0]),2.0) +
777  six*(pow((stress[0][1]),2.0) +
778  pow((stress[1][2]),2.0) +
779  pow((stress[2][0]),2.0))));
780 
781  }
782  }
783  }
784  }
Definition: Mesh.h:49
GradientModel< VectorT3 > _deformationGradientModel
Tangent sqrt(const Tangent &a)
Definition: Tangent.h:317
StructureFields & _structureFields
const StorageSite & getCells() const
Definition: Mesh.h:109
Array< Gradient< VectorT3 > > VGradArray
Gradient< VectorT3 > VGradType
int getCount() const
Definition: StorageSite.h:39
StructureModelOptions< T > _options
int getDimension() const
Definition: Mesh.h:105
template<class T>
void StructureModel< T >::Impl::creepInit ( )
inline

Definition at line 501 of file StructureModel_impl.h.

References Model::_meshes, Mesh::getCells(), StorageSite::getCount(), Mesh::getDimension(), and sqrt().

502  {
503  const int numMeshes = _meshes.size();
504  for (int n=0; n<numMeshes; n++)
505  {
506  const Mesh& mesh = *_meshes[n];
507 
508  const StorageSite& cells = mesh.getCells();
509  VectorT3Array& w =
510  dynamic_cast<VectorT3Array&>(_structureFields.deformation[cells]);
511  VectorT3Array& ew =
512  dynamic_cast<VectorT3Array&>(_structureFields.elasticDeformation[cells]);
513  ew = w;
514 
515  _deformationGradientModel.compute();
516  const VGradArray& wGradCell =
517  dynamic_cast<const VGradArray&>(_structureFields.deformationGradient[cells]);
518 
519  const TArray& muCell =
520  dynamic_cast<const TArray&>(_structureFields.eta[cells]);
521 
522  const TArray& lambdaCell =
523  dynamic_cast<const TArray&>(_structureFields.eta1[cells]);
524 
525 
526  VGradArray& devStress =
527  dynamic_cast<VGradArray&>(_structureFields.devStress[cells]);
528  TArray& VMStress =
529  dynamic_cast<TArray&>(_structureFields.VMStress[cells]);
530 
531  const int nCells = cells.getCount();
532  const T onethird(1.0/3.0);
533  const T half(0.5);
534  const T twothirds(2.0/3.0);
535  const T six(6.0);
536  const T zero(0.0);
537 
538  const VectorT3Array& xc =
539  dynamic_cast<const VectorT3Array&>(_geomFields.coordinate[cells]);
540  T xm(1.0);
541  T xv(1.0);
542  T xI(1.0);
543  const T one(1.0);
544  const T two(2.0);
545  const T three(3.0);
546  const T four(4.0);
547  const T eight(8.0);
548  const T twelve(12.0);
549  const T xl(400.e-6);
550  const T mid(200.e-6);
551  const T th(4.e-6);
552  const T midh(2.e-6);
553  xI = pow(th,three)/twelve;
554 
555  for(int k=0; k<nCells; k++)
556  {
557  const VGradType& wg = wGradCell[k];
558  VGradType wgPlusTranspose = wGradCell[k];
559  VGradType stress = wGradCell[k];
560 
561  for(int i=0;i<3;i++)
562  for(int j=0;j<3;j++)
563  wgPlusTranspose[i][j] += wg[j][i];
564 
565  stress[0][0] = wgPlusTranspose[0][0]*muCell[k]+
566  (wg[0][0]+wg[1][1]+wg[2][2])*lambdaCell[k];
567  stress[0][1] = wgPlusTranspose[0][1]*muCell[k];
568  stress[0][2] = wgPlusTranspose[0][2]*muCell[k];
569 
570  stress[1][0] = wgPlusTranspose[1][0]*muCell[k];
571  stress[1][1] = wgPlusTranspose[1][1]*muCell[k]+
572  (wg[0][0]+wg[1][1]+wg[2][2])*lambdaCell[k];
573  stress[1][2] = wgPlusTranspose[1][2]*muCell[k];
574 
575  stress[2][0] = wgPlusTranspose[2][0]*muCell[k];
576  stress[2][1] = wgPlusTranspose[2][1]*muCell[k];
577  stress[2][2] = wgPlusTranspose[2][2]*muCell[k]+
578  (wg[0][0]+wg[1][1]+wg[2][2])*lambdaCell[k];
579 
580  if (mesh.getDimension() == 2)
581  {
582  stress[2][0] = zero;
583  stress[2][1] = zero;
584  stress[2][2] = zero;
585  }
586 
587  /*
588  if(xc[k][0]<=mid)
589  {
590  xm = -xl*two/eight+two*xc[k][0]/two;
591  xv = one;
592  }
593  else
594  {
595  xm = (two/eight)*(three*xl-four*xc[k][0]);
596  xv = -one;
597  }
598 
599  stress[0][0] = -xm*(xc[k][1]-midh)/xI;
600  stress[0][1] = (three/two)*(xv/th)*(pow(midh,two)-
601  pow((xc[k][1]-midh),two))/pow(midh,two);
602  stress[0][2] = zero;
603  stress[1][0] = (three/two)*(xv/th)*(pow(midh,two)-
604  pow((xc[k][1]-midh),two))/pow(midh,two);
605  stress[1][1] = zero;
606  stress[1][2] = zero;
607  */
608 
609  devStress[k] = stress;
610  const T trace = stress[0][0]+stress[1][1]+stress[2][2];
611  (devStress[k])[0][0] = (devStress[k])[0][0] - onethird*trace;
612  (devStress[k])[1][1] = (devStress[k])[1][1] - onethird*trace;
613  (devStress[k])[2][2] = (devStress[k])[2][2] - onethird*trace;
614 
615  VMStress[k] = sqrt(half*(pow((stress[0][0]-stress[1][1]),2.0) +
616  pow((stress[1][1]-stress[2][2]),2.0) +
617  pow((stress[2][2]-stress[0][0]),2.0) +
618  six*(pow((stress[0][1]),2.0) +
619  pow((stress[1][2]),2.0) +
620  pow((stress[2][0]),2.0))));
621  }
622 
623  }
624  }
Field coordinate
Definition: GeomFields.h:19
Definition: Mesh.h:49
GradientModel< VectorT3 > _deformationGradientModel
Tangent sqrt(const Tangent &a)
Definition: Tangent.h:317
StructureFields & _structureFields
const StorageSite & getCells() const
Definition: Mesh.h:109
const GeomFields & _geomFields
Array< Gradient< VectorT3 > > VGradArray
Gradient< VectorT3 > VGradType
int getCount() const
Definition: StorageSite.h:39
int getDimension() const
Definition: Mesh.h:105
template<class T>
void StructureModel< T >::Impl::finishExplicitAdvance ( )
inline

Definition at line 1105 of file StructureModel_impl.h.

1106  {
1107  this->_lsK = shared_ptr<LinearSystem>();
1108  }
shared_ptr< LinearSystem > _lsK
template<class T>
StructureBCMap& StructureModel< T >::Impl::getBCMap ( )
inline

Definition at line 463 of file StructureModel_impl.h.

463 {return _bcMap;}
template<class T>
StructureModelOptions<T>& StructureModel< T >::Impl::getOptions ( )
inline

Definition at line 465 of file StructureModel_impl.h.

465 {return _options;}
StructureModelOptions< T > _options
template<class T>
void StructureModel< T >::Impl::getPlasticDiagStrain ( const Mesh mesh)
inline

Definition at line 1500 of file StructureModel_impl.h.

References Mesh::getCells(), and StorageSite::getSelfCount().

1501  {
1502  const StorageSite& cells = mesh.getCells();
1503 
1504  const int nCells = cells.getSelfCount();
1505 
1506  shared_ptr<VectorT3Array> plasticDiagStrainPtr(new VectorT3Array(nCells));
1507  plasticDiagStrainPtr->zero();
1508  _structureFields.plasticDiagStrain.addArray(cells,plasticDiagStrainPtr);
1509  VectorT3Array& plasticDiagStrain = *plasticDiagStrainPtr;
1510 
1511  const VGradArray& plasticStrain =
1512  dynamic_cast<const VGradArray&>(_structureFields.plasticStrain[cells]);
1513 
1514  for(int n=0; n<nCells; n++)
1515  {
1516  plasticDiagStrain[n][0]=plasticStrain[n][0][0];
1517  plasticDiagStrain[n][1]=plasticStrain[n][1][1];
1518  plasticDiagStrain[n][2]=plasticStrain[n][0][1];
1519  }
1520  }
int getSelfCount() const
Definition: StorageSite.h:40
StructureFields & _structureFields
const StorageSite & getCells() const
Definition: Mesh.h:109
void addArray(const StorageSite &, shared_ptr< ArrayBase > a)
Definition: Field.cpp:72
Array< Gradient< VectorT3 > > VGradArray
Array< VectorT3 > VectorT3Array
template<class T>
void StructureModel< T >::Impl::getStrain ( const Mesh mesh)
inline

Definition at line 1449 of file StructureModel_impl.h.

References Mesh::getCells(), and StorageSite::getCount().

1450  {
1451  const StorageSite& cells = mesh.getCells();
1452 
1453  const int nCells = cells.getCount();
1454 
1455  shared_ptr<VectorT3Array> strainXPtr(new VectorT3Array(nCells));
1456  strainXPtr->zero();
1457  _structureFields.strainX.addArray(cells,strainXPtr);
1458  VectorT3Array& strainX = *strainXPtr;
1459 
1460  shared_ptr<VectorT3Array> strainYPtr(new VectorT3Array(nCells));
1461  strainYPtr->zero();
1462  _structureFields.strainY.addArray(cells,strainYPtr);
1463  VectorT3Array& strainY = *strainYPtr;
1464 
1465  shared_ptr<VectorT3Array> strainZPtr(new VectorT3Array(nCells));
1466  strainZPtr->zero();
1467  _structureFields.strainZ.addArray(cells,strainZPtr);
1468  VectorT3Array& strainZ = *strainZPtr;
1469 
1470  _deformationGradientModel.compute();
1471 
1472  const VGradArray& wGrad =
1473  dynamic_cast<const VGradArray&>(_structureFields.deformationGradient[cells]);
1474 
1475  const T half(1./2.);
1476 
1477  for(int n=0; n<nCells; n++)
1478  {
1479  const VGradType& wg = wGrad[n];
1480  VGradType wgPlusTranspose = wGrad[n];
1481 
1482  for(int i=0;i<3;i++)
1483  for(int j=0;j<3;j++)
1484  wgPlusTranspose[i][j] += wg[j][i];
1485 
1486  strainX[n][0] = half*wgPlusTranspose[0][0];
1487  strainX[n][1] = half*wgPlusTranspose[0][1];
1488  strainX[n][2] = half*wgPlusTranspose[0][2];
1489 
1490  strainY[n][0] = half*wgPlusTranspose[1][0];
1491  strainY[n][1] = half*wgPlusTranspose[1][1];
1492  strainY[n][2] = half*wgPlusTranspose[1][2];
1493 
1494  strainZ[n][0] = half*wgPlusTranspose[2][0];
1495  strainZ[n][1] = half*wgPlusTranspose[2][1];
1496  strainZ[n][2] = half*wgPlusTranspose[2][2];
1497  }
1498  }
GradientModel< VectorT3 > _deformationGradientModel
StructureFields & _structureFields
const StorageSite & getCells() const
Definition: Mesh.h:109
void addArray(const StorageSite &, shared_ptr< ArrayBase > a)
Definition: Field.cpp:72
Array< Gradient< VectorT3 > > VGradArray
Gradient< VectorT3 > VGradType
Array< VectorT3 > VectorT3Array
int getCount() const
Definition: StorageSite.h:39
template<class T>
void StructureModel< T >::Impl::getTraction ( const Mesh mesh)
inline

Definition at line 1344 of file StructureModel_impl.h.

References Mesh::getCells(), StorageSite::getCount(), and Mesh::getDimension().

1345  {
1346  const StorageSite& cells = mesh.getCells();
1347 
1348  const int nCells = cells.getCount();
1349 
1350  shared_ptr<VectorT3Array> tractionXPtr(new VectorT3Array(nCells));
1351  tractionXPtr->zero();
1352  _structureFields.tractionX.addArray(cells,tractionXPtr);
1353  VectorT3Array& tractionX = *tractionXPtr;
1354 
1355  shared_ptr<VectorT3Array> tractionYPtr(new VectorT3Array(nCells));
1356  tractionYPtr->zero();
1357  _structureFields.tractionY.addArray(cells,tractionYPtr);
1358  VectorT3Array& tractionY = *tractionYPtr;
1359 
1360  shared_ptr<VectorT3Array> tractionZPtr(new VectorT3Array(nCells));
1361  tractionZPtr->zero();
1362  _structureFields.tractionZ.addArray(cells,tractionZPtr);
1363  VectorT3Array& tractionZ = *tractionZPtr;
1364 
1365  _deformationGradientModel.compute();
1366 
1367  const VGradArray& wGrad =
1368  dynamic_cast<const VGradArray&>(_structureFields.deformationGradient[cells]);
1369 
1370  const VGradArray& plasticStrainCell =
1371  dynamic_cast<VGradArray&>(_structureFields.plasticStrain[cells]);
1372 
1373  const TArray& eta = dynamic_cast<const TArray&>(_structureFields.eta[cells]);
1374  const TArray& eta1 = dynamic_cast<const TArray&>(_structureFields.eta1[cells]);
1375  const TArray& alpha = dynamic_cast<const TArray&>(_structureFields.alpha[cells]);
1376 
1377  const TArray& temperature = dynamic_cast<const TArray&>(_structureFields.temperature[cells]);
1378 
1379  const T two(2.0);
1380  const T three(3.0);
1381  const T zero(0.0);
1382 
1383  for(int n=0; n<nCells; n++)
1384  {
1385  const VGradType& wg = wGrad[n];
1386  VGradType wgPlusTranspose = wGrad[n];
1387  const VGradType& pS = plasticStrainCell[n];
1388  for(int i=0;i<3;i++)
1389  for(int j=0;j<3;j++)
1390  wgPlusTranspose[i][j] += wg[j][i];
1391 
1392  tractionX[n][0] = wgPlusTranspose[0][0]*eta[n]+
1393  (wg[0][0]+wg[1][1]+wg[2][2])*eta1[n];
1394  tractionX[n][1] = wgPlusTranspose[0][1]*eta[n];
1395  tractionX[n][2] = wgPlusTranspose[0][2]*eta[n];
1396 
1397  tractionY[n][0] = wgPlusTranspose[1][0]*eta[n];
1398  tractionY[n][1] = wgPlusTranspose[1][1]*eta[n]+
1399  (wg[0][0]+wg[1][1]+wg[2][2])*eta1[n];
1400  tractionY[n][2] = wgPlusTranspose[1][2]*eta[n];
1401 
1402  tractionZ[n][0] = wgPlusTranspose[2][0]*eta[n];
1403  tractionZ[n][1] = wgPlusTranspose[2][1]*eta[n];
1404  tractionZ[n][2] = wgPlusTranspose[2][2]*eta[n]+
1405  (wg[0][0]+wg[1][1]+wg[2][2])*eta1[n];
1406 
1407  if(_options.residualStress)
1408  {
1409  tractionX[n][0] += _options["residualXXStress"];
1410  tractionY[n][1] += _options["residualYYStress"];
1411  tractionZ[n][2] += _options["residualZZStress"];
1412  }
1413 
1414  if(_options.thermo)
1415  {
1416  if(mesh.getDimension()==2)
1417  {
1418  tractionX[n][0] -= (two*eta1[n]+two*eta[n])*alpha[n]*(temperature[n]-_options["operatingTemperature"]);
1419  tractionY[n][1] -= (two*eta1[n]+two*eta[n])*alpha[n]*(temperature[n]-_options["operatingTemperature"]);
1420  }
1421  else
1422  {
1423  tractionX[n][0] -= (three*eta1[n]+two*eta[n])*alpha[n]*(temperature[n]-_options["operatingTemperature"]);
1424  tractionY[n][1] -= (three*eta1[n]+two*eta[n])*alpha[n]*(temperature[n]-_options["operatingTemperature"]);
1425  tractionZ[n][2] -= (three*eta1[n]+two*eta[n])*alpha[n]*(temperature[n]-_options["operatingTemperature"]);
1426  }
1427  }
1428 
1429  if(_options.creep)
1430  {
1431  tractionX[n][0]-=(two*eta[n]*pS[0][0] +
1432  (pS[0][0] + pS[1][1])*eta1[n]);
1433  tractionX[n][1]-=(two*eta[n]*pS[0][1]);
1434  tractionX[n][2]-=(two*eta[n]*pS[0][2]);
1435 
1436  tractionY[n][0]-=(two*eta[n]*pS[1][0]);
1437  tractionY[n][1]-=(two*eta[n]*pS[1][1] +
1438  (pS[0][0] + pS[1][1])*eta1[n]);
1439  tractionY[n][2]-=(two*eta[n]*pS[1][2]);
1440  }
1441 
1442  if (mesh.getDimension() == 2)
1443  {
1444  tractionZ[n] = zero;
1445  }
1446  }
1447  }
GradientModel< VectorT3 > _deformationGradientModel
StructureFields & _structureFields
const StorageSite & getCells() const
Definition: Mesh.h:109
void addArray(const StorageSite &, shared_ptr< ArrayBase > a)
Definition: Field.cpp:72
Array< Gradient< VectorT3 > > VGradArray
Gradient< VectorT3 > VGradType
Array< VectorT3 > VectorT3Array
int getCount() const
Definition: StorageSite.h:39
StructureModelOptions< T > _options
int getDimension() const
Definition: Mesh.h:105
template<class T>
StructureVCMap& StructureModel< T >::Impl::getVCMap ( )
inline

Definition at line 464 of file StructureModel_impl.h.

464 {return _vcMap;}
template<class T>
void StructureModel< T >::Impl::init ( )
inline

Definition at line 345 of file StructureModel_impl.h.

References Model::_meshes, Mesh::getAllFaceGroups(), Mesh::getCells(), StorageSite::getCount(), StorageSite::getCountLevel1(), Mesh::getID(), FaceGroup::groupType, and FaceGroup::site.

346  {
347  const int numMeshes = _meshes.size();
348  for (int n=0; n<numMeshes; n++)
349  {
350  const Mesh& mesh = *_meshes[n];
351 
352  const StructureVC<T>& vc = *_vcMap[mesh.getID()];
353 
354  const StorageSite& cells = mesh.getCells();
355  // const StorageSite& faces = mesh.getFaces();
356 
357  shared_ptr<VectorT3Array> sCell(new VectorT3Array(cells.getCountLevel1()));
358 
359  VectorT3 initialDeformation;
360  initialDeformation[0] = _options["initialXDeformation"];
361  initialDeformation[1] = _options["initialYDeformation"];
362  initialDeformation[2] = _options["initialZDeformation"];
363  *sCell = initialDeformation;
364 
366 
367  if (_options.transient)
368  {
370  dynamic_pointer_cast<ArrayBase>
371  (_geomFields.volume[cells].newCopy()));
373  dynamic_pointer_cast<ArrayBase>(sCell->newCopy()));
375  dynamic_pointer_cast<ArrayBase>(sCell->newCopy()));
376  if (_options.timeDiscretizationOrder > 1)
378  dynamic_pointer_cast<ArrayBase>(sCell->newCopy()));
379  if(_options.variableTimeStep)
380  {
381  _options.timeStepN1 = _options["timeStep"];
382  _options.timeStepN2 = _options["timeStep"];
383  }
384  }
385 
386  if (_options.creep)
387  {
389  dynamic_pointer_cast<ArrayBase>(sCell->newCopy()));
390  shared_ptr<VGradArray> devStressField(new VGradArray(cells.getCountLevel1()));
391  devStressField->zero();
392  _structureFields.devStress.addArray(cells,devStressField);
393  shared_ptr<TArray> VMStressField(new TArray(cells.getCountLevel1()));
394  VMStressField->zero();
395  _structureFields.VMStress.addArray(cells,VMStressField);
396  shared_ptr<VGradArray> plasticStrainField(new VGradArray(cells.getCountLevel1()));
397  plasticStrainField->zero();
398  _structureFields.plasticStrain.addArray(cells,plasticStrainField);
399  shared_ptr<TArray> acCell(new TArray(cells.getCountLevel1()));
400  *acCell = _options.A;
401  _structureFields.creepConstant.addArray(cells, acCell);
402  }
403 
404  shared_ptr<TArray> rhoCell(new TArray(cells.getCountLevel1()));
405  *rhoCell = vc["density"];
406  _structureFields.density.addArray(cells,rhoCell);
407 
408  shared_ptr<TArray> etaCell(new TArray(cells.getCountLevel1()));
409  *etaCell = vc["eta"];
410  _structureFields.eta.addArray(cells,etaCell);
411 
412  shared_ptr<TArray> eta1Cell(new TArray(cells.getCountLevel1()));
413  *eta1Cell = vc["eta1"];
414  _structureFields.eta1.addArray(cells,eta1Cell);
415 
416  shared_ptr<TArray> alphaCell(new TArray(cells.getCountLevel1()));
417  *alphaCell = vc["alpha"];
418  _structureFields.alpha.addArray(cells,alphaCell);
419 
420  shared_ptr<TArray> tCell(new TArray(cells.getCountLevel1()));
421  *tCell = _options["operatingTemperature"];
423 
424  // compute values of deformation flux
425 
426  // store deformation flux at interfaces
427  /*
428  foreach(const FaceGroupPtr fgPtr, mesh.getInterfaceGroups())
429  {
430  const FaceGroup& fg = *fgPtr;
431  const StorageSite& faces = fg.site;
432  shared_ptr<VectorT3Array> deformationFlux(new VectorT3Array(faces.getCount()));
433  deformationFlux->zero();
434  _structureFields.deformationFlux.addArray(faces,deformationFlux);
435  }
436  */
437 
438  // store deformation flux at boundary faces
439  foreach(const FaceGroupPtr fgPtr, mesh.getAllFaceGroups())
440  {
441  const FaceGroup& fg = *fgPtr;
442  const StorageSite& faces = fg.site;
443  shared_ptr<VectorT3Array> deformationFlux(new VectorT3Array(faces.getCount()));
444  deformationFlux->zero();
445  if (fg.groupType != "interior")
446  {
447  _structureFields.deformationFlux.addArray(faces,deformationFlux);
448  }
449  }
450 
451  }
456 
457 
458 
459  _niters =0;
461  }
shared_ptr< FaceGroup > FaceGroupPtr
Definition: Mesh.h:46
Definition: Mesh.h:28
const FaceGroupList & getAllFaceGroups() const
Definition: Mesh.h:193
Definition: Mesh.h:49
string groupType
Definition: Mesh.h:42
StructureFields & _structureFields
const StorageSite & getCells() const
Definition: Mesh.h:109
Field volume
Definition: GeomFields.h:26
int getCountLevel1() const
Definition: StorageSite.h:72
const GeomFields & _geomFields
void addArray(const StorageSite &, shared_ptr< ArrayBase > a)
Definition: Field.cpp:72
Array< Gradient< VectorT3 > > VGradArray
Array< VectorT3 > VectorT3Array
int getCount() const
Definition: StorageSite.h:39
StructureModelOptions< T > _options
shared_ptr< MultiFieldReduction > MFRPtr
void syncLocal()
Definition: Field.cpp:334
int getID() const
Definition: Mesh.h:106
virtual shared_ptr< IContainer > newCopy() const
Definition: Field.cpp:155
StorageSite site
Definition: Mesh.h:40
template<class T>
void StructureModel< T >::Impl::initDeformationLinearization ( LinearSystem ls)
inline

Definition at line 786 of file StructureModel_impl.h.

References Model::_meshes, MultiField::addArray(), MultiFieldMatrix::addMatrix(), Mesh::getCellCells2(), Mesh::getCells(), LinearSystem::getMatrix(), and LinearSystem::getX().

787  {
788 
789  const int numMeshes = _meshes.size();
790  for (int n=0; n<numMeshes; n++)
791  {
792  const Mesh& mesh = *_meshes[n];
793 
794  const StorageSite& cells = mesh.getCells();
796 
798 
799  const CRConnectivity& cellCells2 = mesh.getCellCells2();
800 
801  shared_ptr<Matrix> m(new CRMatrix<DiagTensorT3,DiagTensorT3,VectorT3>(cellCells2));
802 
803  ls.getMatrix().addMatrix(wIndex,wIndex,m);
804 
805  }
806  }
Definition: Mesh.h:49
StructureFields & _structureFields
pair< const Field *, const StorageSite * > ArrayIndex
Definition: MultiField.h:21
const StorageSite & getCells() const
Definition: Mesh.h:109
void addMatrix(const Index &rowI, const Index &colI, shared_ptr< Matrix > m)
const CRConnectivity & getCellCells2() const
Definition: Mesh.cpp:495
void addArray(const ArrayIndex &aIndex, shared_ptr< ArrayBase > a)
Definition: MultiField.cpp:270
MultiField & getX()
Definition: LinearSystem.h:32
shared_ptr< ArrayBase > getArrayPtr(const StorageSite &)
Definition: Field.cpp:63
MultiFieldMatrix & getMatrix()
Definition: LinearSystem.h:37
template<class T>
void StructureModel< T >::Impl::initExplicitAdvance ( )
inline

Definition at line 1092 of file StructureModel_impl.h.

1093  {
1094  this->_lsK = shared_ptr<LinearSystem>(new LinearSystem());
1095  LinearSystem& ls = *(this->_lsK);
1097  ls.initAssembly();
1098  linearizeDeformation(ls,true);
1099  // add delta explicitly since we won't be calling initSolve
1100  ls.replaceDelta(dynamic_pointer_cast<MultiField>(ls.getX().newClone()));
1101  ls.replaceResidual(dynamic_pointer_cast<MultiField>(ls.getX().newClone()));
1102 
1103  }
void linearizeDeformation(LinearSystem &ls, bool explicitMode)
void initDeformationLinearization(LinearSystem &ls)
shared_ptr< LinearSystem > _lsK
template<class T>
void StructureModel< T >::Impl::linearizeDeformation ( LinearSystem ls,
bool  explicitMode 
)
inline

Definition at line 959 of file StructureModel_impl.h.

References Model::_meshes, LinearSystem::getB(), LinearSystem::getMatrix(), LinearSystem::getX(), and Linearizer::linearize().

960  {
961  _deformationGradientModel.compute();
962  DiscrList discretizations;
963 
964  if(!_options.creep)
965  {
966  shared_ptr<Discretization>
975  _options["operatingTemperature"],
976  _options["residualXXStress"],
977  _options["residualYYStress"],
978  _options["residualZZStress"],
979  _options.thermo,
980  _options.residualStress));
981 
982  // shared_ptr<Discretization>
983  // bfd(new SourceDiscretization<VectorT3>
984  // (_meshes,_geomFields,
985  // _structureFields.deformation,
986  // _structureFields.bodyForce));
987 
988  discretizations.push_back(sd);
989  //discretizations.push_back(bfd);
990  }
991 
992  if (_options.creep)
993  {
994  shared_ptr<Discretization>
1003  _options["operatingTemperature"],
1004  _options["residualXXStress"],
1005  _options["residualYYStress"],
1006  _options["residualZZStress"],
1007  _options.thermo,
1008  _options.residualStress,
1013  _options.A,
1014  _options.B,
1015  _options.m,
1016  _options.n,
1017  _options.Sy0,
1018  _options["timeStep"],
1019  _options.creepModel));
1020 
1021  discretizations.push_back(scd);
1022  }
1023 
1024  if (_options.transient && !explicitMode)
1025  {
1026  shared_ptr<Discretization>
1036  _options.variableTimeStep,
1037  _options["timeStep"],
1038  _options.timeStepN1,
1039  _options.timeStepN2));
1040 
1041  discretizations.push_back(td);
1042  }
1043 
1044  /*
1045  shared_ptr<Discretization>
1046  ibm(new GenericIBDiscretization<VectorT3,DiagTensorT3,T>
1047  (_meshes,_geomFields,_structureFields.deformation));
1048 
1049  discretizations.push_back(ibm);
1050  */
1051  Linearizer linearizer;
1052 
1053  linearizer.linearize(discretizations,_meshes,ls.getMatrix(),
1054  ls.getX(), ls.getB());
1055 
1056  if (!explicitMode)
1057  applyBC(ls,explicitMode);
1058 
1059 #if 0
1060  shared_ptr<Discretization>
1063  _options["deformationURF"]));
1064 
1065  DiscrList discretizations2;
1066  discretizations2.push_back(ud);
1067 
1068  linearizer.linearize(discretizations2,_meshes,ls.getMatrix(),
1069  ls.getX(), ls.getB());
1070 #endif
1071 
1072  }
SquareTensor< T, 3 > DiagTensorT3
GradientModel< VectorT3 > _deformationGradientModel
StructureFields & _structureFields
vector< shared_ptr< Discretization > > DiscrList
void applyBC(LinearSystem &ls, bool explicitMode)
const GeomFields & _geomFields
MultiField & getB()
Definition: LinearSystem.h:33
StructureModelOptions< T > _options
MultiField & getX()
Definition: LinearSystem.h:32
virtual void linearize(DiscrList &discretizations, const MeshList &meshes, MultiFieldMatrix &matrix, MultiField &x, MultiField &b)
Definition: Linearizer.cpp:17
MultiFieldMatrix & getMatrix()
Definition: LinearSystem.h:37
template<class T>
MFRPtr StructureModel< T >::Impl::solveDeformation ( )
inline

Definition at line 1075 of file StructureModel_impl.h.

References LinearSystem::initAssembly(), LinearSystem::initSolve(), LinearSystem::postSolve(), and LinearSystem::updateSolution().

1076  {
1077  LinearSystem ls;
1079  ls.initAssembly();
1080  linearizeDeformation(ls,false);
1081  ls.initSolve();
1082  //AMG solver(ls);
1083  MFRPtr rNorm = _options.getDeformationLinearSolver().solve(ls);
1085  _options.getDeformationLinearSolver().cleanup();
1086  ls.postSolve();
1087  ls.updateSolution();
1088  //postStructureSolve(ls);
1089  return rNorm;
1090  }
void initAssembly()
void linearizeDeformation(LinearSystem &ls, bool explicitMode)
void initDeformationLinearization(LinearSystem &ls)
void updateSolution()
void initSolve()
StructureModelOptions< T > _options
shared_ptr< MultiFieldReduction > MFRPtr
template<class T>
void StructureModel< T >::Impl::updateForceOnBoundary ( const StorageSite faceSite,
const ArrayBase bforceA,
const map< int, int > &  commonFacesMap,
ArrayBase fxA,
ArrayBase fyA,
ArrayBase fzA 
)
inline

Definition at line 1522 of file StructureModel_impl.h.

References StorageSite::getCount(), and StorageSite::getOffset().

1524 {
1525  //bforce came from fluid+elec side
1526  const VectorT3Array& bforce = dynamic_cast<const VectorT3Array&>(bforceA);
1527  //following will be updated
1528  TArray& fx = dynamic_cast<TArray&> (fxA);
1529  TArray& fy = dynamic_cast<TArray&> (fyA);
1530  TArray& fz = dynamic_cast<TArray&> (fzA);
1531  const int offset = faceSite.getOffset();
1532  for (int i = 0; i < faceSite.getCount(); i++ ){
1533  const int faceID = i + offset; //localface ID
1534  //commonFacesMap will get right index in bforce
1535  const int indx = commonFacesMap.find(faceID)->second;
1536  fx[i] = bforce[indx][0];
1537  fy[i] = bforce[indx][1];
1538  fz[i] = bforce[indx][2];
1539  }
1540 
1541 }
int getOffset() const
Definition: StorageSite.h:87
int getCount() const
Definition: StorageSite.h:39
template<class T>
void StructureModel< T >::Impl::updateTime ( )
inline

Definition at line 467 of file StructureModel_impl.h.

References Model::_meshes, and Mesh::getCells().

468  {
469  const int numMeshes = _meshes.size();
470  for (int n=0; n<numMeshes; n++)
471  {
472  const Mesh& mesh = *_meshes[n];
473 
474  const StorageSite& cells = mesh.getCells();
475  VectorT3Array& w =
476  dynamic_cast<VectorT3Array&>(_structureFields.deformation[cells]);
477  VectorT3Array& wN1 =
478  dynamic_cast<VectorT3Array&>(_structureFields.deformationN1[cells]);
479  VectorT3Array& wN2 =
480  dynamic_cast<VectorT3Array&>(_structureFields.deformationN2[cells]);
481  if (_options.timeDiscretizationOrder > 1)
482  {
483  VectorT3Array& wN3 =
484  dynamic_cast<VectorT3Array&>(_structureFields.deformationN3[cells]);
485  wN3 = wN2;
486  }
487  wN2 = wN1;
488  wN1 = w;
489  if(_options.variableTimeStep)
490  {
491  if (_options.timeDiscretizationOrder > 1)
492  {
493  _options.timeStepN2 = _options.timeStepN1;
494  }
495  _options.timeStepN1 = _options["timeStep"];
496  }
497 
498  }
499  }
Definition: Mesh.h:49
StructureFields & _structureFields
const StorageSite & getCells() const
Definition: Mesh.h:109
StructureModelOptions< T > _options

Member Data Documentation

template<class T>
StructureBCMap StructureModel< T >::Impl::_bcMap
private

Definition at line 1655 of file StructureModel_impl.h.

template<class T>
GradientModel<VectorT3> StructureModel< T >::Impl::_deformationGradientModel
private

Definition at line 1659 of file StructureModel_impl.h.

template<class T>
const GeomFields& StructureModel< T >::Impl::_geomFields
private

Definition at line 1652 of file StructureModel_impl.h.

template<class T>
MFRPtr StructureModel< T >::Impl::_initialDeformationNorm
private

Definition at line 1662 of file StructureModel_impl.h.

template<class T>
shared_ptr<LinearSystem> StructureModel< T >::Impl::_lsK
private

Definition at line 1666 of file StructureModel_impl.h.

template<class T>
const MeshList StructureModel< T >::Impl::_meshes
private

Definition at line 1651 of file StructureModel_impl.h.

template<class T>
int StructureModel< T >::Impl::_niters
private

Definition at line 1664 of file StructureModel_impl.h.

template<class T>
StructureModelOptions<T> StructureModel< T >::Impl::_options
private

Definition at line 1658 of file StructureModel_impl.h.

template<class T>
StructureFields& StructureModel< T >::Impl::_structureFields
private

Definition at line 1653 of file StructureModel_impl.h.

template<class T>
StructureVCMap StructureModel< T >::Impl::_vcMap
private

Definition at line 1656 of file StructureModel_impl.h.


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