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

#include <BatteryPC_BCS.h>

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

Public Types

typedef NumTypeTraits< X >
::T_Scalar 
T_Scalar
 
typedef Array< T_ScalarTArray
 
typedef Array< int > IntArray
 
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

 BatteryPC_BCS (const StorageSite &faces, const Mesh &mesh, const GeomFields &geomFields, Field &varField, Field &fluxField, MultiFieldMatrix &matrix, MultiField &xField, MultiField &rField)
 
void applySingleEquationDirichletBC (int f, const T_Scalar &bValue, const int v) const
 
void applySingleEquationDirichletBC (const FloatValEvaluator< T_Scalar > &bValue, const int v) const
 
void applySingleEquationNeumannBC (const int f, const T_Scalar &specifiedFlux, const int v) const
 
void applySingleEquationNeumannBC (const T_Scalar &bFlux, const int v) const
 

Protected Attributes

const StorageSite_faces
 
const StorageSite_cells
 
const IntArray_ibType
 
const CRConnectivity_faceCells
 
const Field_varField
 
const Field_fluxField
 
const MultiField::ArrayIndex _xIndex
 
const MultiField::ArrayIndex _fluxIndex
 
CCMatrix_dRdX
 
FMatrix_dFluxdX
 
BBMatrix_dFluxdFlux
 
CCAssembler_assembler
 
DiagArray_dRdXDiag
 
XArray_x
 
XArray_r
 
XArray_flux
 
XArray_rFlux
 
const Field_areaMagField
 
const TArray_faceAreaMag
 
const Field_areaField
 
const VectorT3Array_faceArea
 
const bool _is2D
 

Detailed Description

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

Definition at line 22 of file BatteryPC_BCS.h.

Member Typedef Documentation

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

Definition at line 37 of file BatteryPC_BCS.h.

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

Definition at line 34 of file BatteryPC_BCS.h.

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

Definition at line 33 of file BatteryPC_BCS.h.

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

Definition at line 39 of file BatteryPC_BCS.h.

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

Definition at line 36 of file BatteryPC_BCS.h.

template<class X , class Diag , class OffDiag >
typedef Array<int> BatteryPC_BCS< X, Diag, OffDiag >::IntArray

Definition at line 29 of file BatteryPC_BCS.h.

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

Definition at line 40 of file BatteryPC_BCS.h.

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

Definition at line 26 of file BatteryPC_BCS.h.

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

Definition at line 28 of file BatteryPC_BCS.h.

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

Definition at line 31 of file BatteryPC_BCS.h.

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

Definition at line 43 of file BatteryPC_BCS.h.

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

Definition at line 42 of file BatteryPC_BCS.h.

Constructor & Destructor Documentation

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

Definition at line 46 of file BatteryPC_BCS.h.

52  :
53  _faces(faces),
54  _cells(mesh.getCells()),
55  _ibType(dynamic_cast<const IntArray&>(geomFields.ibType[_cells])),
57  _varField(varField),
58  _fluxField(fluxField),
61  _dRdX(dynamic_cast<CCMatrix&>(matrix.getMatrix(_xIndex,_xIndex))),
62  _dFluxdX(dynamic_cast<FMatrix&>(matrix.getMatrix(_fluxIndex,_xIndex))),
63  _dFluxdFlux(dynamic_cast<BBMatrix&>(matrix.getMatrix(_fluxIndex,_fluxIndex))),
66  _x(dynamic_cast<XArray&>(xField[_xIndex])),
67  _r(dynamic_cast<XArray&>(rField[_xIndex])),
68  _flux(dynamic_cast<XArray&>(xField[_fluxIndex])),
69  _rFlux(dynamic_cast<XArray&>(rField[_fluxIndex])),
70  _areaMagField(geomFields.areaMag),
71  _faceAreaMag(dynamic_cast<const TArray&>(_areaMagField[_faces])),
72  _areaField(geomFields.area),
73  _faceArea(dynamic_cast<const VectorT3Array&>(_areaField[_faces])),
74  _is2D(mesh.getDimension()==2)
75  {}
const StorageSite & _cells
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
const MultiField::ArrayIndex _fluxIndex
FMatrix & _dFluxdX
const MultiField::ArrayIndex _xIndex
const Field & _fluxField
const Field & _areaField
XArray & _rFlux
Array< Diag > & getDiag()
Definition: CRMatrix.h:856
const Field & _areaMagField
Field ibType
Definition: GeomFields.h:38
const VectorT3Array & _faceArea
const Field & _varField
CCAssembler & _assembler
DiagArray & _dRdXDiag
XArray & _flux
const StorageSite & getCells() const
Definition: Mesh.h:109
CCMatrix & _dRdX
const CRConnectivity & getFaceCells(const StorageSite &site) const
Definition: Mesh.cpp:388
const TArray & _faceAreaMag
Field area
Definition: GeomFields.h:23
PairWiseAssembler & getPairWiseAssembler(const CRConnectivity &pairs)
Definition: CRMatrix.h:867
int getDimension() const
Definition: Mesh.h:105
BBMatrix & _dFluxdFlux
const bool _is2D
Field areaMag
Definition: GeomFields.h:25
const StorageSite & _faces
const CRConnectivity & _faceCells
const IntArray & _ibType

Member Function Documentation

template<class X , class Diag , class OffDiag >
void BatteryPC_BCS< X, Diag, OffDiag >::applySingleEquationDirichletBC ( int  f,
const T_Scalar bValue,
const int  v 
) const
inline

Definition at line 77 of file BatteryPC_BCS.h.

References BatteryPC_BCS< X, Diag, OffDiag >::_assembler, BatteryPC_BCS< X, Diag, OffDiag >::_dFluxdFlux, BatteryPC_BCS< X, Diag, OffDiag >::_dFluxdX, BatteryPC_BCS< X, Diag, OffDiag >::_dRdXDiag, BatteryPC_BCS< X, Diag, OffDiag >::_faceCells, BatteryPC_BCS< X, Diag, OffDiag >::_flux, BatteryPC_BCS< X, Diag, OffDiag >::_ibType, BatteryPC_BCS< X, Diag, OffDiag >::_r, BatteryPC_BCS< X, Diag, OffDiag >::_rFlux, BatteryPC_BCS< X, Diag, OffDiag >::_x, CRMatrix< T_Diag, T_OffDiag, X >::PairWiseAssembler::getCoeff01(), CRMatrix< T_Diag, T_OffDiag, X >::PairWiseAssembler::getCoeff10(), Mesh::IBTYPE_FLUID, FluxJacobianMatrix< OffDiag, X >::setCoeffL(), and FluxJacobianMatrix< OffDiag, X >::setCoeffR().

Referenced by BatteryPC_BCS< X, Diag, OffDiag >::applySingleEquationDirichletBC().

78  {
79  const int c0 = _faceCells(f,0);
80  const int c1 = _faceCells(f,1);
81 
82  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
83  return;
84 
85  // the current value of flux and its Jacobians
86  const T_Scalar fluxB = -(_r[c1])[v];
87  //const T_Scalar dFluxdXC0 = -(_assembler.getCoeff10(f))(v,v);
88  const OffDiag dFluxdXC0_orig = -_assembler.getCoeff10(f);
89  const T_Scalar dFluxdXC1 = -(_dRdXDiag[c1])[v];
90  OffDiag dRC0dXC1_orig = _assembler.getCoeff01(f);
91  const T_Scalar dRC0dXC1 = dRC0dXC1_orig[v];
92 
93  // since we know the boundary value, compute the boundary
94  // x correction and it's contribution to the residual for c0; we
95  // can then eliminate the coefficient to the boundary cell
96 
97  const T_Scalar dXC1 = bValue - (_x[c1])[v];
98  const T_Scalar dFlux = dFluxdXC1*dXC1;
99  const T_Scalar dRC0 = dRC0dXC1*dXC1;
100  (_r[c0])[v] += dRC0;
101 
103 
104  // set the boundary value and make its correction equation an
105  // identity
106  (_x[c1])[v] = bValue;
110 
111  //setup the equation for the boundary flux correction
112  _dFluxdX.setCoeffL(f,dFluxdXC0_orig);
113  dRC0dXC1_orig[v] = NumTypeTraits<T_Scalar>::getZero();
114  _dFluxdX.setCoeffR(f,dRC0dXC1_orig);
115  (_flux[f])[v] = fluxB;
116  (_rFlux[f])[v] = dFlux;
117  Diag _dFluxdFlux_orig = _dFluxdFlux[f];
118  _dFluxdFlux_orig[v] = NumTypeTraits<T_Scalar>::getNegativeUnity();
119  _dFluxdFlux[f] = _dFluxdFlux_orig;
120  }
NumTypeTraits< X >::T_Scalar T_Scalar
Definition: BatteryPC_BCS.h:26
FMatrix & _dFluxdX
XArray & _rFlux
void setCoeffR(const int f, const OffDiag &c)
OffDiag & getCoeff10(const int np)
Definition: CRMatrix.h:131
CCAssembler & _assembler
void setCoeffL(const int f, const OffDiag &c)
DiagArray & _dRdXDiag
XArray & _flux
OffDiag & getCoeff01(const int np)
Definition: CRMatrix.h:126
BBMatrix & _dFluxdFlux
const CRConnectivity & _faceCells
const IntArray & _ibType
template<class X , class Diag , class OffDiag >
void BatteryPC_BCS< X, Diag, OffDiag >::applySingleEquationDirichletBC ( const FloatValEvaluator< T_Scalar > &  bValue,
const int  v 
) const
inline

Definition at line 122 of file BatteryPC_BCS.h.

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

123  {
124  for(int i=0; i<_faces.getCount(); i++)
125  applySingleEquationDirichletBC(i,bValue[i],v);
126  }
void applySingleEquationDirichletBC(int f, const T_Scalar &bValue, const int v) const
Definition: BatteryPC_BCS.h:77
int getCount() const
Definition: StorageSite.h:39
const StorageSite & _faces
template<class X , class Diag , class OffDiag >
void BatteryPC_BCS< X, Diag, OffDiag >::applySingleEquationNeumannBC ( const int  f,
const T_Scalar specifiedFlux,
const int  v 
) const
inline

Definition at line 128 of file BatteryPC_BCS.h.

References BatteryPC_BCS< X, Diag, OffDiag >::_dFluxdFlux, BatteryPC_BCS< X, Diag, OffDiag >::_dRdX, BatteryPC_BCS< X, Diag, OffDiag >::_faceAreaMag, BatteryPC_BCS< X, Diag, OffDiag >::_faceCells, BatteryPC_BCS< X, Diag, OffDiag >::_flux, BatteryPC_BCS< X, Diag, OffDiag >::_ibType, BatteryPC_BCS< X, Diag, OffDiag >::_r, Mesh::IBTYPE_FLUID, and CRMatrix< T_Diag, T_OffDiag, X >::setBoundary().

Referenced by BatteryPC_BCS< X, Diag, OffDiag >::applySingleEquationNeumannBC().

130  {
131  const int c0 = _faceCells(f,0);
132  const int c1 = _faceCells(f,1);
133 
134  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
135  return;
136  // the current value of flux and its Jacobians
137  const T_Scalar fluxB = -(_r[c1])[v];
138 
139 
140  // since we know the boundary flux, compute the boundary flux
141  // correction and add it to the c0 residual; also eliminate
142  // coeff to the boundary cell and remove it from the ap coeff
143 
144  const T_Scalar dFlux = specifiedFlux*_faceAreaMag[f] - fluxB;
145  // setup the equation for the boundary value; the coefficients
146  // are already computed so just need to set the rhs
147  (_r[c1])[v] = dFlux;
148 
149  // mark this row as a "boundary" row so that we will update it
150  // after the overall system is solved
151  _dRdX.setBoundary(c1);
152 
153  // fix the boundary flux to the specified value
154  (_flux[f])[v] = specifiedFlux*_faceAreaMag[f];
155 
156  Diag _dFluxdFlux_orig = _dFluxdFlux[f];
157  _dFluxdFlux_orig[v] = NumTypeTraits<T_Scalar>::getNegativeUnity();
158  _dFluxdFlux[f] = _dFluxdFlux_orig;
159  }
NumTypeTraits< X >::T_Scalar T_Scalar
Definition: BatteryPC_BCS.h:26
XArray & _flux
CCMatrix & _dRdX
void setBoundary(const int nr)
Definition: CRMatrix.h:1056
const TArray & _faceAreaMag
BBMatrix & _dFluxdFlux
const CRConnectivity & _faceCells
const IntArray & _ibType
template<class X , class Diag , class OffDiag >
void BatteryPC_BCS< X, Diag, OffDiag >::applySingleEquationNeumannBC ( const T_Scalar bFlux,
const int  v 
) const
inline

Definition at line 161 of file BatteryPC_BCS.h.

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

162  {
163  for(int i=0; i<_faces.getCount(); i++)
164  applySingleEquationNeumannBC(i,bFlux,v);
165  }
void applySingleEquationNeumannBC(const int f, const T_Scalar &specifiedFlux, const int v) const
int getCount() const
Definition: StorageSite.h:39
const StorageSite & _faces

Member Data Documentation

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

Definition at line 187 of file BatteryPC_BCS.h.

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

Definition at line 185 of file BatteryPC_BCS.h.

template<class X , class Diag , class OffDiag >
CCAssembler& BatteryPC_BCS< X, Diag, OffDiag >::_assembler
protected
template<class X , class Diag , class OffDiag >
const StorageSite& BatteryPC_BCS< X, Diag, OffDiag >::_cells
protected

Definition at line 169 of file BatteryPC_BCS.h.

template<class X , class Diag , class OffDiag >
BBMatrix& BatteryPC_BCS< X, Diag, OffDiag >::_dFluxdFlux
protected
template<class X , class Diag , class OffDiag >
FMatrix& BatteryPC_BCS< X, Diag, OffDiag >::_dFluxdX
protected
template<class X , class Diag , class OffDiag >
CCMatrix& BatteryPC_BCS< X, Diag, OffDiag >::_dRdX
protected
template<class X , class Diag , class OffDiag >
DiagArray& BatteryPC_BCS< X, Diag, OffDiag >::_dRdXDiag
protected
template<class X , class Diag , class OffDiag >
const VectorT3Array& BatteryPC_BCS< X, Diag, OffDiag >::_faceArea
protected

Definition at line 188 of file BatteryPC_BCS.h.

template<class X , class Diag , class OffDiag >
const TArray& BatteryPC_BCS< X, Diag, OffDiag >::_faceAreaMag
protected
template<class X , class Diag , class OffDiag >
const CRConnectivity& BatteryPC_BCS< X, Diag, OffDiag >::_faceCells
protected
template<class X , class Diag , class OffDiag >
const StorageSite& BatteryPC_BCS< X, Diag, OffDiag >::_faces
protected
template<class X , class Diag , class OffDiag >
XArray& BatteryPC_BCS< X, Diag, OffDiag >::_flux
protected
template<class X , class Diag , class OffDiag >
const Field& BatteryPC_BCS< X, Diag, OffDiag >::_fluxField
protected

Definition at line 173 of file BatteryPC_BCS.h.

template<class X , class Diag , class OffDiag >
const MultiField::ArrayIndex BatteryPC_BCS< X, Diag, OffDiag >::_fluxIndex
protected

Definition at line 175 of file BatteryPC_BCS.h.

template<class X , class Diag , class OffDiag >
const IntArray& BatteryPC_BCS< X, Diag, OffDiag >::_ibType
protected
template<class X , class Diag , class OffDiag >
const bool BatteryPC_BCS< X, Diag, OffDiag >::_is2D
protected

Definition at line 189 of file BatteryPC_BCS.h.

template<class X , class Diag , class OffDiag >
XArray& BatteryPC_BCS< X, Diag, OffDiag >::_r
protected
template<class X , class Diag , class OffDiag >
XArray& BatteryPC_BCS< X, Diag, OffDiag >::_rFlux
protected
template<class X , class Diag , class OffDiag >
const Field& BatteryPC_BCS< X, Diag, OffDiag >::_varField
protected

Definition at line 172 of file BatteryPC_BCS.h.

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

Definition at line 174 of file BatteryPC_BCS.h.


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