Memosa-FVM  0.2
PhononInterface< X > Class Template Reference

#include <PhononInterface.h>

Collaboration diagram for PhononInterface< X >:

Public Types

typedef NumTypeTraits< X >
::T_Scalar 
T_Scalar
 
typedef Array< int > IntArray
 
typedef Array< T_ScalarTArray
 
typedef Vector< T_Scalar, 3 > VectorT3
 
typedef Array< VectorT3VectorT3Array
 
typedef Array< X > XArray
 
typedef Vector< X, 3 > VectorX3
 
typedef Array< VectorX3VectorX3Array
 
typedef Kspace< X > Xkspace
 
typedef kvol< X > Xkvol
 
typedef pmode< X > Xmode
 
typedef Xmode::Refl_pair Refl_pair
 

Public Member Functions

 PhononInterface (const FaceGroup &fg, const Mesh &mesh, const Mesh &otherMesh, const GeomFields &geomFields, const Xkspace &kspace, const Xkspace &kspaceOther, PhononModelOptions< X > &opts)
 
PhononModelOptions< X > & getOptions ()
 
void applyInterfaceCondition (int f, const X refl, const X trans) const
 
void applyInterfaceCondition (T_Scalar bRefl, T_Scalar bTrans) const
 

Protected Attributes

const FaceGroup_fg
 
const StorageSite_faces
 
const StorageSite_cells
 
const StorageSite_otherCells
 
const Array< int > & _ibType
 
const CRConnectivity_faceCells
 
const Field_areaMagField
 
const TArray_faceAreaMag
 
const Field_areaField
 
const VectorT3Array_faceArea
 
PhononModelOptions< X > & _options
 
const Xkspace_kspace
 
const Xkspace_kspaceOther
 
const int _fg_id
 
const FaceGroup_otherfg
 
const StorageSite_otherFaces
 
const CRConnectivity_otherFaceCells
 
const TArray_faceAreaMagOther
 
const VectorT3Array_faceAreaOther
 

Detailed Description

template<class X>
class PhononInterface< X >

Definition at line 26 of file PhononInterface.h.

Member Typedef Documentation

template<class X>
typedef Array<int> PhononInterface< X >::IntArray

Definition at line 32 of file PhononInterface.h.

template<class X>
typedef Xmode::Refl_pair PhononInterface< X >::Refl_pair

Definition at line 44 of file PhononInterface.h.

template<class X>
typedef NumTypeTraits<X>::T_Scalar PhononInterface< X >::T_Scalar

Definition at line 30 of file PhononInterface.h.

template<class X>
typedef Array<T_Scalar> PhononInterface< X >::TArray

Definition at line 34 of file PhononInterface.h.

template<class X>
typedef Vector<T_Scalar,3> PhononInterface< X >::VectorT3

Definition at line 35 of file PhononInterface.h.

template<class X>
typedef Array<VectorT3> PhononInterface< X >::VectorT3Array

Definition at line 36 of file PhononInterface.h.

template<class X>
typedef Vector<X,3> PhononInterface< X >::VectorX3

Definition at line 39 of file PhononInterface.h.

template<class X>
typedef Array<VectorX3> PhononInterface< X >::VectorX3Array

Definition at line 40 of file PhononInterface.h.

template<class X>
typedef Array<X> PhononInterface< X >::XArray

Definition at line 38 of file PhononInterface.h.

template<class X>
typedef Kspace<X> PhononInterface< X >::Xkspace

Definition at line 41 of file PhononInterface.h.

template<class X>
typedef kvol<X> PhononInterface< X >::Xkvol

Definition at line 42 of file PhononInterface.h.

template<class X>
typedef pmode<X> PhononInterface< X >::Xmode

Definition at line 43 of file PhononInterface.h.

Constructor & Destructor Documentation

template<class X>
PhononInterface< X >::PhononInterface ( const FaceGroup fg,
const Mesh mesh,
const Mesh otherMesh,
const GeomFields geomFields,
const Xkspace kspace,
const Xkspace kspaceOther,
PhononModelOptions< X > &  opts 
)
inline

Definition at line 46 of file PhononInterface.h.

52  :
53 
54  _fg(fg),
55  _faces(fg.site),
56  _cells(mesh.getCells()),
57  _otherCells(otherMesh.getCells()),
58  _ibType(dynamic_cast<const IntArray&>(geomFields.ibType[_cells])),
60  _areaMagField(geomFields.areaMag),
61  _faceAreaMag(dynamic_cast<const TArray&>(_areaMagField[_faces])),
62  _areaField(geomFields.area),
63  _faceArea(dynamic_cast<const VectorT3Array&>(_areaField[_faces])),
64  _options(opts),
65  _kspace(kspace),
66  _kspaceOther(kspaceOther),
67  _fg_id(fg.id),
68  _otherfg(otherMesh.getFaceGroup(fg.id)),
71  _faceAreaMagOther(dynamic_cast<const TArray&>(_areaMagField[_otherFaces])),
72  _faceAreaOther(dynamic_cast<const VectorT3Array&>(_areaField[_otherFaces]))
73 
74  {}
PhononModelOptions< X > & _options
const StorageSite & _faces
const Xkspace & _kspace
const StorageSite & _otherFaces
const FaceGroup & getFaceGroup(const int fgId) const
Definition: Mesh.cpp:1570
const Xkspace & _kspaceOther
const VectorT3Array & _faceAreaOther
const TArray & _faceAreaMagOther
Field ibType
Definition: GeomFields.h:38
const StorageSite & _cells
const Field & _areaMagField
const CRConnectivity & _otherFaceCells
const int id
Definition: Mesh.h:41
const Field & _areaField
const StorageSite & getCells() const
Definition: Mesh.h:109
const CRConnectivity & _faceCells
const CRConnectivity & getFaceCells(const StorageSite &site) const
Definition: Mesh.cpp:388
const TArray & _faceAreaMag
Field area
Definition: GeomFields.h:23
const VectorT3Array & _faceArea
Field areaMag
Definition: GeomFields.h:25
const FaceGroup & _fg
const Array< int > & _ibType
StorageSite site
Definition: Mesh.h:40
const FaceGroup & _otherfg
const StorageSite & _otherCells

Member Function Documentation

template<class X>
void PhononInterface< X >::applyInterfaceCondition ( int  f,
const X  refl,
const X  trans 
) const
inline

Definition at line 79 of file PhononInterface.h.

References PhononInterface< X >::_cells, PhononInterface< X >::_faceArea, PhononInterface< X >::_faceAreaMag, PhononInterface< X >::_faceAreaMagOther, PhononInterface< X >::_faceAreaOther, PhononInterface< X >::_faceCells, PhononInterface< X >::_ibType, PhononInterface< X >::_kspace, PhononInterface< X >::_kspaceOther, PhononInterface< X >::_otherCells, PhononInterface< X >::_otherFaceCells, kvol< T >::getdk3(), pmode< T >::getfield(), Kspace< T >::getkvol(), Kspace< T >::getlength(), kvol< T >::getmode(), kvol< T >::getmodenum(), StorageSite::getSelfCount(), pmode< T >::getv(), Mesh::IBTYPE_FLUID, and sqrt().

Referenced by PhononInterface< X >::applyInterfaceCondition(), and PhononModel< T >::callBoundaryConditions().

80  {
81 
82  int c0 = _faceCells(f,0);
83  int c1 = _faceCells(f,1);
85  if (c1 < _cells.getSelfCount())
86  {
87  // c0 is ghost cell and c1 is boundry cell, so swap cell numbers
88  // so that c1p refers to the ghost cell in the following
89  int temp = c0;
90  c0 = c1;
91  c1 = temp;
92  sign *= -1.0;
93  }
94 
95 
96  X tot_in = 0.; //total incoming energy (to wall)
97  X tot_dk3 = 0.; //total weight of incoming energy
98 
99  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
100  return;
101 
102  // current mesh
103  // sum up energy incoming to boundary (from domain)
104  int numK=_kspace.getlength();
105  for (int k=0;k<numK;k++)
106  {
107 
108  Xkvol& kv=_kspace.getkvol(k);
109  X dk3=kv.getdk3();
110  int numM=kv.getmodenum();
111 
112  for (int m=0;m<numM;m++) //mode loop beg
113  {
114 
115  Xmode& mode=kv.getmode(m);
116  Field& efield=mode.getfield();
117  VectorT3 vg = mode.getv(); // phonon group velocity
118  XArray& e_val = dynamic_cast< XArray&>(efield[_cells]); // e"
119  const VectorT3 en = sign*(_faceArea[f]/_faceAreaMag[f]); //outward normal unit vector to face
120  const VectorT3 sn = vg/sqrt(pow(vg[0],2)+pow(vg[1],2)+pow(vg[2],2));
121  const X sn_dot_en = sn[0]*en[0]+sn[1]*en[1]+sn[2]*en[2];
122  const X vg_dot_en = vg[0]*en[0]+vg[1]*en[1]+vg[2]*en[2];
123 
124  if (sn_dot_en > T_Scalar(0.0))
125  {
126  tot_in+=e_val[c0]*dk3*vg_dot_en;
127  tot_dk3+=vg_dot_en*dk3;
128  }
129  else
130  {
131  e_val[c1]=0.;
132  }
133 
134  } //mode loop end
135  }
136 
137  const X diff_refl = tot_in/tot_dk3; // value for e" leaving the wall
138 
139 
140  // other mesh
141  int c0other = _otherFaceCells(f,0);
142  int c1other = _otherFaceCells(f,1);
144  if (c1other < _otherCells.getSelfCount())
145  {
146  // c0 is ghost cell and c1 is boundry cell, so swap cell numbers
147  // so that c1p refers to the ghost cell in the following
148  int temp = c0other;
149  c0other = c1other;
150  c1other = temp;
151  sign2 *= -1.0;
152  }
153 
154 
155  X tot_in_other = 0.; //total incoming energy (to wall)
156  X tot_dk3_other = 0.; //total weight of incoming energy
157 
158 
159  // sum up energy incoming to boundary (from domain)
160  int numKOther=_kspaceOther.getlength();
161  for (int k=0;k<numKOther;k++)
162  {
163 
164  Xkvol& kv=_kspaceOther.getkvol(k);
165  X dk3=kv.getdk3();
166  int numM=kv.getmodenum();
167 
168  for (int m=0;m<numM;m++) //mode loop beg
169  {
170 
171  Xmode& mode=kv.getmode(m);
172  Field& efield=mode.getfield();
173  VectorT3 vg = mode.getv(); // phonon group velocity
174  XArray& e_val = dynamic_cast< XArray&>(efield[_otherCells]); // e"
175  const VectorT3 en = sign2*(_faceAreaOther[f]/_faceAreaMagOther[f]); //outward normal unit vector to face
176  const VectorT3 sn = vg/sqrt(pow(vg[0],2)+pow(vg[1],2)+pow(vg[2],2));
177  const X sn_dot_en = sn[0]*en[0]+sn[1]*en[1]+sn[2]*en[2];
178  const X vg_dot_en = vg[0]*en[0]+vg[1]*en[1]+vg[2]*en[2];
179 
180  if (sn_dot_en > T_Scalar(0.0))
181  {
182  tot_in_other+=e_val[c0other]*dk3*vg_dot_en;
183  tot_dk3_other+=vg_dot_en*dk3;
184  }
185  else
186  {
187  //e_val[c1]=0.;
188  }
189 
190  } //mode loop end
191  }
192 
193  const X diff_trans = tot_in_other/tot_dk3; // value for e" leaving the wall
194 
195 
196  // assign values for incoming (upwinded) and outgoing (reflected) to/from wall
197  for (int k=0;k<numK;k++)
198  {
199 
200  Xkvol& kv=_kspace.getkvol(k);
201  int numM=kv.getmodenum();
202 
203  for (int m=0;m<numM;m++) //mode loop beg
204  {
205 
206  Xmode& mode=kv.getmode(m);
207  Field& efield=mode.getfield();
208  VectorT3 vg = mode.getv(); // phonon group velocity
209  XArray& e_val = dynamic_cast<XArray&>(efield[_cells]); // e"
210  const VectorT3 en = sign*(_faceArea[f]/_faceAreaMag[f]); //normal unit vector to face
211  const X vg_dot_en = vg[0]*en[0]+vg[1]*en[1]+vg[2]*en[2];
212 
213  if (vg_dot_en > T_Scalar(0.0))
214  {
215 
216  /*Refl_pair& rpairs=mode.getReflpair(_fg_id);
217  X w1=rpairs.first.first;
218  X w2=rpairs.second.first;
219  int k1=rpairs.first.second;
220  int k2=rpairs.second.second;
221  Xmode& mode1=_kspace.getkvol(k1).getmode(m);
222  Xmode& mode2=_kspace.getkvol(k2).getmode(m);
223  Field& field1=mode1.getfield();
224  Field& field2=mode2.getfield();
225  XArray& e_val1=dynamic_cast<XArray&>(field1[_cells]);
226  XArray& e_val2=dynamic_cast<XArray&>(field2[_cells]);
227  e_val1[c1]+=refl*w1*e_val[c0];
228  e_val2[c1]+=refl*w2*e_val[c0];*/
229  e_val[c1]=e_val[c0]; // upwinded value
230  }
231  else
232  {
233  e_val[c1]+=refl*diff_refl; // diffusely reflected value
234  e_val[c1]+=trans*diff_trans; // diffusely transmitted value
235  }
236  } //mode loop end
237  }
238  }
int getSelfCount() const
Definition: StorageSite.h:40
const Xkspace & _kspace
Definition: Field.h:14
Tkvol & getkvol(int n) const
Definition: Kspace.h:390
int getlength() const
Definition: Kspace.h:391
int getmodenum()
Definition: kvol.h:43
const Xkspace & _kspaceOther
pmode< X > Xmode
const VectorT3Array & _faceAreaOther
const TArray & _faceAreaMagOther
const StorageSite & _cells
const CRConnectivity & _otherFaceCells
Tangent sqrt(const Tangent &a)
Definition: Tangent.h:317
Array< X > XArray
NumTypeTraits< X >::T_Scalar T_Scalar
const CRConnectivity & _faceCells
const TArray & _faceAreaMag
const VectorT3Array & _faceArea
const Array< int > & _ibType
T getdk3()
Definition: kvol.h:42
const StorageSite & _otherCells
template<class X>
void PhononInterface< X >::applyInterfaceCondition ( T_Scalar  bRefl,
T_Scalar  bTrans 
) const
inline

Definition at line 240 of file PhononInterface.h.

References PhononInterface< X >::_faces, PhononInterface< X >::applyInterfaceCondition(), and StorageSite::getCount().

241  {
242  for (int i=0; i<_faces.getCount();i++)
243  applyInterfaceCondition(i,bRefl,bTrans);
244  }
const StorageSite & _faces
int getCount() const
Definition: StorageSite.h:39
void applyInterfaceCondition(int f, const X refl, const X trans) const
template<class X>
PhononModelOptions<X>& PhononInterface< X >::getOptions ( )
inline

Definition at line 76 of file PhononInterface.h.

References PhononInterface< X >::_options.

76 {return _options;}
PhononModelOptions< X > & _options

Member Data Documentation

template<class X>
const Field& PhononInterface< X >::_areaField
protected

Definition at line 257 of file PhononInterface.h.

template<class X>
const Field& PhononInterface< X >::_areaMagField
protected

Definition at line 255 of file PhononInterface.h.

template<class X>
const StorageSite& PhononInterface< X >::_cells
protected

Definition at line 251 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
const VectorT3Array& PhononInterface< X >::_faceArea
protected

Definition at line 258 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
const TArray& PhononInterface< X >::_faceAreaMag
protected

Definition at line 256 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
const TArray& PhononInterface< X >::_faceAreaMagOther
protected

Definition at line 266 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
const VectorT3Array& PhononInterface< X >::_faceAreaOther
protected

Definition at line 267 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
const CRConnectivity& PhononInterface< X >::_faceCells
protected

Definition at line 254 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
const StorageSite& PhononInterface< X >::_faces
protected

Definition at line 250 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
const FaceGroup& PhononInterface< X >::_fg
protected

Definition at line 249 of file PhononInterface.h.

template<class X>
const int PhononInterface< X >::_fg_id
protected

Definition at line 262 of file PhononInterface.h.

template<class X>
const Array<int>& PhononInterface< X >::_ibType
protected

Definition at line 253 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
const Xkspace& PhononInterface< X >::_kspace
protected

Definition at line 260 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
const Xkspace& PhononInterface< X >::_kspaceOther
protected

Definition at line 261 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
PhononModelOptions<X>& PhononInterface< X >::_options
protected

Definition at line 259 of file PhononInterface.h.

Referenced by PhononInterface< X >::getOptions().

template<class X>
const StorageSite& PhononInterface< X >::_otherCells
protected

Definition at line 252 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
const CRConnectivity& PhononInterface< X >::_otherFaceCells
protected

Definition at line 265 of file PhononInterface.h.

Referenced by PhononInterface< X >::applyInterfaceCondition().

template<class X>
const StorageSite& PhononInterface< X >::_otherFaces
protected

Definition at line 264 of file PhononInterface.h.

template<class X>
const FaceGroup& PhononInterface< X >::_otherfg
protected

Definition at line 263 of file PhononInterface.h.


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