5 #ifndef _LINEARIZEINTERFACEJUMPUNCONNECTED_H_
6 #define _LINEARIZEINTERFACEJUMPUNCONNECTED_H_
23 template<
class X,
class Diag,
class OffDiag>
50 cout <<
"LINERIZEINTERFACEJUMPUNCONNECTED" << endl;
60 const XArray& xCell =
dynamic_cast<const XArray&
>((lsShell.
getX())[cVarIndex]);
72 XArray& rParentCell =
dynamic_cast<XArray&
>(rField[cVarIndexParent]);
83 XArray& rOtherCell =
dynamic_cast<XArray&
>(rField[cVarIndexOther]);
89 for (
int f=0; f<faces.
getCount(); f++)
92 int c0p = parentFaceCells(f,0);
93 int c1p = parentFaceCells(f,1);
103 const X leftFlux = rParentCell[c1p];
104 const OffDiag dRC0dXC3 = parentmatrix.
getCoeff(c1p, c0p);
105 const Diag dRC0dXC0 = parentdiag[c1p];
108 int c0o = otherFaceCells(f,0);
109 int c1o = otherFaceCells(f,1);
119 const X rightFlux = rOtherCell[c1o];
120 const OffDiag dRC0dXC2 = othermatrix.
getCoeff(c1o, c0o);
121 const OffDiag dRC0dXC1 = otherdiag[c1o];
125 const int c1 = cellCells(f,0);
126 const int c2 = cellCells(f,1);
127 const int c3 = cellCells(f,2);
130 varCell[c3] = varCellParent[c0p];
131 varCell[c2] = varCellOther[c0o];
134 const X r0 = -1*(rightFlux + leftFlux);
142 const OffDiag A = dRC1dXC0;
143 const Diag B = dRC1dXC1;
144 const OffDiag C = dRC1dXC2;
145 const OffDiag D = dRC1dXC3;
147 const Diag F = dRC0dXC0;
148 const OffDiag G = dRC0dXC1;
149 const OffDiag H = dRC0dXC2;
150 const OffDiag J = dRC0dXC3;
154 OffDiag& offDiagParentC0_C1 = parentmatrix.
getCoeff(c0p, c1p);
155 Diag& diagParentC0 = parentdiag[c0p];
156 X& parentR0 = rParentCell[c0p];
160 cout <<
"orignialParentOffDiag " << offDiagParentC0_C1 << endl;
161 cout <<
"originalDiagparent" << diagParentC0 << endl;
163 const OffDiag originalParentOffDiag = offDiagParentC0_C1;
164 offDiagParentC0_C1 = originalParentOffDiag*(B*H-G*C)/(A*G-B*F);
165 diagParentC0 += originalParentOffDiag*(B*J-D*G)/(A*G-B*F);
167 parentR0 += originalParentOffDiag*(G*r1 - B*r0)/(A*G-B*F);
170 cout << A <<
" " << B <<
" " << C <<
" " << D <<
" " << E <<
" " << F <<
" " << G <<
" " << H <<
" " << J <<
" " << K <<
" " << originalParentOffDiag <<
" " << r0 <<
" " << r1 << endl;
171 cout << (B*H-G*C) <<
" " << (B*J-D*G) <<
" " << (A*G-B*F) << endl;
172 cout << offDiagParentC0_C1 <<
" " << diagParentC0 << endl;
176 OffDiag& offDiagOtherC0_C1 = othermatrix.
getCoeff(c0o, c1o);
177 Diag& diagOtherC0 = otherdiag[c0o];
178 X& otherR0 = rOtherCell[c0o];
180 const OffDiag originalOtherOffDiag = offDiagOtherC0_C1;
181 offDiagOtherC0_C1 = originalOtherOffDiag*(D*F-A*J)/(A*G-B*F);
182 diagOtherC0 += originalOtherOffDiag*(C*F-A*H)/(A*G-B*F);
184 otherR0 += originalOtherOffDiag*(A*r0 - F*r1)/(A*G-B*F);
191 OffDiag& offDiagParentC1_C0 = parentmatrix.
getCoeff(c1p, c0p);
192 Diag& diagParentC1 = parentdiag[c1p];
193 X& parentR1 = rParentCell[c1p];
195 const Diag originalParentDiagC1 = diagParentC1;
196 offDiagParentC1_C0 += diagParentC1*(B*J-D*G)/(A*G-B*F);
197 diagParentC1 *= (B*H-G*C)/(A*G-B*F);
198 parentR1 += originalParentDiagC1*(G*r1 - B*r0)/(A*G-B*F);
201 OffDiag& offDiagOtherC1_C0 = othermatrix.
getCoeff(c1o, c0o);
202 Diag& diagOtherC1 = otherdiag[c1o];
203 X& otherR1 = rOtherCell[c1o];
205 const Diag originalOtherDiagC1 = diagOtherC1;
206 offDiagOtherC1_C0 += diagOtherC1*(C*F-A*H)/(A*G-B*F);
207 diagOtherC1 *= (D*F-A*J)/(A*G-B*F);
208 otherR1 += originalOtherDiagC1*(A*r0 - F*r1)/(A*G-B*F);
215 OffDiag& offdiagC0_C1 = matrix.
getCoeff(c0, c1);
216 OffDiag& offdiagC0_C2 = matrix.
getCoeff(c0, c2);
217 OffDiag& offdiagC0_C3 = matrix.
getCoeff(c0, c3);
220 offdiagC0_C1 = dRC0dXC1;
221 offdiagC0_C3 = dRC0dXC3;
222 offdiagC0_C2 = dRC0dXC2;
226 OffDiag& offdiagC1_C0 = matrix.
getCoeff(c1, c0);
227 OffDiag& offdiagC1_C2 = matrix.
getCoeff(c1, c2);
228 OffDiag& offdiagC1_C3 = matrix.
getCoeff(c1, c3);
231 offdiagC1_C0 = dRC1dXC0;
232 offdiagC1_C2 = dRC1dXC2;
233 offdiagC1_C3 = dRC1dXC3;
238 cout << xCell[c0] <<
" " << xCell[c1] <<
" " << xCell[c2] <<
" " << xCell[c3] << endl;
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
const StorageSite & getParentFaceGroupSite() const
OffDiag & getCoeff(const int i, const int j)
LinearizeInterfaceJumpUnconnected(const T_Scalar A_coeff, const X B_coeff, Field &varField)
Array< Diag > & getDiag()
const StorageSite & getOtherFaceGroupSite() const
CRMatrix< Diag, OffDiag, X > CCMatrix
void discretize(const Mesh &mesh, const Mesh &parentMesh, const Mesh &otherMesh, MultiFieldMatrix &mfmatrix, MultiField &xField, MultiField &rField, LinearSystem &lsShell)
NumTypeTraits< X >::T_Scalar T_Scalar
pair< const Field *, const StorageSite * > ArrayIndex
Array< VectorT3 > VectorT3Array
const CRConnectivity & getCellCells() const
const StorageSite & getCells() const
Vector< T_Scalar, 3 > VectorT3
SquareTensor< T_Scalar, 2 > SquareTensorT2
const CRConnectivity & getFaceCells(const StorageSite &site) const
CCMatrix::DiagArray DiagArray
MultiFieldMatrix & getMatrix()