67 const XArray& mFElecModel =
73 const XArray& xCell =
dynamic_cast<const XArray&
>(xField[cVarIndex]);
75 XArray& rCell =
dynamic_cast<XArray&
>(rField[cVarIndex]);
91 XArray& rParentCell =
dynamic_cast<XArray&
>(rField[cVarIndexParent]);
93 DiagArray& parentdiag = parentmatrix.getDiag();
94 const TArray& faceAreaMag =
102 XArray& rOtherCell =
dynamic_cast<XArray&
>(rField[cVarIndexOther]);
104 DiagArray& otherdiag = othermatrix.getDiag();
118 const T_Scalar C_a = alpha_a*F/R/Temp;
119 const T_Scalar C_c = alpha_c*F/R/Temp;
121 for (
int f=0; f<faces.
getCount(); f++)
124 int c0p = parentFaceCells(f,0);
125 int c1p = parentFaceCells(f,1);
135 const X parentFlux = rParentCell[c1p];
136 const OffDiag dRC0dXC3 = parentmatrix.getCoeff(c1p, c0p);
137 const Diag dRC0dXC0 = parentdiag[c1p];
140 int c0o = otherFaceCells(f,0);
141 int c1o = otherFaceCells(f,1);
151 const X otherFlux = rOtherCell[c1o];
152 const OffDiag dRC0dXC2 = othermatrix.getCoeff(c1o, c0o);
153 const OffDiag dRC0dXC1 = otherdiag[c1o];
158 const int c1 = cellCells(f,0);
159 const int c2 = cellCells(f,1);
160 const int c3 = cellCells(f,2);
162 const T_Scalar Area = faceAreaMag[c0];
168 if (cs_star < 0.0){ cout <<
"ERROR: Cs < 0, Cs=" << cs_star << endl; cs_star = 0.0;}
169 if (ce_star < 0.0){ cout <<
"ERROR: Ce < 0, Ce=" << ce_star << endl; ce_star = 0.0;}
170 if (cs_star > csMax){ cout <<
"ERROR: Cs > CsMax, Cs=" << cs_star << endl; cs_star = csMax;}
172 const T_Scalar SOC = mFElecModel[c1]/csMax;
176 U_ref = -0.16 + 1.32*exp(-3.0*SOC)+10.0*exp(-2000.0*SOC);
178 {U_ref = 0.0; cout <<
"U_ref < 0" << endl;}
180 {U_ref = 1.2; cout <<
"U_ref > 1.2" << endl;}
183 U_ref = 4.19829 + 0.0565661*tanh(-14.5546*SOC + 8.60942) - 0.0275479*(1.0/pow((0.998432-SOC),0.492465) - 1.90111) - 0.157123*exp(-0.04738*pow(SOC,8.0)) + 0.810239*exp(-40.0*(SOC-0.133875));
185 {U_ref = 0.0; cout <<
"U_ref < 0" << endl;}
187 {U_ref = 5.0; cout <<
"U_ref > 5.0" << endl;}
190 const T_Scalar eta_star = ePotCell[c1] - ePotCell[c0] - U_ref;
193 T_Scalar C_0 = exp(C_a*eta_star)-exp(-1.0*C_c*eta_star);
195 const T_Scalar i_star = C_0*k*F*Area*pow(ce_star,alpha_c)*pow((csMax-cs_star),alpha_a)*pow(cs_star,alpha_c);
198 if (i_star == 0.0){cout <<
"WARNING: current = 0" << endl;}
205 dC_0dCS = (C_a*exp(C_a*eta_star) + C_c*exp(-1*C_c*eta_star))*(-1.0)*(-20000.0*exp(-2000.0*SOC) - 3.96*exp(-3.0*SOC))*(1.0/csMax);
209 dC_0dCS = (C_a*exp(C_a*eta_star) + C_c*exp(-1*C_c*eta_star))*(-1.0)*(-0.0135664/pow((0.998432-SOC),1.49247) - 0.823297/pow(cosh(8.60942-14.5546*SOC),2.0) + 0.0595559*exp(-0.04738*pow(SOC,8.0))*pow(SOC,7.0) - 6859.94*exp(-40.0*SOC))*(1.0/csMax);
212 const T_Scalar dIdCS_star = i_star*(alpha_c/cs_star - alpha_a/(csMax-cs_star)+ dC_0dCS/C_0);
214 const T_Scalar dIdCE_star = i_star*alpha_c/ce_star;
218 OffDiag& offdiagC0_C1 = matrix.getCoeff(c0, c1);
219 OffDiag& offdiagC0_C2 = matrix.getCoeff(c0, c2);
220 OffDiag& offdiagC0_C3 = matrix.getCoeff(c0, c3);
222 rCell[c0] = F*otherFlux + F*parentFlux;
223 offdiagC0_C1 = F*dRC0dXC1;
224 offdiagC0_C3 = F*dRC0dXC3;
225 offdiagC0_C2 = F*dRC0dXC2;
226 diag[c0] = F*dRC0dXC0;
230 OffDiag& offdiagC1_C0 = matrix.getCoeff(c1, c0);
231 OffDiag& offdiagC1_C2 = matrix.getCoeff(c1, c2);
233 rCell[c1] = otherFlux*F - (i_star + dIdCS_star*(xCell[c1]-cs_star) + dIdCE_star*(xCell[c0]-ce_star));
234 offdiagC1_C0 = -1*dIdCE_star;
235 offdiagC1_C2 = F*dRC0dXC2;
237 if (dIdCS_star > 0.0)
239 diag[c1] = F*dRC0dXC1 - dIdCS_star;
243 diag[c1] = F*dRC0dXC1;
247 OffDiag& offdiagC1_C3 = matrix.getCoeff(c1, c3);
266 cout <<
"Cs0: " << cs_star << endl;
const T_Scalar _interfaceUnderRelax
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
CRMatrix< Diag, OffDiag, X > CCMatrix
const StorageSite & getParentFaceGroupSite() const
CCMatrix::DiagArray DiagArray
Field & _elecPotentialField
const StorageSite & getOtherFaceGroupSite() const
pair< const Field *, const StorageSite * > ArrayIndex
const T_Scalar _RRConstant
const CRConnectivity & getCellCells() const
NumTypeTraits< X >::T_Scalar T_Scalar
const StorageSite & getCells() const
const GeomFields & _geomFields
const CRConnectivity & getFaceCells(const StorageSite &site) const