Memosa-FVM  0.2
FlowModelSlipJump.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 _FLOWMODELSLIPJUMP_H_
6 #define _FLOWMODELSLIPJUMP_H_
7 
8 // this file is meant to be included inside the FlowModel::Impl class
9 // the code is here just because FlowModel_impl.h has grown too big
10 
11 void slipJumpMomentumBC(const StorageSite& faces,
12  const Mesh& mesh,
14  const T accomodationCoefficient,
15  const FloatValEvaluator<VectorT3>& bVelocity)
16 {
17  const StorageSite& cells = mesh.getCells();
18 
19  const CRConnectivity& faceCells = mesh.getFaceCells(faces);
20 
21  const VectorT3Array& faceArea =
22  dynamic_cast<const VectorT3Array&>(_geomFields.area[faces]);
23 
24  const VectorT3Array& faceCentroid =
25  dynamic_cast<const VectorT3Array&>(_geomFields.coordinate[faces]);
26 
27  const VectorT3Array& cellCentroid =
28  dynamic_cast<const VectorT3Array&>(_geomFields.coordinate[cells]);
29 
30  const TArray& faceAreaMag =
31  dynamic_cast<const TArray&>(_geomFields.areaMag[faces]);
32 
33  const VectorT3Array& V = dynamic_cast<const VectorT3Array&>(_flowFields.velocity[cells]);
34 
35  const TArray& p = dynamic_cast<const TArray&>(_flowFields.pressure[cells]);
36  const TArray& mu = dynamic_cast<const TArray&>(_flowFields.viscosity[cells]);
37 
38  const T opPressure( _options["operatingPressure"]);
39  const T opTemperature(_options["operatingTemperature"]);
40  const T molWt(_options["molecularWeight"]);
41  const T Rgas = 8314.472/molWt;
42 
43  const bool incompressible = _options.incompressible;
44 
45  const int nFaces = faces.getCount();
46 
47  for(int f=0; f<nFaces; f++)
48  {
49  const int c0 = faceCells(f,0);
50 
51  // face normal
52 
53  const VectorT3 en(faceArea[f]/faceAreaMag[f]);
54 
55  // normal velocity
56  const T Vn = dot(V[c0],en);
57 
58  // wall parallel component of cell velocity is Vc - Vn * en
59  const VectorT3 Vp(V[c0] - Vn*en);
60 
61  const VectorT3 ds(faceCentroid[f]-cellCentroid[c0]);
62 
63  // normal distance between face and cell centroid
64  const T dn = dot(ds,en);
65 
66 
67  const T pAbs = incompressible ? opPressure : (p[c0]+opPressure);
68 
69 
70  const T muCell = mu[c0];
71  const T MeanFreePath = muCell/pAbs*sqrt(0.5*M_PI*Rgas*opTemperature);
72 
73  const T coeff = accomodationCoefficient*MeanFreePath/ (dn+(accomodationCoefficient*MeanFreePath));
74  const VectorT3 Vwp(Vp*coeff);
75 
76  // specified velocity at the boundary
77  const VectorT3 bv = bVelocity[f];
78 
79  // normal component of the specified boundary velocity
80  const VectorT3 Vwn(bv-dot(bv,en)*bv);
81 
82  // the velocity at the boundary is the parallel component
83  // computed above + the normal from the bc specfication
84  const VectorT3 Vw(Vwn + Vwp);
85  gbc.applyDirichletBC(f,Vw);
86 
87  }
88 }
89 
90 #endif
Definition: Mesh.h:49
Tangent sqrt(const Tangent &a)
Definition: Tangent.h:317
void applyDirichletBC(int f, const X &bValue) const
Definition: GenericBCS.h:77
const StorageSite & getCells() const
Definition: Mesh.h:109
const CRConnectivity & getFaceCells(const StorageSite &site) const
Definition: Mesh.cpp:388
int getCount() const
Definition: StorageSite.h:39
void slipJumpMomentumBC(const StorageSite &faces, const Mesh &mesh, GenericBCS< VectorT3, DiagTensorT3, T > &gbc, const T accomodationCoefficient, const FloatValEvaluator< VectorT3 > &bVelocity)
T dot(const Vector< T, 3 > &a, const Vector< T, 3 > &b)
Definition: Vector.h:253