Memosa-FVM  0.2
PhononBoundary< X > Class Template Reference

#include <PhononBoundary.h>

Collaboration diagram for PhononBoundary< 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

 PhononBoundary (const StorageSite &faces, const Mesh &mesh, const GeomFields &geomFields, const Xkspace &kspace, PhononModelOptions< X > &opts, const int fg_id)
 
PhononModelOptions< X > & getOptions ()
 
void applyReflectingWall (int f, const X refl) const
 
void applyReflectingWall (FloatValEvaluator< X > &bRefl) const
 
void applyTemperatureWall (int f, const X Twall) const
 
void applyTemperatureWall (FloatValEvaluator< X > &bTemp) const
 

Protected Attributes

const StorageSite_faces
 
const StorageSite_cells
 
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 int _fg_id
 

Detailed Description

template<class X>
class PhononBoundary< X >

Definition at line 26 of file PhononBoundary.h.

Member Typedef Documentation

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

Definition at line 32 of file PhononBoundary.h.

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

Definition at line 44 of file PhononBoundary.h.

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

Definition at line 30 of file PhononBoundary.h.

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

Definition at line 34 of file PhononBoundary.h.

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

Definition at line 35 of file PhononBoundary.h.

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

Definition at line 36 of file PhononBoundary.h.

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

Definition at line 39 of file PhononBoundary.h.

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

Definition at line 40 of file PhononBoundary.h.

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

Definition at line 38 of file PhononBoundary.h.

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

Definition at line 41 of file PhononBoundary.h.

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

Definition at line 42 of file PhononBoundary.h.

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

Definition at line 43 of file PhononBoundary.h.

Constructor & Destructor Documentation

template<class X>
PhononBoundary< X >::PhononBoundary ( const StorageSite faces,
const Mesh mesh,
const GeomFields geomFields,
const Xkspace kspace,
PhononModelOptions< X > &  opts,
const int  fg_id 
)
inline

Definition at line 46 of file PhononBoundary.h.

51  :
52 
53  _faces(faces),
54  _cells(mesh.getCells()),
55  _ibType(dynamic_cast<const IntArray&>(geomFields.ibType[_cells])),
57  _areaMagField(geomFields.areaMag),
58  _faceAreaMag(dynamic_cast<const TArray&>(_areaMagField[_faces])),
59  _areaField(geomFields.area),
60  _faceArea(dynamic_cast<const VectorT3Array&>(_areaField[_faces])),
61  _options(opts),
62  _kspace(kspace),
63  _fg_id(fg_id)
64  {}
const Field & _areaMagField
Field ibType
Definition: GeomFields.h:38
const Xkspace & _kspace
PhononModelOptions< X > & _options
const StorageSite & _faces
const CRConnectivity & _faceCells
const StorageSite & getCells() const
Definition: Mesh.h:109
const VectorT3Array & _faceArea
const CRConnectivity & getFaceCells(const StorageSite &site) const
Definition: Mesh.cpp:388
const int _fg_id
const Array< int > & _ibType
const TArray & _faceAreaMag
const StorageSite & _cells
const Field & _areaField
Field area
Definition: GeomFields.h:23
Field areaMag
Definition: GeomFields.h:25

Member Function Documentation

template<class X>
void PhononBoundary< X >::applyReflectingWall ( int  f,
const X  refl 
) const
inline

changed

Definition at line 68 of file PhononBoundary.h.

References PhononBoundary< X >::_cells, PhononBoundary< X >::_faceArea, PhononBoundary< X >::_faceAreaMag, PhononBoundary< X >::_faceCells, PhononBoundary< X >::_fg_id, PhononBoundary< X >::_ibType, PhononBoundary< X >::_kspace, kvol< T >::getdk3(), pmode< T >::getfield(), Kspace< T >::getkvol(), Kspace< T >::getlength(), kvol< T >::getmode(), kvol< T >::getmodenum(), pmode< T >::getReflpair(), pmode< T >::getv(), Mesh::IBTYPE_FLUID, and sqrt().

Referenced by PhononBoundary< X >::applyReflectingWall(), and PhononModel< T >::callBoundaryConditions().

69  {
70 
71  const int c0 = _faceCells(f,0);
72  const int c1 = _faceCells(f,1);
73  X tot_in = 0.; //total incoming energy (to wall)
74  X tot_dk3 = 0.; //total weight of incoming energy
75 
76  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
77  return;
78 
79  // sum up energy incoming to boundary (from domain)
80  int numK=_kspace.getlength();
81  for (int k=0;k<numK;k++)
82  {
83 
84  Xkvol& kv=_kspace.getkvol(k);
85  X dk3=kv.getdk3();
86  int numM=kv.getmodenum();
87 
88  for (int m=0;m<numM;m++) //mode loop beg
89  {
90 
91  Xmode& mode=kv.getmode(m);
92  Field& efield=mode.getfield();
93  VectorT3 vg = mode.getv(); // phonon group velocity
94  XArray& e_val = dynamic_cast< XArray&>(efield[_cells]); // e"
95  const VectorT3 en = _faceArea[f]/_faceAreaMag[f]; //normal unit vector to face
96  const VectorT3 sn = vg/sqrt(pow(vg[0],2)+pow(vg[1],2)+pow(vg[2],2));
97  const X sn_dot_en = sn[0]*en[0]+sn[1]*en[1]+sn[2]*en[2];
98  const X vg_dot_en = vg[0]*en[0]+vg[1]*en[1]+vg[2]*en[2];
99 
100  if (sn_dot_en > T_Scalar(0.0))
101  {
102  tot_in+=e_val[c0]*dk3*vg_dot_en;
103  tot_dk3+=vg_dot_en*dk3;
104  }
105  else
106  {
107  e_val[c1]=0.;
108  }
109 
110  } //mode loop end
111  }
112 
113  const X diff_refl = tot_in/tot_dk3; // value for e" leaving the wall
114 
115  // assign values for incoming (upwinded) and outgoing (reflected) to/from wall
116  for (int k=0;k<numK;k++)
117  {
118 
119  Xkvol& kv=_kspace.getkvol(k);
120  int numM=kv.getmodenum();
121 
122  for (int m=0;m<numM;m++) //mode loop beg
123  {
124 
125  Xmode& mode=kv.getmode(m);
126  Field& efield=mode.getfield();
127  VectorT3 vg = mode.getv(); // phonon group velocity
128  XArray& e_val = dynamic_cast<XArray&>(efield[_cells]); // e"
129  const VectorT3 en = _faceArea[f]/_faceAreaMag[f]; //normal unit vector to face
130  const X vg_dot_en = vg[0]*en[0]+vg[1]*en[1]+vg[2]*en[2];
131 
132  if (vg_dot_en > T_Scalar(0.0))
133  {
134 
135  Refl_pair& rpairs=mode.getReflpair(_fg_id);
136  //X w1=rpairs.first.first;
137  //X w2=rpairs.second.first;
138  int k1=rpairs.first.second;
139  //int k2=rpairs.second.second;
140  Xmode& mode1=_kspace.getkvol(k1).getmode(m);
141  //Xmode& mode2=_kspace.getkvol(k2).getmode(m);
142  Field& field1=mode1.getfield();
143  //Field& field2=mode2.getfield();
144  XArray& e_val1=dynamic_cast<XArray&>(field1[_cells]);
145  //XArray& e_val2=dynamic_cast<XArray&>(field2[_cells]);
146  e_val1[c1]+=refl*e_val[c0];
147  //e_val2[c1]+=refl*w2*e_val[c0];
148  e_val[c1]=e_val[c0]; // upwinded value
149  }
150  else
151  {
152  e_val[c1]+=(1-refl)*diff_refl; // diffusely reflected value
153  }
154  } //mode loop end
155  }
156  }
Array< X > XArray
Definition: Field.h:14
Tkvol & getkvol(int n) const
Definition: Kspace.h:390
Tmode & getmode(int n) const
Definition: kvol.h:44
int getlength() const
Definition: Kspace.h:391
int getmodenum()
Definition: kvol.h:43
Tangent sqrt(const Tangent &a)
Definition: Tangent.h:317
const Xkspace & _kspace
const CRConnectivity & _faceCells
const VectorT3Array & _faceArea
const int _fg_id
const Array< int > & _ibType
pmode< X > Xmode
const TArray & _faceAreaMag
Xmode::Refl_pair Refl_pair
const StorageSite & _cells
NumTypeTraits< X >::T_Scalar T_Scalar
kvol< X > Xkvol
T getdk3()
Definition: kvol.h:42
template<class X>
void PhononBoundary< X >::applyReflectingWall ( FloatValEvaluator< X > &  bRefl) const
inline

Definition at line 158 of file PhononBoundary.h.

References PhononBoundary< X >::_faces, PhononBoundary< X >::applyReflectingWall(), and StorageSite::getCount().

159  {
160  for (int i=0; i<_faces.getCount();i++)
161  applyReflectingWall(i,bRefl[i]);
162  }
void applyReflectingWall(int f, const X refl) const
const StorageSite & _faces
int getCount() const
Definition: StorageSite.h:39
template<class X>
void PhononBoundary< X >::applyTemperatureWall ( int  f,
const X  Twall 
) const
inline

changed

Definition at line 165 of file PhononBoundary.h.

References PhononBoundary< X >::_cells, PhononBoundary< X >::_faceArea, PhononBoundary< X >::_faceAreaMag, PhononBoundary< X >::_faceCells, PhononBoundary< X >::_ibType, PhononBoundary< X >::_kspace, pmode< T >::calce0(), pmode< T >::getfield(), Kspace< T >::getkvol(), Kspace< T >::getlength(), kvol< T >::getmode(), kvol< T >::getmodenum(), pmode< T >::getv(), and Mesh::IBTYPE_FLUID.

Referenced by PhononBoundary< X >::applyTemperatureWall(), and PhononModel< T >::callBoundaryConditions().

166  {
167 
168  const int c0 = _faceCells(f,0);
169  const int c1 = _faceCells(f,1);
170 
171  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
172  return;
173 
174  // sum up energy incoming to boundary (from domain)
175  int numK=_kspace.getlength();
176 
177  for (int k=0;k<numK;k++)
178  {
179  Xkvol& kv=_kspace.getkvol(k);
180  int numM=kv.getmodenum();
181 
182  for (int m=0;m<numM;m++) //mode loop beg
183  {
184  Xmode& mode=kv.getmode(m);
185  Field& efield=mode.getfield();
186  VectorX3 vg = mode.getv();
187  XArray& e_val = dynamic_cast< XArray&>(efield[_cells]); // e"
188  const VectorX3 en = _faceArea[f]/_faceAreaMag[f]; //normal unit vector to face
189  const X vg_dot_en = vg[0]*en[0]+vg[1]*en[1]+vg[2]*en[2];
190 
191  if (vg_dot_en > T_Scalar(0.0))
192  {
193  e_val[c1]=e_val[c0];
194  }
195  else
196  {
197  e_val[c1]=mode.calce0(Twall);
198  }
199 
200  } //mode loop end
201  }
202  }
Array< X > XArray
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 & _kspace
const CRConnectivity & _faceCells
const VectorT3Array & _faceArea
const Array< int > & _ibType
pmode< X > Xmode
const TArray & _faceAreaMag
const StorageSite & _cells
NumTypeTraits< X >::T_Scalar T_Scalar
Vector< X, 3 > VectorX3
kvol< X > Xkvol
template<class X>
void PhononBoundary< X >::applyTemperatureWall ( FloatValEvaluator< X > &  bTemp) const
inline

Definition at line 204 of file PhononBoundary.h.

References PhononBoundary< X >::_faces, PhononBoundary< X >::applyTemperatureWall(), and StorageSite::getCount().

205  {
206  for (int j=0; j<_faces.getCount();j++)
207  {
208  applyTemperatureWall(j,bTemp[j]);
209  }
210  }
const StorageSite & _faces
int getCount() const
Definition: StorageSite.h:39
void applyTemperatureWall(int f, const X Twall) const
template<class X>
PhononModelOptions<X>& PhononBoundary< X >::getOptions ( )
inline

Definition at line 66 of file PhononBoundary.h.

References PhononBoundary< X >::_options.

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

Member Data Documentation

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

Definition at line 359 of file PhononBoundary.h.

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

Definition at line 357 of file PhononBoundary.h.

template<class X>
const StorageSite& PhononBoundary< X >::_cells
protected
template<class X>
const VectorT3Array& PhononBoundary< X >::_faceArea
protected
template<class X>
const TArray& PhononBoundary< X >::_faceAreaMag
protected
template<class X>
const CRConnectivity& PhononBoundary< X >::_faceCells
protected
template<class X>
const StorageSite& PhononBoundary< X >::_faces
protected
template<class X>
const int PhononBoundary< X >::_fg_id
protected

Definition at line 363 of file PhononBoundary.h.

Referenced by PhononBoundary< X >::applyReflectingWall().

template<class X>
const Array<int>& PhononBoundary< X >::_ibType
protected
template<class X>
const Xkspace& PhononBoundary< X >::_kspace
protected
template<class X>
PhononModelOptions<X>& PhononBoundary< X >::_options
protected

Definition at line 361 of file PhononBoundary.h.

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


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