Skip to content

Solving DFTProfile for binary mixture with x1 = 1 results in singular matrix #39

Closed

Description

@g-bauer
parameters = PcSaftParameters.from_json(
    ['toluene', 'acetone'], 
    '../parameters/pcsaft/loetgeringlin2018.json'
)
pcsaft = HelmholtzEnergyFunctional.pcsaft(parameters)
vle = PhaseDiagram.binary_vle(pcsaft, 300 * KELVIN, 251)
gamma = [PlanarInterface.from_tanh(pe, 1024, 100 * ANGSTROM, 500 * KELVIN).solve().surface_tension() for pe in vle.states]

results in RuntimeError: The matrix appears to be singular. for both end-points (pure substances) of the phase diagram.

The above functionality can be done with a SurfaceTensionDiagram but would it be helpful to handle PhaseEquilibrium inputs for mixtures with x=1?

Activity

  1. added
    enhancementNew feature or request
    DFTDFT related feature or issue
    on Aug 1, 2022
  2. prehner commented on Aug 2, 2022

    @prehner
    Contributor

    The density solver cannot handle components with x=0 because their total chemical potential diverges. Even though a physical solution exists, it cannot be found because the code does not cancel out the diverging ideal gas contributions.

    Some thoughts:

    • maybe a method to convert PhaseEquilibriums between different component sets could be useful (i.e. add components with n=0 or remove all components where n=0)
    • Solving density profiles for one (or more) non-zero components and then adding a zero component can be an interesting case because it gives rise to an inhomogeneous Henry constant and should not suffer from the same problems that the solver has with empty components.
  3. prehner commented on Dec 4, 2022

    @prehner
    Contributor

    This problem is solved in #60. However, any solver with log=True will still not converge as it will inevitably call log(0). So a solver has to be passed explicitly. In this case both

    DFTSolver().anderson_mixing()

    and

    solver = DFTSolver().picard_iteration(max_iter=3).newton()

    converge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DFTDFT related feature or issueenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions