Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "PorousFlowEffectiveFluidPressure.h" 11 : 12 : registerMooseObject("PorousFlowApp", PorousFlowEffectiveFluidPressure); 13 : registerMooseObject("PorousFlowApp", ADPorousFlowEffectiveFluidPressure); 14 : 15 : template <bool is_ad> 16 : InputParameters 17 15328 : PorousFlowEffectiveFluidPressureTempl<is_ad>::validParams() 18 : { 19 15328 : InputParameters params = PorousFlowMaterialVectorBase::validParams(); 20 15328 : params.set<std::string>("pf_material_type") = "effective_pressure"; 21 15328 : params.addClassDescription("This Material calculates an effective fluid pressure: " 22 : "effective_stress = total_stress + " 23 : "biot_coeff*effective_fluid_pressure. The effective_fluid_pressure = " 24 : "sum_{phases}(S_phase * P_phase)"); 25 15328 : return params; 26 0 : } 27 : 28 : template <bool is_ad> 29 11931 : PorousFlowEffectiveFluidPressureTempl<is_ad>::PorousFlowEffectiveFluidPressureTempl( 30 : const InputParameters & parameters) 31 : : PorousFlowMaterialVectorBase(parameters), 32 11931 : _porepressure( 33 11931 : _nodal_material 34 4455 : ? getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_porepressure_nodal") 35 19407 : : getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_porepressure_qp")), 36 23664 : _dporepressure_dvar(is_ad ? nullptr 37 11733 : : _nodal_material ? &getMaterialProperty<std::vector<std::vector<Real>>>( 38 : "dPorousFlow_porepressure_nodal_dvar") 39 26289 : : &getMaterialProperty<std::vector<std::vector<Real>>>( 40 : "dPorousFlow_porepressure_qp_dvar")), 41 11931 : _saturation( 42 11931 : _nodal_material 43 11931 : ? getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_saturation_nodal") 44 19407 : : getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_saturation_qp")), 45 23664 : _dsaturation_dvar(is_ad ? nullptr 46 11733 : : _nodal_material ? &getMaterialProperty<std::vector<std::vector<Real>>>( 47 : "dPorousFlow_saturation_nodal_dvar") 48 26289 : : &getMaterialProperty<std::vector<std::vector<Real>>>( 49 : "dPorousFlow_saturation_qp_dvar")), 50 11931 : _pf(_nodal_material 51 4455 : ? declareGenericProperty<Real, is_ad>("PorousFlow_effective_fluid_pressure_nodal") 52 26883 : : declareGenericProperty<Real, is_ad>("PorousFlow_effective_fluid_pressure_qp")), 53 11931 : _dpf_dvar( 54 11733 : is_ad ? nullptr 55 11733 : : _nodal_material 56 4455 : ? &declareProperty<std::vector<Real>>("dPorousFlow_effective_fluid_pressure_nodal_dvar") 57 30942 : : &declareProperty<std::vector<Real>>("dPorousFlow_effective_fluid_pressure_qp_dvar")) 58 : { 59 11931 : } 60 : 61 : template <bool is_ad> 62 : void 63 3294441 : PorousFlowEffectiveFluidPressureTempl<is_ad>::initQpStatefulProperties() 64 : { 65 3294441 : _pf[_qp] = 0.0; 66 6593218 : for (unsigned int ph = 0; ph < _num_phases; ++ph) 67 3298777 : _pf[_qp] += _saturation[_qp][ph] * _porepressure[_qp][ph]; 68 3294441 : } 69 : 70 : template <bool is_ad> 71 : void 72 42413629 : PorousFlowEffectiveFluidPressureTempl<is_ad>::computeQpProperties() 73 : { 74 42413629 : _pf[_qp] = 0.0; 75 : 76 : if (!is_ad) 77 42412657 : (*_dpf_dvar)[_qp].assign(_num_var, 0.0); 78 : 79 84881296 : for (unsigned int ph = 0; ph < _num_phases; ++ph) 80 : { 81 42468639 : _pf[_qp] += _saturation[_qp][ph] * _porepressure[_qp][ph]; 82 : 83 : if constexpr (!is_ad) 84 155131005 : for (unsigned int v = 0; v < _num_var; ++v) 85 112664310 : (*_dpf_dvar)[_qp][v] += (*_dsaturation_dvar)[_qp][ph][v] * _porepressure[_qp][ph] + 86 112664310 : _saturation[_qp][ph] * (*_dporepressure_dvar)[_qp][ph][v]; 87 : } 88 42413629 : }