www.mooseframework.org
VanDerWaalsFreeEnergy.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "VanDerWaalsFreeEnergy.h"
11 
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<GasFreeEnergyBase>();
19  params.addClassDescription("Free energy of a Van der Waals gas.");
20  params.addRequiredParam<Real>("a",
21  "Van der Waals coefficient a (default mass_unit_conversion "
22  "requires this to be in [eV*Ang^3])");
23  params.addRequiredParam<Real>("b",
24  "Van der Waals molecular exclusion volume b (default "
25  "mass_unit_conversion requires this to be in [Ang^3])");
26  params.addParam<Real>("log_tol",
27  0.1,
28  "The logarithm in the free energy is evaluated using a Taylor expansion "
29  "below this value. This allows formulating free energies for systems where "
30  "the molecular volume is smaller than the exclusion volume b.");
31  return params;
32 }
33 
34 VanDerWaalsFreeEnergy::VanDerWaalsFreeEnergy(const InputParameters & parameters)
35  : GasFreeEnergyBase(parameters),
36  _a(getParam<Real>("a")),
37  _b(getParam<Real>("b")),
38  _log_tol(getParam<Real>("log_tol"))
39 {
40  // Definition of the free energy for the expression builder
41  EBFunction free_energy;
42  free_energy(_c, _T) =
43  -_n * _kB * _T * (plog(_nq * (1.0 / _n - _b), _log_tol) + 1.0) - _n * _n * _a;
44 
45  // Parse function for automatic differentiation
46  functionParse(free_energy);
47 }
ExpressionBuilder::EBFunction
User facing host object for a function. This combines a term with an argument list.
Definition: ExpressionBuilder.h:520
GasFreeEnergyBase::_kB
const Real _kB
Definition: GasFreeEnergyBase.h:45
VanDerWaalsFreeEnergy::VanDerWaalsFreeEnergy
VanDerWaalsFreeEnergy(const InputParameters &parameters)
Definition: VanDerWaalsFreeEnergy.C:34
GasFreeEnergyBase::_n
const EBTerm _n
gas number density n = N/V = c/Omega (where Omega is the lattice site volume)
Definition: GasFreeEnergyBase.h:49
VanDerWaalsFreeEnergy.h
VanDerWaalsFreeEnergy::_log_tol
const Real _log_tol
Taylor expansion threshold for the logarithm in the free energy.
Definition: VanDerWaalsFreeEnergy.h:52
VanDerWaalsFreeEnergy::_b
const Real _b
Definition: VanDerWaalsFreeEnergy.h:49
GasFreeEnergyBase::_nq
const EBTerm _nq
quantum concentration
Definition: GasFreeEnergyBase.h:52
validParams< GasFreeEnergyBase >
InputParameters validParams< GasFreeEnergyBase >()
Definition: GasFreeEnergyBase.C:14
GasFreeEnergyBase::_T
const EBTerm _T
Coupled variable value for the Temperature.
Definition: GasFreeEnergyBase.h:32
GasFreeEnergyBase::_c
const EBTerm _c
Coupled variable value for the concentration .
Definition: GasFreeEnergyBase.h:35
VanDerWaalsFreeEnergy::_a
const Real _a
Van der Waals coefficient a in [eV*Ang^3] (default units)
Definition: VanDerWaalsFreeEnergy.h:39
validParams< VanDerWaalsFreeEnergy >
InputParameters validParams< VanDerWaalsFreeEnergy >()
Definition: VanDerWaalsFreeEnergy.C:16
registerMooseObject
registerMooseObject("PhaseFieldApp", VanDerWaalsFreeEnergy)
VanDerWaalsFreeEnergy
Material class that provides the free energy of a Van der Waals gas with the expression builder and u...
Definition: VanDerWaalsFreeEnergy.h:24
GasFreeEnergyBase
Material class that provides the free energy of an ideal gas with the expression builder and uses aut...
Definition: GasFreeEnergyBase.h:25