unitialized diverence
In viscosity.ccp, we have:
for (int i = 0; i < nr; i++) { /* TAUrr TAUtt and TAUpp computation */
for (int h = 0; h < ni; h++) {
for (int j = 0; j < ns; j++) {
int l = j+h*ns+i*ni*ns;
Trr[l] = 2*rho[l]*visc[l]*(Drr[l]-onethird*divergence[l]);
Ttt[l] = 2*rho[l]*visc[l]*(Dtt[l]-onethird*divergence[l]);
Tpp[l] = 2*rho[l]*visc[l]*(Dpp[l]-onethird*divergence[l]);
}
}
}
but divergence is only initialized up to nr-1:
for (int i = 0; i < nr-1; i++) { /* Drr, Dtt, Dpp and divV computation */
for ( int h = 0; h < ni; h++) {
int k = h+i*ni;
for (int j = 0; j < ns; j++) {
int l = j+h*ns+i*ni*ns;
int lip = l+ns*ni;
int lhp = l+ns;
ljp = j==ns-1 ? h*ns+i*ni*ns : l+1;
Drr[l] = (vr[lip]-vr[l])*invDiffRsup[i];
Dtt[l] = (vt[ljp]-vt[l])*invdtheta[l]+0.5*(vr[lip]+vr[l])*invRmed[i]+
(vp[lhp]+vp[l])*0.5*invRmed[i]*cosPhiMed[h]/sinPhiMed[h];
Dpp[l] = (vp[lhp]-vp[l])*invDPhi[k]+0.5*(vr[lip]+vr[l])*invRmed[i];
divergence[l] = ((vr[lip]*Rsup[i]*Rsup[i]-vr[l]*Rinf[i]*Rinf[i])*invDiffRsup[i]*invRmed[i]*invRmed[i]
+ (vt[ljp]-vt[l])*invdtheta[l]
+ (vp[lhp]*sinPhi[h+1]-vp[l]*sinPhi[h])*invDPhi[k]/sinPhiMed[h]);
}
}
}
Do we need to check if it's a problem ?