Ejemplo n.º 1
0
Real
NSMomentumViscousBC::computeQpOffDiagJacobian(unsigned jvar)
{
  if (isNSVariable(jvar))
  {

    // See Eqns. (41)--(43) from the notes for the viscous boundary
    // term contributions.

    // Map jvar into the variable m for our problem, regardless of
    // how Moose has numbered things.
    unsigned m = mapVarNumber(jvar);

    // Now compute viscous contribution
    Real visc_term = 0.0;

    // Set variable names as in the notes
    const unsigned int k = _component;

    for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
      visc_term += _vst_derivs.dtau(k, ell, m) * _normals[_qp](ell);

    // Multiply visc_term by test function
    visc_term *= _test[_i][_qp];

    // Note the sign...
    return -visc_term;
  }
  else
    return 0.0;
}
Ejemplo n.º 2
0
Real
NSMassInviscidFlux::computeQpOffDiagJacobian(unsigned int jvar)
{
  if (isNSVariable(jvar))
  {
    // Map jvar into the variable m for our problem, regardless of
    // how Moose has numbered things.
    unsigned int m = mapVarNumber(jvar);

    switch (m)
    {
      // Don't handle the on-diagonal case here
      // case 0: // density
      case 1:
      case 2:
      case 3: // momentums
        return -_phi[_j][_qp] * _grad_test[_i][_qp](m - 1);

      case 4: // energy
        return 0.0;

      default:
        mooseError("Should not get here!");
        break;
    }
  }
  else
    return 0.0;
}
Ejemplo n.º 3
0
Real
NSSUPGMass::computeJacobianHelper(unsigned var)
{
  if (isNSVariable(var))
  {

    // Convert the Moose numbering to canonical NS variable numbering.
    unsigned m = mapVarNumber(var);

    // Time derivative contributions only for momentum
    Real time_part = 0.;

    // The derivative of "udot" wrt u for each of the momentum variables.
    // This is always 1/dt unless you are using BDF2...
    Real d_udot_du[3] = {_d_rhoudot_du[_qp], _d_rhovdot_du[_qp], _d_rhowdot_du[_qp]};

    switch (m)
    {
      case 1:
      case 2:
      case 3:
        // time_part = _grad_test[_i][_qp](m-1) * (_phi[_j][_qp]/_subproblem.parent()->dt());
        time_part = _grad_test[_i][_qp](m - 1) * (_phi[_j][_qp] * d_udot_du[m - 1]);
        break;
    }

    // Store result so we can print it before returning
    Real result =
        _taum[_qp] * (time_part + _grad_test[_i][_qp] * (_calA[_qp][m] * _grad_phi[_j][_qp]));

    return result;
  }
  else
    return 0.0;
}
Real
NSEnergyInviscidSpecifiedPressureBC::computeQpOffDiagJacobian(unsigned jvar)
{
  if (isNSVariable(jvar))
    return computeJacobianHelper(mapVarNumber(jvar));
  else
    return 0.0;
}
Real
NSMomentumInviscidNoPressureImplicitFlowBC::computeQpOffDiagJacobian(unsigned int jvar)
{
  if (isNSVariable(jvar))
    return convectiveQpJacobianHelper(mapVarNumber(jvar));
  else
    return 0.0;
}
Real
NSMomentumInviscidSpecifiedNormalFlowBC::computeQpOffDiagJacobian(unsigned jvar)
{
  if (isNSVariable(jvar))
    return pressureQpJacobianHelper(mapVarNumber(jvar));
  else
    return 0.0;
}
Ejemplo n.º 7
0
Real
NSEnergyThermalFlux::computeQpOffDiagJacobian(unsigned int jvar)
{
    // Map jvar into the numbering expected by this->compute_jacobain_value()
    unsigned var_number = mapVarNumber(jvar);

    return computeJacobianHelper_value(var_number);
}
Ejemplo n.º 8
0
Real
NSMomentumInviscidFlux::computeQpOffDiagJacobian(unsigned int jvar)
{
  // Map jvar into the variable m for our problem, regardless of
  // how Moose has numbered things.
  unsigned m = mapVarNumber(jvar);

  return computeJacobianHelper(m);
}
Ejemplo n.º 9
0
Real NSEnergyViscousBC::computeQpOffDiagJacobian(unsigned jvar)
{
  // Note: This function requires both _vst_derivs *and* _temp_derivs

  // Convenience variables
  const RealTensorValue & tau = _viscous_stress_tensor[_qp];

  Real rho  = _rho[_qp];
  Real phij = _phi[_j][_qp];
  RealVectorValue U(_rho_u[_qp], _rho_v[_qp], _rho_w[_qp]);

  // Map jvar into the variable m for our problem, regardless of
  // how Moose has numbered things.
  unsigned m = mapVarNumber(jvar);


  //
  // 1.) Thermal term derivatives
  //

  // See notes for this term, involves temperature Hessian
  Real thermal_term = 0.;

  for (unsigned ell=0; ell<LIBMESH_DIM; ++ell)
  {
    Real intermediate_result = 0.;

    // The temperature Hessian contribution
    for (unsigned n=0; n<5; ++n)
      intermediate_result += _temp_derivs.get_hess(m, n) * (*_gradU[n])[_qp](ell);

    // Hit Hessian contribution with test function
    intermediate_result *= _phi[_j][_qp];

    // Add in the temperature gradient contribution
    intermediate_result += _temp_derivs.get_grad(m) * _grad_phi[_j][_qp](ell);

    // Hit the result with the normal component, accumulate in thermal_term
    thermal_term += intermediate_result * _normals[_qp](ell);
  }

  // Hit thermal_term with thermal conductivity
  thermal_term *= _thermal_conductivity[_qp];

  //
  // 2.) Viscous term derivatives
  //

  // Compute viscous term derivatives
  Real visc_term = 0.;

  switch ( m )
  {
    case 0: // density
    {
      // Loop over k and ell as in the notes...
      for (unsigned int k = 0; k < LIBMESH_DIM; ++k)
      {
        Real intermediate_value = 0.0;
        for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
          intermediate_value += (U(ell) / rho * (-tau(k,ell) * phij / rho + _vst_derivs.dtau(k,ell,m)));

        // Hit accumulated value with normal component k.  We will multiply by test function at
        // the end of this routine...
        visc_term += intermediate_value * _normals[_qp](k);
      } // end for k

      break;
    } // end case 0

    case 1:
    case 2:
    case 3: // momentums
    {
      // Map m -> 0,1,2 as usual...
      unsigned int m_local = m - 1;

      // Loop over k and ell as in the notes...
      for (unsigned int k = 0; k < LIBMESH_DIM; ++k)
      {
        Real intermediate_value = tau(k,m_local) * phij / rho;

        for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
          intermediate_value += _vst_derivs.dtau(k,ell,m) * U(ell) / rho; // Note: pass 'm' to dtau, it will convert it internally

        // Hit accumulated value with normal component k.
        visc_term += intermediate_value * _normals[_qp](k);
      } // end for k

      break;
    } // end case 1,2,3

    case 4: // energy
      mooseError("Shouldn't get here, this is the on-diagonal entry!");
      break;

    default:
      mooseError("Invalid m value.");
      break;
  }

  // Finally, sum up the different contributions (with appropriate
  // sign) multiply by the test function, and return.
  return (-thermal_term - visc_term) * _test[_i][_qp];
}
Ejemplo n.º 10
0
Real NSEnergyInviscidUnspecifiedBC::computeQpOffDiagJacobian(unsigned jvar)
{
  return computeJacobianHelper(mapVarNumber(jvar));
}
Ejemplo n.º 11
0
Real
NSPressureNeumannBC::computeQpOffDiagJacobian(unsigned jvar)
{
  unsigned m = mapVarNumber(jvar);
  return computeJacobianHelper(m);
}