Memosa-FVM  0.2
StructureBCS< X, Diag, OffDiag > Class Template Reference

#include <StructureModel_impl.h>

Collaboration diagram for StructureBCS< X, Diag, OffDiag >:

Public Types

typedef NumTypeTraits< X >
::T_Scalar 
T_Scalar
 
typedef Array< T_ScalarTArray
 
typedef Vector< T_Scalar, 3 > VectorT3
 
typedef CRMatrix< Diag,
OffDiag, X > 
CCMatrix
 
typedef CCMatrix::PairWiseAssembler CCAssembler
 
typedef FluxJacobianMatrix
< Diag, X > 
FMatrix
 
typedef DiagonalMatrix< Diag, X > BBMatrix
 
typedef Array< Diag > DiagArray
 
typedef Array< OffDiag > OffDiagArray
 
typedef Array< X > XArray
 
typedef Array< VectorT3VectorT3Array
 

Public Member Functions

 StructureBCS (const StorageSite &faces, const Mesh &mesh, const GeomFields &geomFields, Field &varField, MultiFieldMatrix &matrix, MultiField &xField, MultiField &rField, const bool explicitMode)
 
applyDirichletBC (int f, const X &bValue) const
 
applyDirichletBC (const X &bValue) const
 
applyDirichletBC (const FloatValEvaluator< X > &bValue) const
 
applyNeumannBC (const int f, const X &specifiedFlux) const
 
applyNeumannBC (const X &bFlux) const
 
applyZeroDerivativeBC () const
 
applyNeumannBC (const FloatValEvaluator< X > &bFlux) const
 
void applyInterfaceBC (const int f) const
 
void applyInterfaceBC () const
 
void applySymmetryBC () const
 

Protected Attributes

const StorageSite_faces
 
const StorageSite_cells
 
const CRConnectivity_faceCells
 
const Field_varField
 
const MultiField::ArrayIndex _xIndex
 
CCMatrix_dRdX
 
CCAssembler_assembler
 
DiagArray_dRdXDiag
 
XArray_x
 
XArray_r
 
const Field_areaMagField
 
const TArray_faceAreaMag
 
const Field_areaField
 
const VectorT3Array_faceArea
 
const bool _explicitMode
 

Detailed Description

template<class X, class Diag, class OffDiag>
class StructureBCS< X, Diag, OffDiag >

Definition at line 40 of file StructureModel_impl.h.

Member Typedef Documentation

template<class X, class Diag, class OffDiag>
typedef DiagonalMatrix<Diag,X> StructureBCS< X, Diag, OffDiag >::BBMatrix

Definition at line 53 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
typedef CCMatrix::PairWiseAssembler StructureBCS< X, Diag, OffDiag >::CCAssembler

Definition at line 50 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
typedef CRMatrix<Diag,OffDiag,X> StructureBCS< X, Diag, OffDiag >::CCMatrix

Definition at line 49 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
typedef Array<Diag> StructureBCS< X, Diag, OffDiag >::DiagArray

Definition at line 55 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
typedef FluxJacobianMatrix<Diag,X> StructureBCS< X, Diag, OffDiag >::FMatrix

Definition at line 52 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
typedef Array<OffDiag> StructureBCS< X, Diag, OffDiag >::OffDiagArray

Definition at line 56 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
typedef NumTypeTraits<X>::T_Scalar StructureBCS< X, Diag, OffDiag >::T_Scalar

Definition at line 44 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
typedef Array<T_Scalar> StructureBCS< X, Diag, OffDiag >::TArray

Definition at line 46 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
typedef Vector<T_Scalar,3> StructureBCS< X, Diag, OffDiag >::VectorT3

Definition at line 47 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
typedef Array<VectorT3> StructureBCS< X, Diag, OffDiag >::VectorT3Array

Definition at line 59 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
typedef Array<X> StructureBCS< X, Diag, OffDiag >::XArray

Definition at line 58 of file StructureModel_impl.h.

Constructor & Destructor Documentation

template<class X, class Diag, class OffDiag>
StructureBCS< X, Diag, OffDiag >::StructureBCS ( const StorageSite faces,
const Mesh mesh,
const GeomFields geomFields,
Field varField,
MultiFieldMatrix matrix,
MultiField xField,
MultiField rField,
const bool  explicitMode 
)
inline

Definition at line 62 of file StructureModel_impl.h.

70  :
71  _faces(faces),
72  _cells(mesh.getCells()),
74  _varField(varField),
76  _dRdX(dynamic_cast<CCMatrix&>(matrix.getMatrix(_xIndex,_xIndex))),
79  _x(dynamic_cast<XArray&>(xField[_xIndex])),
80  _r(dynamic_cast<XArray&>(rField[_xIndex])),
81  _areaMagField(geomFields.areaMag),
82  _faceAreaMag(dynamic_cast<const TArray&>(_areaMagField[_faces])),
83  _areaField(geomFields.area),
84  _faceArea(dynamic_cast<const VectorT3Array&>(_areaField[_faces])),
85  _explicitMode(explicitMode)
86  {}
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
const bool _explicitMode
CCAssembler & _assembler
const TArray & _faceAreaMag
const VectorT3Array & _faceArea
const Field & _varField
Array< Diag > & getDiag()
Definition: CRMatrix.h:856
const StorageSite & _cells
const Field & _areaField
const StorageSite & getCells() const
Definition: Mesh.h:109
DiagArray & _dRdXDiag
const StorageSite & _faces
const CRConnectivity & getFaceCells(const StorageSite &site) const
Definition: Mesh.cpp:388
const MultiField::ArrayIndex _xIndex
Field area
Definition: GeomFields.h:23
PairWiseAssembler & getPairWiseAssembler(const CRConnectivity &pairs)
Definition: CRMatrix.h:867
Field areaMag
Definition: GeomFields.h:25
const Field & _areaMagField
const CRConnectivity & _faceCells

Member Function Documentation

template<class X, class Diag, class OffDiag>
X StructureBCS< X, Diag, OffDiag >::applyDirichletBC ( int  f,
const X &  bValue 
) const
inline

Definition at line 88 of file StructureModel_impl.h.

References StructureBCS< X, Diag, OffDiag >::_dRdX, StructureBCS< X, Diag, OffDiag >::_explicitMode, StructureBCS< X, Diag, OffDiag >::_faceCells, StructureBCS< X, Diag, OffDiag >::_r, StructureBCS< X, Diag, OffDiag >::_x, CRMatrix< T_Diag, T_OffDiag, X >::eliminateDirichlet(), and CRMatrix< T_Diag, T_OffDiag, X >::setDirichlet().

Referenced by StructureModel< T >::Impl::applyBC(), and StructureBCS< X, Diag, OffDiag >::applyDirichletBC().

89  {
90  const int c1 = _faceCells(f,1);
91 
92  const X fluxB = -_r[c1];
93 
94  const X dXC1 = bValue - _x[c1];
95 
97  _x[c1] = bValue;
99  if (!_explicitMode)
100  _dRdX.setDirichlet(c1);
101  return fluxB;
102  }
const bool _explicitMode
void setDirichlet(const int nr)
Definition: CRMatrix.h:887
void eliminateDirichlet(const int j, Array< X > &b, const X &delta_j, const bool explicitMode=false)
Definition: CRMatrix.h:1041
const CRConnectivity & _faceCells
template<class X, class Diag, class OffDiag>
X StructureBCS< X, Diag, OffDiag >::applyDirichletBC ( const X &  bValue) const
inline

Definition at line 104 of file StructureModel_impl.h.

References StructureBCS< X, Diag, OffDiag >::_faces, StructureBCS< X, Diag, OffDiag >::applyDirichletBC(), and StorageSite::getCount().

105  {
106  X fluxB(NumTypeTraits<X>::getZero());
107  for(int i=0; i<_faces.getCount(); i++)
108  fluxB += applyDirichletBC(i,bValue);
109  return fluxB;
110  }
const StorageSite & _faces
int getCount() const
Definition: StorageSite.h:39
X applyDirichletBC(int f, const X &bValue) const
template<class X, class Diag, class OffDiag>
X StructureBCS< X, Diag, OffDiag >::applyDirichletBC ( const FloatValEvaluator< X > &  bValue) const
inline

Definition at line 112 of file StructureModel_impl.h.

References StructureBCS< X, Diag, OffDiag >::_faces, StructureBCS< X, Diag, OffDiag >::applyDirichletBC(), and StorageSite::getCount().

113  {
114  X fluxB(NumTypeTraits<X>::getZero());
115  for(int i=0; i<_faces.getCount(); i++)
116  fluxB += applyDirichletBC(i,bValue[i]);
117  return fluxB;
118  }
const StorageSite & _faces
int getCount() const
Definition: StorageSite.h:39
X applyDirichletBC(int f, const X &bValue) const
template<class X, class Diag, class OffDiag>
void StructureBCS< X, Diag, OffDiag >::applyInterfaceBC ( const int  f) const
inline

Definition at line 183 of file StructureModel_impl.h.

References StructureBCS< X, Diag, OffDiag >::_assembler, StructureBCS< X, Diag, OffDiag >::_cells, StructureBCS< X, Diag, OffDiag >::_faceCells, StructureBCS< X, Diag, OffDiag >::_r, CRMatrix< T_Diag, T_OffDiag, X >::PairWiseAssembler::getCoeff01(), CRMatrix< T_Diag, T_OffDiag, X >::PairWiseAssembler::getCoeff10(), and StorageSite::getSelfCount().

184  {
185  // the boundary cell could be either c0 or c1 at an interface
186  int cb = _faceCells(f,1);
188  if (cb < _cells.getSelfCount())
189  {
190  cb = _faceCells(f,0);
191  sign *= -1.0;
192  }
193 
194 
195  _r[cb] = T_Scalar(0);
196 
197  if (sign>0)
199  else
201 
202  }
int getSelfCount() const
Definition: StorageSite.h:40
CCAssembler & _assembler
OffDiag & getCoeff10(const int np)
Definition: CRMatrix.h:131
const StorageSite & _cells
OffDiag & getCoeff01(const int np)
Definition: CRMatrix.h:126
NumTypeTraits< X >::T_Scalar T_Scalar
const CRConnectivity & _faceCells
template<class X, class Diag, class OffDiag>
void StructureBCS< X, Diag, OffDiag >::applyInterfaceBC ( ) const
inline

Definition at line 204 of file StructureModel_impl.h.

References StructureBCS< X, Diag, OffDiag >::_faces, and StorageSite::getCount().

205  {
206  for(int i=0; i<_faces.getCount(); i++)
207  applyInterfaceBC(i);
208  }
void applyInterfaceBC() const
const StorageSite & _faces
int getCount() const
Definition: StorageSite.h:39
template<class X, class Diag, class OffDiag>
X StructureBCS< X, Diag, OffDiag >::applyNeumannBC ( const int  f,
const X &  specifiedFlux 
) const
inline

Definition at line 120 of file StructureModel_impl.h.

References StructureBCS< X, Diag, OffDiag >::_dRdX, StructureBCS< X, Diag, OffDiag >::_faceAreaMag, StructureBCS< X, Diag, OffDiag >::_faceCells, StructureBCS< X, Diag, OffDiag >::_r, and CRMatrix< T_Diag, T_OffDiag, X >::setBoundary().

Referenced by StructureModel< T >::Impl::applyBC(), and StructureBCS< X, Diag, OffDiag >::applyNeumannBC().

122  {
123  //const int c0 = _faceCells(f,0);
124  const int c1 = _faceCells(f,1);
125  const X fluxB = -_r[c1];
126 
127  // the current value of flux and its Jacobians
128  const X dFlux = specifiedFlux*_faceAreaMag[f] - fluxB;
129 
130  // setup the equation for the boundary value; the coefficients
131  // are already computed so just need to set the rhs
132  _r[c1] = dFlux;
133 
134  // _dRdX.eliminate(c1,_r);
135  // mark this row as a "boundary" row so that we will update it
136  // after the overall system is solved
137  _dRdX.setBoundary(c1);
138  return fluxB;
139  }
const TArray & _faceAreaMag
void setBoundary(const int nr)
Definition: CRMatrix.h:1056
const CRConnectivity & _faceCells
template<class X, class Diag, class OffDiag>
X StructureBCS< X, Diag, OffDiag >::applyNeumannBC ( const X &  bFlux) const
inline

Definition at line 142 of file StructureModel_impl.h.

References StructureBCS< X, Diag, OffDiag >::_faces, StructureBCS< X, Diag, OffDiag >::applyNeumannBC(), and StorageSite::getCount().

143  {
144  X fluxB(NumTypeTraits<X>::getZero());
145 
146  for(int i=0; i<_faces.getCount(); i++)
147  fluxB += applyNeumannBC(i,bFlux);
148  return fluxB;
149  }
X applyNeumannBC(const int f, const X &specifiedFlux) const
const StorageSite & _faces
int getCount() const
Definition: StorageSite.h:39
template<class X, class Diag, class OffDiag>
X StructureBCS< X, Diag, OffDiag >::applyNeumannBC ( const FloatValEvaluator< X > &  bFlux) const
inline

Definition at line 175 of file StructureModel_impl.h.

References StructureBCS< X, Diag, OffDiag >::_faces, StructureBCS< X, Diag, OffDiag >::applyNeumannBC(), and StorageSite::getCount().

176  {
177  X fluxB(NumTypeTraits<X>::getZero());
178  for(int i=0; i<_faces.getCount(); i++)
179  fluxB += applyNeumannBC(i,bFlux[i]);
180  return fluxB;
181  }
X applyNeumannBC(const int f, const X &specifiedFlux) const
const StorageSite & _faces
int getCount() const
Definition: StorageSite.h:39
template<class X, class Diag, class OffDiag>
void StructureBCS< X, Diag, OffDiag >::applySymmetryBC ( ) const
inline

Definition at line 210 of file StructureModel_impl.h.

References StructureBCS< X, Diag, OffDiag >::_assembler, StructureBCS< X, Diag, OffDiag >::_dRdX, StructureBCS< X, Diag, OffDiag >::_faceArea, StructureBCS< X, Diag, OffDiag >::_faceAreaMag, StructureBCS< X, Diag, OffDiag >::_faceCells, StructureBCS< X, Diag, OffDiag >::_faces, StructureBCS< X, Diag, OffDiag >::_r, StructureBCS< X, Diag, OffDiag >::_x, dot(), CRMatrix< T_Diag, T_OffDiag, X >::PairWiseAssembler::getCoeff10(), StorageSite::getCount(), and CRMatrix< T_Diag, T_OffDiag, X >::setDirichlet().

211  {
212  for(int f=0; f<this->_faces.getCount(); f++)
213  {
214  const int c0 = this->_faceCells(f,0);
215  const int c1 = this->_faceCells(f,1);
216 
217 
218  const VectorT3 en = this->_faceArea[f]/this->_faceAreaMag[f];
219  const T_Scalar xC0_dotn = dot(this->_x[c0],en);
220  const X xB = this->_x[c0] - 2.*xC0_dotn * en;
221 
222  Diag dxBdxC0(Diag::getZero());
223  dxBdxC0(0,0) = 1.0 - 2.*en[0]*en[0];
224  dxBdxC0(0,1) = - 2.*en[0]*en[1];
225  dxBdxC0(0,2) = - 2.*en[0]*en[2];
226 
227  dxBdxC0(1,0) = - 2.*en[1]*en[0];
228  dxBdxC0(1,1) = 1.0 - 2.*en[1]*en[1];
229  dxBdxC0(1,2) = - 2.*en[1]*en[2];
230 
231  dxBdxC0(2,0) = - 2.*en[2]*en[0];
232  dxBdxC0(2,1) = - 2.*en[2]*en[1];
233  dxBdxC0(2,2) = 1.0 - 2.*en[2]*en[2];
234 
235 
236  const X xc1mxB = xB-this->_x[c1];
237 
238  // boundary value equation
239  // set all neighbour coeffs to zero first and ap to -1
240  this->_dRdX.setDirichlet(c1);
241 
242  // dependance on c0
243  this->_assembler.getCoeff10(f) = dxBdxC0;
244  this->_r[c1] = xc1mxB;
245 
246  }
247  }
CCAssembler & _assembler
const TArray & _faceAreaMag
const VectorT3Array & _faceArea
OffDiag & getCoeff10(const int np)
Definition: CRMatrix.h:131
const StorageSite & _faces
int getCount() const
Definition: StorageSite.h:39
void setDirichlet(const int nr)
Definition: CRMatrix.h:887
NumTypeTraits< X >::T_Scalar T_Scalar
T dot(const Vector< T, 3 > &a, const Vector< T, 3 > &b)
Definition: Vector.h:253
const CRConnectivity & _faceCells
template<class X, class Diag, class OffDiag>
X StructureBCS< X, Diag, OffDiag >::applyZeroDerivativeBC ( ) const
inline

Definition at line 151 of file StructureModel_impl.h.

References StructureBCS< X, Diag, OffDiag >::_assembler, StructureBCS< X, Diag, OffDiag >::_dRdX, StructureBCS< X, Diag, OffDiag >::_dRdXDiag, StructureBCS< X, Diag, OffDiag >::_faceCells, StructureBCS< X, Diag, OffDiag >::_faces, StructureBCS< X, Diag, OffDiag >::_r, StructureBCS< X, Diag, OffDiag >::_x, CRMatrix< T_Diag, T_OffDiag, X >::PairWiseAssembler::getCoeff10(), StorageSite::getCount(), and CRMatrix< T_Diag, T_OffDiag, X >::setBoundary().

152  {
153  X fluxTotal(NumTypeTraits<X>::getZero());
154  for(int f=0; f<_faces.getCount(); f++)
155  {
156  const int c0 = _faceCells(f,0);
157  const int c1 = _faceCells(f,1);
158  const X fluxB = -_r[c1];
159 
160  // setup the equation for the boundary value; we want xb to be equal to xc
161 
162  _r[c1] = _x[c0] - _x[c1];
165 
166 
167  // mark this row as a "boundary" row so that we will update it
168  // after the overall system is solved
169  _dRdX.setBoundary(c1);
170  fluxTotal += fluxB;
171  }
172  return fluxTotal;
173  }
CCAssembler & _assembler
OffDiag & getCoeff10(const int np)
Definition: CRMatrix.h:131
DiagArray & _dRdXDiag
const StorageSite & _faces
void setBoundary(const int nr)
Definition: CRMatrix.h:1056
int getCount() const
Definition: StorageSite.h:39
const CRConnectivity & _faceCells

Member Data Documentation

template<class X, class Diag, class OffDiag>
const Field& StructureBCS< X, Diag, OffDiag >::_areaField
protected

Definition at line 264 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
const Field& StructureBCS< X, Diag, OffDiag >::_areaMagField
protected

Definition at line 262 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
CCAssembler& StructureBCS< X, Diag, OffDiag >::_assembler
protected
template<class X, class Diag, class OffDiag>
const StorageSite& StructureBCS< X, Diag, OffDiag >::_cells
protected
template<class X, class Diag, class OffDiag>
DiagArray& StructureBCS< X, Diag, OffDiag >::_dRdXDiag
protected
template<class X, class Diag, class OffDiag>
const bool StructureBCS< X, Diag, OffDiag >::_explicitMode
protected
template<class X, class Diag, class OffDiag>
const VectorT3Array& StructureBCS< X, Diag, OffDiag >::_faceArea
protected
template<class X, class Diag, class OffDiag>
const TArray& StructureBCS< X, Diag, OffDiag >::_faceAreaMag
protected
template<class X, class Diag, class OffDiag>
const Field& StructureBCS< X, Diag, OffDiag >::_varField
protected

Definition at line 255 of file StructureModel_impl.h.

template<class X, class Diag, class OffDiag>
XArray& StructureBCS< X, Diag, OffDiag >::_x
protected
template<class X, class Diag, class OffDiag>
const MultiField::ArrayIndex StructureBCS< X, Diag, OffDiag >::_xIndex
protected

Definition at line 256 of file StructureModel_impl.h.


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