Memosa-FVM  0.2
COMETInterface< T > Class Template Reference

#include <COMETInterface.h>

Collaboration diagram for COMETInterface< T >:

Public Types

typedef NumTypeTraits< T >
::T_Scalar 
T_Scalar
 
typedef Array< int > IntArray
 
typedef shared_ptr< IntArrayIntArrayPtr
 
typedef Array< T > TArray
 
typedef KSConnectivity< T > TKConn
 
typedef vector< TKConn * > TKClist
 
typedef Vector< T_Scalar, 3 > VectorT3
 
typedef Array< VectorT3VectorT3Array
 
typedef Kspace< T > Tkspace
 
typedef TkspaceTkspPtr
 
typedef vector< Tkspace * > TkspList
 
typedef kvol< T > Tkvol
 
typedef pmode< T > Tmode
 
typedef map< int, int > MeshKspaceMap
 
typedef StorageSite::ScatterMap ScatterMap
 
typedef StorageSite::CommonMap CommonMap
 
typedef pair< T, T > FreqBin
 
typedef shared_ptr< FreqBinBinPtr
 
typedef vector< BinPtrBinList
 
typedef DensityOfStates< T > DOST
 
typedef vector< COMETIC< T > * > IClist
 

Public Member Functions

 COMETInterface (const MeshList &meshes, TkspList &klist, MeshKspaceMap &MKMap, PhononMacro &macro, const GeomFields &geomFields)
 
void makeDMMcoeffs (COMETIC< T > &ic)
 
void makeNoInterfaceCoeffs (COMETIC< T > &ic)
 
void makeCoarseCoeffs (const IClist &fineList, IClist &coarseList, MeshList &coarseMeshes)
 
void updateOtherGhost (const COMETIC< T > &ic, const int Mid0, const bool plusFAS)
 
void updateResid (const COMETIC< T > &ic, const bool plusFAS)
 
void makeValueArray (const int msh, const int c, TArray &o)
 
void makeEquilibriumArray (const int msh, const T Temp, TArray &o)
 
void Distribute (const int msh, const int cell, TArray &BVec)
 
void DistributeResid (const int msh, const int cell, TArray &BVec)
 
void ZeroGhost (const int msh, const int cell)
 
void findWallTemp (const int meshID, const int cell0, const int cell0ghost, const VectorT3 Af, T &Tguess)
 
void addFAS (const int msh, const int c, TArray &bVec)
 

Private Attributes

const MeshList_meshes
 
TkspList_KList
 
MeshKspaceMap _MeshKspaceMap
 
PhononMacro_macro
 
const GeomFields_geomFields
 

Detailed Description

template<class T>
class COMETInterface< T >

Definition at line 10 of file COMETInterface.h.

Member Typedef Documentation

template<class T>
typedef vector<BinPtr> COMETInterface< T >::BinList

Definition at line 31 of file COMETInterface.h.

template<class T>
typedef shared_ptr<FreqBin> COMETInterface< T >::BinPtr

Definition at line 30 of file COMETInterface.h.

template<class T>
typedef StorageSite::CommonMap COMETInterface< T >::CommonMap

Definition at line 28 of file COMETInterface.h.

template<class T>
typedef DensityOfStates<T> COMETInterface< T >::DOST

Definition at line 32 of file COMETInterface.h.

template<class T>
typedef pair<T,T> COMETInterface< T >::FreqBin

Definition at line 29 of file COMETInterface.h.

template<class T>
typedef vector<COMETIC<T>*> COMETInterface< T >::IClist

Definition at line 33 of file COMETInterface.h.

template<class T>
typedef Array<int> COMETInterface< T >::IntArray

Definition at line 14 of file COMETInterface.h.

template<class T>
typedef shared_ptr<IntArray> COMETInterface< T >::IntArrayPtr

Definition at line 15 of file COMETInterface.h.

template<class T>
typedef map<int,int> COMETInterface< T >::MeshKspaceMap

Definition at line 26 of file COMETInterface.h.

template<class T>
typedef StorageSite::ScatterMap COMETInterface< T >::ScatterMap

Definition at line 27 of file COMETInterface.h.

template<class T>
typedef NumTypeTraits<T>::T_Scalar COMETInterface< T >::T_Scalar

Definition at line 13 of file COMETInterface.h.

template<class T>
typedef Array<T> COMETInterface< T >::TArray

Definition at line 16 of file COMETInterface.h.

template<class T>
typedef vector<TKConn*> COMETInterface< T >::TKClist

Definition at line 18 of file COMETInterface.h.

template<class T>
typedef KSConnectivity<T> COMETInterface< T >::TKConn

Definition at line 17 of file COMETInterface.h.

template<class T>
typedef Kspace<T> COMETInterface< T >::Tkspace

Definition at line 21 of file COMETInterface.h.

template<class T>
typedef vector<Tkspace*> COMETInterface< T >::TkspList

Definition at line 23 of file COMETInterface.h.

template<class T>
typedef Tkspace* COMETInterface< T >::TkspPtr

Definition at line 22 of file COMETInterface.h.

template<class T>
typedef kvol<T> COMETInterface< T >::Tkvol

Definition at line 24 of file COMETInterface.h.

template<class T>
typedef pmode<T> COMETInterface< T >::Tmode

Definition at line 25 of file COMETInterface.h.

template<class T>
typedef Vector<T_Scalar,3> COMETInterface< T >::VectorT3

Definition at line 19 of file COMETInterface.h.

template<class T>
typedef Array<VectorT3> COMETInterface< T >::VectorT3Array

Definition at line 20 of file COMETInterface.h.

Constructor & Destructor Documentation

template<class T>
COMETInterface< T >::COMETInterface ( const MeshList meshes,
TkspList klist,
MeshKspaceMap MKMap,
PhononMacro macro,
const GeomFields geomFields 
)
inline

Definition at line 35 of file COMETInterface.h.

36  :
37  _meshes(meshes),
38  _KList(klist),
39  _MeshKspaceMap(MKMap),
40  _macro(macro),
41  _geomFields(geomFields)
42  {}
MeshKspaceMap _MeshKspaceMap
const GeomFields & _geomFields
const MeshList & _meshes
TkspList & _KList
PhononMacro & _macro

Member Function Documentation

template<class T>
void COMETInterface< T >::addFAS ( const int  msh,
const int  c,
TArray bVec 
)
inline

Definition at line 1094 of file COMETInterface.h.

References COMETInterface< T >::_KList, COMETInterface< T >::_macro, COMETInterface< T >::_meshes, COMETInterface< T >::_MeshKspaceMap, Mesh::getCells(), pmode< T >::getFASfield(), pmode< T >::getIndex(), Kspace< T >::getkvol(), Array< T >::getLength(), Kspace< T >::getlength(), kvol< T >::getmode(), kvol< T >::getmodenum(), Kspace< T >::gettotmodes(), and PhononMacro::TlFASCorrection.

1095  {
1096  const Mesh& mesh=*_meshes[msh];
1097  const StorageSite& cells=mesh.getCells();
1098  Tkspace& kspace=*_KList[_MeshKspaceMap[msh]];
1099  const int klen=kspace.gettotmodes();
1100  const int kpts=kspace.getlength();
1101 
1102  if(klen+1==bVec.getLength())
1103  {
1104  for(int k=0;k<kpts;k++)
1105  {
1106  Tkvol& kvol=kspace.getkvol(k);
1107  const int numModes=kvol.getmodenum();
1108  for(int m=0;m<numModes;m++)
1109  {
1110  Tmode& mode=kvol.getmode(m);
1111  const int count=mode.getIndex()-1;
1112  Field& fasField=mode.getFASfield();
1113  TArray& fasArray=dynamic_cast<TArray&>(fasField[cells]);
1114  bVec[count]+=fasArray[c];
1115  }
1116  }
1117  TArray& fasArray=dynamic_cast<TArray&>(_macro.TlFASCorrection[cells]);
1118  bVec[klen]+=fasArray[c];
1119  }
1120  }
Array< T > TArray
Definition: Field.h:14
MeshKspaceMap _MeshKspaceMap
kvol< T > Tkvol
Definition: Mesh.h:49
int getmodenum()
Definition: kvol.h:43
const MeshList & _meshes
TkspList & _KList
pmode< T > Tmode
Field TlFASCorrection
Definition: PhononMacro.h:26
const StorageSite & getCells() const
Definition: Mesh.h:109
PhononMacro & _macro
Kspace< T > Tkspace
Definition: kvol.h:14
template<class T>
void COMETInterface< T >::Distribute ( const int  msh,
const int  cell,
TArray BVec 
)
inline

Definition at line 998 of file COMETInterface.h.

References COMETInterface< T >::_KList, COMETInterface< T >::_macro, COMETInterface< T >::_meshes, COMETInterface< T >::_MeshKspaceMap, Mesh::getCells(), Array< T >::getLength(), Kspace< T >::gettotmodes(), Kspace< T >::seteCellVals(), and PhononMacro::temperature.

Referenced by COMETInterface< T >::updateOtherGhost().

999  {
1000  const Mesh& mesh=*_meshes[msh];
1001  const StorageSite& cells=mesh.getCells();
1002  Tkspace& kspace=*_KList[_MeshKspaceMap[msh]];
1003  const int klen=kspace.gettotmodes();
1004 
1005  if(klen+1==BVec.getLength())
1006  {
1007  kspace.seteCellVals(cell, BVec);
1008  TArray& TlArray=dynamic_cast<TArray&>(_macro.temperature[cells]);
1009  TlArray[cell]=BVec[klen];
1010  }
1011  else
1012  throw CException("Distribute: Array not the same size as the k-space!");
1013  }
Array< T > TArray
MeshKspaceMap _MeshKspaceMap
Field temperature
Definition: PhononMacro.h:21
Definition: Mesh.h:49
const MeshList & _meshes
TkspList & _KList
const StorageSite & getCells() const
Definition: Mesh.h:109
PhononMacro & _macro
Kspace< T > Tkspace
template<class T>
void COMETInterface< T >::DistributeResid ( const int  msh,
const int  cell,
TArray BVec 
)
inline

Definition at line 1015 of file COMETInterface.h.

References COMETInterface< T >::_KList, COMETInterface< T >::_MeshKspaceMap, Array< T >::getLength(), Kspace< T >::gettotmodes(), and Kspace< T >::setResidCell().

Referenced by COMETInterface< T >::updateResid().

1016  {
1017  Tkspace& kspace=*_KList[_MeshKspaceMap[msh]];
1018  const int klen=kspace.gettotmodes();
1019 
1020  if(klen+1==BVec.getLength())
1021  {
1022  kspace.setResidCell(cell, BVec);
1023  }
1024  else
1025  throw CException("DistributeResid: Array not the same size as the k-space!");
1026  }
MeshKspaceMap _MeshKspaceMap
TkspList & _KList
Kspace< T > Tkspace
template<class T>
void COMETInterface< T >::findWallTemp ( const int  meshID,
const int  cell0,
const int  cell0ghost,
const VectorT3  Af,
T &  Tguess 
)
inline

Definition at line 1052 of file COMETInterface.h.

References COMETInterface< T >::_geomFields, COMETInterface< T >::_KList, COMETInterface< T >::_meshes, COMETInterface< T >::_MeshKspaceMap, Kspace< T >::calcTemp(), GeomFields::coordinate, Mesh::getCells(), kvol< T >::getdk3(), Kspace< T >::geteCellVals(), pmode< T >::getIndex(), Kspace< T >::getkvol(), Kspace< T >::getlength(), kvol< T >::getmode(), kvol< T >::getmodenum(), Kspace< T >::gettotmodes(), pmode< T >::getv(), and sqrt().

Referenced by COMETInterface< T >::makeDMMcoeffs().

1053  {
1054  const Mesh& mesh=*_meshes[meshID];
1055  const StorageSite& cells=mesh.getCells();
1056  Tkspace& kspace=*_KList[_MeshKspaceMap[meshID]];
1057  int kpts=kspace.getlength();
1058  const VectorT3Array& coordArray=dynamic_cast<const VectorT3Array&>(_geomFields.coordinate[cells]);
1059 
1060  const VectorT3 c0Pos=coordArray[cell0];
1061  const VectorT3 cGhstPos=coordArray[cell0ghost];
1062  const VectorT3 from0toGhst=cGhstPos-c0Pos;
1063 
1064  VectorT3 n=Af/sqrt(pow(Af[0],2)+pow(Af[1],2)+pow(Af[2],2));
1065 
1066  if((n[0]*from0toGhst[0]+n[1]*from0toGhst[1]+n[2]*from0toGhst[2])<0.)
1067  n*=-1.;
1068 
1069  T sume(0.);
1070  TArray eArray(kspace.gettotmodes());
1071  kspace.geteCellVals(cell0, eArray);
1072 
1073  for(int k=0;k<kpts;k++)
1074  {
1075  Tkvol& kvol=kspace.getkvol(k);
1076  const int numModes=kvol.getmodenum();
1077  T dk3=kvol.getdk3();
1078  for(int m=0;m<numModes;m++)
1079  {
1080  Tmode& mode=kvol.getmode(m);
1081  VectorT3 vg=mode.getv();
1082  T VdotN=vg[0]*n[0]+vg[1]*n[1]+vg[2]*n[2];
1083  if(VdotN>0)
1084  {
1085  int index=mode.getIndex()-1;
1086  sume+=eArray[index]*dk3;
1087  }
1088  }
1089  }
1090 
1091  kspace.calcTemp(Tguess,sume,n);
1092  }
Array< T > TArray
Field coordinate
Definition: GeomFields.h:19
MeshKspaceMap _MeshKspaceMap
kvol< T > Tkvol
Definition: Mesh.h:49
int getmodenum()
Definition: kvol.h:43
const GeomFields & _geomFields
Tangent sqrt(const Tangent &a)
Definition: Tangent.h:317
const MeshList & _meshes
TkspList & _KList
pmode< T > Tmode
const StorageSite & getCells() const
Definition: Mesh.h:109
Kspace< T > Tkspace
Definition: kvol.h:14
template<class T>
void COMETInterface< T >::makeCoarseCoeffs ( const IClist fineList,
IClist coarseList,
MeshList coarseMeshes 
)
inline

Definition at line 467 of file COMETInterface.h.

References COMETInterface< T >::_geomFields, COMETInterface< T >::_KList, COMETInterface< T >::_meshes, COMETInterface< T >::_MeshKspaceMap, GeomFields::area, KSConnectivity< T >::copyFrom(), COMETIC< T >::FgID0, COMETIC< T >::FgID1, COMETIC< T >::FineToCoarse0, COMETIC< T >::FineToCoarse1, StorageSite::getCommonMap(), StorageSite::getCount(), Mesh::getFaceGroup(), COMETIC< T >::getKConnectivity(), Kspace< T >::gettotmodes(), COMETIC< T >::MeshID0, COMETIC< T >::MeshID1, KSConnectivity< T >::multiplyOther(), KSConnectivity< T >::multiplySelf(), Array< T >::resize(), FaceGroup::site, and Array< T >::zero().

Referenced by COMETModel< T >::MakeCoarseModel().

468  {
469  const int listSize=fineList.size();
470  for(int ic=0;ic<listSize;ic++)
471  {
472  COMETIC<T>& fineIC=*fineList[ic];
473  const IntArray& FineToCoarse0=*fineIC.FineToCoarse0;
474  const IntArray& FineToCoarse1=*fineIC.FineToCoarse1;
475  const int Mid0=fineIC.MeshID0;
476  const int Mid1=fineIC.MeshID1;
477  const int Fg0=fineIC.FgID0;
478  const int Fg1=fineIC.FgID1;
479  const Mesh& mesh0=*_meshes[Mid0];
480  const Mesh& mesh1=*_meshes[Mid1];
481  const FaceGroup& fineFg0=mesh0.getFaceGroup(Fg0);
482  const FaceGroup& fineFg1=mesh1.getFaceGroup(Fg1);
483  const StorageSite& fineFaces0=fineFg0.site;
484  const StorageSite& fineFaces1=fineFg1.site;
485  const StorageSite::CommonMap& ComMap = fineFaces0.getCommonMap();
486  const IntArray& common01=*(ComMap.find(&fineFaces1)->second);
487 
488  const int faceCount=fineFaces1.getCount();
489  const VectorT3Array& FArea0=
490  dynamic_cast<const VectorT3Array&>(_geomFields.area[fineFaces0]);
491  TKClist& Fkclist01=fineIC.getKConnectivity(Fg0);
492  TKClist& Fkclist10=fineIC.getKConnectivity(Fg1);
493  COMETIC<T>* coarseICptr=new COMETIC<T>(Mid0,Fg0,Mid1,Fg1,faceCount);
494  coarseList[ic]=coarseICptr;
495  COMETIC<T>& coarseIC=*coarseICptr;
496  TKClist& Ckclist01=coarseIC.getKConnectivity(Fg0);
497  TKClist& Ckclist10=coarseIC.getKConnectivity(Fg1);
498  Tkspace& kspace0=*_KList[_MeshKspaceMap[Mid0]];
499  Tkspace& kspace1=*_KList[_MeshKspaceMap[Mid1]];
500  const int k0len=kspace0.gettotmodes();
501  const int k1len=kspace1.gettotmodes();
502 
503  Mesh& Cmesh0=*coarseMeshes[Mid0];
504  Mesh& Cmesh1=*coarseMeshes[Mid1];
505  FaceGroup& coarseFg0=const_cast<FaceGroup&>(Cmesh0.getFaceGroup(Fg0));
506  FaceGroup& coarseFg1=const_cast<FaceGroup&>(Cmesh1.getFaceGroup(Fg1));
507  StorageSite& coarseFaces0=coarseFg0.site;
508  StorageSite& coarseFaces1=coarseFg1.site;
509 
510  int coarseCount(0);
511  for(int f=0;f<faceCount;f++)
512  if(FineToCoarse0[f]>coarseCount)
513  coarseCount=FineToCoarse0[f];
514  coarseCount+=1;
515 
516  IntArrayPtr CoarseComm01Ptr(new IntArray(coarseCount));
517  IntArray& CoarseComm01=*CoarseComm01Ptr;
518  IntArrayPtr CoarseComm10Ptr(new IntArray(coarseCount));
519  IntArray& CoarseComm10=*CoarseComm10Ptr;
520 
521  Ckclist01.clear();
522  Ckclist01.resize(coarseCount, NULL);
523  Ckclist10.clear();
524  Ckclist10.resize(coarseCount, NULL);
525 
526  VectorT3Array sumArea(coarseCount);
527 
528  sumArea.zero();
529 
530  for(int f=0;f<faceCount;f++)
531  sumArea[FineToCoarse0[f]]+=FArea0[f];
532 
533  for(int f=0;f<faceCount;f++)
534  {
535  const int f1=common01[f];
536  const int cF0=FineToCoarse0[f];
537  const int cF1=FineToCoarse1[f1];
538  CoarseComm01[cF0]=cF1;
539  CoarseComm10[cF1]=cF0;
540  const VectorT3& sumVec=sumArea[cF0];
541  const VectorT3& partVec=FArea0[f];
542  const T num=sumVec[0]*partVec[0]+sumVec[1]*partVec[1]+
543  sumVec[2]*partVec[2];
544  const T den=sumVec[0]*sumVec[0]+sumVec[1]*sumVec[1]+
545  sumVec[2]*sumVec[2];
546  const T factor=num/den;
547 
548  TKConn& Fconn01=*Fkclist01[f];
549  TKConn& Fconn10=*Fkclist10[f1];
550 
551  if(Ckclist01[cF0]==NULL)
552  {
553  TKConn* Cconn01=new TKConn(k0len+1,k1len+1); //must include lattice connection (reason for +1)
554  Cconn01->copyFrom(Fconn01);
555  Cconn01->multiplySelf(factor);
556  Cconn01->multiplyOther(factor);
557  Ckclist01[cF0]=Cconn01;
558  }
559  else
560  {
561  TKConn Cconn01(k0len+1,k1len+1);
562  Cconn01.copyFrom(Fconn01);
563  Cconn01.multiplySelf(factor);
564  Cconn01.multiplyOther(factor);
565  (Ckclist01[cF0])->addToSelf(Cconn01);
566  (Ckclist01[cF0])->addToOther(Cconn01);
567  }
568 
569  if(Ckclist10[cF1]==NULL)
570  {
571  TKConn* Cconn10=new TKConn(k1len+1,k0len+1);
572  Cconn10->copyFrom(Fconn10);
573  Cconn10->multiplySelf(factor);
574  Cconn10->multiplyOther(factor);
575  Ckclist10[cF1]=Cconn10;
576  }
577  else
578  {
579  TKConn Cconn10(k1len+1,k0len+1);
580  Cconn10.copyFrom(Fconn10);
581  Cconn10.multiplySelf(factor);
582  Cconn10.multiplyOther(factor);
583  (Ckclist10[cF1])->addToSelf(Cconn10);
584  (Ckclist10[cF1])->addToOther(Cconn10);
585  }
586 
587  }
588 
589  coarseFaces0.getCommonMap()[&coarseFaces1]=CoarseComm01Ptr;
590  coarseFaces1.getCommonMap()[&coarseFaces0]=CoarseComm10Ptr;
591 
592  }
593  }
Definition: Mesh.h:28
MeshKspaceMap _MeshKspaceMap
const FaceGroup & getFaceGroup(const int fgId) const
Definition: Mesh.cpp:1570
Definition: Mesh.h:49
const CommonMap & getCommonMap() const
Definition: StorageSite.h:60
const GeomFields & _geomFields
Array< int > IntArray
Array< int > * FineToCoarse1
const MeshList & _meshes
TkspList & _KList
void resize(const int newLength)
Definition: Array.h:56
map< const StorageSite *, shared_ptr< Array< int > > > CommonMap
Definition: StorageSite.h:25
shared_ptr< IntArray > IntArrayPtr
int getCount() const
Definition: StorageSite.h:39
Array< int > * FineToCoarse0
Field area
Definition: GeomFields.h:23
Kspace< T > Tkspace
KSConnectivity< T > TKConn
vector< TKConn * > TKClist
const TKClist & getKConnectivity(const int fgid) const
StorageSite site
Definition: Mesh.h:40
template<class T>
void COMETInterface< T >::makeDMMcoeffs ( COMETIC< T > &  ic)
inline

Definition at line 44 of file COMETInterface.h.

References COMETInterface< T >::_geomFields, COMETInterface< T >::_KList, COMETInterface< T >::_macro, COMETInterface< T >::_meshes, COMETInterface< T >::_MeshKspaceMap, KSConnectivity< T >::addCountOther(), KSConnectivity< T >::addCountSelf(), KSConnectivity< T >::addOther(), KSConnectivity< T >::addSelf(), GeomFields::area, pmode< T >::calce0(), COMETIC< T >::clearConnections(), GeomFields::coordinate, COMETIC< T >::FgID0, COMETIC< T >::FgID1, COMETInterface< T >::findWallTemp(), KSConnectivity< T >::finishAddOther(), KSConnectivity< T >::finishAddSelf(), KSConnectivity< T >::finishCountOther(), KSConnectivity< T >::finishCountSelf(), Mesh::getCellCells(), Mesh::getCellFaces(), Mesh::getCells(), StorageSite::getCount(), kvol< T >::getdk3(), Kspace< T >::getDOSptr(), Mesh::getFaceCells(), Mesh::getFaceGroup(), DensityOfStates< T >::getFreqMidsT(), pmode< T >::getIndex(), COMETIC< T >::getKConnectivity(), DensityOfStates< T >::getKIndices(), Kspace< T >::getkvol(), Array< T >::getLength(), DensityOfStates< T >::getMIndices(), kvol< T >::getmode(), StorageSite::getOffset(), StorageSite::getScatterMap(), Kspace< T >::gettotmodes(), Kspace< T >::getTransArray(), pmode< T >::getv(), KSConnectivity< T >::initOtherCount(), KSConnectivity< T >::initSelfCount(), COMETIC< T >::MeshID0, COMETIC< T >::MeshID1, FaceGroup::site, sqrt(), and PhononMacro::temperature.

Referenced by COMETModel< T >::init(), and COMETModel< T >::initFromOld().

45  {
46  const int Mid0=ic.MeshID0;
47  const int Mid1=ic.MeshID1;
48  const int Fid0=ic.FgID0;
49  const int Fid1=ic.FgID1;
50  const Mesh& mesh0=*_meshes[Mid0];
51  const Mesh& mesh1=*_meshes[Mid1];
52  Tkspace& kspace0=*_KList[_MeshKspaceMap[Mid0]];
53  Tkspace& kspace1=*_KList[_MeshKspaceMap[Mid1]];
54  const int k0len=kspace0.gettotmodes();
55  const int k1len=kspace1.gettotmodes();
56  const StorageSite& faces0=mesh0.getFaceGroup(Fid0).site;
57  const StorageSite& faces1=mesh1.getFaceGroup(Fid1).site;
58  const ScatterMap& ScatMap01=faces0.getScatterMap();
59  const IntArray& scatter01=(*ScatMap01.find(&faces1)->second);
60  const StorageSite& cells0=mesh0.getCells();
61  const StorageSite& cells1=mesh1.getCells();
62  const CRConnectivity& faceCells0=mesh0.getFaceCells(faces0);
63  const CRConnectivity& faceCells1=mesh1.getFaceCells(faces1);
64  const CRConnectivity& CellCells1=mesh1.getCellCells();
65  const CRConnectivity& CellFaces1=mesh1.getCellFaces();
66  const int face1Offset=faces1.getOffset();
67  const int faceCount=faces0.getCount();
68  TKClist& kclist01=ic.getKConnectivity(Fid0);
69  TKClist& kclist10=ic.getKConnectivity(Fid1);
70  const Field& faceAreaField=_geomFields.area;
71  const Field& coordsField=_geomFields.coordinate;
72  const VectorT3Array& faceAreaArray=dynamic_cast<const VectorT3Array&>(faceAreaField[faces0]);
73  const VectorT3Array& coord0Array=dynamic_cast<const VectorT3Array&>(coordsField[cells0]);
74  TArray& TL0Array=dynamic_cast<TArray&>(_macro.temperature[cells0]);
75  TArray& TL1Array=dynamic_cast<TArray&>(_macro.temperature[cells1]);
76 
77  DOST& dos0=*kspace0.getDOSptr();
78  DOST& dos1=*kspace1.getDOSptr();
79  TArray& freqMids=dos0.getFreqMidsT();
80  const T binNos=freqMids.getLength();
81  const TArray& transArray01=kspace0.getTransArray(kspace1);
82  const TArray& transArray10=kspace1.getTransArray(kspace0);
83 
84  ic.clearConnections();
85 
86  kclist01.resize(faceCount);
87  kclist10.resize(faceCount);
88 
89  for(int f=0;f<faceCount;f++)
90  {
91  const VectorT3& An=faceAreaArray[f];
92  VectorT3 n=An/sqrt(pow(An[0],2)+pow(An[1],2)+pow(An[2],2));
93  const int cell0=faceCells0(f,0);
94  const int cell0ghost=faceCells0(f,1);
95  const int cell1ghost=scatter01[f];
96  const int cell1=CellCells1(cell1ghost,0);
97  const int f1=CellFaces1(cell1ghost,0)-face1Offset;
98  const VectorT3 c0Pos=coord0Array[cell0];
99  const VectorT3 cGhstPos=coord0Array[cell0ghost];
100  const VectorT3 from0toGhst=cGhstPos-c0Pos;
101  T TL1(TL1Array[cell1]), TL0(TL0Array[cell0]);
102 
103  if((n[0]*from0toGhst[0]+n[1]*from0toGhst[1]+n[2]*from0toGhst[2])<0.)
104  n*=-1.;
105 
106  //TL1=300.;
107  //TL0=300.;
108  findWallTemp(Mid0,cell0,cell0ghost,An,TL0);
109  findWallTemp(Mid1,cell1,cell1ghost,-An,TL1);
110 
111  TKConn* conn01=new TKConn(k0len+1,k1len+1); //must include lattice connection (reason for +1)
112  TKConn* conn10=new TKConn(k1len+1,k0len+1);
113 
114  //Start Counting
115  conn01->initSelfCount();
116  conn01->initOtherCount();
117  conn10->initSelfCount();
118  conn10->initOtherCount();
119  for(int binIndx=0;binIndx<binNos;binIndx++)
120  {
121  IntArray& k0kpts=dos0.getKIndices(binIndx);
122  IntArray& k1kpts=dos1.getKIndices(binIndx);
123  IntArray& k0mpts=dos0.getMIndices(binIndx);
124  IntArray& k1mpts=dos1.getMIndices(binIndx);
125  IntArray pos0self(k0kpts.getLength());
126  IntArray pos1self(k1kpts.getLength());
127  IntArray pos0other(k0kpts.getLength());
128  IntArray pos1other(k1kpts.getLength());
129  const T t01=transArray01[binIndx];
130  const T r01=1.-t01;
131  const T t10=transArray10[binIndx];
132  const T r10=1-t10;
133 
134  int out0(0);
135  int out1(0);
136  T in0sum(0.);
137  T in1sum(0.);
138  pos0self.zero();
139  pos1self.zero();
140  pos0other.zero();
141  pos1other.zero();
142 
143  for(int kI=0;kI<k0kpts.getLength();kI++)
144  {
145  Tkvol& kvol0=kspace0.getkvol(k0kpts[kI]);
146  T dk30=kvol0.getdk3();
147  Tmode& mode0=kvol0.getmode(k0mpts[kI]);
148  VectorT3 vg0=mode0.getv();
149  T v0dotN=vg0[0]*n[0]+vg0[1]*n[1]+vg0[2]*n[2];
150 
151  if(v0dotN>=0)
152  {
153  out0++;
154  int count0=mode0.getIndex()-1;
155  conn01->addCountSelf(count0,1);
156  //conn01->setSelf(count0,0,count0,1.);
157  }
158  else
159  {
160  in0sum-=v0dotN*dk30*mode0.calce0(TL0);
161  //incp0sum+=mode0.calcde0dT(TL0)*dk30;
162  }
163  }
164 
165  for(int kI=0;kI<k1kpts.getLength();kI++)
166  {
167  Tkvol& kvol1=kspace1.getkvol(k1kpts[kI]);
168  T dk31=kvol1.getdk3();
169  Tmode& mode1=kvol1.getmode(k1mpts[kI]);
170  VectorT3 vg1=mode1.getv();
171  T v1dotN=vg1[0]*n[0]+vg1[1]*n[1]+vg1[2]*n[2];
172 
173  if(v1dotN<=0)
174  {
175  out1++;
176  int count1=mode1.getIndex()-1;
177  conn10->addCountSelf(count1,1);
178  //conn10->setSelf(count1,0,count1,1.);
179  }
180  else
181  {
182  in1sum+=v1dotN*dk31*mode1.calce0(TL1);
183  //incp1sum+=mode1.calcde0dT(TL1)*dk31;
184  }
185  }
186 
187  for(int kI=0;kI<k0kpts.getLength();kI++)
188  {
189  Tkvol& kvol0=kspace0.getkvol(k0kpts[kI]);
190  Tmode& mode0=kvol0.getmode(k0mpts[kI]);
191  int count0=mode0.getIndex()-1;
192  VectorT3 vg0=mode0.getv();
193  T v0dotN=vg0[0]*n[0]+vg0[1]*n[1]+vg0[2]*n[2];
194 
195  if(v0dotN<0)
196  {
197  conn01->addCountOther(count0,out1);
198  conn01->addCountSelf(count0,out0);
199  }
200  }
201 
202  for(int kI=0;kI<k1kpts.getLength();kI++)
203  {
204  Tkvol& kvol1=kspace1.getkvol(k1kpts[kI]);
205  Tmode& mode1=kvol1.getmode(k1mpts[kI]);
206  int count1=mode1.getIndex()-1;
207  VectorT3 vg1=mode1.getv();
208  T v1dotN=vg1[0]*n[0]+vg1[1]*n[1]+vg1[2]*n[2];
209 
210  if(v1dotN>0)
211  {
212  conn10->addCountOther(count1,out0);
213  conn10->addCountSelf(count1,out1);
214  }
215 
216  }
217 
218  }
219 
220  conn01->finishCountSelf();
221  conn01->finishCountOther();
222  conn10->finishCountSelf();
223  conn10->finishCountOther();
224 
225  for(int binIndx=0;binIndx<binNos;binIndx++)
226  {
227  IntArray& k0kpts=dos0.getKIndices(binIndx);
228  IntArray& k1kpts=dos1.getKIndices(binIndx);
229  IntArray& k0mpts=dos0.getMIndices(binIndx);
230  IntArray& k1mpts=dos1.getMIndices(binIndx);
231  IntArray pos0self(k0kpts.getLength());
232  IntArray pos1self(k1kpts.getLength());
233  IntArray pos0other(k0kpts.getLength());
234  IntArray pos1other(k1kpts.getLength());
235  const T t01=transArray01[binIndx];
236  const T r01=1.-t01;
237  const T t10=transArray10[binIndx];
238  const T r10=1-t10;
239 
240  int out0(0);
241  int out1(0);
242  T in0sum(0.);
243  T in1sum(0.);
244  pos0self.zero();
245  pos1self.zero();
246  pos0other.zero();
247  pos1other.zero();
248 
249  for(int kI=0;kI<k0kpts.getLength();kI++)
250  {
251  Tkvol& kvol0=kspace0.getkvol(k0kpts[kI]);
252  T dk30=kvol0.getdk3();
253  Tmode& mode0=kvol0.getmode(k0mpts[kI]);
254  VectorT3 vg0=mode0.getv();
255  T v0dotN=vg0[0]*n[0]+vg0[1]*n[1]+vg0[2]*n[2];
256 
257  if(v0dotN>=0)
258  {
259  out0++;
260  int count0=mode0.getIndex()-1;
261  conn01->addSelf(count0,count0,1.); //upwinding
262  }
263  else
264  {
265  in0sum-=v0dotN*dk30*mode0.calce0(TL0);
266  //incp0sum+=mode0.calcde0dT(TL0)*dk30;
267  }
268  }
269 
270  for(int kI=0;kI<k1kpts.getLength();kI++)
271  {
272  Tkvol& kvol1=kspace1.getkvol(k1kpts[kI]);
273  T dk31=kvol1.getdk3();
274  Tmode& mode1=kvol1.getmode(k1mpts[kI]);
275  VectorT3 vg1=mode1.getv();
276  T v1dotN=vg1[0]*n[0]+vg1[1]*n[1]+vg1[2]*n[2];
277 
278  if(v1dotN<=0)
279  {
280  out1++;
281  int count1=mode1.getIndex()-1;
282  conn10->addSelf(count1,count1,1.); //upwinding
283  }
284  else
285  {
286  in1sum+=v1dotN*dk31*mode1.calce0(TL1);
287  //incp1sum+=mode1.calcde0dT(TL1)*dk31;
288  }
289  }
290 
291  for(int kI=0;kI<k0kpts.getLength();kI++)
292  {
293  Tkvol& kvol0=kspace0.getkvol(k0kpts[kI]);
294  Tmode& mode0=kvol0.getmode(k0mpts[kI]);
295  //T dk30=kvol0.getdk3();
296  T de0dT0=mode0.calce0(TL0);
297  int count0=mode0.getIndex()-1;
298  VectorT3 vg0=mode0.getv();
299  T v0dotN=vg0[0]*n[0]+vg0[1]*n[1]+vg0[2]*n[2];
300 
301  if(v0dotN<0)
302  {
303  for(int kkI=0;kkI<k0kpts.getLength();kkI++)
304  {
305  Tkvol& kkvol0=kspace0.getkvol(k0kpts[kkI]);
306  T ddk30=kkvol0.getdk3();
307  Tmode& mmode0=kkvol0.getmode(k0mpts[kkI]);
308  int ccount0=mmode0.getIndex()-1;
309  VectorT3 vvg0=mmode0.getv();
310  T vv0dotN=vvg0[0]*n[0]+vvg0[1]*n[1]+vvg0[2]*n[2];
311 
312  if(vv0dotN>=0)
313  {
314  T coeff=vv0dotN*ddk30/in0sum*r01*de0dT0;
315  conn01->addSelf(count0,ccount0,coeff);
316  //pos0self[kI]++;
317  }
318  }
319 
320  for(int kkI=0;kkI<k1kpts.getLength();kkI++)
321  {
322  Tkvol& kkvol1=kspace1.getkvol(k1kpts[kkI]);
323  T ddk31=kkvol1.getdk3();
324  Tmode& mmode1=kkvol1.getmode(k1mpts[kkI]);
325  int ccount1=mmode1.getIndex()-1;
326  VectorT3 vvg1=mmode1.getv();
327  T vv1dotN=vvg1[0]*n[0]+vvg1[1]*n[1]+vvg1[2]*n[2];
328 
329  if(vv1dotN<=0)
330  {
331  T coeff=-vv1dotN*ddk31/in0sum*t10*de0dT0;
332  conn01->addOther(count0,ccount1,coeff);
333  //pos0other[kI]++;
334  }
335  }
336  }
337  }
338 
339  for(int kI=0;kI<k1kpts.getLength();kI++)
340  {
341  Tkvol& kvol1=kspace1.getkvol(k1kpts[kI]);
342  Tmode& mode1=kvol1.getmode(k1mpts[kI]);
343  //T dk31=kvol1.getdk3();
344  T de0dT1=mode1.calce0(TL1);
345  int count1=mode1.getIndex()-1;
346  VectorT3 vg1=mode1.getv();
347  T v1dotN=vg1[0]*n[0]+vg1[1]*n[1]+vg1[2]*n[2];
348 
349  if(v1dotN>0)
350  {
351  for(int kkI=0;kkI<k1kpts.getLength();kkI++)
352  {
353  Tkvol& kkvol1=kspace1.getkvol(k1kpts[kkI]);
354  T ddk31=kkvol1.getdk3();
355  Tmode& mmode1=kkvol1.getmode(k1mpts[kkI]);
356  int ccount1=mmode1.getIndex()-1;
357  VectorT3 vvg1=mmode1.getv();
358  T vv1dotN=vvg1[0]*n[0]+vvg1[1]*n[1]+vvg1[2]*n[2];
359 
360  if(vv1dotN<=0)
361  {
362  T coeff=-vv1dotN*ddk31/in1sum*r10*de0dT1;
363  conn10->addSelf(count1,ccount1,coeff);
364  //pos1self[kI]++;
365  }
366  }
367 
368  for(int kkI=0;kkI<k0kpts.getLength();kkI++)
369  {
370  Tkvol& kkvol0=kspace0.getkvol(k0kpts[kkI]);
371  T ddk30=kkvol0.getdk3();
372  Tmode& mmode0=kkvol0.getmode(k0mpts[kkI]);
373  int ccount0=mmode0.getIndex()-1;
374  VectorT3 vvg0=mmode0.getv();
375  T vv0dotN=vvg0[0]*n[0]+vvg0[1]*n[1]+vvg0[2]*n[2];
376 
377  if(vv0dotN>=0)
378  {
379  T coeff=vv0dotN*ddk30/in1sum*t01*de0dT1;
380  conn10->addOther(count1,ccount0,coeff);
381  //pos1other[kI]++;
382  }
383  }
384  }
385  }
386  }
387 
388  conn01->finishAddSelf();
389  conn01->finishAddOther();
390  conn10->finishAddSelf();
391  conn10->finishAddOther();
392 
393  kclist01[f]=conn01;
394  kclist10[f1]=conn10;
395  }
396 
397  }
Array< T > TArray
Field coordinate
Definition: GeomFields.h:19
Definition: Field.h:14
MeshKspaceMap _MeshKspaceMap
Field temperature
Definition: PhononMacro.h:21
kvol< T > Tkvol
const FaceGroup & getFaceGroup(const int fgId) const
Definition: Mesh.cpp:1570
Definition: Mesh.h:49
const GeomFields & _geomFields
Array< int > IntArray
Tangent sqrt(const Tangent &a)
Definition: Tangent.h:317
const MeshList & _meshes
const CRConnectivity & getCellFaces() const
Definition: Mesh.cpp:454
TkspList & _KList
pmode< T > Tmode
DensityOfStates< T > DOST
const CRConnectivity & getCellCells() const
Definition: Mesh.cpp:480
const StorageSite & getCells() const
Definition: Mesh.h:109
PhononMacro & _macro
StorageSite::ScatterMap ScatterMap
const ScatterMap & getScatterMap() const
Definition: StorageSite.h:58
const CRConnectivity & getFaceCells(const StorageSite &site) const
Definition: Mesh.cpp:388
int getOffset() const
Definition: StorageSite.h:87
int getCount() const
Definition: StorageSite.h:39
void clearConnections()
void findWallTemp(const int meshID, const int cell0, const int cell0ghost, const VectorT3 Af, T &Tguess)
Field area
Definition: GeomFields.h:23
Kspace< T > Tkspace
KSConnectivity< T > TKConn
vector< TKConn * > TKClist
const TKClist & getKConnectivity(const int fgid) const
StorageSite site
Definition: Mesh.h:40
template<class T>
void COMETInterface< T >::makeEquilibriumArray ( const int  msh,
const T  Temp,
TArray o 
)
inline

Definition at line 972 of file COMETInterface.h.

References COMETInterface< T >::_KList, COMETInterface< T >::_meshes, COMETInterface< T >::_MeshKspaceMap, pmode< T >::calce0(), pmode< T >::getIndex(), Kspace< T >::getkvol(), Array< T >::getLength(), Kspace< T >::getlength(), kvol< T >::getmode(), kvol< T >::getmodenum(), and Kspace< T >::gettotmodes().

973  {
974  const Mesh& mesh=*_meshes[msh];
975  Tkspace& kspace=*_KList[_MeshKspaceMap[msh]];
976  int klen=kspace.gettotmodes();
977  int kpts=kspace.getlength();
978 
979  if(klen+1==o.getLength())
980  {
981  for(int k=0;k<kpts;k++)
982  {
983  Tkvol& kvol=kspace.getkvol(k);
984  const int numModes=kvol.getmodenum();
985  for(int m=0;m<numModes;m++)
986  {
987  Tmode& mode=kvol.getmode(m);
988  const int count=mode.getIndex()-1;
989  o[count]=mode.calce0(Temp);
990  }
991  }
992  o[klen]=0.;
993  }
994  else
995  throw CException("makeEquilibriumArray: Array not the same size as the k-space!");
996  }
MeshKspaceMap _MeshKspaceMap
kvol< T > Tkvol
Definition: Mesh.h:49
int getmodenum()
Definition: kvol.h:43
const MeshList & _meshes
TkspList & _KList
pmode< T > Tmode
Kspace< T > Tkspace
Definition: kvol.h:14
template<class T>
void COMETInterface< T >::makeNoInterfaceCoeffs ( COMETIC< T > &  ic)
inline

Definition at line 399 of file COMETInterface.h.

References COMETInterface< T >::_KList, COMETInterface< T >::_meshes, COMETInterface< T >::_MeshKspaceMap, KSConnectivity< T >::addCountOther(), KSConnectivity< T >::addCountSelf(), KSConnectivity< T >::addOther(), KSConnectivity< T >::addSelf(), COMETIC< T >::clearConnections(), COMETIC< T >::FgID0, COMETIC< T >::FgID1, KSConnectivity< T >::finishAddOther(), KSConnectivity< T >::finishAddSelf(), KSConnectivity< T >::finishCountOther(), KSConnectivity< T >::finishCountSelf(), StorageSite::getCount(), Mesh::getFaceGroup(), COMETIC< T >::getKConnectivity(), Kspace< T >::gettotmodes(), KSConnectivity< T >::initOtherCount(), KSConnectivity< T >::initSelfCount(), COMETIC< T >::MeshID0, COMETIC< T >::MeshID1, and FaceGroup::site.

Referenced by COMETModel< T >::init().

400  {//this only works if you have the same material on either side of the interface.
401  //it is just making the transmission operator the identity matrix and the
402  //reflection operator zeros.
403 
404  const int Fid0=ic.FgID0;
405  const int Fid1=ic.FgID1;
406  const int Mid0=ic.MeshID0;
407  const int Mid1=ic.MeshID1;
408  const Mesh& mesh0=*_meshes[Mid0];
409  const StorageSite& faces0=mesh0.getFaceGroup(Fid0).site;
410  const int faceCount=faces0.getCount();
411  Tkspace& kspace0=*_KList[_MeshKspaceMap[Mid0]];
412  Tkspace& kspace1=*_KList[_MeshKspaceMap[Mid1]];
413  TKClist& kclist01=ic.getKConnectivity(Fid0);
414  TKClist& kclist10=ic.getKConnectivity(Fid1);
415 
416  if(kspace0.gettotmodes()!=kspace1.gettotmodes())
417  throw CException("Must have the same wave vector space on either side.");
418 
419  const int klen(kspace0.gettotmodes());
420 
421  ic.clearConnections();
422 
423  for(int f=0;f<faceCount;f++)
424  {
425  TKConn* conn01=new TKConn(klen+1,klen+1); //must include lattice connection (reason for +1)
426  TKConn* conn10=new TKConn(klen+1,klen+1);
427 
428  conn01->initSelfCount();
429  conn01->initOtherCount();
430  conn10->initSelfCount();
431  conn10->initOtherCount();
432  for(int i=0;i<klen;i++)
433  {
434  conn01->addCountSelf(i,1);
435  conn01->addCountOther(i,1);
436 
437  conn10->addCountSelf(i,1);
438  conn10->addCountOther(i,1);
439  }
440 
441  conn01->finishCountSelf();
442  conn01->finishCountOther();
443  conn10->finishCountSelf();
444  conn10->finishCountOther();
445 
446  for(int i=0;i<klen;i++)
447  {
448  conn01->addSelf(i,i,0.);
449  conn01->addOther(i,i,1.);
450 
451  conn10->addSelf(i,i,0.);
452  conn10->addOther(i,i,1.);
453  }
454 
455  conn01->finishAddSelf();
456  conn01->finishAddOther();
457  conn10->finishAddSelf();
458  conn10->finishAddOther();
459 
460  kclist01.push_back(conn01);
461  kclist10.push_back(conn10);
462 
463  }
464 
465  }
MeshKspaceMap _MeshKspaceMap
const FaceGroup & getFaceGroup(const int fgId) const
Definition: Mesh.cpp:1570
Definition: Mesh.h:49
const MeshList & _meshes
TkspList & _KList
int getCount() const
Definition: StorageSite.h:39
void clearConnections()
Kspace< T > Tkspace
KSConnectivity< T > TKConn
vector< TKConn * > TKClist
const TKClist & getKConnectivity(const int fgid) const
StorageSite site
Definition: Mesh.h:40
template<class T>
void COMETInterface< T >::makeValueArray ( const int  msh,
const int  c,
TArray o 
)
inline

Definition at line 958 of file COMETInterface.h.

References COMETInterface< T >::_KList, COMETInterface< T >::_MeshKspaceMap, Kspace< T >::geteCellVals(), Array< T >::getLength(), and Kspace< T >::gettotmodes().

Referenced by COMETInterface< T >::updateOtherGhost(), and COMETInterface< T >::updateResid().

959  {
960  Tkspace& kspace=*_KList[_MeshKspaceMap[msh]];
961  int klen=kspace.gettotmodes();
962 
963  if(klen+1==o.getLength())
964  {
965  kspace.geteCellVals(c,o);
966  o[klen]=0.;
967  }
968  else
969  throw CException("makeValueArray: Array not the same size as the k-space!");
970  }
MeshKspaceMap _MeshKspaceMap
TkspList & _KList
Kspace< T > Tkspace
template<class T>
void COMETInterface< T >::updateOtherGhost ( const COMETIC< T > &  ic,
const int  Mid0,
const bool  plusFAS 
)
inline

Definition at line 820 of file COMETInterface.h.

References COMETInterface< T >::_KList, COMETInterface< T >::_meshes, COMETInterface< T >::_MeshKspaceMap, Kspace< T >::addFASint(), COMETInterface< T >::Distribute(), COMETIC< T >::FgID0, COMETIC< T >::FgID1, StorageSite::getCommonMap(), StorageSite::getCount(), Kspace< T >::getDK3(), Mesh::getFaceCells(), Mesh::getFaceGroup(), COMETIC< T >::getKConnectivity(), Kspace< T >::gettotmodes(), COMETInterface< T >::makeValueArray(), COMETIC< T >::MeshID0, COMETIC< T >::MeshID1, KSConnectivity< T >::multiplyOther(), KSConnectivity< T >::multiplySelf(), FaceGroup::site, and Array< T >::zero().

Referenced by COMETModel< T >::init(), and COMETModel< T >::smooth().

821  {//always going to be scattering the values of mesh with id0
822 
823  int Mid1,Fid0,Fid1;
824 
825  if(Mid0==ic.MeshID1)
826  {
827  Mid1=ic.MeshID0;
828  Fid1=ic.FgID0;
829  Fid0=ic.FgID1;
830  }
831  else
832  {
833  Mid1=ic.MeshID1;
834  Fid1=ic.FgID1;
835  Fid0=ic.FgID0;
836  }
837 
838  const Mesh& mesh0=*_meshes[Mid0];
839  const Mesh& mesh1=*_meshes[Mid1];
840  Tkspace& kspace0=*_KList[_MeshKspaceMap[Mid0]];
841  Tkspace& kspace1=*_KList[_MeshKspaceMap[Mid1]];
842  const T DK30=kspace0.getDK3();
843  const T DK31=kspace1.getDK3();
844  const StorageSite& faces0=mesh0.getFaceGroup(Fid0).site;
845  const StorageSite& faces1=mesh1.getFaceGroup(Fid1).site;
846  const ScatterMap& CommMap01=faces0.getCommonMap();
847  const IntArray& common01=(*CommMap01.find(&faces1)->second);
848  const CRConnectivity& faceCells0=mesh0.getFaceCells(faces0);
849  const CRConnectivity& faceCells1=mesh1.getFaceCells(faces1);
850  const TKClist& KconnList1=ic.getKConnectivity(Fid1);
851  const int numFaces=faces0.getCount();
852  const int klen0=kspace0.gettotmodes()+1;
853  const int klen1=kspace1.gettotmodes()+1;
854 
855  TArray transmitted(klen1);
856  TArray reflected(klen1);
857  TArray vals0(klen0);
858  TArray vals1(klen1);
859 
860  for(int f0=0;f0<numFaces;f0++)
861  {
862  const int cell0=faceCells0(f0,0);
863  const int f1=common01[f0];
864  const int cell1ghost=faceCells1(f1,1);
865  const int cell1=faceCells1(f1,0);
866 
867  const TKConn& Kconn1=*KconnList1[f1];
868 
869  vals1.zero();
870  vals0.zero();
871 
872  makeValueArray(Mid0,cell0,vals0);
873  makeValueArray(Mid1,cell1,vals1);
874 
875  Kconn1.multiplyOther(vals0,transmitted,DK30);
876  Kconn1.multiplySelf(vals1,reflected,DK31);
877  transmitted+=reflected;
878  if(plusFAS)
879  kspace1.addFASint(cell1ghost,transmitted);
880  Distribute(Mid1,cell1ghost,transmitted);
881 
882  }
883  }
Array< T > TArray
MeshKspaceMap _MeshKspaceMap
const FaceGroup & getFaceGroup(const int fgId) const
Definition: Mesh.cpp:1570
Definition: Mesh.h:49
const CommonMap & getCommonMap() const
Definition: StorageSite.h:60
Array< int > IntArray
const MeshList & _meshes
TkspList & _KList
StorageSite::ScatterMap ScatterMap
const CRConnectivity & getFaceCells(const StorageSite &site) const
Definition: Mesh.cpp:388
void makeValueArray(const int msh, const int c, TArray &o)
int getCount() const
Definition: StorageSite.h:39
void Distribute(const int msh, const int cell, TArray &BVec)
Kspace< T > Tkspace
KSConnectivity< T > TKConn
vector< TKConn * > TKClist
const TKClist & getKConnectivity(const int fgid) const
StorageSite site
Definition: Mesh.h:40
template<class T>
void COMETInterface< T >::updateResid ( const COMETIC< T > &  ic,
const bool  plusFAS 
)
inline

Definition at line 885 of file COMETInterface.h.

References COMETInterface< T >::_KList, COMETInterface< T >::_meshes, COMETInterface< T >::_MeshKspaceMap, Kspace< T >::addFASint(), COMETInterface< T >::DistributeResid(), COMETIC< T >::FgID0, COMETIC< T >::FgID1, StorageSite::getCommonMap(), StorageSite::getCount(), Kspace< T >::getDK3(), Mesh::getFaceCells(), Mesh::getFaceGroup(), COMETIC< T >::getKConnectivity(), Kspace< T >::gettotmodes(), COMETInterface< T >::makeValueArray(), COMETIC< T >::MeshID0, COMETIC< T >::MeshID1, KSConnectivity< T >::multiplyOther(), KSConnectivity< T >::multiplySelf(), FaceGroup::site, and Array< T >::zero().

Referenced by COMETModel< T >::updateResid().

886  {
887  int Mid0,Mid1,Fid0,Fid1;
888 
889  Mid0=ic.MeshID0;
890  Mid1=ic.MeshID1;
891  Fid1=ic.FgID1;
892  Fid0=ic.FgID0;
893 
894  const Mesh& mesh0=*_meshes[Mid0];
895  const Mesh& mesh1=*_meshes[Mid1];
896  Tkspace& kspace0=*_KList[_MeshKspaceMap[Mid0]];
897  Tkspace& kspace1=*_KList[_MeshKspaceMap[Mid1]];
898  const T DK30=kspace0.getDK3();
899  const T DK31=kspace1.getDK3();
900  const StorageSite& faces0=mesh0.getFaceGroup(Fid0).site;
901  const StorageSite& faces1=mesh1.getFaceGroup(Fid1).site;
902  const ScatterMap& CommMap01=faces0.getCommonMap();
903  const IntArray& common01=(*CommMap01.find(&faces1)->second);
904  const CRConnectivity& faceCells0=mesh0.getFaceCells(faces0);
905  const CRConnectivity& faceCells1=mesh1.getFaceCells(faces1);
906  const TKClist& KconnList1=ic.getKConnectivity(Fid1);
907  const TKClist& KconnList0=ic.getKConnectivity(Fid0);
908  const int numFaces=faces0.getCount();
909  const int klen0=kspace0.gettotmodes()+1;
910  const int klen1=kspace1.gettotmodes()+1;
911 
912  TArray transmitted01(klen1);
913  TArray reflected10(klen1);
914  TArray transmitted10(klen0);
915  TArray reflected01(klen0);
916  TArray vals0(klen0);
917  TArray vals1(klen1);
918  TArray currentSol0(klen0);
919  TArray currentSol1(klen1);
920 
921  for(int f0=0;f0<numFaces;f0++)
922  {
923  int cell0=faceCells0(f0,0);
924  int cell0ghost=faceCells0(f0,1);
925  int f1=common01[f0];
926  int cell1ghost=faceCells1(f1,1);
927  int cell1=faceCells1(f1,0);
928 
929  const TKConn& Kconn1=*KconnList1[f1];
930  const TKConn& Kconn0=*KconnList0[f0];
931 
932  vals1.zero();
933  vals0.zero();
934 
935  makeValueArray(Mid0,cell0,vals0);
936  makeValueArray(Mid1,cell1,vals1);
937  makeValueArray(Mid0,cell0ghost,currentSol0);
938  makeValueArray(Mid1,cell1ghost,currentSol1);
939 
940  Kconn1.multiplyOther(vals0,transmitted01,DK30);
941  Kconn1.multiplySelf(vals1,reflected10,DK31);
942  transmitted01+=reflected10;
943  transmitted01-=currentSol1; //now transmitted01 is the residual
944  if(plusFAS)
945  kspace1.addFASint(cell1ghost,transmitted01);
946  DistributeResid(Mid1,cell1ghost,transmitted01);
947 
948  Kconn0.multiplyOther(vals1,transmitted10,DK31);
949  Kconn0.multiplySelf(vals0,reflected01,DK30);
950  transmitted10+=reflected01;
951  transmitted10-=currentSol0; //now transmitted10 is the residual
952  if(plusFAS)
953  kspace0.addFASint(cell0ghost,transmitted10);
954  DistributeResid(Mid0,cell0ghost,transmitted10);
955  }
956  }
Array< T > TArray
MeshKspaceMap _MeshKspaceMap
const FaceGroup & getFaceGroup(const int fgId) const
Definition: Mesh.cpp:1570
Definition: Mesh.h:49
const CommonMap & getCommonMap() const
Definition: StorageSite.h:60
Array< int > IntArray
const MeshList & _meshes
TkspList & _KList
StorageSite::ScatterMap ScatterMap
const CRConnectivity & getFaceCells(const StorageSite &site) const
Definition: Mesh.cpp:388
void makeValueArray(const int msh, const int c, TArray &o)
int getCount() const
Definition: StorageSite.h:39
void DistributeResid(const int msh, const int cell, TArray &BVec)
Kspace< T > Tkspace
KSConnectivity< T > TKConn
vector< TKConn * > TKClist
const TKClist & getKConnectivity(const int fgid) const
StorageSite site
Definition: Mesh.h:40
template<class T>
void COMETInterface< T >::ZeroGhost ( const int  msh,
const int  cell 
)
inline

Definition at line 1028 of file COMETInterface.h.

References COMETInterface< T >::_KList, COMETInterface< T >::_macro, COMETInterface< T >::_meshes, COMETInterface< T >::_MeshKspaceMap, Mesh::getCells(), pmode< T >::getfield(), Kspace< T >::getkvol(), Kspace< T >::getlength(), kvol< T >::getmode(), kvol< T >::getmodenum(), and PhononMacro::temperature.

1029  {
1030  const Mesh& mesh=*_meshes[msh];
1031  const StorageSite& cells=mesh.getCells();
1032  Tkspace& kspace=*_KList[_MeshKspaceMap[msh]];
1033  const int klen=kspace.getlength();
1034 
1035  for(int k=0;k<klen;k++)
1036  {
1037  Tkvol& kvol=kspace.getkvol(k);
1038  const int numModes=kvol.getmodenum();
1039  for(int m=0;m<numModes;m++)
1040  {
1041  Tmode& mode=kvol.getmode(m);
1042  Field& efield=mode.getfield();
1043  TArray& eArray=dynamic_cast<TArray&>(efield[cells]);
1044  eArray[cell]=0.;
1045  }
1046  }
1047 
1048  TArray& TlArray=dynamic_cast<TArray&>(_macro.temperature[cells]);
1049  TlArray[cell]=0;
1050  }
Array< T > TArray
Definition: Field.h:14
MeshKspaceMap _MeshKspaceMap
Field temperature
Definition: PhononMacro.h:21
kvol< T > Tkvol
Definition: Mesh.h:49
int getmodenum()
Definition: kvol.h:43
const MeshList & _meshes
TkspList & _KList
pmode< T > Tmode
const StorageSite & getCells() const
Definition: Mesh.h:109
PhononMacro & _macro
Kspace< T > Tkspace
Definition: kvol.h:14

Member Data Documentation

template<class T>
const GeomFields& COMETInterface< T >::_geomFields
private

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