https://mooseframework.inl.gov
INSCourant.C
Go to the documentation of this file.
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 "INSCourant.h"
11 #include "MooseMesh.h"
12 
13 registerMooseObject("NavierStokesApp", INSCourant);
14 
17 {
19 
20  params.addClassDescription("Computes h_min / |u|.");
21  // Coupled variables
22  params.addRequiredCoupledVar("u", "x-velocity");
23  params.addCoupledVar("v", "y-velocity"); // only required in 2D and 3D
24  params.addCoupledVar("w", "z-velocity"); // only required in 3D
25 
26  return params;
27 }
28 
30  : AuxKernel(parameters),
31  _u_vel(coupledValue("u")),
32  _v_vel(_mesh.dimension() >= 2 ? coupledValue("v") : _zero),
33  _w_vel(_mesh.dimension() == 3 ? coupledValue("w") : _zero)
34 {
35  if (isNodal())
36  mooseError("This AuxKernel only supports Elemental fields");
37 }
38 
39 Real
41 {
43  Real vel_mag = U.norm();
44 
45  // Don't divide by zero...
46  vel_mag = std::max(vel_mag, std::numeric_limits<Real>::epsilon());
47 
48  return _current_elem->hmin() / vel_mag;
49 }
auto norm() const -> decltype(std::norm(Real()))
INSCourant(const InputParameters &parameters)
Definition: INSCourant.C:29
Computes h_min / |u|.
Definition: INSCourant.h:19
const VariableValue & _w_vel
Definition: INSCourant.h:32
const VariableValue & _u_vel
Definition: INSCourant.h:30
static InputParameters validParams()
Definition: INSCourant.C:16
registerMooseObject("NavierStokesApp", INSCourant)
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real computeValue()
Definition: INSCourant.C:40
void mooseError(Args &&... args) const
const Elem *const & _current_elem
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
const VariableValue & _v_vel
Definition: INSCourant.h:31