Memosa-FVM  0.2
FlowModelVelocityBC.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _FLOWMODELVELOCITYBC_H_
 

Functions

fixedFluxContinuityBC (const StorageSite &faces, const Mesh &mesh, MultiFieldMatrix &matrix, MultiField &xField, MultiField &rField, const FlowBC< T > &bc)
 

Macro Definition Documentation

#define _FLOWMODELVELOCITYBC_H_

Definition at line 7 of file FlowModel_impl.h.

Function Documentation

T fixedFluxContinuityBC ( const StorageSite faces,
const Mesh mesh,
MultiFieldMatrix matrix,
MultiField xField,
MultiField rField,
const FlowBC< T > &  bc 
)

Definition at line 11 of file FlowModelVelocityBC.h.

References FlowBC< T >::bcType, dot(), Mesh::getCells(), StorageSite::getCount(), Mesh::getFaceCells(), MultiFieldMatrix::getMatrix(), FloatVarDict< T >::getVal(), and MultiFieldMatrix::hasMatrix().

Referenced by FlowModel< T >::Impl::linearizeContinuity().

17  {
18  const StorageSite& cells = mesh.getCells();
19 
20  const CRConnectivity& faceCells = mesh.getFaceCells(faces);
21 
22  MultiField::ArrayIndex mfIndex(&_flowFields.massFlux,&faces);
23  MultiField::ArrayIndex vIndex(&_flowFields.velocity,&cells);
24  MultiField::ArrayIndex pIndex(&_flowFields.pressure,&cells);
25 
26  PPMatrix& ppMatrix =
27  dynamic_cast<PPMatrix&>(matrix.getMatrix(pIndex,pIndex));
28 
29  FMatrix& dFluxdP = dynamic_cast<FMatrix&>(matrix.getMatrix(mfIndex,pIndex));
30 
31  PPAssembler& ppAssembler = ppMatrix.getPairWiseAssembler(faceCells);
32  PPDiagArray& ppDiag = ppMatrix.getDiag();
33 
34  const VectorT3Array& faceArea =
35  dynamic_cast<const VectorT3Array&>(_geomFields.area[faces]);
36 
37  TArray& rCell = dynamic_cast<TArray&>(rField[pIndex]);
38  TArray& massFlux = dynamic_cast<TArray&>(_flowFields.massFlux[faces]);
39  TArray& pCell = dynamic_cast<TArray&>(_flowFields.pressure[cells]);
40  const TArray& density = dynamic_cast<const TArray&>(_flowFields.density[cells]);
41 
43  bVelocity(bc.getVal("specifiedXVelocity"),
44  bc.getVal("specifiedYVelocity"),
45  bc.getVal("specifiedZVelocity"),
46  faces);
47 
48  FloatValEvaluator<T> bp(bc.getVal("specifiedPressure"), faces);
49 
50  const bool fixPressure = (bc.bcType == "FixedBoundary");
51 
52  const int nFaces = faces.getCount();
53 
54  T netFlux(0.);
55 
56  for(int f=0; f<nFaces; f++)
57  {
58  const int c0 = faceCells(f,0);
59  const int c1 = faceCells(f,1);
60 
61  massFlux[f] = density[c0]*dot(bVelocity[f],faceArea[f]);
62 
63  rCell[c0] -= massFlux[f];
64 
65  netFlux += massFlux[f];
66  ppAssembler.getCoeff01(f) =0;
67  ppDiag[c1] = -1;
68  if (fixPressure)
69  {
70  rCell[c1] = bp[f]-pCell[c1];
71  ppAssembler.getCoeff10(f) =0;
72  }
73  else
74  {
75  rCell[c1] = 0.;
76  ppAssembler.getCoeff10(f) =1;
77  }
78 
79  ppMatrix.setBoundary(c1);
80 
81  dFluxdP.setCoeffL(f,T(0.));
82  dFluxdP.setCoeffR(f,T(0.));
83 
84  }
85 #ifdef PV_COUPLED
86  if (matrix.hasMatrix(vIndex,pIndex))
87  {
88  VPMatrix& vpMatrix =
89  dynamic_cast<VPMatrix&>(matrix.getMatrix(vIndex,pIndex));
90 
91  VPAssembler& vpAssembler = vpMatrix.getPairWiseAssembler(faceCells);
92  VPDiagArray& vpDiag = vpMatrix.getDiag();
93 
94  for(int f=0; f<nFaces; f++)
95  {
96  const int c0 = faceCells(f,0);
97  vpDiag[c0] += vpAssembler.getCoeff01(f);
98  vpAssembler.getCoeff01(f) = NumTypeTraits<T>::getZero();
99  }
100  }
101 #endif
102  return netFlux;
103  }
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
string bcType
Definition: FlowBC.h:20
bool hasMatrix(const Index &rowIndex, const Index &colIndex) const
FloatVal< T > getVal(const string varName) const
Definition: FloatVarDict.h:85
pair< const Field *, const StorageSite * > ArrayIndex
Definition: MultiField.h:21
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
T dot(const Vector< T, 3 > &a, const Vector< T, 3 > &b)
Definition: Vector.h:253