https://mooseframework.inl.gov
INSFVMushyPorousFrictionFunctorMaterial.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 
11 #include "MooseMesh.h"
12 #include "NS.h"
13 
15 registerMooseObjectRenamed("NavierStokesApp",
16  INSFVMushyPorousFrictionMaterial,
17  "08/01/2024 00:00",
19 
22 {
24  params.addClassDescription(
25  "Computes the mushy zone porous resistance for solidification/melting problems.");
26  params.addRequiredParam<MooseFunctorName>("liquid_fraction", "Liquid Fraction Functor.");
27  params.addRequiredParam<MooseFunctorName>(NS::mu, "The liquid dynamic viscosity.");
28  params.addRequiredParam<MooseFunctorName>("rho_l", "The liquid density (not the mixture one).");
29  params.addParam<MooseFunctorName>(
30  "dendrite_spacing_scaling", "1e-4", "The dendrite spacing scaling.");
31  params.addParam<MooseFunctorName>(
32  "Darcy_coef_name", "Darcy_coefficient", "Name of the Darcy friction coefficient");
33  params.addParam<MooseFunctorName>("Forchheimer_coef_name",
34  "Forchheimer_coefficient",
35  "Name of the Forchheimer friction coefficient");
36 
37  return params;
38 }
39 
41  const InputParameters & parameters)
42  : FunctorMaterial(parameters),
43  _fl(getFunctor<ADReal>("liquid_fraction")),
44  _mu(getFunctor<ADReal>(NS::mu)),
45  _rho_l(getFunctor<ADReal>("rho_l")),
46  _dendrite_spacing_scaling(getFunctor<ADReal>("dendrite_spacing_scaling"))
47 {
48 
49  addFunctorProperty<ADReal>(
50  getParam<MooseFunctorName>("Darcy_coef_name"),
51  [this](const auto & r, const auto & t) -> ADReal
52  {
53  constexpr Real epsilon = 1e-15; // prevents explosion of sqrt(x) derivative to infinity
54  const auto fs = 1.0 - _fl(r, t);
55  mooseAssert(_dendrite_spacing_scaling(r, t) > 0,
56  "Dendrite spacing scaling should be positive!");
57  const auto cs = _c / Utility::pow<2>(_dendrite_spacing_scaling(r, t));
58  const auto Fk = 0.5 + std::atan(_s * (fs - _fs_crit)) / libMesh::pi;
59  const auto K =
60  Utility::pow<3>(_fl(r, t)) / ((Utility::pow<2>(fs) + epsilon) * Fk * cs) + epsilon;
61  return _mu(r, t) / K;
62  });
63 
64  addFunctorProperty<ADReal>(
65  getParam<MooseFunctorName>("Forchheimer_coef_name"),
66  [this](const auto & r, const auto & t) -> ADReal
67  {
68  constexpr Real epsilon = 1e-15; // prevents explosion of sqrt(x) derivative to infinity
69  const auto fs = 1.0 - _fl(r, t);
70  mooseAssert(_dendrite_spacing_scaling(r, t) > 0,
71  "Dendrite spacing scaling should be positive!");
72  const auto cs = _c / Utility::pow<2>(_dendrite_spacing_scaling(r, t));
73  const auto Fk = 0.5 + std::atan(_s * (fs - _fs_crit)) / libMesh::pi;
74  const auto K =
75  Utility::pow<3>(_fl(r, t)) / ((Utility::pow<2>(fs) + epsilon) * Fk * cs) + epsilon;
76  return _forchheimer_coef * _rho_l(r, t) / std::sqrt(K);
77  });
78 }
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static const std::string K
Definition: NS.h:170
registerMooseObject("NavierStokesApp", INSFVMushyPorousFrictionFunctorMaterial)
const Moose::Functor< ADReal > & _mu
The dynamic viscosity.
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
const Moose::Functor< ADReal > & _rho_l
The liquid density.
const Moose::Functor< ADReal > & _dendrite_spacing_scaling
Dendrite spacing.
static const std::string mu
Definition: NS.h:123
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObjectRenamed("NavierStokesApp", INSFVMushyPorousFrictionMaterial, "08/01/2024 00:00", INSFVMushyPorousFrictionFunctorMaterial)
INSFVMushyPorousFrictionFunctorMaterial(const InputParameters &parameters)
static const ADReal _c
Main closures parameters.
This is the material class used to compute the drag coefficients in mushy (porous) regions during pha...
void addClassDescription(const std::string &doc_string)
const Moose::Functor< ADReal > & _fl
The liquid fraction.
const Real pi