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 598 : PorousFlowFullySaturatedAdvectiveFlux::validParams() 16 : { 17 598 : InputParameters params = PorousFlowDarcyBase::validParams(); 18 1196 : params.addParam<unsigned int>( 19 1196 : "fluid_component", 0, "The index corresponding to the fluid component for this kernel"); 20 1196 : params.addParam<bool>("multiply_by_density", 21 1196 : 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 598 : params.addClassDescription("Fully-upwinded advective flux of the fluid component given by " 27 : "fluid_component, in a single-phase fluid"); 28 598 : return params; 29 0 : } 30 : 31 348 : PorousFlowFullySaturatedAdvectiveFlux::PorousFlowFullySaturatedAdvectiveFlux( 32 348 : const InputParameters & parameters) 33 : : PorousFlowDarcyBase(parameters), 34 348 : _mass_fractions( 35 696 : getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")), 36 696 : _dmass_fractions_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>( 37 : "dPorousFlow_mass_frac_nodal_dvar")), 38 696 : _fluid_component(getParam<unsigned int>("fluid_component")), 39 1044 : _multiply_by_density(getParam<bool>("multiply_by_density")) 40 : { 41 348 : 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 348 : } 46 : 47 : Real 48 4915851 : PorousFlowFullySaturatedAdvectiveFlux::mobility(unsigned nodenum, unsigned phase) const 49 : { 50 4915851 : if (_multiply_by_density == false) 51 62692 : return _mass_fractions[nodenum][phase][_fluid_component] / _fluid_viscosity[nodenum][phase]; 52 4853159 : return _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] / 53 4853159 : _fluid_viscosity[nodenum][phase]; 54 : } 55 : 56 : Real 57 2752209 : PorousFlowFullySaturatedAdvectiveFlux::dmobility(unsigned nodenum, 58 : unsigned phase, 59 : unsigned pvar) const 60 : { 61 2752209 : if (_multiply_by_density == false) 62 34612 : return _dmass_fractions_dvar[nodenum][phase][_fluid_component][pvar] / 63 34612 : _fluid_viscosity[nodenum][phase] - 64 34612 : _mass_fractions[nodenum][phase][_fluid_component] * 65 34612 : _dfluid_viscosity_dvar[nodenum][phase][pvar] / 66 34612 : Utility::pow<2>(_fluid_viscosity[nodenum][phase]); 67 2717597 : Real dm = _dmass_fractions_dvar[nodenum][phase][_fluid_component][pvar] * 68 2717597 : _fluid_density_node[nodenum][phase] / _fluid_viscosity[nodenum][phase]; 69 2717597 : dm += _mass_fractions[nodenum][phase][_fluid_component] * 70 2717597 : _dfluid_density_node_dvar[nodenum][phase][pvar] / _fluid_viscosity[nodenum][phase]; 71 2717597 : dm -= _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] * 72 2717597 : _dfluid_viscosity_dvar[nodenum][phase][pvar] / 73 : Utility::pow<2>(_fluid_viscosity[nodenum][phase]); 74 2717597 : return dm; 75 : }