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 "PorousFlowAdvectiveFluxCalculatorSaturatedMultiComponent.h" 11 : 12 : registerMooseObject("PorousFlowApp", PorousFlowAdvectiveFluxCalculatorSaturatedMultiComponent); 13 : 14 : InputParameters 15 1373 : PorousFlowAdvectiveFluxCalculatorSaturatedMultiComponent::validParams() 16 : { 17 1373 : InputParameters params = PorousFlowAdvectiveFluxCalculatorSaturated::validParams(); 18 1373 : params.addClassDescription( 19 : "Computes the advective flux of fluid of given phase and fluid component. Explicitly, the " 20 : "UserObject computes (mass_fraction * density / viscosity) * (- permeability * (grad(P) - " 21 : "density * gravity)), using the Kuzmin-Turek FEM-TVD multidimensional stabilization scheme"); 22 2746 : params.addParam<unsigned int>( 23 2746 : "fluid_component", 0, "The index corresponding to the fluid component for this UserObject"); 24 1373 : return params; 25 0 : } 26 : 27 833 : PorousFlowAdvectiveFluxCalculatorSaturatedMultiComponent:: 28 833 : PorousFlowAdvectiveFluxCalculatorSaturatedMultiComponent(const InputParameters & parameters) 29 : : PorousFlowAdvectiveFluxCalculatorSaturated(parameters), 30 833 : _fluid_component(getParam<unsigned int>("fluid_component")), 31 833 : _mass_fractions( 32 833 : getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")), 33 1666 : _dmass_fractions_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>( 34 833 : "dPorousFlow_mass_frac_nodal_dvar")) 35 : { 36 833 : if (_fluid_component >= _dictator.numComponents()) 37 2 : paramError("fluid_component", 38 : "Fluid component number entered is greater than the number of fluid components " 39 : "specified in the Dictator. Remember that indexing starts at 0"); 40 831 : } 41 : 42 : Real 43 645742 : PorousFlowAdvectiveFluxCalculatorSaturatedMultiComponent::computeU(unsigned i) const 44 : { 45 645742 : return _mass_fractions[i][_phase][_fluid_component] * 46 645742 : PorousFlowAdvectiveFluxCalculatorSaturated::computeU(i); 47 : } 48 : 49 : Real 50 844116 : PorousFlowAdvectiveFluxCalculatorSaturatedMultiComponent::computedU_dvar(unsigned i, 51 : unsigned pvar) const 52 : { 53 844116 : Real du = _mass_fractions[i][_phase][_fluid_component] * 54 844116 : PorousFlowAdvectiveFluxCalculatorSaturated::computedU_dvar(i, pvar); 55 844116 : du += _dmass_fractions_dvar[i][_phase][_fluid_component][pvar] * 56 844116 : PorousFlowAdvectiveFluxCalculatorSaturated::computeU(i); 57 844116 : return du; 58 : }