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 "PorousFlowFullySaturatedAdvectiveFlux.h" 11 : 12 : registerMooseObject("PorousFlowApp", PorousFlowFullySaturatedAdvectiveFlux); 13 : 14 : InputParameters 15 1151 : PorousFlowFullySaturatedAdvectiveFlux::validParams() 16 : { 17 1151 : InputParameters params = PorousFlowDarcyBase::validParams(); 18 2302 : params.addParam<unsigned int>( 19 2302 : "fluid_component", 0, "The index corresponding to the fluid component for this kernel"); 20 2302 : params.addParam<bool>("multiply_by_density", 21 2302 : true, 22 : "If true, then this Kernel is the fluid mass " 23 : "flux. If false, then this Kernel is the " 24 : "fluid volume flux (which is common in " 25 : "poro-mechanics)"); 26 1151 : params.addClassDescription("Fully-upwinded advective flux of the fluid component given by " 27 : "fluid_component, in a single-phase fluid"); 28 1151 : return params; 29 0 : } 30 : 31 688 : PorousFlowFullySaturatedAdvectiveFlux::PorousFlowFullySaturatedAdvectiveFlux( 32 688 : const InputParameters & parameters) 33 : : PorousFlowDarcyBase(parameters), 34 688 : _mass_fractions( 35 1376 : getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")), 36 1376 : _dmass_fractions_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>( 37 : "dPorousFlow_mass_frac_nodal_dvar")), 38 1376 : _fluid_component(getParam<unsigned int>("fluid_component")), 39 2064 : _multiply_by_density(getParam<bool>("multiply_by_density")) 40 : { 41 688 : if (_dictator.numPhases() != 1) 42 0 : mooseError( 43 : "PorousFlowFullySaturatedAdvectiveFlux should not be used for multi-phase scenarios as " 44 : "it does not include relative-permeability effects"); 45 688 : } 46 : 47 : Real 48 7319619 : PorousFlowFullySaturatedAdvectiveFlux::mobility(unsigned nodenum, unsigned phase) const 49 : { 50 7319619 : if (_multiply_by_density == false) 51 103745 : return _mass_fractions[nodenum][phase][_fluid_component] / _fluid_viscosity[nodenum][phase]; 52 7215874 : return _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] / 53 7215874 : _fluid_viscosity[nodenum][phase]; 54 : } 55 : 56 : Real 57 4099361 : PorousFlowFullySaturatedAdvectiveFlux::dmobility(unsigned nodenum, 58 : unsigned phase, 59 : unsigned pvar) const 60 : { 61 4099361 : if (_multiply_by_density == false) 62 57985 : return _dmass_fractions_dvar[nodenum][phase][_fluid_component][pvar] / 63 57985 : _fluid_viscosity[nodenum][phase] - 64 57985 : _mass_fractions[nodenum][phase][_fluid_component] * 65 57985 : _dfluid_viscosity_dvar[nodenum][phase][pvar] / 66 57985 : Utility::pow<2>(_fluid_viscosity[nodenum][phase]); 67 4041376 : Real dm = _dmass_fractions_dvar[nodenum][phase][_fluid_component][pvar] * 68 4041376 : _fluid_density_node[nodenum][phase] / _fluid_viscosity[nodenum][phase]; 69 4041376 : dm += _mass_fractions[nodenum][phase][_fluid_component] * 70 4041376 : _dfluid_density_node_dvar[nodenum][phase][pvar] / _fluid_viscosity[nodenum][phase]; 71 4041376 : dm -= _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] * 72 4041376 : _dfluid_viscosity_dvar[nodenum][phase][pvar] / 73 : Utility::pow<2>(_fluid_viscosity[nodenum][phase]); 74 4041376 : return dm; 75 : }