https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
16 INSFVMushyPorousFrictionMaterial,
17 "08/01/2024 00:00",
19
22{
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 using std::atan;
54
55 constexpr Real epsilon = 1e-15; // prevents explosion of sqrt(x) derivative to infinity
56 const auto fs = 1.0 - _fl(r, t);
57 mooseAssert(_dendrite_spacing_scaling(r, t) > 0,
58 "Dendrite spacing scaling should be positive!");
59 const auto cs = _c / Utility::pow<2>(_dendrite_spacing_scaling(r, t));
60 const auto Fk = 0.5 + atan(_s * (fs - _fs_crit)) / libMesh::pi;
61 const auto K =
62 Utility::pow<3>(_fl(r, t)) / ((Utility::pow<2>(fs) + epsilon) * Fk * cs) + epsilon;
63 return _mu(r, t) / K;
64 });
65
66 addFunctorProperty<ADReal>(
67 getParam<MooseFunctorName>("Forchheimer_coef_name"),
68 [this](const auto & r, const auto & t) -> ADReal
69 {
70 using std::atan, std::sqrt;
71
72 constexpr Real epsilon = 1e-15; // prevents explosion of sqrt(x) derivative to infinity
73 const auto fs = 1.0 - _fl(r, t);
74 mooseAssert(_dendrite_spacing_scaling(r, t) > 0,
75 "Dendrite spacing scaling should be positive!");
76 const auto cs = _c / Utility::pow<2>(_dendrite_spacing_scaling(r, t));
77 const auto Fk = 0.5 + atan(_s * (fs - _fs_crit)) / libMesh::pi;
78 const auto K =
79 Utility::pow<3>(_fl(r, t)) / ((Utility::pow<2>(fs) + epsilon) * Fk * cs) + epsilon;
80 return _forchheimer_coef * _rho_l(r, t) / sqrt(K);
81 });
82}
DualNumber< Real, DNDerivativeType, true > ADReal
const double mu
registerMooseObjectRenamed("NavierStokesApp", INSFVMushyPorousFrictionMaterial, "08/01/2024 00:00", INSFVMushyPorousFrictionFunctorMaterial)
registerMooseObject("NavierStokesApp", INSFVMushyPorousFrictionFunctorMaterial)
static InputParameters validParams()
This is the material class used to compute the drag coefficients in mushy (porous) regions during pha...
INSFVMushyPorousFrictionFunctorMaterial(const InputParameters &parameters)
const Moose::Functor< ADReal > & _fl
The liquid fraction.
const Moose::Functor< ADReal > & _mu
The dynamic viscosity.
const Moose::Functor< ADReal > & _rho_l
The liquid density.
static const ADReal _c
Main closures parameters.
const Moose::Functor< ADReal > & _dendrite_spacing_scaling
Dendrite spacing.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
static const std::string mu
Definition NS.h:127
const Real pi