Exemple #1
0
void CFDDataPack::reinitViscous()
{
	grad_rho = duh[0];
	grad_mom = RealTensor(duh[1], duh[2], duh[3]);

	for (int a = 0; a < 3; ++a)
		for (int b = 0; b < 3; ++b)
			grad_vel(a, b) = (grad_mom(a, b) - vel(a)*grad_rho(b))/r;

	tau = grad_vel + grad_vel.transpose();
	vel_div =  grad_vel.tr();
	tau(0, 0) -= 2./3*vel_div; tau(1, 1) -= 2./3*vel_div; tau(2, 2) -= 2./3*vel_div;

	if(_cfd_problem._vis_type == 0) vis = 0.0;
	else if(_cfd_problem._vis_type == 1) vis = 1.0;
	else if(_cfd_problem._vis_type == 2)
	{
		Real t_ref(288), t_s(110.4);
		vis = pow(t/t_ref, 1.5)*(t_ref+t_s)/(t+t_s);
	}
	else mooseError("不可知的粘性模型");
	tau *= vis/_reynolds;

	grad_enthalpy = (duh[4]-uh[4]/uh[0] * duh[0])/r - grad_vel.transpose() * vel;
	grad_enthalpy *= (vis/_reynolds)*(_gamma/_prandtl);

	invis_flux[0] = r*vel;

	invis_flux[1] = mom(0)*vel;
	invis_flux[1](0) += p;

	invis_flux[2] = mom(1)*vel;
	invis_flux[2](1) += p;

	invis_flux[3] = mom(2)*vel;
	invis_flux[3](2) += p;

	invis_flux[4] = r*h*vel;

	vis_flux[0].zero();
	vis_flux[1] = tau.row(0);
	vis_flux[2] = tau.row(1);
	vis_flux[3] = tau.row(2);
	vis_flux[4] = tau * vel + grad_enthalpy;
}
Exemple #2
0
bool
DisplacedProblem::reinitDirac(const Elem * elem, THREAD_ID tid)
{
  std::vector<Point> & points = _dirac_kernel_info.getPoints()[elem];

  unsigned int n_points = points.size();

  if (n_points)
  {
    unsigned int max_qps = _mproblem.getMaxQps();

    if (n_points > max_qps)
    {
      /**
       * The maximum number of qps can rise if several Dirac points are added to a single element.
       * In that case we need to resize the zeros to compensate.
       */
      for (unsigned int tid = 0; tid < libMesh::n_threads(); ++tid)
      {
        _zero[tid].resize(max_qps, 0);
        _grad_zero[tid].resize(max_qps, 0);
        _second_zero[tid].resize(max_qps, RealTensor(0.));
        _second_phi_zero[tid].resize(max_qps, std::vector<RealTensor>(_mproblem.getMaxShapeFunctions(), RealTensor(0.)));
      }
    }

    _assembly[tid]->reinitAtPhysical(elem, points);

    _displaced_nl.prepare(tid);
    _displaced_aux.prepare(tid);

    reinitElem(elem, tid);
  }

  _assembly[tid]->prepare();

  return n_points > 0;
}