Memosa-FVM  0.2
PhononModel.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 #ifndef _PHONONMODEL_H_
6 #define _PHONONMODEL_H_
7 
8 #include "Model.h"
9 #include "Array.h"
10 #include "Vector.h"
11 #include <vector>
12 #include "Mesh.h"
13 #include "Kspace.h"
14 #include "kvol.h"
15 #include "pmode.h"
16 #include "PhononMacro.h"
17 #include "PhononBC.h"
18 #include <map>
19 #include "PhononBoundary.h"
20 #include "PhononInterface.h"
21 #include "LinearSystem.h"
22 #include "NumType.h"
25 #include "GenericPhononBCS.h"
26 #include "Linearizer.h"
27 #include "ArrowHeadMatrix.h"
28 #include "COMETDiscretizer.h"
29 #include <math.h>
30 
31 template<class T>
32 class PhononModel : public Model
33 {
34 
35  public:
36 
40  typedef shared_ptr<VectorT3Array> T3ptr;
41  typedef Kspace<T> Tkspace;
42  typedef kvol<T> Tkvol;
43  typedef pmode<T> Tmode;
44  typedef Array<T> Tarray;
45  typedef shared_ptr<Tarray> Tarrptr;
46  typedef map<int,PhononBC<T>*> PhononBCMap;
47  typedef typename Tmode::Mode_ptr Mode_ptr;
48  typedef typename Tmode::Reflection Reflection;
49  typedef typename Tmode::Reflptr Reflptr;
50  typedef typename Tmode::Refl_pair Refl_pair;
51  typedef typename Tmode::Refl_Map Refl_Map;
53  typedef shared_ptr<BCcellArray> BCellPtr;
54  typedef vector<BCellPtr> BCcellList;
56  typedef shared_ptr<BCfaceArray> BfacePtr;
57  typedef vector<BfacePtr> BCfaceList;
58 
59  PhononModel(const MeshList& meshes,const GeomFields& geomFields,Tkspace& kspace,PhononMacro& macro):
60 
61  Model(meshes),
62  _geomFields(geomFields),
63  _kspace(kspace),
64  _macro(macro),
65  _BCells(),
66  _BFaces()
67  {
68  //setting boundary conditions
69  const int numMeshes = _meshes.size();
70 
71  for (int n=0; n<numMeshes; n++) //mesh loop beg
72  {
73  const Mesh& mesh = *_meshes[n];
74  const StorageSite& cells=mesh.getCells();
75  const StorageSite& faces=mesh.getFaces();
76  const int cellCount=cells.getSelfCount();
77  const int faceCount=faces.getCount();
78 
79  BCellPtr BCptr(new BCcellArray(cellCount));
80  _BCells.push_back(BCptr);
81  BCptr->zero();
82 
83  BfacePtr BFptr(new BCfaceArray(faceCount));
84  BFptr->zero();
85  _BFaces.push_back(BFptr);
86 
87  foreach(const FaceGroupPtr fgPtr, mesh.getBoundaryFaceGroups()) //facegroup loop beg
88  {
89  const FaceGroup& fg = *fgPtr;
90  if (_bcMap.find(fg.id) == _bcMap.end())
91  {
92  PhononBC<T> *bc(new PhononBC<T>());
93 
94  _bcMap[fg.id] = bc;
95  if((fg.groupType == "wall"))
96  {
97  bc->bcType = "reflecting";
98  }
99  else if (fg.groupType == "velocity-inlet")
100  {
101  bc->bcType = "temperature";
102  }
103  else
104  throw CException("PhononModel: unknown face group type "
105  + fg.groupType);
106  }
107  }
108  }
109 
110  }
111 
113  PhononBCMap& getBCs() {return _bcMap;}
114 
115  void init()
116  {
117 
118  _initialnorm = MFRPtr();
119  _niters=0;
120  const int numMeshes=_meshes.size();
121 
122  for (int n=0;n<numMeshes;n++) //mesh loop beg
123  {
124  const Mesh& mesh=*_meshes[n];
125  const int numK=_kspace.getlength();
126  const StorageSite& cells=mesh.getCells();
127  const int numcells=cells.getCount();
128 
129  //initialize lattice temperature
130  shared_ptr<Tarray> TLcell(new Tarray(numcells));
131  const T Tinit=_options["initialTemperature"];
132  *TLcell=Tinit;
133  _macro.temperature.addArray(cells,TLcell);
134 
135  T e0sum=0.;
136 
137  for (int k=0;k<numK;k++) //kspace loop beg
138  {
139  Tkvol& kv=_kspace.getkvol(k);
140  const int numM=kv.getmodenum();
141  const T dk3=kv.getdk3();
142 
143  for (int m=0;m<numM;m++) //mode loop beg
144  {
145  //initialize each phonon mode
146  Tmode& mode=kv.getmode(m);
147  Field& efield=mode.getfield();
148  Field& e0field=mode.gete0field();
149  Field& resfield=mode.getresid();
150  Tarrptr e0var=shared_ptr<Tarray>(new Tarray(numcells));
151  Tarrptr evar=shared_ptr<Tarray>(new Tarray(numcells));
152  Tarrptr resid=shared_ptr<Tarray>(new Tarray(numcells));
153  const T einit=mode.calce0(Tinit);
154  e0sum+=einit*dk3;
155  *evar=einit;
156  *e0var=einit;
157  *resid=0.;
158  efield.addArray(cells,evar);
159  e0field.addArray(cells,e0var);
160  resfield.addArray(cells,resid);
161  }; //mode loop end
162  }; //kspace loop end
163 
164  e0sum=e0sum/_kspace.getDK3();
165  shared_ptr<Tarray> e0cell(new Tarray(numcells));
166  *e0cell=e0sum;
167  _macro.e0.addArray(cells,e0cell);
168  shared_ptr<Tarray> e0ResidCell(new Tarray(numcells));
169  *e0ResidCell=0.;
170  // _macro.e0Residual.addArray(cells,e0ResidCell);
171 
172  // Compute reflections--later, should be moved inside above loop
173 
174  for (int k=0;k<numK;k++) //kspace loop beg
175  {
176  Tkvol& kv=_kspace.getkvol(k);
177  const int numM=kv.getmodenum();
178  //const T dk3=kv.getdk3();
179 
180  for (int m=0;m<numM;m++) //mode loop beg
181  {
182  Tmode& mode=kv.getmode(m);
183  Refl_Map& rmap=mode.getreflmap();
184  VectorT3 vg=mode.getv();
185  T vmag=sqrt(pow(vg[0],2)+pow(vg[1],2)+pow(vg[2],2));
186  VectorT3 si=vg/vmag;
187  VectorT3 so;
188 
189  foreach(const FaceGroupPtr fgPtr, mesh.getBoundaryFaceGroups())
190  {
191  const FaceGroup& fg = *fgPtr;
192  const StorageSite& faces = fg.site;
193  const Field& AreaMagField=_geomFields.areaMag;
194  const Tarray& AreaMag=dynamic_cast<const Tarray&>(AreaMagField[faces]);
195  const Field& AreaDirField=_geomFields.area;
196  const VectorT3Array& AreaDir=
197  dynamic_cast<const VectorT3Array&>(AreaDirField[faces]);
198 
199  const VectorT3 n=AreaDir[0]/AreaMag[0];
200  const T sidotn=si[0]*n[0]+si[1]*n[1]+si[2]*n[2];
201 
202  if (sidotn > T_Scalar(0.0))
203  {
204  so=si-2.*(si[0]*n[0]+si[1]*n[1]+si[2]*n[2])*n;
205  T soMag=sqrt(pow(so[0],2)+pow(so[1],2)+pow(so[2],2));
206  so/=soMag;
207  so*=vmag;
208  Refl_pair refls;
209  Refl_pair reflsFrom;
210  _kspace.findSpecs(n,m,k,refls);
211  rmap[fg.id]=refls;
212  const int k1=refls.first.second;
213  Tmode& mode2=_kspace.getkvol(k1).getmode(m);
214  Refl_Map& rmap2=mode2.getreflmap();
215  reflsFrom.first.second=-1;
216  reflsFrom.second.second=k;
217  rmap2[fg.id]=reflsFrom;
218  }
219  }
220  }
221  }
222 
223  BCcellArray& BCArray=*(_BCells[n]);
224  BCfaceArray& BCfArray=*(_BFaces[n]);
225  foreach(const FaceGroupPtr fgPtr, mesh.getBoundaryFaceGroups())
226  {
227  const FaceGroup& fg = *fgPtr;
228  if((_bcMap[fg.id]->bcType == "reflecting"))
229  {
230  const CRConnectivity& BfaceCells=mesh.getFaceCells(fg.site);
231  const int faceCount=fg.site.getCount();
232  const int offSet=fg.site.getOffset();
233  for(int i=0;i<faceCount;i++)
234  {
235  int cell1=BfaceCells(i,0);
236  BCArray[cell1]=1;
237  }
238  for(int i=offSet;i<offSet+faceCount;i++)
239  BCfArray[i]=true;
240  }
241  }
242  }
243  }
244 
246  {
247  const int numMeshes = _meshes.size();
248  for (int n=0; n<numMeshes; n++)
249  {
250  const Mesh& mesh = *_meshes[n];
251 
252  foreach(const FaceGroupPtr fgPtr, mesh.getBoundaryFaceGroups())
253  {
254  const FaceGroup& fg = *fgPtr;
255  const StorageSite& faces = fg.site;
256  const PhononBC<T>& bc = *_bcMap[fg.id];
257 
258  PhononBoundary<T> pbc(faces, mesh,_geomFields,_kspace,_options,fg.id);
259 
260  if (bc.bcType == "reflecting")
261  {
262 
264  bReflection(bc.getVal("specifiedReflection"),faces);
265 
266  pbc.applyReflectingWall(bReflection);
267  }
268  else if(bc.bcType=="temperature")
269  {
270 
272  bTemperature(bc.getVal("specifiedTemperature"),faces);
273 
274  pbc.applyTemperatureWall(bTemperature);
275  }
276  else
277  {
278  cout<<"Couldn't find boundary condition"<<endl;
279  break;
280  }
281  };
282  foreach(const FaceGroupPtr fgPtr, mesh.getInterfaceGroups())
283  {
284  int otherMeshID = 0;
285  T_Scalar btrans = _options["transmissivity0to1"];
286  T_Scalar brefl = 1.0 - _options["transmissivity1to0"];
287  if (n==0)
288  {
289  otherMeshID = 1;
290  btrans = _options["transmissivity1to0"];
291  brefl = 1.0 - _options["transmissivity0to1"];
292  }
293  const Mesh& otherMesh = *_meshes[otherMeshID];
294  const FaceGroup& fg = *fgPtr;
295  PhononInterface<T> pInt(fg, mesh, otherMesh,_geomFields,_kspace,_kspace,_options);
296 
297  pInt.applyInterfaceCondition(brefl,btrans);
298  };
299  };
300  };
301 
302  void updateTL()
303  {
304 
305  const int numMeshes = _meshes.size();
306  for (int n=0; n<numMeshes; n++)
307  {
308  const Mesh& mesh = *_meshes[n];
309  const StorageSite& cells = mesh.getCells();
310  const int numcells = cells.getCount();
311  const int numK=_kspace.getlength();
312  Tarray& TL=dynamic_cast<Tarray&>(_macro.temperature[cells]);
313  Tarrptr e_sumptr=shared_ptr<Tarray>(new Tarray(numcells));
314  Tarray& e_sum=*(e_sumptr);
315  e_sum=0.;
316 
317  for(int k=0;k<numK;k++)
318  {
319  Tkvol& kv=_kspace.getkvol(k);
320  const int modenum=kv.getmodenum();
321  T dk3=kv.getdk3();
322 
323  for(int m=0;m<modenum;m++)
324  {
325  Tmode& mode=kv.getmode(m);
326  T tau=mode.gettau();
327  Field& efield=mode.getfield();
328  Tarray& e_val=dynamic_cast<Tarray&>(efield[cells]);
329 
330  for(int c=0;c<numcells;c++)
331  e_sum[c]+=e_val[c]*dk3/tau;
332 
333  }
334  }
335 
336  for(int c=0;c<numcells;c++)
337  _kspace.NewtonSolve(TL[c],e_sum[c]);
338  }
339  }
340 
342  {
343  const int numMeshes = _meshes.size();
344  for (int n=0; n<numMeshes; n++)
345  {
346  const Mesh& mesh = *_meshes[n];
347  const StorageSite& cells = mesh.getCells();
348  const int numcells = cells.getCount();
349  Tarray& TL=dynamic_cast<Tarray&>(_macro.temperature[cells]);
350  Tarray& e0Array=dynamic_cast<Tarray&>(_macro.e0[cells]);
351 
352  for(int c=0;c<numcells;c++)
353  _kspace.NewtonSolve(TL[c],e0Array[c]);
354  }
355  }
356 
357  void updatee0()
358  {
359 
360  const int numMeshes = _meshes.size();
361  for (int n=0; n<numMeshes; n++)
362  {
363  const Mesh& mesh = *_meshes[n];
364  const StorageSite& cells = mesh.getCells();
365  const int numcells = cells.getCount();
366  const int numK=_kspace.getlength();
367  Tarray& TL=dynamic_cast<Tarray&>(_macro.temperature[cells]);
368 
369  for(int k=0;k<numK;k++)
370  {
371  Tkvol& kv=_kspace.getkvol(k);
372  const int modenum=kv.getmodenum();
373 
374  for(int m=0;m<modenum;m++)
375  {
376  Tmode& mode=kv.getmode(m);
377  Field& e0field=mode.gete0field();
378  Tarray& e0_val=dynamic_cast<Tarray&>(e0field[cells]);
379  for(int c=0;c<numcells;c++)
380  e0_val[c]=mode.calce0(TL[c]);
381  }
382  }
383 
384  }
385  }
386 
388  {
389  const int numMeshes = _meshes.size();
390  for (int n=0; n<numMeshes; n++)
391  {
392  VectorT3 zero_vec;
393  const Mesh& mesh = *_meshes[n];
394  const StorageSite& cells = mesh.getCells();
395  const int numcells = cells.getCount();
396  T3ptr heatFluxptr=T3ptr(new VectorT3Array(numcells));
397  VectorT3Array& heatFlux=*heatFluxptr;
398  zero_vec[0]=0.;zero_vec[1]=0.;zero_vec[2]=0.;
399  heatFlux=zero_vec;
400 
401  const int numK=_kspace.getlength();
402  for(int k=0;k<numK;k++)
403  {
404  Tkvol& kv=_kspace.getkvol(k);
405  T dk3=kv.getdk3();
406  const int modenum=kv.getmodenum();
407  for(int m=0;m<modenum;m++)
408  {
409  Tmode& mode=kv.getmode(m);
410  VectorT3 vg=mode.getv();
411  Field& efield=mode.getfield();
412  const Tarray& eval=dynamic_cast<const Tarray&>(efield[cells]);
413 
414  for(int c=0;c<numcells;c++)
415  heatFlux[c]+=eval[c]*vg*dk3;
416  }
417  }
418  _macro.heatFlux.addArray(cells,heatFluxptr);
419  }
420  }
421 
423  {
424  const int numMeshes = _meshes.size();
425  for (int n=0; n<numMeshes; n++)
426  {
427  const Mesh& mesh = *_meshes[n];
428  const StorageSite& cells = mesh.getCells();
429 
430  Field& fnd = mode.getfield();
431 
432  MultiField::ArrayIndex vIndex(&fnd,&cells);
433 
434  ls.getX().addArray(vIndex,fnd.getArrayPtr(cells));
435 
436  const CRConnectivity& cellCells = mesh.getCellCells();
437 
438  shared_ptr<Matrix> m(new CRMatrix<T,T,T>(cellCells));
439 
440  ls.getMatrix().addMatrix(vIndex,vIndex,m);
441  }
442 
443  };
444 
446  {
447  // _velocityGradientModel.compute();
448  DiscrList discretizations;
449 
450  Field& fnd = mode.getfield(); //field for e"
451  Field& e0fld=mode.gete0field(); //field for e0
452  T tau=mode.gettau();
453  VectorT3 vg=mode.getv();
454 
455  shared_ptr<Discretization>
456  colldisc(new PhononCollisionDiscretization<T,T,T>(_meshes, _geomFields,fnd,e0fld,tau));
457 
458  discretizations.push_back(colldisc);
459 
460  shared_ptr<Discretization>
462 
463  discretizations.push_back(convdisc);
464 
465  Linearizer linearizer;
466 
467  linearizer.linearize(discretizations,_meshes,ls.getMatrix(),
468  ls.getX(), ls.getB());
469 
470 
471 
472  // boundary conditions
473  const int numMeshes = _meshes.size();
474  for (int n=0; n<numMeshes; n++)
475  {
476  const Mesh& mesh = *_meshes[n];
477  const StorageSite& cells = mesh.getCells();
478  foreach(const FaceGroupPtr fgPtr, mesh.getBoundaryFaceGroups())
479  {
480  const FaceGroup& fg = *fgPtr;
481  const StorageSite& faces = fg.site;
482  const int nFaces = faces.getCount();
483  const PhononBC<T>& bc = *_bcMap[fg.id];
484  Tarray& dsf = dynamic_cast< Tarray&>(fnd[cells]);
485  BaseGenericPhononBCS<T,T,T> gpbc(faces, mesh, _geomFields,
486  fnd,
487  ls.getMatrix(),
488  ls.getX(),
489  ls.getB());
490 
491 
492  const CRConnectivity& faceCells = mesh.getFaceCells(faces);
493  const Field& areaMagField = _geomFields.areaMag;
494  const Tarray& faceAreaMag = dynamic_cast<const Tarray &>(areaMagField[faces]);
495  const Field& areaField = _geomFields.area;
496  const VectorT3Array& faceArea=dynamic_cast<const VectorT3Array&>(areaField[faces]);
497 
498  if (( bc.bcType == "CopyBC"))
499  {
500  for(int f=0; f< nFaces; f++)
501  {
502  gpbc.applyExtrapolationBC(f);
503  }
504  }
505  else{
506  for(int f=0; f< nFaces; f++)
507  {
508  const VectorT3 en = faceArea[f]/faceAreaMag[f];
509  const T v_dot_en = vg[0]*en[0]+vg[1]*en[1]+vg[2]*en[2];
510 
511  if(v_dot_en < T_Scalar(0.0))
512  {
513  //incoming direction - dirchlet bc
514  const int c1= faceCells(f,1); // boundary cell
515  T bvalue =dsf[c1];
516  gpbc.applyDirichletBC(f,bvalue);
517  }
518  else
519  {
520  //outgoing direction - extrapolation bc
521  gpbc.applyExtrapolationBC(f);
522  }
523  }
524  }
525  }
526  }
527 
528  }
529 
530  bool advance(const int niter)
531  {
532  bool keepGoing(true);
533  for(int n=0; n<niter; n++)
534  {
535  const int klength =_kspace.getlength();
536  MFRPtr rNorm;
537 
538  for(int k=0; k<klength;k++)
539  {
540 
541  Tkvol& kv=_kspace.getkvol(k);
542  const int mlength=kv.getmodenum();
543 
544  for(int m=0;m<mlength;m++)
545  {
546 
547  Tmode& mode=kv.getmode(m);
548 
549  LinearSystem ls;
551  ls.initAssembly();
552  linearizePhononModel(ls,mode);
553  ls.initSolve();
554 
555  MFRPtr kNorm(_options.getPhononLinearSolver().solve(ls));
556 
557  if (!rNorm)
558  rNorm = kNorm;
559  else
560  {
561  // find the array for the 0the direction residual and
562  // add the current residual to it
563  Tkvol& kvol0=_kspace.getkvol(0);
564  Tmode& mode0=kvol0.getmode(0);
565  Field& efield0=mode0.getfield();
566  Field& efield=mode.getfield();
567 
568  ArrayBase& rArray0 = (*rNorm)[efield0];
569  ArrayBase& rArrayd = (*kNorm)[efield];
570  rArray0 += rArrayd;
571  }
572 
573  ls.postSolve();
574  ls.updateSolution();
575 
576  _options.getPhononLinearSolver().cleanup();
577 
578  }
579  }
580 
581  if (!_initialnorm) _initialnorm = rNorm;
582 
583  if (_niters < 5)
584  _initialnorm->setMax(*rNorm);
585 
586 
587  MFRPtr normRatio((*rNorm)/(*_initialnorm));
588 
589  if(_niters % _options.showResidual == 0)
590  cout << _niters << ": " << *rNorm <<endl;
591 
592  _niters++;
593  if ((*rNorm < _options.absTolerance)||(*normRatio < _options.relTolerance ))
594  {
595  //cout << endl;
596  //cout << "Final Residual at "<<_niters<<": "<< *rNorm <<endl;
597  keepGoing=false;
598  break;}
599 
600  updateTL(); //update macroparameters
601  updatee0();
603  }
604 
605  return keepGoing;
606  }
607 
608  void printTemp()
609  {
610  const int numMeshes = _meshes.size();
611  for (int n=0; n<numMeshes; n++)
612  {
613  const Mesh& mesh = *_meshes[n];
614  const StorageSite& cells = mesh.getCells();
615  const int numcells=cells.getCount();
616  Tarray& TL=dynamic_cast<Tarray&>(_macro.temperature[cells]);
617  for(int i=0;i<numcells;i++)
618  cout<<TL[i]<<" "<<i<<endl;
619  }
620 
621  }
622 
623  T HeatFluxIntegral(const Mesh& mesh, const int faceGroupId)
624  {
625  T r(0.);
626  bool found = false;
627  const T DK3=_kspace.getDK3();
628  foreach(const FaceGroupPtr fgPtr, mesh.getBoundaryFaceGroups())
629  {
630  const FaceGroup& fg = *fgPtr;
631  if (fg.id == faceGroupId)
632  {
633  const StorageSite& faces = fg.site;
634  const int nFaces = faces.getCount();
635  const StorageSite& cells = mesh.getCells();
636  const CRConnectivity& faceCells=mesh.getFaceCells(faces);
637  const Field& areaField=_geomFields.area;
638  const VectorT3Array& faceArea=dynamic_cast<const VectorT3Array&>(areaField[faces]);
639 
640 
641  for(int k=0;k<_kspace.getlength();k++)
642  {
643  Tkvol& kv=_kspace.getkvol(k);
644  int modenum=kv.getmodenum();
645  for(int m=0;m<modenum;m++)
646  {
647  VectorT3 vg=kv.getmode(m).getv();
648  T dk3=kv.getdk3();
649  Field& efield=kv.getmode(m).getfield();
650  const Tarray& eval=dynamic_cast<const Tarray&>(efield[cells]);
651  for(int f=0; f<nFaces; f++)
652  {
653  const VectorT3 An=faceArea[f];
654  const int c1=faceCells(f,1);
655  const T vgdotAn=An[0]*vg[0]+An[1]*vg[1]+An[2]*vg[2];
656  r += eval[c1]*vgdotAn*dk3/DK3;
657  }
658  found=true;
659  }
660  }
661  }
662  }
663  if (!found)
664  throw CException("getHeatFluxIntegral: invalid faceGroupID");
665  return r*DK3;
666  }
667 
668  int getIters() {return _niters;}
669 
670  private:
671 
673  Tkspace& _kspace; //kspace
678  int _niters;
681 };
682 
683 #endif
Tmode::Reflection Reflection
Definition: PhononModel.h:48
shared_ptr< BCcellArray > BCellPtr
Definition: PhononModel.h:53
shared_ptr< Reflection > Reflptr
Definition: pmode.h:28
const FaceGroupList & getBoundaryFaceGroups() const
Definition: Mesh.h:187
kvol< T > Tkvol
Definition: PhononModel.h:42
pair< Reflection, Reflection > Refl_pair
Definition: pmode.h:29
void initAssembly()
void NewtonSolve(T &guess, const T e_sum)
Definition: Kspace.h:425
shared_ptr< FaceGroup > FaceGroupPtr
Definition: Mesh.h:46
shared_ptr< VectorT3Array > T3ptr
Definition: PhononModel.h:40
int getSelfCount() const
Definition: StorageSite.h:40
Tvec getv()
Definition: pmode.h:59
Definition: Kspace.h:28
void findSpecs(const Tvec n, const int m, const int k, Refl_pair &refls)
Definition: Kspace.h:742
int getIters()
Definition: PhononModel.h:668
Definition: Mesh.h:28
PhononModelOptions< T > & getOptions()
Definition: PhononModel.h:112
T HeatFluxIntegral(const Mesh &mesh, const int faceGroupId)
Definition: PhononModel.h:623
T calce0(T Tl)
Definition: pmode.h:88
Definition: Field.h:14
Tkvol & getkvol(int n) const
Definition: Kspace.h:390
void applyReflectingWall(int f, const X refl) const
BCcellList _BCells
Definition: PhononModel.h:679
Tmode & getmode(int n) const
Definition: kvol.h:44
int getlength() const
Definition: Kspace.h:391
string bcType
Definition: PhononBC.h:21
shared_ptr< Tarray > Tarrptr
Definition: PhononModel.h:45
const GeomFields & _geomFields
Definition: PhononModel.h:672
Field temperature
Definition: PhononMacro.h:21
shared_ptr< pmode< T > > Mode_ptr
Definition: pmode.h:26
Definition: Mesh.h:49
PhononBCMap _bcMap
Definition: PhononModel.h:676
int getmodenum()
Definition: kvol.h:43
T getDK3() const
Definition: Kspace.h:408
NumTypeTraits< T >::T_Scalar T_Scalar
Definition: PhononModel.h:37
void updateHeatFlux()
Definition: PhononModel.h:387
Field & gete0field()
Definition: pmode.h:76
Refl_Map & getreflmap()
Definition: pmode.h:69
vector< BCellPtr > BCcellList
Definition: PhononModel.h:54
void init()
Definition: PhononModel.h:115
PhononModelOptions< T > _options
Definition: PhononModel.h:675
map< int, Refl_pair > Refl_Map
Definition: pmode.h:30
PhononMacro & _macro
Definition: PhononModel.h:674
string groupType
Definition: Mesh.h:42
FloatVal< T > getVal(const string varName) const
Definition: FloatVarDict.h:85
Tmode::Mode_ptr Mode_ptr
Definition: PhononModel.h:47
Tangent sqrt(const Tangent &a)
Definition: Tangent.h:317
const int id
Definition: Mesh.h:41
void updateSolution()
BCfaceList _BFaces
Definition: PhononModel.h:680
MFRPtr _initialnorm
Definition: PhononModel.h:677
void linearizePhononModel(LinearSystem &ls, Tmode &mode)
Definition: PhononModel.h:445
pair< const Field *, const StorageSite * > ArrayIndex
Definition: MultiField.h:21
void initSolve()
vector< BfacePtr > BCfaceList
Definition: PhononModel.h:57
vector< shared_ptr< Discretization > > DiscrList
void printTemp()
Definition: PhononModel.h:608
const StorageSite & getFaces() const
Definition: Mesh.h:108
Tmode::Refl_pair Refl_pair
Definition: PhononModel.h:50
const MeshList _meshes
Definition: Model.h:29
const CRConnectivity & getCellCells() const
Definition: Mesh.cpp:480
Definition: Model.h:13
const StorageSite & getCells() const
Definition: Mesh.h:109
Tmode::Refl_Map Refl_Map
Definition: PhononModel.h:51
PhononBCMap & getBCs()
Definition: PhononModel.h:113
shared_ptr< BCfaceArray > BfacePtr
Definition: PhononModel.h:56
Array< bool > BCfaceArray
Definition: PhononModel.h:55
bool advance(const int niter)
Definition: PhononModel.h:530
void addArray(const StorageSite &, shared_ptr< ArrayBase > a)
Definition: Field.cpp:72
const CRConnectivity & getFaceCells(const StorageSite &site) const
Definition: Mesh.cpp:388
Array< T > Tarray
Definition: PhononModel.h:44
Definition: Array.h:14
Field & getfield()
Definition: pmode.h:74
void addMatrix(const Index &rowI, const Index &colI, shared_ptr< Matrix > m)
int getOffset() const
Definition: StorageSite.h:87
Tmode::Reflptr Reflptr
Definition: PhononModel.h:49
int getCount() const
Definition: StorageSite.h:39
Array< VectorT3 > VectorT3Array
Definition: PhononModel.h:39
MultiField & getB()
Definition: LinearSystem.h:33
pair< T, int > Reflection
Definition: pmode.h:27
map< int, PhononBC< T > * > PhononBCMap
Definition: PhononModel.h:46
shared_ptr< MultiFieldReduction > MFRPtr
Field area
Definition: GeomFields.h:23
Field & getresid()
Definition: pmode.h:78
void addArray(const ArrayIndex &aIndex, shared_ptr< ArrayBase > a)
Definition: MultiField.cpp:270
const FaceGroupList & getInterfaceGroups() const
Definition: Mesh.h:190
MultiField & getX()
Definition: LinearSystem.h:32
Kspace< T > Tkspace
Definition: PhononModel.h:41
void applyInterfaceCondition(int f, const X refl, const X trans) const
void updatee0()
Definition: PhononModel.h:357
Definition: pmode.h:18
void COMETupdateTL()
Definition: PhononModel.h:341
void applyTemperatureWall(int f, const X Twall) const
shared_ptr< ArrayBase > getArrayPtr(const StorageSite &)
Definition: Field.cpp:63
Vector< T_Scalar, 3 > VectorT3
Definition: PhononModel.h:38
Field areaMag
Definition: GeomFields.h:25
Definition: kvol.h:14
T gettau()
Definition: pmode.h:61
Field heatFlux
Definition: PhononMacro.h:27
void updateTL()
Definition: PhononModel.h:302
Array< int > BCcellArray
Definition: PhononModel.h:52
PhononModel(const MeshList &meshes, const GeomFields &geomFields, Tkspace &kspace, PhononMacro &macro)
Definition: PhononModel.h:59
void initPhononModelLinearization(LinearSystem &ls, Tmode &mode)
Definition: PhononModel.h:422
virtual void linearize(DiscrList &discretizations, const MeshList &meshes, MultiFieldMatrix &matrix, MultiField &x, MultiField &b)
Definition: Linearizer.cpp:17
pmode< T > Tmode
Definition: PhononModel.h:43
Tkspace & _kspace
Definition: PhononModel.h:673
MultiFieldMatrix & getMatrix()
Definition: LinearSystem.h:37
vector< Mesh * > MeshList
Definition: Mesh.h:439
void callBoundaryConditions()
Definition: PhononModel.h:245
T getdk3()
Definition: kvol.h:42
StorageSite site
Definition: Mesh.h:40