Real INSChorinCorrector::computeQpResidual() { // Vector object for U_star RealVectorValue U_star(_u_vel_star[_qp], _v_vel_star[_qp], _w_vel_star[_qp]); // The symmetric part Real symmetric_part = (_u[_qp] - U_star(_component)) * _test[_i][_qp]; // The pressure part, don't forget to multiply by dt! Real pressure_part = (_dt/_rho) * _grad_p[_qp](_component) * _test[_i][_qp]; return symmetric_part + pressure_part; }
Real INSChorinPredictor::computeQpJacobian() { // The mass matrix part is always there. Real mass_part = _phi[_j][_qp] * _test[_i][_qp]; // The on-diagonal Jacobian contribution depends on whether the predictor uses the // 'new' or 'star' velocity. Real other_part = 0.; switch (_predictor_enum) { case OLD: case NEW: break; case STAR: { RealVectorValue U_star(_u_vel_star[_qp], _v_vel_star[_qp], _w_vel_star[_qp]); Real convective_part = _dt * ((U_star*_grad_phi[_j][_qp]) + _phi[_j][_qp]*_grad_u[_qp](_component)) * _test[_i][_qp]; Real viscous_part = _dt * ((_mu/_rho) * (_grad_phi[_j][_qp] * _grad_test[_i][_qp])); other_part = convective_part + viscous_part; break; } default: mooseError("Unrecognized Chorin predictor type requested."); } return mass_part + other_part; }