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 "NSGravityForce.h" 11 : 12 : registerMooseObject("NavierStokesApp", NSGravityForce); 13 : 14 : InputParameters 15 0 : NSGravityForce::validParams() 16 : { 17 0 : InputParameters params = NSKernel::validParams(); 18 0 : params.addClassDescription("This class computes the gravity force contribution."); 19 : // The strength of the acceleration in the _component direction. Make this 20 : // value negative if you want force in the -_component direction. 21 0 : params.addRequiredParam<Real>("acceleration", "The body force vector component."); 22 0 : return params; 23 0 : } 24 : 25 0 : NSGravityForce::NSGravityForce(const InputParameters & parameters) 26 0 : : NSKernel(parameters), _acceleration(getParam<Real>("acceleration")) 27 : { 28 0 : } 29 : 30 : Real 31 0 : NSGravityForce::computeQpResidual() 32 : { 33 : // -rho * g * phi 34 0 : return -_rho[_qp] * _acceleration * _test[_i][_qp]; 35 : } 36 : 37 : Real 38 0 : NSGravityForce::computeQpJacobian() 39 : { 40 0 : return 0.0; 41 : } 42 : 43 : Real 44 0 : NSGravityForce::computeQpOffDiagJacobian(unsigned int jvar) 45 : { 46 0 : if (jvar == _rho_var_number) 47 0 : return -_phi[_j][_qp] * _acceleration * _test[_i][_qp]; 48 : 49 : return 0.0; 50 : }