Memosa-FVM  0.2
PlateModel_impl.h
Go to the documentation of this file.
1 // This file os part of FVM
2 // Copyright (c) 2012 FVM Authors
3 // See LICENSE file for terms.
4 
5 #ifdef FVM_PARALLEL
6 #include <mpi.h>
7 #endif
8 
9 #include "Mesh.h"
10 
11 #include "NumType.h"
12 #include "Array.h"
13 #include "Field.h"
14 #include "CRConnectivity.h"
15 #include "LinearSystem.h"
16 #include "StorageSite.h"
17 #include "MultiFieldMatrix.h"
18 #include "CRMatrix.h"
19 #include "FluxJacobianMatrix.h"
20 #include "DiagonalMatrix.h"
21 #include "GenericBCS.h"
22 #include "Vector.h"
23 #include "VectorTranspose.h"
27 #include "SourceDiscretization.h"
28 #include "Underrelaxer.h"
29 #include "AMG.h"
30 #include "Linearizer.h"
31 #include "GradientModel.h"
33 #include "StressTensor.h"
34 #include "SquareTensor.h"
35 
36 
37 template<class X, class Diag, class OffDiag>
38 class PlateBCS
39 {
40 public:
41 
43 
46 
49 
52 
55 
56  typedef Array<X> XArray;
58 
59 
60  PlateBCS(const StorageSite& faces,
61  const Mesh& mesh,
62  const GeomFields& geomFields,
63  Field& varField,
64  MultiFieldMatrix& matrix,
65  MultiField& xField, MultiField& rField) :
66  _faces(faces),
67  _cells(mesh.getCells()),
68  _faceCells(mesh.getFaceCells(_faces)),
69  _varField(varField),
71  _dRdX(dynamic_cast<CCMatrix&>(matrix.getMatrix(_xIndex,_xIndex))),
72  _assembler(_dRdX.getPairWiseAssembler(_faceCells)),
73  _dRdXDiag(_dRdX.getDiag()),
74  _x(dynamic_cast<XArray&>(xField[_xIndex])),
75  _r(dynamic_cast<XArray&>(rField[_xIndex])),
76  _areaMagField(geomFields.areaMag),
77  _faceAreaMag(dynamic_cast<const TArray&>(_areaMagField[_faces])),
78  _areaField(geomFields.area),
79  _faceArea(dynamic_cast<const VectorT3Array&>(_areaField[_faces])),
80  _faceCoord(dynamic_cast<const VectorT3Array&>(geomFields.coordinate[_faces])),
81  _cellCoord(dynamic_cast<const VectorT3Array&>(geomFields.coordinate[_cells]))
82  {}
83 
84  X applyDirichletBC(int f, const X& bValue) const
85  {
86  const int c1 = _faceCells(f,1);
87 
88  const X fluxB = -_r[c1];
89 
90  const X dXC1 = bValue - _x[c1];
91 
92  _dRdX.eliminateDirichlet(c1,_r,dXC1);
93  _x[c1] = bValue;
95 
96  return fluxB;
97  }
98 
99  X applyDirichletBC(const X& bValue) const
100  {
101  X fluxB(NumTypeTraits<X>::getZero());
102  for(int i=0; i<_faces.getCount(); i++)
103  fluxB += applyDirichletBC(i,bValue);
104  return fluxB;
105  }
106 
107  X applyDirichletBC(const FloatValEvaluator<X>& bValue) const
108  {
109  X fluxB(NumTypeTraits<X>::getZero());
110  for(int i=0; i<_faces.getCount(); i++)
111  fluxB += applyDirichletBC(i,bValue[i]);
112  return fluxB;
113  }
114 
115  X applyCantileverBC(const int f,
116  const X& specifiedFlux) const
117  {
118  //const int c0 = _faceCells(f,0);
119  const int c1 = _faceCells(f,1);
120  const X fluxB = -_r[c1];
121 
122  VectorT3 dzeta1 = _faceCoord[f]-_cellCoord[c1];
123 
124  // the current value of flux and its Jacobians
125  X dFlux;
126  dFlux[0]= (-(specifiedFlux[0]*_faceArea[f][0] +
127  specifiedFlux[1]*_faceArea[f][1])*dzeta1[0])
128  - fluxB[0];
129  dFlux[1]= (-(specifiedFlux[0]*_faceArea[f][0] +
130  specifiedFlux[1]*_faceArea[f][1])*dzeta1[1])
131  - fluxB[1];
132  dFlux[2]= (specifiedFlux[0]*_faceArea[f][0] +
133  specifiedFlux[1]*_faceArea[f][1])
134  - fluxB[2];
135 
136  // setup the equation for the boundary value; the coefficients
137  // are already computed so just need to set the rhs
138  _r[c1] = dFlux;
139 
140  // _dRdX.eliminate(c1,_r);
141  // mark this row as a "boundary" row so that we will update it
142  // after the overall system is solved
143  _dRdX.setBoundary(c1);
144  return fluxB;
145  }
146 
147  X applyNeumannBC(const int f,
148  const X& specifiedFlux) const
149  {
150  //const int c0 = _faceCells(f,0);
151  const int c1 = _faceCells(f,1);
152  const X fluxB = -_r[c1];
153 
154  // the current value of flux and its Jacobians
155  const X dFlux = specifiedFlux*_faceAreaMag[f] - fluxB;
156 
157  // setup the equation for the boundary value; the coefficients
158  // are already computed so just need to set the rhs
159  _r[c1] = dFlux;
160 
161  // _dRdX.eliminate(c1,_r);
162  // mark this row as a "boundary" row so that we will update it
163  // after the overall system is solved
164  _dRdX.setBoundary(c1);
165  return fluxB;
166  }
167 
168 
169  X applyNeumannBC(const X& bFlux) const
170  {
171  X fluxB(NumTypeTraits<X>::getZero());
172 
173  for(int i=0; i<_faces.getCount(); i++)
174  fluxB += applyNeumannBC(i,bFlux);
175  return fluxB;
176  }
177 
179  {
180  X fluxTotal(NumTypeTraits<X>::getZero());
181  for(int f=0; f<_faces.getCount(); f++)
182  {
183  const int c0 = _faceCells(f,0);
184  const int c1 = _faceCells(f,1);
185  const X fluxB = -_r[c1];
186 
187  // setup the equation for the boundary value; we want xb to be equal to xc
188 
189  _r[c1] = _x[c0] - _x[c1];
192 
193 
194  // mark this row as a "boundary" row so that we will update it
195  // after the overall system is solved
196  _dRdX.setBoundary(c1);
197  fluxTotal += fluxB;
198  }
199  return fluxTotal;
200  }
201 
202  X applyNeumannBC(const FloatValEvaluator<X>& bFlux) const
203  {
204  X fluxB(NumTypeTraits<X>::getZero());
205  for(int i=0; i<_faces.getCount(); i++)
206  fluxB += applyNeumannBC(i,bFlux[i]);
207  return fluxB;
208  }
209 
210  void applyInterfaceBC(const int f) const
211  {
212  // do nothing
213  // the boundary cell could be either c0 or c1 at an interface
214  int cb = _faceCells(f,1);
216  if (cb < _cells.getSelfCount())
217  {
218  cb = _faceCells(f,0);
219  sign *= -1.0;
220  }
221 
222 
223  _r[cb] = T_Scalar(0);
224 
225  if (sign>0)
227  else
229 
230  }
231 
232  void applyInterfaceBC() const
233  {
234  // do nothing
235  }
236 
237  void applySymmetryBC() const
238  {
239  for(int f=0; f<this->_faces.getCount(); f++)
240  {
241  const int c0 = this->_faceCells(f,0);
242  const int c1 = this->_faceCells(f,1);
243 
244 
245  const VectorT3 en = this->_faceArea[f]/this->_faceAreaMag[f];
246  const T_Scalar xC0_dotn = dot(this->_x[c0],en);
247  const X xB = this->_x[c0] - 2.*xC0_dotn * en;
248 
249  Diag dxBdxC0(Diag::getZero());
250  dxBdxC0(0,0) = 1.0 - 2.*en[0]*en[0];
251  dxBdxC0(0,1) = - 2.*en[0]*en[1];
252  dxBdxC0(0,2) = - 2.*en[0]*en[2];
253 
254  dxBdxC0(1,0) = - 2.*en[1]*en[0];
255  dxBdxC0(1,1) = 1.0 - 2.*en[1]*en[1];
256  dxBdxC0(1,2) = - 2.*en[1]*en[2];
257 
258  dxBdxC0(2,0) = - 2.*en[2]*en[0];
259  dxBdxC0(2,1) = - 2.*en[2]*en[1];
260  dxBdxC0(2,2) = 1.0 - 2.*en[2]*en[2];
261 
262 
263  const X xc1mxB = xB-this->_x[c1];
264 
265  // boundary value equation
266  // set all neighbour coeffs to zero first and ap to -1
267  this->_dRdX.setDirichlet(c1);
268 
269  // dependance on c0
270  this->_assembler.getCoeff10(f) = dxBdxC0;
271  this->_r[c1] = xc1mxB;
272 
273  }
274  }
275 
276 
277 
278 protected:
282  const Field& _varField;
295 };
296 
297 template<class T>
298 class PlateModel<T>::Impl
299 {
300 public:
301  typedef T T_Scalar;
302  typedef Array<T> TArray;
305 
309  //typedef DiagonalTensor<T,3> DiagTensorT3;
310  //typedef SquareTensor<T,3> SquareTensorT3;
312 
315 
316 
319 
320  Impl(const GeomFields& geomFields,
321  PlateFields& plateFields,
322  const MeshList& meshes) :
323  _meshes(meshes),
324  _geomFields(geomFields),
325  _plateFields(plateFields),
326  _deformationGradientModel(_meshes,_plateFields.deformation,
327  _plateFields.deformationGradient,_geomFields),
328  _initialDeformationNorm(),
329  _niters(0)
330  {
331  const int numMeshes = _meshes.size();
332  for (int n=0; n<numMeshes; n++)
333  {
334  const Mesh& mesh = *_meshes[n];
335 
336  PlateVC<T> *vc(new PlateVC<T>());
337  vc->vcType = "plate";
338  _vcMap[mesh.getID()] = vc;
339  foreach(const FaceGroupPtr fgPtr, mesh.getAllFaceGroups())
340  {
341  const FaceGroup& fg = *fgPtr;
342  if ((_bcMap.find(fg.id) == _bcMap.end())&&(fg.groupType != "interior"))
343  {
344  PlateBC<T> *bc(new PlateBC<T>());
345 
346  _bcMap[fg.id] = bc;
347  if (fg.groupType == "wall")
348  {
349  bc->bcType = "SpecifiedTraction";
350  }
351  else if (fg.groupType == "interface")
352  {
353  bc->bcType = "Interface";
354  }
355  else if (fg.groupType == "symmetry")
356  {
357  bc->bcType = "Symmetry";
358  }
359  else if ((fg.groupType == "velocity-inlet") ||
360  (fg.groupType == "pressure-inlet"))
361  {
362  bc->bcType = "SpecifiedDeformation";
363  }
364  else if (fg.groupType == "pressure-outlet")
365  {
366  bc->bcType = "SpecifiedForce";
367  }
368  else
369  throw CException("PlateModel: unknown face group type "
370  + fg.groupType);
371  }
372  }
373  }
374  }
375 
376  void init()
377  {
378  const int numMeshes = _meshes.size();
379  for (int n=0; n<numMeshes; n++)
380  {
381  const Mesh& mesh = *_meshes[n];
382 
383  const PlateVC<T>& vc = *_vcMap[mesh.getID()];
384 
385  const StorageSite& cells = mesh.getCells();
386  // const StorageSite& faces = mesh.getFaces();
387 
388  shared_ptr<VectorT3Array> sCell(new VectorT3Array(cells.getCountLevel1()));
389 
390  VectorT3 initialDeformation;
391  initialDeformation[0] = _options["initialXRotation"];
392  initialDeformation[1] = _options["initialYRotation"];
393  initialDeformation[2] = _options["initialZDeformation"];
394  *sCell = initialDeformation;
395 
396  _plateFields.deformation.addArray(cells,sCell);
397  _plateFields.deformation.syncLocal();
398 
399  if (_options.transient)
400  {
401  _plateFields.volume0.addArray(cells,
402  dynamic_pointer_cast<ArrayBase>
403  (_geomFields.volume[cells].newCopy()));
404  _plateFields.volume0.syncLocal();
405 
406  _plateFields.deformationN1.addArray(cells,
407  dynamic_pointer_cast<ArrayBase>(sCell->newCopy()));
408  _plateFields.deformationN1.syncLocal();
409 
410  _plateFields.deformationN2.addArray(cells,
411  dynamic_pointer_cast<ArrayBase>(sCell->newCopy()));
412  _plateFields.deformationN2.syncLocal();
413 
414  if (_options.timeDiscretizationOrder > 1)
415  _plateFields.deformationN3.addArray(cells,
416  dynamic_pointer_cast<ArrayBase>(sCell->newCopy()));
417  _plateFields.deformationN3.syncLocal();
418 
419  if(_options.variableTimeStep)
420  {
421  _options.timeStepN1 = _options["timeStep"];
422  _options.timeStepN2 = _options["timeStep"];
423  }
424  }
425 
426  shared_ptr<VectorT3Array> stressField(new VectorT3Array(cells.getCountLevel1()));
427  stressField->zero();
428  _plateFields.stress.addArray(cells,stressField);
429  _plateFields.stress.syncLocal();
430 
431  shared_ptr<VectorT4Array> devStressField(new VectorT4Array((cells.getCountLevel1())*(_options.nz+1)));
432  devStressField->zero();
433  _plateFields.devStress.addArray(cells,devStressField);
434  _plateFields.devStress.syncLocal();
435 
436  shared_ptr<TArray> VMStressField(new TArray((cells.getCountLevel1())*(_options.nz+1)));
437  VMStressField->zero();
438  _plateFields.VMStress.addArray(cells,VMStressField);
439  _plateFields.VMStress.syncLocal();
440 
441  shared_ptr<TArray> VMStressOutField(new TArray(cells.getCountLevel1()));
442  VMStressOutField->zero();
443  _plateFields.VMStressOut.addArray(cells,VMStressOutField);
444  _plateFields.VMStressOut.syncLocal();
445 
446  shared_ptr<VectorT3Array> strainField(new VectorT3Array(cells.getCountLevel1()));
447  strainField->zero();
448  _plateFields.strain.addArray(cells,strainField);
449  _plateFields.strain.syncLocal();
450 
451  shared_ptr<VectorT4Array> plasticStrainField(new VectorT4Array((cells.getCountLevel1())*(_options.nz+1)));
452  plasticStrainField->zero();
453  _plateFields.plasticStrain.addArray(cells,plasticStrainField);
454  _plateFields.plasticStrain.syncLocal();
455 
456  shared_ptr<VectorT3Array> plasticStrainOutField(new VectorT3Array(cells.getCountLevel1()));
457  plasticStrainOutField->zero();
458  _plateFields.plasticStrainOut.addArray(cells,plasticStrainOutField);
459  _plateFields.plasticStrainOut.syncLocal();
460 
461  shared_ptr<VectorT4Array> plasticStrainN1Field(new VectorT4Array((cells.getCountLevel1())*(_options.nz+1)));
462  plasticStrainN1Field->zero();
463  _plateFields.plasticStrainN1.addArray(cells,plasticStrainN1Field);
464  _plateFields.plasticStrainN1.syncLocal();
465 
466  shared_ptr<VectorT3Array> plasticMomentField(new VectorT3Array(cells.getCountLevel1()));
467  plasticMomentField->zero();
468  _plateFields.plasticMoment.addArray(cells,plasticMomentField);
469  _plateFields.plasticMoment.syncLocal();
470 
471  shared_ptr<TArray> rhoCell(new TArray(cells.getCountLevel1()));
472  *rhoCell = vc["density"];
473  _plateFields.density.addArray(cells,rhoCell);
474  _plateFields.density.syncLocal();
475 
476  shared_ptr<TArray> ymCell(new TArray(cells.getCountLevel1()));
477  *ymCell = vc["ym"];
478  _plateFields.ym.addArray(cells,ymCell);
479  _plateFields.ym.syncLocal();
480 
481  shared_ptr<TArray> nuCell(new TArray(cells.getCountLevel1()));
482  *nuCell = vc["nu"];
483  _plateFields.nu.addArray(cells,nuCell);
484  _plateFields.nu.syncLocal();
485 
486  shared_ptr<TArray> forceCell(new TArray(cells.getCountLevel1()));
487  forceCell->zero();
488  _plateFields.force.addArray(cells,forceCell);
489  _plateFields.force.syncLocal();
490 
491  shared_ptr<TArray> thicknessCell(new TArray(cells.getCountLevel1()));
492  thicknessCell->zero();
493  _plateFields.thickness.addArray(cells,thicknessCell);
494  _plateFields.thickness.syncLocal();
495 
496  shared_ptr<TArray> accelerationCell(new TArray(cells.getCountLevel1()));
497  accelerationCell->zero();
498  _plateFields.acceleration.addArray(cells,accelerationCell);
499  _plateFields.acceleration.syncLocal();
500 
501  shared_ptr<VectorT3Array> velCell(new VectorT3Array(cells.getCountLevel1()));
502  velCell->zero();
503  _plateFields.velocity.addArray(cells,velCell);
504  _plateFields.velocity.syncLocal();
505 
506  //initial temparature gradient array
507  shared_ptr<VGradArray> rCell(new VGradArray(cells.getCountLevel1()));
508  VGradType residualStress;
509  residualStress[0][0] = _options["residualStressXX"];
510  residualStress[0][1] = _options["residualStressXY"];
511  residualStress[0][2] = _options["residualStressXZ"];
512  residualStress[1][0] = _options["residualStressXY"];
513  residualStress[1][1] = _options["residualStressYY"];
514  residualStress[1][2] = _options["residualStressYZ"];
515  residualStress[2][0] = _options["residualStressXZ"];
516  residualStress[2][1] = _options["residualStressYZ"];
517  residualStress[2][2] = _options["residualStressZZ"];
518  *rCell = residualStress;
519  _plateFields.residualStress.addArray(cells,rCell);
520  _plateFields.residualStress.syncLocal();
521 
522  // compute values of deformation flux
523 
524  // store deformation flux at interfaces
525  /*
526  foreach(const FaceGroupPtr fgPtr, mesh.getInterfaceGroups())
527  {
528  const FaceGroup& fg = *fgPtr;
529  const StorageSite& faces = fg.site;
530  shared_ptr<VectorT3Array> deformationFlux(new VectorT3Array(faces.getCount()));
531  deformationFlux->zero();
532  _plateFields.deformationFlux.addArray(faces,deformationFlux);
533  }
534  */
535 
536  // store deformation flux at boundary faces
537  foreach(const FaceGroupPtr fgPtr, mesh.getAllFaceGroups())
538  {
539  const FaceGroup& fg = *fgPtr;
540  const StorageSite& faces = fg.site;
541  shared_ptr<VectorT3Array> deformationFlux(new VectorT3Array(faces.getCount()));
542  deformationFlux->zero();
543  if (fg.groupType != "interior")
544  {
545  _plateFields.deformationFlux.addArray(faces,deformationFlux);
546  }
547  }
548 
549  }
550 
551  _niters =0;
552  _initialDeformationNorm = MFRPtr();
553  }
554 
555  PlateBCMap& getBCMap() {return _bcMap;}
556  PlateVCMap& getVCMap() {return _vcMap;}
557  PlateModelOptions<T>& getOptions() {return _options;}
558 
559  void updateTime()
560  {
561  const int numMeshes = _meshes.size();
562  for (int n=0; n<numMeshes; n++)
563  {
564  const Mesh& mesh = *_meshes[n];
565 
566  const StorageSite& cells = mesh.getCells();
567  VectorT3Array& w =
568  dynamic_cast<VectorT3Array&>(_plateFields.deformation[cells]);
569  VectorT3Array& wN1 =
570  dynamic_cast<VectorT3Array&>(_plateFields.deformationN1[cells]);
571  VectorT3Array& wN2 =
572  dynamic_cast<VectorT3Array&>(_plateFields.deformationN2[cells]);
573  if (_options.timeDiscretizationOrder > 1)
574  {
575  VectorT3Array& wN3 =
576  dynamic_cast<VectorT3Array&>(_plateFields.deformationN3[cells]);
577  wN3 = wN2;
578  }
579  wN2 = wN1;
580  wN1 = w;
581  if(_options.variableTimeStep)
582  {
583  if (_options.timeDiscretizationOrder > 1)
584  {
585  _options.timeStepN2 = _options.timeStepN1;
586  }
587  _options.timeStepN1 = _options["timeStep"];
588  }
589  VectorT4Array& pS =
590  dynamic_cast<VectorT4Array&>(_plateFields.plasticStrain[cells]);
591  VectorT4Array& pSN1 =
592  dynamic_cast<VectorT4Array&>(_plateFields.plasticStrainN1[cells]);
593  pSN1 = pS;
594  }
595  }
596 
597 
599  {
600  const int numMeshes = _meshes.size();
601  for (int n=0; n<numMeshes; n++)
602  {
603  const Mesh& mesh = *_meshes[n];
604 
605  const StorageSite& cells = mesh.getCells();
606  MultiField::ArrayIndex wIndex(&_plateFields.deformation,&cells);
607 
608  ls.getX().addArray(wIndex,_plateFields.deformation.getArrayPtr(cells));
609 
610  const CRConnectivity& cellCells2 = mesh.getCellCells2();
611 
612  shared_ptr<Matrix> m(new CRMatrix<DiagTensorT3,DiagTensorT3,VectorT3>(cellCells2));
613 
614  ls.getMatrix().addMatrix(wIndex,wIndex,m);
615 
616  }
617  }
618 
620  {
621  _deformationGradientModel.compute();
622  DiscrList discretizations;
623 
624  const Mesh& mesh = *_meshes[0];
625  if(!_options.constForce)
626  getMoment(mesh);
627  shared_ptr<Discretization>
629  (_meshes,_geomFields,
630  _plateFields.deformation,
631  _plateFields.ym,
632  _plateFields.nu,
633  _plateFields.deformationGradient,
634  _plateFields.residualStress,
635  _plateFields.thickness,
636  _plateFields.force,
637  _options.scf,
638  _plateFields.devStress,
639  _plateFields.VMStress,
640  _plateFields.plasticStrain,
641  _plateFields.plasticStrainOut,
642  _plateFields.plasticStrainN1,
643  _plateFields.plasticMoment,
644  _options.A,
645  _options.B,
646  _options.m,
647  _options.n,
648  _options.Sy0,
649  _options.nz,
650  _options["timeStep"],
651  _options.creepModel,
652  _options.creep));
653 
654  // shared_ptr<Discretization>
655  // bfd(new SourceDiscretization<VectorT3>
656  // (_meshes,_geomFields,
657  // _structureFields.deformation,
658  // _structureFields.bodyForce));
659 
660  discretizations.push_back(sd);
661  //discretizations.push_back(bfd);
662 
663  if (_options.transient)
664  {
665  shared_ptr<Discretization>
668  (_meshes,_geomFields,
669  _plateFields.deformation,
670  _plateFields.deformationN1,
671  _plateFields.deformationN2,
672  _plateFields.deformationN3,
673  _plateFields.density,
674  _plateFields.thickness,
675  _plateFields.acceleration,
676  _plateFields.volume0,
677  _options.variableTimeStep,
678  _options["timeStep"],
679  _options.timeStepN1,
680  _options.timeStepN2));
681 
682  discretizations.push_back(td);
683  }
684 
685  /*
686  shared_ptr<Discretization>
687  ibm(new GenericIBDiscretization<VectorT3,DiagTensorT3,T>
688  (_meshes,_geomFields,_plateFields.deformation));
689 
690  discretizations.push_back(ibm);
691  */
692  Linearizer linearizer;
693 
694  linearizer.linearize(discretizations,_meshes,ls.getMatrix(),
695  ls.getX(), ls.getB());
696  bool allNeumann = true;
697  const int numMeshes = _meshes.size();
698  for (int n=0; n<numMeshes; n++)
699  {
700  const Mesh& mesh = *_meshes[n];
701 
702  foreach(const FaceGroupPtr fgPtr, mesh.getAllFaceGroups())
703  {
704  const FaceGroup& fg = *fgPtr;
705  if (fg.groupType != "interior")
706  {
707  const StorageSite& faces = fg.site;
708  const int nFaces = faces.getCount();
709  const TArray& faceAreaMag =
710  dynamic_cast<const TArray&>(_geomFields.areaMag[faces]);
711  const PlateBC<T>& bc = *_bcMap[fg.id];
712 
713 
715  _geomFields,
716  _plateFields.deformation,
717  ls.getMatrix(), ls.getX(), ls.getB());
718 
721  if (bc.bcType == "Clamped")
722  {
724  bDeformation(bc.getVal("specifiedXRotation"),
725  bc.getVal("specifiedYRotation"),
726  bc.getVal("specifiedZDeformation"),
727  faces);
728  fluxB = gbc.applyDirichletBC(bDeformation);
729 
730  allNeumann = false;
731  }
732  else if (bc.bcType == "Symmetry")
733  {
734  gbc.applySymmetryBC();
735  allNeumann = false;
736  }
737  else if (bc.bcType == "ZeroDerivative")
738  {
739  gbc.applyZeroDerivativeBC();
740  }
741  else if (bc.bcType == "SpecifiedTraction")
742  {
743  for(int f=0; f<nFaces; f++)
744  {
745 
746  fluxB += gbc.applyNeumannBC(f,zeroFlux);
747 
748  }
749  }
750  else if (bc.bcType == "SpecifiedForce")
751  {
753  bForce(bc.getVal("specifiedXForce"),
754  bc.getVal("specifiedYForce"),
755  bc.getVal("specifiedZForce"),
756  faces);
757  for(int f=0; f<nFaces; f++)
758  {
759 
760  fluxB += gbc.applyNeumannBC(f,bForce[f]/faceAreaMag[f]);
761 
762  }
763  }
764  else if (bc.bcType == "SpecifiedShear")
765  {
767  bShear(bc.getVal("specifiedXShear"),
768  bc.getVal("specifiedYShear"),
769  bc.getVal("specifiedZShear"),
770  faces);
771  for(int f=0; f<nFaces; f++)
772  {
773 
774  fluxB += gbc.applyCantileverBC(f,bShear[f]);
775 
776  }
777  }
778  else if (bc.bcType != "Interface")
779  throw CException(bc.bcType + " not implemented for StructureModel");
780  //cout << "force sum for " << fg.id << " = " << fluxB << endl;
781  }
782  }
783  /*
784  foreach(const FaceGroupPtr fgPtr, mesh.getInterfaceGroups())
785  {
786  const FaceGroup& fg = *fgPtr;
787  const StorageSite& faces = fg.site;
788  GenericBCS<VectorT3,DiagTensorT3,DiagTensorT3> gbc(faces,mesh,
789  _geomFields,
790  _structureFields.deformation,
791  _structureFields.deformationFlux,
792  ls.getMatrix(), ls.getX(), ls.getB());
793 
794  gbc.applyInterfaceBC();
795  }
796  */
797  }
798 
799 
800 #ifdef FVM_PARALLEL
801  int count = 1;
802  int allNeumannInt = int( allNeumann);
803  MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &allNeumannInt, count, MPI::INT, MPI::PROD);
804  allNeumann = bool(allNeumannInt);
805 #endif
806 
807 
808 
809  if(allNeumann && !_options.transient)
810  {
811  const Mesh& mesh = *_meshes[0];
812  const StorageSite& cells = mesh.getCells();
813  MultiField& b = ls.getB();
814  MultiFieldMatrix& matrix = ls.getMatrix();
815  MultiField::ArrayIndex wIndex(&_plateFields.deformation,&cells);
816  VectorT3Array& rCell = dynamic_cast<VectorT3Array&>(b[wIndex]);
817  VectorT3Array& w = dynamic_cast<VectorT3Array&>
818  (_plateFields.deformation[cells]);
819  VVMatrix& vvMatrix =
820  dynamic_cast<VVMatrix&>(matrix.getMatrix(wIndex,wIndex));
821  rCell[0] = T(0);
822  w[0] = T(0);
823  vvMatrix.setDirichlet(0);
824  }
825 
826 #if 0
827  shared_ptr<Discretization>
829  (_meshes,_structureFields.deformation,
830  _options["deformationURF"]));
831 
832  DiscrList discretizations2;
833  discretizations2.push_back(ud);
834 
835  linearizer.linearize(discretizations2,_meshes,ls.getMatrix(),
836  ls.getX(), ls.getB());
837 #endif
838 
839  }
840 
841 
843  {
844  LinearSystem ls;
845  initDeformationLinearization(ls);
846  ls.initAssembly();
847  linearizeDeformation(ls);
848  ls.initSolve();
849 
850  //AMG solver(ls);
851  MFRPtr rNorm = _options.getDeformationLinearSolver().solve(ls);
852  if (!_initialDeformationNorm) _initialDeformationNorm = rNorm;
853 
854  _options.getDeformationLinearSolver().cleanup();
855  ls.postSolve();
856  ls.updateSolution();
857  //postPlateSolve(ls);
858  if (_options.transient){
859  calculatePlateVelocity();
860  calculatePlateAcceleration();
861  }
862  return rNorm;
863  }
864 
866  {
867  const int numMeshes = _meshes.size();
868  for(int n=0;n<numMeshes;n++)
869  {
870  const Mesh& mesh = *_meshes[n];
871  const StorageSite& cells = mesh.getCells();
872  const int nCells = cells.getCountLevel1();
873  const VectorT3Array& w =
874  dynamic_cast<const VectorT3Array&>(_plateFields.deformation[cells]);
875  const VectorT3Array& wN1 =
876  dynamic_cast<const VectorT3Array&>(_plateFields.deformationN1[cells]);
877  VectorT3Array& velocity =
878  dynamic_cast<VectorT3Array&>(_plateFields.velocity[cells]);
879  const T timeStep = _options["timeStep"];
880  for (int c=0; c<nCells; c++){
881  velocity[c] = (w[c]-wN1[c])/timeStep;
882  }
883 
884  }
885  }
886 
887 
889  {
890 
891  T_Scalar two(2.0);
892  T_Scalar three(3.0);
893  T_Scalar five(5.0);
894  T_Scalar four(4.0);
895  T_Scalar twelve(12.0);
896  T_Scalar dT = _options["timeStep"];
897 
898  const T_Scalar dT2 = dT*dT;
899 
900  const int numMeshes = _meshes.size();
901  for(int n=0;n<numMeshes;n++)
902  {
903  const Mesh& mesh = *_meshes[n];
904  const StorageSite& cells = mesh.getCells();
905  const int nCells = cells.getCountLevel1();
906 
907  TArray& acceleration =
908  dynamic_cast<TArray&>(_plateFields.acceleration[cells]);
909  const VectorT3Array& w =
910  dynamic_cast<const VectorT3Array&>(_plateFields.deformation[cells]);
911  const VectorT3Array& wN1 =
912  dynamic_cast<const VectorT3Array&>(_plateFields.deformationN1[cells]);
913  const VectorT3Array& wN2 =
914  dynamic_cast<const VectorT3Array&>(_plateFields.deformationN2[cells]);
915  const TArray& density =
916  dynamic_cast<const TArray&> (_plateFields.density[cells]);
917  //constant time step
918  if(!_options.variableTimeStep)
919  {
920  if (_options.timeDiscretizationOrder > 1) //second order
921  {
922  const VectorT3Array& wN3 =
923  dynamic_cast<const VectorT3Array&>(_plateFields.deformationN3[cells]);
924  for(int c=0; c<nCells; c++)
925  {
926  const T_Scalar rhobydT2 = density[c]/dT2;
927  acceleration[c] = rhobydT2*(two*w[c][2] - five*wN1[c][2] + four*wN2[c][2]
928  - wN3[c][2]);
929  }
930  }
931  else // first order
932  {
933  for(int c=0; c<nCells; c++)
934  {
935  const T_Scalar rhobydT2 = density[c]/dT2;
936  acceleration[c] = rhobydT2*(w[c][2]- two*wN1[c][2] + wN2[c][2]);
937  }
938  }
939  }
940  //variable time step
941  else
942  {
943  T_Scalar dTN1 = _options.timeStepN1;
944  T_Scalar dTN2 = _options.timeStepN2;
945  T_Scalar a = (dT + dTN1)/dT;
946  T_Scalar b = (dT + dTN1 + dTN2)/dT;
947  T_Scalar one(1.0);
948  if (_options.timeDiscretizationOrder > 1) //second order
949  {
950  const VectorT3Array& wN3 =
951  dynamic_cast<const VectorT3Array&>(_plateFields.deformationN3[cells]);
952  T_Scalar c1 = (two*a*b*(pow(a,two)-pow(b,two))+two*b*(pow(b,two)-one)-two*a*(pow(a,two)-one))/
953  (a*b*(a-one)*(b-one)*(a-b));
954  T_Scalar c2 = -two*(a+b)/((a-1)*(b-1));
955  T_Scalar c3 = -two*(b+one)/(a*(a-b)*(a-one));
956  T_Scalar c4 = two*(a+one)/(b*(a-b)*(b-one));
957  for(int c=0; c<nCells; c++)
958  {
959  const T_Scalar rhobydT2 = density[c]/dT2;
960  acceleration[c] = rhobydT2*(c1*w[c][2] + c2*wN1[c][2] + c3*wN2[c][2]
961  + c4*wN3[c][2]);
962  }
963  }
964  else
965  {
966  T_Scalar c1 = two/a;
967  T_Scalar c2 = -two/(a-one);
968  T_Scalar c3 = two/(a*(a-one));
969  for(int c=0; c<nCells; c++)
970  {
971  const T_Scalar rhobydT2 = density[c]/dT2;
972  acceleration[c] = rhobydT2*(c1*w[c][2] + c2*wN1[c][2]
973  + c3*wN2[c][2]);
974  }
975  }
976  }
977  }
978  }
979 
981  {
982  MultiField& sField = ls.getDelta();
983 
984  const int numMeshes = _meshes.size();
985  for(int n=0;n<numMeshes;n++)
986  {
987  const Mesh& mesh = *_meshes[n];
988 
989  const StorageSite& cells = mesh.getCells();
990 
991  MultiField::ArrayIndex sIndex(&_plateFields.deformation,&cells);
992  VectorT3Array& w = dynamic_cast<VectorT3Array&>
993  (_plateFields.deformation[cells]);
994  const VectorT3Array& ww = dynamic_cast<const VectorT3Array&>
995  (sField[sIndex]);
996  //const T deformationURF(_options["deformationURF"]);
997 
998  const int nCells = cells.getCountLevel1();
999  for(int c=0;c<nCells;c++)
1000  {
1001  w[c] += ww[c];
1002  }
1003  }
1004  }
1005 
1006  bool advance(const int niter)
1007  {
1008 
1009  for(int n=0; n<niter; n++)
1010  {
1011  MFRPtr dNorm = solveDeformation();
1012 
1013  if (_niters < 5)
1014  {
1015  _initialDeformationNorm->setMax(*dNorm);
1016  }
1017 
1018  MFRPtr dNormRatio(dNorm->normalize(*_initialDeformationNorm));
1019 
1020  if (_options.printNormalizedResiduals)
1021  cout << _niters << ": " << *dNormRatio << endl;
1022  else
1023  cout << _niters << ": " << *dNorm << endl;
1024 
1025  _niters++;
1026  if (*dNormRatio < _options.deformationTolerance)
1027  return true;
1028  }
1029  return false;
1030  }
1031 
1032  void printBCs()
1033  {
1034  foreach(typename PlateBCMap::value_type& pos, _bcMap)
1035  {
1036  cout << "Face Group " << pos.first << ":" << endl;
1037  cout << " bc type " << pos.second->bcType << endl;
1038  foreach(typename PlateBC<T>::value_type& vp, *pos.second)
1039  {
1040  cout << " " << vp.first << " " << vp.second.constant << endl;
1041  }
1042  }
1043  }
1044 
1045  void getMoment(const Mesh& mesh)
1046  {
1047  const StorageSite& cells = mesh.getCells();
1048 
1049  const int nCells = cells.getCountLevel1();
1050 
1051  shared_ptr<VectorT3Array> momentPtr(new VectorT3Array(nCells));
1052  momentPtr->zero();
1053  _plateFields.moment.addArray(cells,momentPtr);
1054  VectorT3Array& moment = *momentPtr;
1055 
1056  _deformationGradientModel.compute();
1057 
1058  const VGradArray& wGrad =
1059  dynamic_cast<const VGradArray&>(_plateFields.deformationGradient[cells]);
1060 
1061  const TArray& ym = dynamic_cast<const TArray&>(_plateFields.ym[cells]);
1062  const TArray& nu = dynamic_cast<const TArray&>(_plateFields.nu[cells]);
1063 
1064  const TArray& thickness = dynamic_cast<const TArray&>(_plateFields.thickness[cells]);
1065 
1066  TArray& VMStress = dynamic_cast<TArray&>(_plateFields.VMStress[cells]);
1067  TArray& VMStressOut = dynamic_cast<TArray&>(_plateFields.VMStressOut[cells]);
1068  VectorT3Array& cellStress =
1069  dynamic_cast<VectorT3Array&>(_plateFields.stress[cells]);
1070  VectorT4Array& devStress =
1071  dynamic_cast<VectorT4Array&>(_plateFields.devStress[cells]);
1072  VectorT4Array& pg =
1073  dynamic_cast<VectorT4Array&>(_plateFields.plasticStrain[cells]);
1074 
1075  VectorT3Array& plasticMoment =
1076  dynamic_cast<VectorT3Array&>(_plateFields.plasticMoment[cells]);
1077 
1078  VectorT3Array& cellStrain =
1079  dynamic_cast<VectorT3Array&>(_plateFields.strain[cells]);
1080 
1081  const T onethird(1.0/3.0);
1082  const T one(1.0);
1083  const T two(2.0);
1084  const T three(3.0);
1085  const T six(6.0);
1086  const T twelve(12.0);
1087  const T zero(0.0);
1088 
1089  for(int n=0; n<nCells; n++)
1090  {
1091  T cellD = ym[n]*pow(thickness[n],three)/(twelve*(one - pow(nu[n],two)));
1092  const VGradType& wg = wGrad[n];
1093  VectorT3 stress;
1094 
1095  moment[n][0] = cellD*(wg[0][0]+nu[n]*wg[1][1]);
1096  moment[n][1] = cellD*(wg[1][1]+nu[n]*wg[0][0]);
1097  moment[n][2] = cellD*((one-nu[n])/two)*(wg[1][0]+wg[0][1]);
1098  if(_options.creep)
1099  moment[n] = moment[n] - plasticMoment[n];
1100 
1101  cellStress[n][0] = six*moment[n][0]/pow(thickness[n],two);
1102  cellStress[n][1] = six*moment[n][1]/pow(thickness[n],two);
1103  cellStress[n][2] = six*moment[n][2]/pow(thickness[n],two);
1104 
1105  cellStrain[n][0] = (thickness[n]/two)*wg[0][0];
1106  cellStrain[n][1] = (thickness[n]/two)*wg[1][1];
1107  cellStrain[n][2] = (thickness[n]/two)*(wg[1][0]+wg[0][1]);
1108 
1109  T cellE = ym[n]/(one - pow(nu[n],two));
1110 
1111  int nn = n*(_options.nz+1);
1112  for(int k=0; k<=_options.nz; k++)
1113  {
1114  T zz(thickness[n]*(T(k)-T(_options.nz)/T(2))/T(_options.nz));
1115  stress[0] = (twelve*zz/pow(thickness[n],three))*cellD*(wg[0][0]+nu[n]*wg[1][1])-
1116  cellE*(pg[nn+k][0]+nu[n]*pg[nn+k][1]);
1117  stress[1] = (twelve*zz/pow(thickness[n],three))*cellD*(wg[1][1]+nu[n]*wg[0][0])-
1118  cellE*(pg[nn+k][1]+nu[n]*pg[nn+k][0]);
1119  stress[2] = (twelve*zz/pow(thickness[n],three))*cellD*((one-nu[n])/two)*(wg[1][0]+wg[0][1])-
1120  cellE*(one-nu[n])*(pg[nn+k][3]);
1121 
1122  T trace = stress[0] + stress[1];
1123  devStress[nn+k][0] = stress[0];
1124  devStress[nn+k][1] = stress[1];
1125  devStress[nn+k][2] = zero;
1126  devStress[nn+k][3] = stress[2];
1127  devStress[nn+k][0] = devStress[nn+k][0] - onethird*trace;
1128  devStress[nn+k][1] = devStress[nn+k][1] - onethird*trace;
1129  devStress[nn+k][2] = devStress[nn+k][2] - onethird*trace;
1130  VMStress[nn+k] = sqrt(pow(stress[0],2.0) + pow(stress[1],2.0) -
1131  stress[0]*stress[1] + three*pow(stress[2],2.0));
1132  //VMStress[nn+k] = sqrt(pow(stress[0],2.0) + three*pow(stress[2],2.0));
1133  }
1134  VMStressOut[n] = VMStress[nn+_options.nz];
1135  }
1136  }
1137 
1138  map<string,shared_ptr<ArrayBase> >&
1140  {
1141  _persistenceData.clear();
1142 
1143  Array<int>* niterArray = new Array<int>(1);
1144  (*niterArray)[0] = _niters;
1145  _persistenceData["niters"]=shared_ptr<ArrayBase>(niterArray);
1146 
1147  if (_initialDeformationNorm)
1148  {
1149  _persistenceData["initialDeformationNorm"] =
1150  _initialDeformationNorm->getArrayPtr(_plateFields.deformation);
1151  }
1152  else
1153  {
1154  Array<Vector<T,3> >* xArray = new Array<Vector<T,3> >(1);
1155  xArray->zero();
1156  _persistenceData["initialDeformationNorm"]=shared_ptr<ArrayBase>(xArray);
1157  }
1158  return _persistenceData;
1159  }
1160 
1161  void restart()
1162  {
1163  if (_persistenceData.find("niters") != _persistenceData.end())
1164  {
1165  shared_ptr<ArrayBase> rp = _persistenceData["niters"];
1166  ArrayBase& r = *rp;
1167  Array<int>& niterArray = dynamic_cast<Array<int>& >(r);
1168  _niters = niterArray[0];
1169  }
1170  if (_persistenceData.find("initialDeformationNorm") != _persistenceData.end())
1171  {
1172  shared_ptr<ArrayBase> r = _persistenceData["initialDeformationNorm"];
1173  _initialDeformationNorm = MFRPtr(new MultiFieldReduction());
1174  _initialDeformationNorm->addArray(_plateFields.deformation,r);
1175  }
1176  }
1177 
1178  #if !(defined(USING_ATYPE_TANGENT) || defined(USING_ATYPE_PC))
1179 
1180  void dumpMatrix(const string fileBase)
1181  {
1182  LinearSystem ls;
1183  initDeformationLinearization(ls);
1184  ls.initAssembly();
1185  linearizeDeformation(ls);
1186  ls.initSolve();
1187 
1188  MultiFieldMatrix& mfmatrix = ls.getMatrix();
1189  MultiField& b = ls.getB();
1190 
1191  const Mesh& mesh = *_meshes[0];
1192  const StorageSite& cells = mesh.getCells();
1193 
1194  MultiField::ArrayIndex vIndex(&_plateFields.deformation,&cells);
1195 
1196  VVMatrix& matrix =
1197  dynamic_cast<VVMatrix&>(mfmatrix.getMatrix(vIndex,vIndex));
1198 
1199  VVDiagArray& diag = matrix.getDiag();
1200  VVDiagArray& coeff = matrix.getOffDiag();
1201 
1202  VectorT3Array& rCell = dynamic_cast<VectorT3Array&>(b[vIndex]);
1203 
1204  const CRConnectivity& cr = matrix.getConnectivity();
1205 
1206  const Array<int>& row = cr.getRow();
1207  const Array<int>& col = cr.getCol();
1208 
1209  const int nCells = cells.getSelfCount();
1210 
1211  const int dimension = 3;
1212 
1213  const int dim2 = dimension*dimension;
1214 
1215  int nFlatRows = dimension*nCells;
1216 
1217  int nFlatCoeffs = nCells*dim2;
1218 
1219  for(int i=0; i<nCells; i++)
1220  for(int jp=row[i]; jp<row[i+1]; jp++)
1221  {
1222  const int j = col[jp];
1223  if (j<nCells) nFlatCoeffs += dim2;
1224  }
1225 
1226  string matFileName = fileBase + ".mat";
1227  FILE *matFile = fopen(matFileName.c_str(),"wb");
1228 
1229  fprintf(matFile,"%%%%MatrixMarket matrix coordinate real general\n");
1230  fprintf(matFile,"%d %d %d\n", nFlatRows,nFlatRows,nFlatCoeffs);
1231 
1232  for(int i=0; i<nCells; i++)
1233  {
1234  for(int ndr=0; ndr<dimension; ndr++)
1235  for(int ndc=0; ndc<dimension; ndc++)
1236  {
1237  const int nfr = i*dimension + ndr;
1238  const int nfc = i*dimension + ndc;
1239  T ap = diag[i](ndr,ndc);
1240  //if (fabs(ap) < 1.0) ap =0.;
1241  fprintf(matFile,"%d %d %22.15le\n", nfr+1, nfc+1, ap);
1242  }
1243 
1244  for(int jp=row[i]; jp<row[i+1]; jp++)
1245  {
1246  const int j = col[jp];
1247  if (j<nCells)
1248  {
1249  for(int ndr=0; ndr<dimension; ndr++)
1250  for(int ndc=0; ndc<dimension; ndc++)
1251  {
1252  const int nfr = i*dimension + ndr;
1253  const int nfc = j*dimension + ndc;
1254  T anb = coeff[jp](ndr,ndc);
1255  //if (fabs(anb) < 1.0) anb =0.;
1256  fprintf(matFile,"%d %d %22.15le\n", nfr+1, nfc+1, anb);
1257  }
1258  }
1259  }
1260  }
1261 
1262  fclose(matFile);
1263 
1264  string rhsFileName = fileBase + ".rhs";
1265  FILE *rhsFile = fopen(rhsFileName.c_str(),"wb");
1266 
1267  for(int i=0; i<nCells; i++)
1268  for(int nd=0; nd < dimension; nd++)
1269  fprintf(rhsFile,"%22.15le\n",-rCell[i][nd]);
1270 
1271  fclose(rhsFile);
1272  }
1273 #endif
1274 
1275 
1276 private:
1280 
1283 
1286 
1288  int _niters;
1289 
1290  map<string,shared_ptr<ArrayBase> > _persistenceData;
1291 };
1292 
1293 template<class T>
1295  PlateFields& plateFields,
1296  const MeshList& meshes) :
1297  Model(meshes),
1298  _impl(new Impl(geomFields,plateFields,meshes))
1299 {
1300  logCtor();
1301 }
1302 
1303 
1304 template<class T>
1306 {
1307  logDtor();
1308 }
1309 
1310 template<class T>
1311 void
1313 {
1314  _impl->init();
1315 }
1316 
1317 template<class T>
1318 typename PlateModel<T>::PlateBCMap&
1319 PlateModel<T>::getBCMap() {return _impl->getBCMap();}
1320 
1321 template<class T>
1322 typename PlateModel<T>::PlateVCMap&
1323 PlateModel<T>::getVCMap() {return _impl->getVCMap();}
1324 
1325 template<class T>
1327 PlateModel<T>::getOptions() {return _impl->getOptions();}
1328 
1329 
1330 template<class T>
1331 void
1333 {
1334  _impl->printBCs();
1335 }
1336 
1337 template<class T>
1338 bool
1339 PlateModel<T>::advance(const int niter)
1340 {
1341  return _impl->advance(niter);
1342 }
1343 
1344 template<class T>
1345 void
1347 {
1348  _impl->updateTime();
1349 }
1350 
1351 template<class T>
1352 void
1354 {
1355  return _impl->getMoment(mesh);
1356 }
1357 
1358 template<class T>
1359 void
1360 PlateModel<T>::dumpMatrix(const string fileBase)
1361 {
1362  _impl->dumpMatrix(fileBase);
1363 }
1364 
1365 
1366 template<class T>
1367 map<string,shared_ptr<ArrayBase> >&
1369 {
1370  return _impl->getPersistenceData();
1371 }
1372 
1373 template<class T>
1374 void
1376 {
1377  _impl->restart();
1378 }
const Array< int > & getCol() const
virtual void zero()
Definition: Array.h:281
PlateModel(const GeomFields &geomFields, PlateFields &plateFields, const MeshList &meshes)
const Array< int > & getRow() const
void initAssembly()
GradientModel< VectorT3 > _deformationGradientModel
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
X applyNeumannBC(const int f, const X &specifiedFlux) const
shared_ptr< FaceGroup > FaceGroupPtr
Definition: Mesh.h:46
void applyInterfaceBC(const int f) const
int getSelfCount() const
Definition: StorageSite.h:40
void initDeformationLinearization(LinearSystem &ls)
X applyCantileverBC(const int f, const X &specifiedFlux) const
Gradient< VectorT3 > VGradType
VVMatrix::DiagArray VVDiagArray
Array< VectorT3 > VectorT3Array
const StorageSite & _cells
const VectorT3Array & _cellCoord
Vector< T, 3 > VectorT3
PlateBCMap & getBCMap()
Definition: Mesh.h:28
CRMatrix< Diag, OffDiag, X > CCMatrix
Array< Gradient< VectorT3 > > VGradArray
const FaceGroupList & getAllFaceGroups() const
Definition: Mesh.h:193
PlateFields & _plateFields
virtual ~PlateModel()
Definition: Field.h:14
VectorTranspose< T, 3 > VectorT3T
Array< X > XArray
const VectorT3Array & _faceCoord
void applyInterfaceBC() const
std::map< int, PlateBC< T > * > PlateBCMap
Definition: PlateModel.h:23
map< string, shared_ptr< ArrayBase > > _persistenceData
Definition: Model.h:32
XArray & _r
Definition: Mesh.h:49
void getMoment(const Mesh &mesh)
map< string, shared_ptr< ArrayBase > > _persistenceData
NumTypeTraits< X >::T_Scalar T_Scalar
OffDiag & getCoeff10(const int np)
Definition: CRMatrix.h:131
const MeshList _meshes
Array< Diag > & getDiag()
Definition: CRMatrix.h:856
PlateModelOptions< T > & getOptions()
#define logCtor()
Definition: RLogInterface.h:26
virtual map< string, shared_ptr< ArrayBase > > & getPersistenceData()
const TArray & _faceAreaMag
DiagArray & _dRdXDiag
FluxJacobianMatrix< Diag, X > FMatrix
const Field & _areaField
void applySymmetryBC() const
virtual const CRConnectivity & getConnectivity() const
Definition: CRMatrix.h:834
string groupType
Definition: Mesh.h:42
X applyNeumannBC(const X &bFlux) const
const VectorT3Array & _faceArea
MultiField & getDelta()
Definition: LinearSystem.h:34
FloatVal< T > getVal(const string varName) const
Definition: FloatVarDict.h:85
void linearizeDeformation(LinearSystem &ls)
Array< Vector< double, 3 > > VectorT3Array
Definition: CellMark.cpp:7
SquareTensor< T, 3 > DiagTensorT3
Array< OffDiag > & getOffDiag()
Definition: CRMatrix.h:857
Tangent sqrt(const Tangent &a)
Definition: Tangent.h:317
std::map< int, PlateVC< T > * > PlateVCMap
Definition: PlateModel.h:24
const int id
Definition: Mesh.h:41
void updateSolution()
const MultiField::ArrayIndex _xIndex
Vector< T_Scalar, 3 > VectorT3
XArray & _x
X applyZeroDerivativeBC() const
PlateVCMap & getVCMap()
Array< OffDiag > OffDiagArray
PlateModelOptions< T > & getOptions()
X applyNeumannBC(const FloatValEvaluator< X > &bFlux) const
bool advance(const int niter)
pair< const Field *, const StorageSite * > ArrayIndex
Definition: MultiField.h:21
void initSolve()
map< string, shared_ptr< ArrayBase > > & getPersistenceData()
MFRPtr solveDeformation()
vector< shared_ptr< Discretization > > DiscrList
CCMatrix & _dRdX
X applyDirichletBC(const X &bValue) const
const MeshList _meshes
Definition: Model.h:29
Definition: Model.h:13
const CRConnectivity & _faceCells
Array< VectorT4 > VectorT4Array
MFRPtr _initialDeformationNorm
const StorageSite & getCells() const
Definition: Mesh.h:109
string vcType
Definition: PlateBC.h:34
PlateVCMap & getVCMap()
CCMatrix::PairWiseAssembler CCAssembler
virtual void init()
Array< Diag > DiagArray
#define logDtor()
Definition: RLogInterface.h:33
X applyDirichletBC(const FloatValEvaluator< X > &bValue) const
int getCountLevel1() const
Definition: StorageSite.h:72
const Field & _varField
OffDiag & getCoeff01(const int np)
Definition: CRMatrix.h:126
PlateModelOptions< T > _options
void calculatePlateAcceleration()
void postPlateSolve(LinearSystem &ls)
Array< VectorT3 > VectorT3Array
Definition: Array.h:14
Impl(const GeomFields &geomFields, PlateFields &plateFields, const MeshList &meshes)
void addMatrix(const Index &rowI, const Index &colI, shared_ptr< Matrix > m)
void setBoundary(const int nr)
Definition: CRMatrix.h:1056
virtual void restart()
void calculatePlateVelocity()
const CRConnectivity & getCellCells2() const
Definition: Mesh.cpp:495
DiagonalMatrix< Diag, X > BBMatrix
int getCount() const
Definition: StorageSite.h:39
CRMatrix< DiagTensorT3, DiagTensorT3, VectorT3 > VVMatrix
void dumpMatrix(const string fileBase)
MultiField & getB()
Definition: LinearSystem.h:33
void getMoment(const Mesh &mesh)
PlateBCMap & getBCMap()
string bcType
Definition: PlateBC.h:22
X applyDirichletBC(int f, const X &bValue) const
shared_ptr< MultiFieldReduction > MFRPtr
void addArray(const ArrayIndex &aIndex, shared_ptr< ArrayBase > a)
Definition: MultiField.cpp:270
MultiField & getX()
Definition: LinearSystem.h:32
void dumpMatrix(const string fileBase)
void setDirichlet(const int nr)
Definition: CRMatrix.h:887
CCAssembler & _assembler
const StorageSite & _faces
T dot(const Vector< T, 3 > &a, const Vector< T, 3 > &b)
Definition: Vector.h:253
const GeomFields & _geomFields
PlateBCS(const StorageSite &faces, const Mesh &mesh, const GeomFields &geomFields, Field &varField, MultiFieldMatrix &matrix, MultiField &xField, MultiField &rField)
int getID() const
Definition: Mesh.h:106
bool advance(const int niter)
void eliminateDirichlet(const int j, Array< X > &b, const X &delta_j, const bool explicitMode=false)
Definition: CRMatrix.h:1041
virtual void linearize(DiscrList &discretizations, const MeshList &meshes, MultiFieldMatrix &matrix, MultiField &x, MultiField &b)
Definition: Linearizer.cpp:17
MultiFieldMatrix & getMatrix()
Definition: LinearSystem.h:37
vector< Mesh * > MeshList
Definition: Mesh.h:439
const Field & _areaMagField
StorageSite site
Definition: Mesh.h:40
Vector< T, 4 > VectorT4
Array< T_Scalar > TArray