Memosa-FVM  0.2
GenericBCS.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 _GENERICBCS_H_
6 #define _GENERICBCS_H_
7 
8 #include "Mesh.h"
9 
10 #include "NumType.h"
11 #include "Array.h"
12 #include "Vector.h"
13 #include "Field.h"
14 #include "CRConnectivity.h"
15 #include "StorageSite.h"
16 #include "MultiFieldMatrix.h"
17 #include "CRMatrix.h"
18 #include "FluxJacobianMatrix.h"
19 #include "DiagonalMatrix.h"
20 
21 template<class X, class Diag, class OffDiag>
23 {
24 public:
25 
27 
30 
32 
35 
38 
41 
42  typedef Array<X> XArray;
44 
45 
47  const Mesh& mesh,
48  const GeomFields& geomFields,
49  Field& varField,
50  Field& fluxField,
51  MultiFieldMatrix& matrix,
52  MultiField& xField, MultiField& rField) :
53  _faces(faces),
54  _cells(mesh.getCells()),
55  _ibType(dynamic_cast<const IntArray&>(geomFields.ibType[_cells])),
56  _faceCells(mesh.getFaceCells(_faces)),
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))),
64  _assembler(_dRdX.getPairWiseAssembler(_faceCells)),
65  _dRdXDiag(_dRdX.getDiag()),
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  {}
76 
77  void applyDirichletBC(int f, const X& bValue) const
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 X fluxB = -_r[c1];
87  const OffDiag dFluxdXC0 = -_assembler.getCoeff10(f);
88  const Diag dFluxdXC1 = -_dRdXDiag[c1];
89  const OffDiag dRC0dXC1 = _assembler.getCoeff01(f);
90 
91  // since we know the boundary value, compute the boundary
92  // x correction and it's contribution to the residual for c0; we
93  // can then eliminate the coefficient to the boundary cell
94 
95  const X dXC1 = bValue - _x[c1];
96  const X dFlux = dFluxdXC1*dXC1;
97  const X dRC0 = dRC0dXC1*dXC1;
98  _r[c0] += dRC0;
99 
101 
102  // set the boundary value and make its correction equation an
103  // identity
104  _x[c1] = bValue;
108 
109  //setup the equation for the boundary flux correction
110  _dFluxdX.setCoeffL(f,dFluxdXC0);
112  _flux[f] = fluxB;
113  _rFlux[f] = dFlux;
115  }
116 
117  void applyDirichletBC(const X& bValue) const
118  {
119  for(int i=0; i<_faces.getCount(); i++)
120  applyDirichletBC(i,bValue);
121  }
122 
123  void applyDirichletBC(const FloatValEvaluator<X>& bValue) const
124  {
125  for(int i=0; i<_faces.getCount(); i++)
126  applyDirichletBC(i,bValue[i]);
127  }
128 
129  void applyNeumannBC(const int f,
130  const X& specifiedFlux) const
131  {
132  const int c0 = _faceCells(f,0);
133  const int c1 = _faceCells(f,1);
134 
135  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
136  return;
137  // the current value of flux and its Jacobians
138  const X fluxB = -_r[c1];
139 
140 
141  // since we know the boundary flux, compute the boundary flux
142  // correction and add it to the c0 residual; also eliminate
143  // coeff to the boundary cell and remove it from the ap coeff
144 
145  const X dFlux = specifiedFlux*_faceAreaMag[f] - fluxB;
146  // setup the equation for the boundary value; the coefficients
147  // are already computed so just need to set the rhs
148  _r[c1] = dFlux;
149 
150  // mark this row as a "boundary" row so that we will update it
151  // after the overall system is solved
152  _dRdX.setBoundary(c1);
153 
154  // fix the boundary flux to the specified value
155  _flux[f] = specifiedFlux*_faceAreaMag[f];
157  }
158 
159 
160  void applyNeumannBC(const X& bFlux) const
161  {
162  for(int i=0; i<_faces.getCount(); i++)
163  applyNeumannBC(i,bFlux);
164  }
165 
166  void applyNeumannBC(const FloatValEvaluator<X>& bFlux) const
167  {
168  for(int i=0; i<_faces.getCount(); i++)
169  applyNeumannBC(i,bFlux[i]);
170  }
171 
172  void applyExtrapolationBC() const
173  {
174  for(int i=0; i<_faces.getCount(); i++)
176  }
177 
178  // boundary value = cell value, flux as defined by interior discretization
179 
180  void applyExtrapolationBC(const int f) const
181  {
182  const int c0 = _faceCells(f,0);
183  const int c1 = _faceCells(f,1);
184 
185  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
186  return;
187 
188  // the current value of flux and its Jacobians
189  const X fluxB = -_r[c1];
190  const OffDiag dFluxdXC0 = -_assembler.getCoeff10(f);
191  const Diag dFluxdXC1 = -_dRdXDiag[c1];
192 
193  const X xc0mxc1 = _x[c0]-_x[c1];
194 
195  // eliminate boundary dependency from cell equation
196  _dRdXDiag[c0] += dFluxdXC1;
197  _r[c0] += dFluxdXC1*xc0mxc1;
198  _assembler.getCoeff01(f) = 0;
199 
200  // boundary value equation
203  _r[c1] = xc0mxc1;
204  _dRdX.setBoundary(c1);
205 
206  //setup the equation for the boundary flux correction
207  _dFluxdX.setCoeffL(f,dFluxdXC0);
208  _dFluxdX.setCoeffR(f,dFluxdXC0); // should really be dFluxdXC1
209  _flux[f] = fluxB;
210  _rFlux[f] = T_Scalar(0);
212  }
213 
214  void applyConvectionBC(const int f,
215  const X& hCoeff, const X& Xinf) const
216  {
217  const int c0 = _faceCells(f,0);
218  const int c1 = _faceCells(f,1);
219 
220  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
221  return;
222 
223  // the current value of flux and its Jacobians
224  const X fluxInterior = -_r[c1];
225 
226  // flux based on current boundary value
227  const X fluxBoundary = -hCoeff*(_x[c1]-Xinf)*_faceAreaMag[f];
228 
229  const X dFlux = fluxBoundary-fluxInterior;
230 
231  _r[c1] = dFlux;
232 
233  // add this to complete the Jacobian wrt boundar value
234  _dRdXDiag[c1] -= hCoeff*_faceAreaMag[f];
235 
236  // mark this row as a "boundary" row so that we will update it
237  // after the overall system is solved
238  _dRdX.setBoundary(c1);
239 
240  _flux[f] = fluxBoundary;
241  _rFlux[f] = 0;
243  _dFluxdX.setCoeffR(f,-hCoeff*_faceAreaMag[f]);
245  }
246 
247  void applyConvectionBC(const X& hCoeff, const X& Xinf) const
248  {
249  for(int i=0; i<_faces.getCount(); i++)
250  applyConvectionBC(i,hCoeff,Xinf);
251  }
252 
253  void applyRadiationBC(const int f,
254  const X& emissivity, const X& Xinf) const
255  {
256  const int c0 = _faceCells(f,0);
257  const int c1 = _faceCells(f,1);
258 
259  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
260  return;
261  //The value of the Stefan-Boltzman constant
262  double s_b_const = 5.670373E-8;
263 
264  // the current value of flux and its Jacobians
265  const X fluxInterior = -_r[c1];
266 
267  // flux based on current boundary value
268  const X fluxBoundary = -emissivity*s_b_const*\
269  (_x[c1]*_x[c1]*_x[c1]*_x[c1]-Xinf*Xinf*Xinf*Xinf)*_faceAreaMag[f];
270 
271  const X dFlux = fluxBoundary-fluxInterior;
272 
273  _r[c1] = dFlux;
274 
275  // add this to complete the Jacobian wrt boundary value
276  _dRdXDiag[c1] -= \
277  4*emissivity*s_b_const*_x[c1]*_x[c1]*_x[c1]*_faceAreaMag[f];
278 
279  // mark this row as a "boundary" row so that we will update it
280  // after the overall system is solved
281  _dRdX.setBoundary(c1);
282 
283  _flux[f] = fluxBoundary;
284  _rFlux[f] = 0;
286  _dFluxdX.setCoeffR(f,-4*emissivity*s_b_const*_x[c1]*_x[c1]*_x[c1]*_faceAreaMag[f]);
288  }
289 
290  void applyMixedBC(const int f, const X& hCoeff,
291  const X& emissivity, const X& Xinf) const
292  {
293  const int c0 = _faceCells(f,0);
294  const int c1 = _faceCells(f,1);
295 
296  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
297  return;
298  //The value of the Stefan-Boltzman constant
299  double s_b_const = 5.670373E-8;
300 
301  // the current value of flux and its Jacobians
302  const X fluxInterior = -_r[c1];
303 
304  // flux based on current boundary value
305  const X fluxBoundary = (-emissivity*s_b_const*(_x[c1]*_x[c1]*_x[c1]*_x[c1]-Xinf*Xinf*Xinf*Xinf)-hCoeff*(_x[c1]-Xinf))*_faceAreaMag[f];
306 
307  const X dFlux = fluxBoundary-fluxInterior;
308 
309  _r[c1] = dFlux;
310 
311  // add this to complete the Jacobian wrt boundary value
312  _dRdXDiag[c1] -= (4*emissivity*s_b_const*_x[c1]*_x[c1]*_x[c1]+hCoeff)*_faceAreaMag[f];
313 
314  // mark this row as a "boundary" row so that we will update it
315  // after the overall system is solved
316  _dRdX.setBoundary(c1);
317 
318  _flux[f] = fluxBoundary;
319  _rFlux[f] = 0;
321  _dFluxdX.setCoeffR(f,-4*emissivity*s_b_const*_x[c1]*_x[c1]*_x[c1]*_faceAreaMag[f]);
323  }
324 
325  void applyInterfaceBC(const int f) const
326  {
327  // the boundary cell could be either c0 or c1 at an interface
328  int cb = _faceCells(f,1);
330  if (cb < _cells.getSelfCount())
331  {
332  cb = _faceCells(f,0);
333  sign *= -1.0;
334  }
335 
336 
337  // the current value of flux and its Jacobians
338  const X fluxInterior = -_r[cb];
339  const OffDiag dFluxdXC0 = -sign*_assembler.getCoeff10(f);
340  const OffDiag dFluxdXC1 = sign*_assembler.getCoeff01(f);
341 
342 
343  _r[cb] = T_Scalar(0);
344 
345  if (sign>0)
347  else
349 
350  //setup the equation for the boundary flux correction
351  _dFluxdX.setCoeffL(f,dFluxdXC0);
352  _dFluxdX.setCoeffR(f,dFluxdXC1);
353  _flux[f] = fluxInterior;
354  _rFlux[f] = T_Scalar(0);
356  }
357 
358  void applyInterfaceBC() const
359  {
360  for(int i=0; i<_faces.getCount(); i++)
361  applyInterfaceBC(i);
362  }
363 
364  //*********************************************************************
365  //special interface boundary condition for dielectric layer
366 
367  void applyDielectricInterfaceBC(const int f, const X& hCoeff,
368  const X& Xinf, const X& source) const
369  {
370  // here the hCoeff = dielectric_constant / dielectric_thickness
371  // source = totalcharge * dielectric_thickness / 4. for 2D
372  // source = totalcharge * dielectric_thickness / 6. for 3D
373  const int c0 = _faceCells(f,0);
374  const int c1 = _faceCells(f,1);
375 
376  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
377  return;
378 
379  // the current value of flux and its Jacobians
380  const X fluxInterior = -_r[c1];
381 
382  // flux based on current boundary value
383 
384  X fluxSource = source * _faceAreaMag[f];
385  if (_is2D)
386  fluxSource /= 2.0;
387  else
388  fluxSource /= 2.0;
389  const X fluxBoundary = -hCoeff*(_x[c1]-Xinf)*_faceAreaMag[f] + fluxSource;
390  const X dFlux = fluxBoundary-fluxInterior;
391 
392  _r[c1] = dFlux;
393 
394  // add this to complete the Jacobian wrt boundar value
395  _dRdXDiag[c1] -= hCoeff*_faceAreaMag[f];
396 
397  // mark this row as a "boundary" row so that we will update it
398  // after the overall system is solved
399  _dRdX.setBoundary(c1);
400 
401  _flux[f] = fluxBoundary;
402  _rFlux[f] = 0;
404  _dFluxdX.setCoeffR(f,-hCoeff*_faceAreaMag[f]);
406 
407  }
408 
409  void applyDielectricInterfaceBC(const X& hCoeff,
410  const X& Xinf, const X& source) const
411  {
412  for(int i=0; i<_faces.getCount(); i++)
413  applyDielectricInterfaceBC(i,hCoeff, Xinf, source );
414  }
415 
416 
417 
418  void applyFlowBC(const TArray& convFlux, const X& bValue) const
419  {
420  for(int f=0; f<_faces.getCount(); f++)
421  if (convFlux[f] < 0)
422  applyDirichletBC(f,bValue);
423  else
425  }
426 
427  void applyNonzeroDiagBC() const
428  {
429  for(int i=0; i<_faces.getCount(); i++)
431  }
432 
433  void applyNonzeroDiagBC(int f) const
434  {
435  const int c0 = _faceCells(f,0);
436  const int c1 = _faceCells(f,1);
437 
438  if (_ibType[c0] != Mesh::IBTYPE_FLUID)
439  return;
440 
441  _dRdXDiag[c1][0] = T_Scalar(-1.0);
442  }
443 
444 
445 protected:
450  const Field& _varField;
467  const bool _is2D;
468 
469 };
470 
471 
472 template<class X, class Diag, class OffDiag>
473 class GenericBCS : public BaseGenericBCS<X,Diag,OffDiag>
474 {
475 public:
476 
478 
479  GenericBCS(const StorageSite& faces,
480  const Mesh& mesh,
481  const GeomFields& geomFields,
482  Field& varField,
483  Field& fluxField,
484  MultiFieldMatrix& matrix,
485  MultiField& xField, MultiField& rField) :
486  T_Parent(faces,mesh,geomFields,varField,fluxField,matrix,xField,rField)
487  {}
488 
489 
490  // see the specialization for Vectors below
491  void applySymmetryBC() const
492  {
493  for(int f=0; f<this->_faces.getCount(); f++)
494  {
495  const int c0 = this->_faceCells(f,0);
496  const int c1 = this->_faceCells(f,1);
497 
498  // the current value of flux and its Jacobians
499  //const X fluxB = -this->_r[c1];
500  //const OffDiag dFluxdXC0 = -this->_assembler.getCoeff10(f);
501  const Diag dFluxdXC1 = -this->_dRdXDiag[c1];
502 
503  const X xB = this->_x[c0];
504 
505 
506  const X xc1mxB = this->_x[c1]-xB;
507  this->_x[c1] = xB;
508 
509  // eliminate boundary dependency from cell equation
510  this->_dRdXDiag[c0] += dFluxdXC1;
511  this->_r[c0] -= dFluxdXC1*xc1mxB;
512  this->_assembler.getCoeff01(f) = 0;
513 
514  // boundary value equation
517  this->_r[c1] = X(0);//xc0mxB;
518  this->_dRdX.setBoundary(c1);
519 
520  //setup the equation for the boundary flux correction
521 
522  this->_flux[f] = X(0);
523  this->_rFlux[f] = X(0);
525  }
526  }
527 
528 };
529 
530 template<class T, int N>
531 class GenericBCS< Vector<T,N>, DiagonalTensor<T,N>, T>
532  : public BaseGenericBCS<Vector<T,N>, DiagonalTensor<T,N>, T>
533 {
534 public:
536  typedef Vector<T,N> X;
538  typedef T OffDiag;
539 
541 
544 
547 
550 
553 
554  typedef Array<X> XArray;
556 
557 
558  GenericBCS(const StorageSite& faces,
559  const Mesh& mesh,
560  const GeomFields& geomFields,
561  Field& varField,
562  Field& fluxField,
563  MultiFieldMatrix& matrix,
564  MultiField& xField, MultiField& rField) :
565  T_Parent(faces,mesh,geomFields,varField,fluxField,matrix,xField,rField)
566  {}
567 
568 
569  void applySymmetryBC() const
570  {
571  for(int f=0; f<this->_faces.getCount(); f++)
572  {
573  const int c0 = this->_faceCells(f,0);
574  const int c1 = this->_faceCells(f,1);
575 
576  // the current value of flux and its Jacobians
577  const X fluxB = -this->_r[c1];
578  const OffDiag dFluxdXC0 = -this->_assembler.getCoeff10(f);
579  const Diag dFluxdXC1 = -this->_dRdXDiag[c1];
580  const OffDiag dRC0dXC1 = this->_assembler.getCoeff01(f);
581 
582  const VectorT3 en = this->_faceArea[f]/this->_faceAreaMag[f];
583  const T xC0_dotn = dot(this->_x[c0],en);
584  const X xB = this->_x[c0] - 2*xC0_dotn * en;
585 
586  Diag dxBdxC0;
587  dxBdxC0[0] = 1.0 - 2.0*en[0]*en[0];
588  dxBdxC0[1] = 1.0 - 2.0*en[1]*en[1];
589  dxBdxC0[2] = 1.0 - 2.0*en[2]*en[2];
590 
591 
592  const X dXC1 = xB-this->_x[c1];
593  const X dFlux = dFluxdXC1*dXC1;
594  this->_x[c1] = xB;
595 
596  // eliminate boundary dependency from cell equation
597  this->_r[c0] += dRC0dXC1*dXC1;
598 
599  this->_assembler.getCoeff01(f) = 0;
600 
601  // boundary value equation
602  this->_dRdXDiag[c1] = this->_dRdXDiag[c0];
603  this->_assembler.getCoeff10(f) = 0;
604  this->_r[c1] = T(0);//xc0mxB;
605  this->_dRdX.setBoundary(c1);
606 
607  //setup the equation for the boundary flux correction
608  this->_dFluxdX.setCoeffL(f,dFluxdXC0);
610  this->_flux[f] = fluxB;
611  this->_rFlux[f] = dFlux;
613 
614  }
615  }
616 };
617 
618 
619 template<class T, int N>
620 class GenericBCS< Vector<T,N>, DiagonalTensor<T,N>, DiagonalTensor<T,N> >
621  : public BaseGenericBCS<Vector<T,N>, DiagonalTensor<T,N>, DiagonalTensor<T,N> >
622 {
623 public:
625  typedef Vector<T,N> X;
628 
630 
633 
636 
639 
642 
643  typedef Array<X> XArray;
645 
646 
647  GenericBCS(const StorageSite& faces,
648  const Mesh& mesh,
649  const GeomFields& geomFields,
650  Field& varField,
651  Field& fluxField,
652  MultiFieldMatrix& matrix,
653  MultiField& xField, MultiField& rField) :
654  T_Parent(faces,mesh,geomFields,varField,fluxField,matrix,xField,rField)
655  {}
656 
657 
658  void applySymmetryBC() const
659  {
660  for(int f=0; f<this->_faces.getCount(); f++)
661  {
662  const int c0 = this->_faceCells(f,0);
663  const int c1 = this->_faceCells(f,1);
664 
665  // the current value of flux and its Jacobians
666  const X fluxB = -this->_r[c1];
667  const OffDiag dFluxdXC0 = -this->_assembler.getCoeff10(f);
668  const Diag dFluxdXC1 = -this->_dRdXDiag[c1];
669  const OffDiag dRC0dXC1 = this->_assembler.getCoeff01(f);
670 
671  const VectorT3 en = this->_faceArea[f]/this->_faceAreaMag[f];
672  const T xC0_dotn = dot(this->_x[c0],en);
673  const X xB = this->_x[c0] - 2.0*xC0_dotn * en;
674 
675  const X dXC1 = xB-this->_x[c1];
676  const X dFlux = dFluxdXC1*dXC1;
677  this->_x[c1] = xB;
678 
679  // eliminate boundary dependency from cell equation
680  this->_r[c0] += dRC0dXC1*dXC1;
681 
682  this->_assembler.getCoeff01(f) = 0;
683 
684  // boundary value equation
685  this->_dRdXDiag[c1] = this->_dRdXDiag[c0];
686  this->_assembler.getCoeff10(f) = 0;
687  this->_r[c1] = T(0);
688  this->_dRdX.setBoundary(c1);
689 
690 
691  this->_dFluxdX.setCoeffL(f,dFluxdXC0);
692  this->_dFluxdX.setCoeffR(f,dFluxdXC1);
694  }
695  }
696 };
697 
698 #include "SquareTensor.h"
699 
700 template<class T, int N>
701 class GenericBCS< Vector<T,N>, SquareTensor<T,N>, SquareTensor<T,N> >
702  : public BaseGenericBCS<Vector<T,N>, SquareTensor<T,N>, SquareTensor<T,N> >
703 {
704 public:
706  typedef Vector<T,N> X;
709 
711 
714 
717 
720 
723 
724  typedef Array<X> XArray;
726 
727 
728  GenericBCS(const StorageSite& faces,
729  const Mesh& mesh,
730  const GeomFields& geomFields,
731  Field& varField,
732  Field& fluxField,
733  MultiFieldMatrix& matrix,
734  MultiField& xField, MultiField& rField) :
735  T_Parent(faces,mesh,geomFields,varField,fluxField,matrix,xField,rField)
736  {}
737 
738 
739  void applySymmetryBC() const
740  {
741  for(int f=0; f<this->_faces.getCount(); f++)
742  {
743  const int c0 = this->_faceCells(f,0);
744  const int c1 = this->_faceCells(f,1);
745 
746  // the current value of flux and its Jacobians
747  const X fluxB = -this->_r[c1];
748  const OffDiag dFluxdXC0 = -this->_assembler.getCoeff10(f);
749  const Diag dFluxdXC1 = -this->_dRdXDiag[c1];
750 
751  const VectorT3 en = this->_faceArea[f]/this->_faceAreaMag[f];
752  const T xC0_dotn = dot(this->_x[c0],en);
753  const X xB = this->_x[c0] - xC0_dotn * en;
754 
755  Diag dxBdxC0(Diag::getZero());
756  dxBdxC0(0,0) = 1.0 - en[0]*en[0];
757  dxBdxC0(0,1) = - en[0]*en[1];
758  dxBdxC0(0,2) = - en[0]*en[2];
759 
760  dxBdxC0(1,0) = - en[1]*en[0];
761  dxBdxC0(1,1) = 1.0 - en[1]*en[1];
762  dxBdxC0(1,2) = - en[1]*en[2];
763 
764  dxBdxC0(2,0) = - en[2]*en[0];
765  dxBdxC0(2,1) = - en[2]*en[1];
766  dxBdxC0(2,2) = 1.0 - en[2]*en[2];
767 
768 
769  const X xc1mxB = this->_x[c1]-xB;
770  this->_x[c1] = xB;
771 
772  // eliminate boundary dependency from cell equation
773  this->_dRdXDiag[c0] += dFluxdXC1*dxBdxC0;
774  this->_r[c0] += dFluxdXC1*xc1mxB;
776 
777  // boundary value equation
779  this->_assembler.getCoeff10(f) = dxBdxC0;
780  this->_r[c1] = NumTypeTraits<X>::getZero();//xc0mxB;
781  this->_dRdX.setBoundary(c1);
782 
783  //setup the equation for the boundary flux correction
784  //this->_dFluxdX.setCoeffL(f,dFluxdXC0);
785  //this->_dFluxdX.setCoeffR(f,dFluxdXC1);
786  this->_flux[f] = fluxB - dFluxdXC1*xc1mxB;
787  this->_rFlux[f] = T_Scalar(0);
789  }
790  }
791 };
792 
793 
794 #endif
795 
void applySymmetryBC() const
Definition: GenericBCS.h:491
Array< T_Scalar > TArray
Definition: GenericBCS.h:28
GenericBCS(const StorageSite &faces, const Mesh &mesh, const GeomFields &geomFields, Field &varField, Field &fluxField, MultiFieldMatrix &matrix, MultiField &xField, MultiField &rField)
Definition: GenericBCS.h:728
Array< VectorT3 > VectorT3Array
Definition: GenericBCS.h:43
int getSelfCount() const
Definition: StorageSite.h:40
const VectorT3Array & _faceArea
Definition: GenericBCS.h:466
void applyMixedBC(const int f, const X &hCoeff, const X &emissivity, const X &Xinf) const
Definition: GenericBCS.h:290
BBMatrix & _dFluxdFlux
Definition: GenericBCS.h:456
const TArray & _faceAreaMag
Definition: GenericBCS.h:464
const Field & _areaField
Definition: GenericBCS.h:465
void applyConvectionBC(const int f, const X &hCoeff, const X &Xinf) const
Definition: GenericBCS.h:214
const IntArray & _ibType
Definition: GenericBCS.h:448
CRMatrix< Diag, OffDiag, X > CCMatrix
Definition: GenericBCS.h:33
GenericBCS(const StorageSite &faces, const Mesh &mesh, const GeomFields &geomFields, Field &varField, Field &fluxField, MultiFieldMatrix &matrix, MultiField &xField, MultiField &rField)
Definition: GenericBCS.h:558
GenericBCS(const StorageSite &faces, const Mesh &mesh, const GeomFields &geomFields, Field &varField, Field &fluxField, MultiFieldMatrix &matrix, MultiField &xField, MultiField &rField)
Definition: GenericBCS.h:647
void applyExtrapolationBC(const int f) const
Definition: GenericBCS.h:180
Definition: Field.h:14
void applyDirichletBC(const X &bValue) const
Definition: GenericBCS.h:117
CCAssembler & _assembler
Definition: GenericBCS.h:457
void applyNonzeroDiagBC() const
Definition: GenericBCS.h:427
Definition: Mesh.h:49
void applyDirichletBC(const FloatValEvaluator< X > &bValue) const
Definition: GenericBCS.h:123
void setCoeffR(const int f, const OffDiag &c)
OffDiag & getCoeff10(const int np)
Definition: CRMatrix.h:131
BaseGenericBCS< Vector< T, N >, DiagonalTensor< T, N >, DiagonalTensor< T, N > > T_Parent
Definition: GenericBCS.h:624
void applyInterfaceBC() const
Definition: GenericBCS.h:358
const CRConnectivity & _faceCells
Definition: GenericBCS.h:449
FluxJacobianMatrix< Diag, X > FMatrix
Definition: GenericBCS.h:36
BaseGenericBCS< X, Diag, OffDiag > T_Parent
Definition: GenericBCS.h:477
XArray & _rFlux
Definition: GenericBCS.h:462
DiagonalMatrix< Diag, X > BBMatrix
Definition: GenericBCS.h:37
void applyNeumannBC(const X &bFlux) const
Definition: GenericBCS.h:160
const StorageSite & _faces
Definition: GenericBCS.h:446
void setCoeffL(const int f, const OffDiag &c)
void applyNeumannBC(const FloatValEvaluator< X > &bFlux) const
Definition: GenericBCS.h:166
const bool _is2D
Definition: GenericBCS.h:467
Vector< T_Scalar, 3 > VectorT3
Definition: GenericBCS.h:31
pair< const Field *, const StorageSite * > ArrayIndex
Definition: MultiField.h:21
BaseGenericBCS(const StorageSite &faces, const Mesh &mesh, const GeomFields &geomFields, Field &varField, Field &fluxField, MultiFieldMatrix &matrix, MultiField &xField, MultiField &rField)
Definition: GenericBCS.h:46
XArray & _x
Definition: GenericBCS.h:459
NumTypeTraits< X >::T_Scalar T_Scalar
Definition: GenericBCS.h:26
const MultiField::ArrayIndex _xIndex
Definition: GenericBCS.h:452
void applyDirichletBC(int f, const X &bValue) const
Definition: GenericBCS.h:77
XArray & _r
Definition: GenericBCS.h:460
void applyInterfaceBC(const int f) const
Definition: GenericBCS.h:325
void applyRadiationBC(const int f, const X &emissivity, const X &Xinf) const
Definition: GenericBCS.h:253
void applyNonzeroDiagBC(int f) const
Definition: GenericBCS.h:433
Array< X > XArray
Definition: GenericBCS.h:42
OffDiag & getCoeff01(const int np)
Definition: CRMatrix.h:126
Definition: Array.h:14
void applyNeumannBC(const int f, const X &specifiedFlux) const
Definition: GenericBCS.h:129
const StorageSite & _cells
Definition: GenericBCS.h:447
void setBoundary(const int nr)
Definition: CRMatrix.h:1056
XArray & _flux
Definition: GenericBCS.h:461
void applyConvectionBC(const X &hCoeff, const X &Xinf) const
Definition: GenericBCS.h:247
FMatrix & _dFluxdX
Definition: GenericBCS.h:455
const Field & _varField
Definition: GenericBCS.h:450
CCMatrix::PairWiseAssembler CCAssembler
Definition: GenericBCS.h:34
const MultiField::ArrayIndex _fluxIndex
Definition: GenericBCS.h:453
int getCount() const
Definition: StorageSite.h:39
void applyDielectricInterfaceBC(const X &hCoeff, const X &Xinf, const X &source) const
Definition: GenericBCS.h:409
const Field & _fluxField
Definition: GenericBCS.h:451
void applyFlowBC(const TArray &convFlux, const X &bValue) const
Definition: GenericBCS.h:418
void applyDielectricInterfaceBC(const int f, const X &hCoeff, const X &Xinf, const X &source) const
Definition: GenericBCS.h:367
Array< int > IntArray
Definition: GenericBCS.h:29
const Field & _areaMagField
Definition: GenericBCS.h:463
GenericBCS(const StorageSite &faces, const Mesh &mesh, const GeomFields &geomFields, Field &varField, Field &fluxField, MultiFieldMatrix &matrix, MultiField &xField, MultiField &rField)
Definition: GenericBCS.h:479
Array< OffDiag > OffDiagArray
Definition: GenericBCS.h:40
T dot(const Vector< T, 3 > &a, const Vector< T, 3 > &b)
Definition: Vector.h:253
DiagArray & _dRdXDiag
Definition: GenericBCS.h:458
BaseGenericBCS< Vector< T, N >, DiagonalTensor< T, N >, T > T_Parent
Definition: GenericBCS.h:535
Array< Diag > DiagArray
Definition: GenericBCS.h:39
CCMatrix & _dRdX
Definition: GenericBCS.h:454
BaseGenericBCS< Vector< T, N >, SquareTensor< T, N >, SquareTensor< T, N > > T_Parent
Definition: GenericBCS.h:705
void applyExtrapolationBC() const
Definition: GenericBCS.h:172