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 "VanDerWaalsFreeEnergy.h" 11 : 12 : registerMooseObject("PhaseFieldApp", VanDerWaalsFreeEnergy); 13 : 14 : InputParameters 15 47 : VanDerWaalsFreeEnergy::validParams() 16 : { 17 47 : InputParameters params = GasFreeEnergyBase::validParams(); 18 47 : params.addClassDescription("Free energy of a Van der Waals gas."); 19 94 : params.addRequiredParam<Real>("a", 20 : "Van der Waals coefficient a (default mass_unit_conversion " 21 : "requires this to be in [eV*Ang^3])"); 22 94 : params.addRequiredParam<Real>("b", 23 : "Van der Waals molecular exclusion volume b (default " 24 : "mass_unit_conversion requires this to be in [Ang^3])"); 25 94 : params.addParam<Real>("log_tol", 26 94 : 0.1, 27 : "The logarithm in the free energy is evaluated using a Taylor expansion " 28 : "below this value. This allows formulating free energies for systems where " 29 : "the molecular volume is smaller than the exclusion volume b."); 30 47 : return params; 31 0 : } 32 : 33 36 : VanDerWaalsFreeEnergy::VanDerWaalsFreeEnergy(const InputParameters & parameters) 34 : : GasFreeEnergyBase(parameters), 35 36 : _a(getParam<Real>("a")), 36 72 : _b(getParam<Real>("b")), 37 108 : _log_tol(getParam<Real>("log_tol")) 38 : { 39 : // Definition of the free energy for the expression builder 40 36 : EBFunction free_energy; 41 36 : free_energy(_c, _T) = 42 108 : -_n * _kB * _T * (plog(_nq * (1.0 / _n - _b), _log_tol) + 1.0) - _n * _n * _a; 43 : 44 : // Parse function for automatic differentiation 45 36 : functionParse(free_energy); 46 36 : }