Mixture of fluids that provides the total free energy functional for minimization Constructing Fex and IdealGas objects require a FluidMixture reference, to which they add themselves. The FluidMixture object is ready to use after initialize() is called.
More...
#include <FluidMixture.h>
|
| FluidMixture (const GridInfo &gInfo, const double T=298 *Kelvin) |
|
void | initialize (double P=1.01325 *Bar, double epsBulkOverride=0., double epsInfOverride=0.) |
|
double | getBoilingPressure (double NliqGuess, double NvapGuess, std::vector< double > *Nvap=0) const |
|
unsigned | get_nIndep () const |
| get the number of scalar fields used as independent variables
|
|
unsigned | get_nDensities () const |
| get the total number of site densities
|
|
const std::vector< const
FluidComponent * > & | getComponents () const |
| access component list
|
|
void | initState (double scale=0.0, double Elo=-DBL_MAX, double Ehi=+DBL_MAX) |
|
void | loadState (const char *filename) |
| Load the state from a single binary file.
|
|
void | saveState (const char *filename) const |
| Save the state to a single binary file.
|
|
double | operator() (const ScalarFieldArray &indep, ScalarFieldArray &Phi_indep, Outputs outputs=Outputs()) const |
| Free energy and gradient evaluation. More...
|
|
double | getFreeEnergy (Outputs outputs=Outputs()) const |
| Get the free energy, densities and moments for the current state. More...
|
|
void | step (const ScalarFieldArray &dir, double alpha) |
| Advance step along direction dir by scale alpha (interface for minimize())
|
|
double | compute (ScalarFieldArray *grad, ScalarFieldArray *Kgrad) |
| Return energy at current state, and optionally the gradient (interface for minimize())
|
|
double | sync (double x) const |
| All processes minimize together; make sure scalars are in sync to round-off error.
|
|
virtual bool | report (int iter) |
|
virtual void | constrain (ScalarFieldArray &) |
| Constrain search directions to the space of free directions for minimize.
|
|
virtual double | safeStepSize (const ScalarFieldArray &dir) const |
| Override to return maximum safe step size along a given direction. Steps can be arbitrarily large by default.
|
|
double | minimize (const MinimizeParams ¶ms) |
| Minimize this objective function with algorithm controlled by params and return the minimized value.
|
|
void | fdTest (const MinimizeParams ¶ms) |
|
|
struct | FluidComponent |
|
class | Fmix |
|
struct | BoilingPressureSolver |
|
Mixture of fluids that provides the total free energy functional for minimization Constructing Fex and IdealGas objects require a FluidMixture reference, to which they add themselves. The FluidMixture object is ready to use after initialize() is called.
double FluidMixture::getBoilingPressure |
( |
double |
NliqGuess, |
|
|
double |
NvapGuess, |
|
|
std::vector< double > * |
Nvap = 0 |
|
) |
| const |
Compute the boiling pressure (vapor-liquid equilbirum) at current temperature, given guesses for the total liquid and vapor densities, and optionally retrieve equilibrium vapor densities
double FluidMixture::getFreeEnergy |
( |
Outputs |
outputs = Outputs() | ) |
const |
Get the free energy, densities and moments for the current state.
- Parameters
-
[out] | outputs | optional outputs, see Outputs |
- Returns
- Free energy at current state
void FluidMixture::initialize |
( |
double |
P = 1.01325 *Bar , |
|
|
double |
epsBulkOverride = 0. , |
|
|
double |
epsInfOverride = 0. |
|
) |
| |
Call after initializing and adding all the components of the fluid mixture This calculates the bulk equilibrium densities for all components and corresponding chemical potentials so as to achieve pressure P with the specified mole fractions. The initial guess for the densities is taken from FluidComponent::Nbulk, and this may be altered to select a particular phase The dielectric constants for mixtures is estimated as a weighted combination of the components, and may be overriden by non-zero overrides
void FluidMixture::initState |
( |
double |
scale = 0.0 , |
|
|
double |
Elo = -DBL_MAX , |
|
|
double |
Ehi = +DBL_MAX |
|
) |
| |
Initialize the independent variables
- Parameters
-
scale | scale the state that would produce the equilibrium ideal gas densities by this amount to ge tthe guess |
Elo | Lower cap on the individiual molecule energy configurations used in the estimate |
Ehi | Upper cap on the individiual molecule energy configurations used in the estimate |
Free energy and gradient evaluation.
- Parameters
-
[in] | indep | Current value of the independent variables |
[out] | Phi_indep | Gradient w.r.t indep at the current value of indep |
[out] | outputs | optional outputs, see Outputs |
- Returns
- Free energy difference (compared to uniform fluid) at this value of indep Implemented in FluidMixtureCompute.cpp
double FluidMixture::Qtol |
If true, use the mean field kernel for external coulomb interactions as well.
tolerance for unit cell neutrality (default 1e-12)
External charge density. The interaction energy between internal charges and rhoExternal is included in getFreeEnergy() etc. When charged components are present, the unit cell will be neutral including this charge.
The documentation for this class was generated from the following file: