void
PorousFlow2PhasePS::computeQpProperties()
{
  PorousFlowVariableBase::computeQpProperties();

  buildQpPPSS();

  // _porepressure depends on _phase0_porepressure, and its derivative is 1
  if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
  {
    // _phase0_porepressure is a PorousFlow variable
    for (unsigned phase = 0; phase < _num_phases; ++phase)
    {
      _dporepressure_nodal_dvar[_qp][phase][_pvar] = 1.0;
      _dporepressure_qp_dvar[_qp][phase][_pvar] = 1.0;
      _dgradp_qp_dgradv[_qp][phase][_pvar] = 1.0;
    }
  }

  /// Calculate the capillary pressure and derivatives wrt saturation
  const Real dpc_nodal = dCapillaryPressure_dS(_phase1_saturation_nodal[_qp]);
  const Real dpc_qp = dCapillaryPressure_dS(_phase1_saturation_qp[_qp]);
  const Real d2pc_qp = d2CapillaryPressure_dS2(_phase1_saturation_qp[_qp]);

  // _saturation is only dependent on _phase1_saturation, and its derivative is +/- 1
  if (_dictator.isPorousFlowVariable(_phase1_saturation_varnum))
  {
    // _phase1_saturation is a porflow variable
    _dsaturation_nodal_dvar[_qp][0][_svar] = -1.0;
    _dsaturation_nodal_dvar[_qp][1][_svar] = 1.0;
    _dsaturation_qp_dvar[_qp][0][_svar] = -1.0;
    _dsaturation_qp_dvar[_qp][1][_svar] = 1.0;
    _dgrads_qp_dgradv[_qp][0][_svar] = -1.0;
    _dgrads_qp_dgradv[_qp][1][_svar] = 1.0;

    /// _phase1_porepressure depends on saturation through the capillary pressure function
    _dporepressure_nodal_dvar[_qp][1][_svar] = - dpc_nodal;
    _dporepressure_qp_dvar[_qp][1][_svar] = - dpc_qp;
    _dgradp_qp_dv[_qp][1][_svar] = - d2pc_qp * _grads_qp[_qp][1];
    _dgradp_qp_dgradv[_qp][1][_svar] = - dpc_qp;
  }

  // _temperature is only dependent on temperature, and its derivative is = 1
  if (_dictator.isPorousFlowVariable(_temperature_varnum))
  {
    // _phase0_temperature is a PorousFlow variable
    for (unsigned int phase = 0; phase < _num_phases; ++phase)
    {
      _dtemperature_nodal_dvar[_qp][phase][_tvar] = 1.0;
      _dtemperature_qp_dvar[_qp][phase][_tvar] = 1.0;
    }
  }
}
Exemple #2
0
void
PorousFlow2PhasePS::computeQpProperties()
{
  // size stuff correctly and prepare the derivative matrices with zeroes
  PorousFlowVariableBase::computeQpProperties();

  const Real seff = buildQpPPSS();
  const Real dpc = dCapillaryPressure_dS(seff) * _dseff_ds;

  if (!_nodal_material)
  {
    (*_grads_qp)[_qp][0] = -_phase1_grads_qp[_qp];
    (*_grads_qp)[_qp][1] = _phase1_grads_qp[_qp];
    (*_gradp_qp)[_qp][0] = _phase0_gradp_qp[_qp];
    (*_gradp_qp)[_qp][1] = _phase0_gradp_qp[_qp] + dpc * (*_grads_qp)[_qp][1];
  }


  // _porepressure depends on _phase0_porepressure, and its derivative is 1
  if (_dictator.isPorousFlowVariable(_phase0_porepressure_varnum))
  {
    // _phase0_porepressure is a PorousFlow variable
    for (unsigned phase = 0; phase < _num_phases; ++phase)
    {
      _dporepressure_dvar[_qp][phase][_pvar] = 1.0;
      if (!_nodal_material)
        (*_dgradp_qp_dgradv)[_qp][phase][_pvar] = 1.0;
    }
  }

  // _saturation is only dependent on _phase1_saturation, and its derivative is +/- 1
  if (_dictator.isPorousFlowVariable(_phase1_saturation_varnum))
  {
    // _phase1_saturation is a porflow variable
    // _phase1_porepressure depends on saturation through the capillary pressure function
    _dsaturation_dvar[_qp][0][_svar] = -1.0;
    _dsaturation_dvar[_qp][1][_svar] = 1.0;
    _dporepressure_dvar[_qp][1][_svar] = dpc;

    if (!_nodal_material)
    {
      (*_dgrads_qp_dgradv)[_qp][0][_svar] = -1.0;
      (*_dgrads_qp_dgradv)[_qp][1][_svar] = 1.0;
      const Real d2pc_qp = d2CapillaryPressure_dS2(seff) * _dseff_ds * _dseff_ds;
      (*_dgradp_qp_dv)[_qp][1][_svar] = d2pc_qp * (*_grads_qp)[_qp][1];
      (*_dgradp_qp_dgradv)[_qp][1][_svar] = dpc;
    }
  }
}