doublereal LiquidTransport::getElectricConduct() { vector_fp gradT(m_nDim,0.0); vector_fp gradX(m_nDim * m_nsp); vector_fp gradV(m_nDim); for (size_t i = 0; i < m_nDim; i++) { for (size_t k = 0; k < m_nsp; k++) { gradX[ i*m_nDim + k] = 0.0; } gradV[i] = 1.0; } set_Grad_T(&gradT[0]); set_Grad_X(&gradX[0]); set_Grad_V(&gradV[0]); vector_fp fluxes(m_nsp * m_nDim); doublereal current; getSpeciesFluxesExt(m_nDim, &fluxes[0]); //sum over species charges, fluxes, Faraday to get current // Since we want the scalar conductivity, we need only consider one-dim for (size_t i = 0; i < 1; i++) { current = 0.0; for (size_t k = 0; k < m_nsp; k++) { current += m_chargeSpecies[k] * Faraday * fluxes[k] / m_mw[k]; } //divide by unit potential gradient current /= - gradV[i]; } return current; }
void LiquidTransport::getElectricCurrent(int ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, int ldf, const doublereal* grad_V, doublereal* current) { set_Grad_T(grad_T); set_Grad_X(grad_X); set_Grad_V(grad_V); vector_fp fluxes(m_nsp * m_nDim); getSpeciesFluxesExt(ldf, &fluxes[0]); //sum over species charges, fluxes, Faraday to get current for (size_t i = 0; i < m_nDim; i++) { current[i] = 0.0; for (size_t k = 0; k < m_nsp; k++) { current[i] += m_chargeSpecies[k] * Faraday * fluxes[k] / m_mw[k]; } //divide by unit potential gradient } }
/** * @param ndim The number of spatial dimensions (1, 2, or 3). * @param grad_T The temperature gradient (ignored in this model). * @param ldx Leading dimension of the grad_X array. * The diffusive mass flux of species \e k is computed from * * \f[ * \vec{j}_k = -n M_k D_k \nabla X_k. * \f] */ void LiquidTransport::getSpeciesFluxes(size_t ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, int ldf, doublereal* fluxes) { set_Grad_T(grad_T); set_Grad_X(grad_X); getSpeciesFluxesExt(ldf, fluxes); }
void AqueousTransport::getSpeciesFluxes(size_t ndim, const doublereal* const grad_T, size_t ldx, const doublereal* const grad_X, size_t ldf, doublereal* const fluxes) { set_Grad_T(grad_T); set_Grad_X(grad_X); getSpeciesFluxesExt(ldf, fluxes); }
void LiquidTransport::getSpeciesVdiff(size_t ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, int ldf, doublereal* Vdiff) { set_Grad_T(grad_T); set_Grad_X(grad_X); getSpeciesVdiffExt(ldf, Vdiff); }
/* * The average velocity can be computed on a mole-weighted * or mass-weighted basis, or the diffusion velocities may * be specified as relative to a specific species (i.e. a * solvent) all according to the velocityBasis input parameter. * * Units for the returned velocities are m s-1. * * @param ndim Number of dimensions in the flux expressions * @param grad_T Gradient of the temperature * (length = ndim) * @param ldx Leading dimension of the grad_X array * (usually equal to m_nsp but not always) * @param grad_X Gradients of the mole fraction * Flat vector with the m_nsp in the inner loop. * length = ldx * ndim * @param ldf Leading dimension of the fluxes array * (usually equal to m_nsp but not always) * @param grad_Phi Gradients of the electrostatic potential * (length = ndim) * @param Vdiff Output of the species diffusion velocities * Flat vector with the m_nsp in the inner loop. * length = ldx * ndim */ void SimpleTransport::getSpeciesVdiffES(size_t ndim, const doublereal* grad_T, int ldx, const doublereal* grad_X, int ldf, const doublereal* grad_Phi, doublereal* Vdiff) { set_Grad_T(grad_T); set_Grad_X(grad_X); set_Grad_V(grad_Phi); const doublereal* y = m_thermo->massFractions(); const doublereal rho = m_thermo->density(); getSpeciesFluxesExt(m_nsp, DATA_PTR(Vdiff)); for (size_t n = 0; n < m_nDim; n++) { for (size_t k = 0; k < m_nsp; k++) { if (y[k] > 1.0E-200) { Vdiff[n * m_nsp + k] *= 1.0 / (rho * y[k]); } else { Vdiff[n * m_nsp + k] = 0.0; } } } }