diff --git a/testApp/chemFoam.C b/testApp/chemFoam.C index ffaf40f..6c3d8b2 100644 --- a/testApp/chemFoam.C +++ b/testApp/chemFoam.C @@ -122,11 +122,40 @@ int main(int argc, char *argv[]) diff.correct(); // Cantera gas transport - gas_.setState_TPY(T[i], p0, XY.data()); - + gas_.setState_TPY(T[i], p[0], XY.data()); scalarField Dc (composition.species().size(), 0.0); - tr_->getMixDiffCoeffsMass(Dc.data()); + scalarField Dij (composition.species().size()*composition.species().size(), 0.0); + + const scalar relTol = 1.0e-15; + + // check for singular case (Xi = 1) + label idxFracOne = -1; + scalar sumX = sum(XY); + forAll (XY, i) + { + if ((sumX-XY[i])/sumX < relTol) + { + idxFracOne = i; + break; + } + } + + if (idxFracOne < 0) + { + tr_->getMixDiffCoeffsMass(Dc.data()); + } + else + { + label nSp = nCanteraSp_; + tr_->getBinaryDiffCoeffs(nSp, Dij.data()); + + forAll(Dc, i) + { + Dc[i] = Dij[nSp*idxFracOne+i] / p[0]; + } + } + forAll(thermo.composition().species(), k) {