Exemplo n.º 1
0
void ApproxMixTransport::updateViscosity_T()
{
    double vratiokj, wratiojk, factor1;

    if (!m_spvisc_ok) {
        updateSpeciesViscosities();
    }

    // see Eq. (9-5.15) of Reid, Prausnitz, and Poling
    for (size_t ij=0; ij<_kMajor.size(); ij++) {
        size_t j = _kMajor[ij];
        for (size_t ik=ij; ik<_kMajor.size(); ik++) {
            size_t k = _kMajor[ik];
            vratiokj = m_visc[k]/m_visc[j];
            wratiojk = m_mw[j]/m_mw[k];

            // Note that m_wratjk(k,j) holds the square root of
            // m_wratjk(j,k)!
            factor1 = 1.0 + (m_sqvisc[k]/m_sqvisc[j]) * m_wratjk(k,j);
            m_phi(k,j) = factor1*factor1 / (std::sqrt(8.0) * m_wratkj1(j,k));
            m_phi(j,k) = m_phi(k,j)/(vratiokj * wratiojk);
        }
    }
    m_viscwt_ok = true;
}
Exemplo n.º 2
0
bool SSFPSimple::isSymmetric() const {
	bool sym = true;
    for (ArrayXcd::Index i = 0; i < m_phi.rows(); i++) {
        if (!((abs(m_phi(i) - M_PI) <= (M_PI * numeric_limits<double>::epsilon())) ||
              (abs(m_phi(i) - 0.) <= numeric_limits<double>::epsilon()))) {
			sym = false;
			break; // Don't need to bother checking other values
		}
	}
	return sym;
}
Exemplo n.º 3
0
double ApproxMixTransport::viscosity()
{
    update_T();
    update_C();

    if (m_visc_ok) {
        return m_viscmix;
    }

    doublereal vismix = 0.0;

    // update m_visc and m_phi if necessary
    if (!m_viscwt_ok) {
        updateViscosity_T();
    }

    for (size_t ik=0; ik<_kMajor.size(); ik++) {
        size_t k = _kMajor[ik];
        double sum = 0;
        for (size_t ij=0; ij<_kMajor.size(); ij++) {
            size_t j = _kMajor[ij];
            sum += m_molefracs[j]*m_phi(k,j);
        }
        vismix += m_molefracs[k]*m_visc[k] / sum;
    }

    m_visc_ok = true;
    m_viscmix = vismix;
    assert(m_viscmix > 0 && m_viscmix < 1e100);
    return vismix;
}
Exemplo n.º 4
0
  /*
   * Updates the array of pure species viscosities, and the weighting functions in the viscosity mixture rule.
   * The flag m_visc_ok is set to true.
   *
   * The formula for the weighting function is from Poling and Prausnitz.
   * See Eq. (9-5.14) of  Poling, Prausnitz, and O'Connell. The equation for the weighting function
   * \f$ \phi_{ij} \f$ is reproduced below.
   *
   *  \f[
   *        \phi_{ij} = \frac{ \left[ 1 + \left( \mu_i / \mu_j \right)^{1/2} \left( M_j / M_i \right)^{1/4} \right]^2 }
   *                    {\left[ 8 \left( 1 + M_i / M_j \right) \right]^{1/2}}
   *  \f]
   */
  void MixTransport::updateViscosity_T() {
    doublereal vratiokj, wratiojk, factor1;

    if (!m_spvisc_ok) updateSpeciesViscosities();

    // see Eq. (9-5.15) of Reid, Prausnitz, and Poling
    int j, k;
    for (j = 0; j < m_nsp; j++) {
      for (k = j; k < m_nsp; k++) {
	vratiokj = m_visc[k]/m_visc[j];
	wratiojk = m_mw[j]/m_mw[k];

	// Note that m_wratjk(k,j) holds the square root of
	// m_wratjk(j,k)!
	factor1 = 1.0 + (m_sqvisc[k]/m_sqvisc[j]) * m_wratjk(k,j);
	m_phi(k,j) = factor1*factor1 / (SqrtEight * m_wratkj1(j,k)); 
	m_phi(j,k) = m_phi(k,j)/(vratiokj * wratiojk);
      }
    }
    m_viscwt_ok = true;
  }
Exemplo n.º 5
0
  /**
   * Update the temperature-dependent viscosity terms.
   * Updates the array of pure species viscosities, and the 
   * weighting functions in the viscosity mixture rule.
   * The flag m_visc_ok is set to true.
   */
  void LiquidTransport::updateViscosity_temp() {
    int k;
    doublereal vratiokj, wratiojk, factor1;

    if (m_mode == CK_Mode) {
      for (k = 0; k < m_nsp; k++) {
	viscSpecies_[k] = exp(dot4(m_polytempvec, viscCoeffsVector_[k]));
	m_sqvisc[k] = sqrt(viscSpecies_[k]);
      }
    }
    else {
      for (k = 0; k < m_nsp; k++) {
	// the polynomial fit is done for sqrt(visc/sqrt(T))
	m_sqvisc[k] = m_t14*dot5(m_polytempvec, viscCoeffsVector_[k]);
	viscSpecies_[k] = (m_sqvisc[k]*m_sqvisc[k]);
      }
    }

    // see Eq. (9-5.15) of Reid, Prausnitz, and Poling
    int j;
    for (j = 0; j < m_nsp; j++) {
      for (k = j; k < m_nsp; k++) {
	vratiokj = viscSpecies_[k]/viscSpecies_[j];
	wratiojk = m_mw[j]/m_mw[k];

	// Note that m_wratjk(k,j) holds the square root of
	// m_wratjk(j,k)!
	factor1 = 1.0 + (m_sqvisc[k]/m_sqvisc[j]) * m_wratjk(k,j);
	m_phi(k,j) = factor1*factor1 /
	  (SqrtEight * m_wratkj1(j,k)); 
	m_phi(j,k) = m_phi(k,j)/(vratiokj * wratiojk);
      }
    }

    m_visc_temp_ok = true;
    m_visc_mix_ok = false;
  }
Exemplo n.º 6
0
//**********************************************************************
CellData::CellData()
{ 
  m_coords = Kokkos::View<double***,PHX::Device>("coords",4,4,3);
  m_phi = Kokkos::View<double**,PHX::Device>("phi",4,4);
  m_grad_phi = Kokkos::View<double***,PHX::Device>("grad_phi",4,4,3);

  // just some garbage values for unit testing
  for (PHX::Device::size_type i=0; i < m_phi.dimension(0); ++i) {
    for (PHX::Device::size_type j=0; j < m_phi.dimension(1); ++j) {
      m_phi(i,j) = 0.25;
      for (PHX::Device::size_type k=0; k < m_phi.dimension(2); ++k) {
	m_coords(i,j,k) = 0.25;
	m_grad_phi(i,j,k) = 0.25;
      }
    }
  }
}
Exemplo n.º 7
0
  virtual void evaluateFields (typename Traits::EvalData workset) {
    for (std::size_t cell = 0; cell < workset.numCells; ++cell)
      for (std::size_t iqp=0; iqp<m_num_qp; iqp++)
        m_source(cell, iqp) = 
	  m_phi(cell,iqp) * m_sigma_f(cell,iqp) * m_E_f(cell,iqp);
  }