Substance Derived Type

type, public :: Substance

Substance object.

A Substance object holds all the defined properties available in the package. It can be initialized either by hand or from a json file. To initialize from a json file the user must provide a database path by setting up the variable forsus_dir. Then defining a Substance by it’s name (which should be the same as the filename) will find all the properties and set them up properly.

When using a custom datafile it is very possible that the information in it is limited in comparison of what the original API provides. In this case you it is possible to extract only the desired parameters with the only argument.

Strings for using only are:

  • “critical”: Critical constants , ,

Examples

Default behaviour

use forsus, only: Substance, forsus_dir
type(Substance) :: sus

! Set the path of the json files
forsus_dir = "some/directory/path"

! Define your substance
sus = Substance("1-butanol")

Using a custom path for a single substance

use forsus, only: Substance
sus = Substance("1-butanol", path="the/json/is/here/")

Extracting only specific information

use forsus, only: Substance
character(len=50) :: only_these(3)

! Only extract the critical constants
sus = Substance("1-butanol", only=["critical"])

! Extracting a list of properties
only_these(1) = "critical"
only_these(2) = "unifac"
only_these(3) = "mathiascopeman"
sus = Substance("1-butanol", only=only_these)

The available parameters to single extraction are:

  • “critical”: Tc, Pc and Acentric Factor
  • “unifac_vle”: UNIFAC-VLE (Original UNIFAC) parameters
  • “parachor”: Parachor
  • “mathiascopeman”: Mathias Copeman function parameters

Inherits

type~~substance~~InheritsGraph type~substance Substance type~criticalconstants CriticalConstants type~substance->type~criticalconstants critical type~groups Groups type~substance->type~groups unifac_vle type~scalarproperty ScalarProperty type~substance->type~scalarproperty parachor, mathiascopeman type~criticalconstants->type~scalarproperty critical_pressure, critical_temperature, critical_volume, acentric_factor type~property Property type~groups->type~property type~scalarproperty->type~property

Components

Type Visibility Attributes Name Initial
type(CriticalConstants), public :: critical

Critical constants

type(ScalarProperty), public :: mathiascopeman(3)

Mathias Copeman function parameters

character(len=:), public, allocatable :: name

Substance name

type(ScalarProperty), public :: parachor

Parachor

type(Groups), public :: unifac_vle

UNIFAC-VLE model groups


Constructor

public interface Substance

  • public function init_json(name, path, only)

    Initialize a Substance object from a json file, provided it’s name. It is also optional to use a custom path for the component.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: name

    Component’s name

    character(len=*), intent(in), optional :: path

    Optional database path

    character(len=*), intent(in), optional :: only(:)

    Only extract this parameters, the options are:

    Read more…

    Return Value type(Substance)