Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Feb 18 21:49

    gdmiron on master

    Update interactive2.py (#35) (compare)

  • Feb 18 21:49
    gdmiron closed #35
  • Feb 18 21:49
    gdmiron opened #35
  • Feb 18 21:49

    gdmiron on gdmiron-patch-1

    Update interactive2.py (compare)

  • Feb 18 21:12

    gdmiron on gdmiron-patch-1

    (compare)

  • Feb 18 21:12

    gdmiron on master

    Update environment.yml (#34) (compare)

  • Feb 18 21:12
    gdmiron closed #34
  • Feb 18 21:12
    gdmiron opened #34
  • Feb 18 21:09

    gdmiron on gdmiron-patch-1

    Update environment.yml (compare)

  • Feb 18 21:02

    gdmiron on master

    Gdmiron patch 1 (#33) * Update… (compare)

  • Feb 18 21:02
    gdmiron closed #33
  • Feb 18 21:02
    gdmiron opened #33
George Dan Miron
@gdmiron
I just checked gases in mines16, the gases here also have the required parameters just that the critical pressure is in bars. If you use gases from mines please manually edit the file and change the second number in "values" by multiplying it with 1e5 (e.g. 8308570.09 instead of 83.0857009):
```
          "eos_gas_crit_props": {
            "names": [
              "Tcr",
              "Pcr",
              "W",
              "k1"
            ],
            "units": [
              "K",
              "bar",
              "",
              ""
            ],
            "values": [
              324.60000610352,
              83.08570098877,
              0.12605999410152,
              0.019889999181032,
              0,
              0,
              0
            ]
          },
Enrique García Franco
@EnriqueGarciaFranco

Ok, I will either convert the value or alter the units.

Thanks

George Dan Miron
@gdmiron
I recommend changing "bar" to "Pa" and the values by 1e5 in the mines gases you plan to use.
vscode is a good editor, download their json extension
George Dan Miron
@gdmiron
A good idea would be that in the future update of thermohub to convert all data to SI units. Now it is based on what units the ones that built the databases used.
Enrique García Franco
@EnriqueGarciaFranco

Ok then, I will get vscode.

Let me contribute by adding a link to one of the most "official" critical parameters database:

NIST Webbook search results for water:

https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Mask=4

For further searches, click on the top and type chemical formula/alias/name...

Thank you.

George Dan Miron
@gdmiron
@EnriqueGarciaFranco thanks, this is useful. One can use this to build a separate gases database.
Enrique García Franco
@EnriqueGarciaFranco

Dear all:

I have seen all the gases of my interest, including their Tc, Pc and w.

I will now script some Vapor Liquid Equilibrium calculations, just to be on the safe side of validation.

I am thinking of plotting something very ChemEng'ish: a Txy diagram.

I will chose one which is is peculiar and special.

imagen.png
Txy-diagram
H2O - HCl system
isobaric P = 8 atm
Allan Leal
@allanleal
@gdmiron What is the default temperature and pressures in ChemicalEditor when using ThermoFun databases, so that we don't need to use methods setTemperatures and setPressures to set the T and P points that we want to have support for thermodynamic properties?
Enrique García Franco
@EnriqueGarciaFranco

@gdmiron

I am sorry to interrupt you again, but I am finding difficulties now when importing the database.

Please, find the copypasted & formatted code extract below:


from reaktoro import *

import thermofun.PyThermoFun as thermofun

#Problem setup selection

rock = 'Hematite'


m_rock = 1 #kg
m_rock_units = 'kg'


#Get rock density. 

db = thermofun.Database('E:\\mines16-thermofun.json')
db.appendData('E:\\slop98-gases-crit-thermofun.json')

editor_rock = ChemicalEditor(db)
editor_rock.setMineralPhases(rock)
system_rock = ChemicalSystem(editor_rock)

state_rock = ChemicalState(system_rock)
state_rock.setSpeciesMass(rock, m_rock, m_rock_units)
idx_rock = system_rock.indexPhase(rock)

density_rock = state_rock.properties().phaseDensities().val[idx_rock]/1000 #kg/m3
MW_rock = system_rock.species(rock).molarMass()*1000 #g/mol
V_rock = m_rock / density_rock #m3
Thanks
RuntimeError: 
*******************************************************
*** Error: Invalid symbol
*** Reason: Ar
*** Location: ..\ThermoFun\Common\formuladata.cpp:422
*******************************************************
George Dan Miron
@gdmiron
@EnriqueGarciaFranco probably Ar element is missing

@gdmiron What is the default temperature and pressures in ChemicalEditor when using ThermoFun databases, so that we don't need to use methods setTemperatures and setPressures to set the T and P points that we want to have support for thermodynamic properties?

the default T-P gord

the same T-P grid as when we don't use ThermoFun
Enrique García Franco
@EnriqueGarciaFranco
I see... But I don't have Argon in my simulation. Why is that error message prompting?
George Dan Miron
@gdmiron
@EnriqueGarciaFranco somewhere a formula is parsed that contains Ar. A quick fix would be to copy the {..} containing Ar from slop file into the elements list in the mines file .
Enrique García Franco
@EnriqueGarciaFranco
Ok great. Now I am away from my work place. I will have a look into later on. Thanks.
George Dan Miron
@gdmiron
I will have to fix this in ThermoFun, one should not have to copy things around. The problem is that when appending the new file the elements are loaded correctly, but the formula parser is not updated with the additional elements that were not present in the first file, oops!
Enrique García Franco
@EnriqueGarciaFranco
I see
But it does work for just mine either. I commented the appendix and could not get it working either. I haven't modified any of the databases myself
For just mine...json
George Dan Miron
@gdmiron
what does it output?
Enrique García Franco
@EnriqueGarciaFranco
It must be something silly, I would say. I just sent you the databases
Enrique García Franco
@EnriqueGarciaFranco

Dear all:

Please, find attached a simulation that uses Thermofun to calculate Volume and Density of Hematite.

from reaktoro import *

import thermofun.PyThermoFun as thermofun

#Problem setup selection

rock = 'Hematite'


m_rock = 1 #kg
m_rock_units = 'kg'


#Get rock density. 

db = thermofun.Database("E:\mines16-edited-thermofun_fixed.json")
db.appendData("E:\slop98-gases-crit-thermofun.json")

editor_rock = ChemicalEditor(db)
editor_rock.addMineralPhase(rock)
system_rock = ChemicalSystem(editor_rock)

state_rock = ChemicalState(system_rock)
state_rock.setSpeciesMass(rock, m_rock, m_rock_units)
problem_rock = EquilibriumProblem(system_rock)

idx_rock = system_rock.indexPhase(rock)
density_rock = state_rock.properties().phaseDensities().val[idx_rock]/1000 #kg/m3
MW_rock = system_rock.species(rock).molarMass() #g/mol
V_rock = m_rock / density_rock #m3
V_rock_L = V_rock*1000 #L

I thought you may want it as a check point.

now, I would like to ask you both a question with regards to the aqueous phase
If you may
Enrique García Franco
@EnriqueGarciaFranco

I am now scripting

editor_full.addAqueousPhaseWithElements("H O Fe Cl")

I have dived into the database and changed the name of water to

H2O(l)

And added water in the following way:

state_full.setSpeciesMass("H2O(l)", 100, "kg")

But a new messages prompts out:

RuntimeError: 
***************************************************************************
*** Error: Could not get the index of species `H2O(l)`.
*** Reason: There is no species called `H2O(l)` in the system.
*** Location:  This error was encountered in :291.
***************************************************************************

May I ask you for assistance with this?

I would say it must be something silly.

Thanks in advance for your time.

Have a good afternoon ahead.

Allan Leal
@allanleal

@gdmiron How can we resolve this different naming conventions between Reaktoro, ThermoFun, PHREEQC, GEMS, etc.? :)

Looks like Enrique has a script that works with PHREEQC, but since specific species names are used, when changing database, this breaks

Enrique García Franco
@EnriqueGarciaFranco

That could be the case, but one could alter the name when attempting to add water.

However, even once the string and the database name match, it is not possible to add the mass of water.

It is like Thermofun does not get the message "H O..." already implies water specie consideration.

Allan Leal
@allanleal
Enrique, now I record something possibly helpful (because I also had this problem in the past). There are index methods in ChemicalSystem of the type indexSpeciesAny which expects a list of alternative names
Example:
iwater = system.indexSpeciesAny(["H2O", "H2O(l)", "H2O@"])
George Dan Miron
@gdmiron
if this works would be perfect, in the thermofun database water is H2O@ - therefore the problem of not finding H2O(l)
Enrique García Franco
@EnriqueGarciaFranco

I see

@allanleal , If I understand correctly this is useful when attempting to use the same simulation with different Databases (i.e. Thermofun, PHREEQC...)?

George Dan Miron
@gdmiron

@gdmiron How can we resolve this different naming conventions between Reaktoro, ThermoFun, PHREEQC, GEMS, etc.? :)

Looks like Enrique has a script that works with PHREEQC, but since specific species names are used, when changing database, this breaks

for future we should load names of species from the database only, and only use these names throughout - name agnostic, or use the possibility to define synonyms

Enrique García Franco
@EnriqueGarciaFranco
@gdmiron If I understand you correctly too, Liquid Water has to be called as:
state_full.setSpeciesMass("H2O@", 100, "kg")
George Dan Miron
@gdmiron
yes
Enrique García Franco
@EnriqueGarciaFranco
👍
Thanks
George Dan Miron
@gdmiron
@allanleal In fact I use the synonyms idea in GEMSFITS to solve the problem that experimentalists use all sorts of names for phases and species, different from how they are in the chemical system
Allan Leal
@allanleal
@EnriqueGarciaFranco I think you can also use indices in
state_full.setSpeciesMass(iwater, 100, "kg")
Forget it - it has to be name/string
but you can define this string at the beginning of the script:
water = "H2O@" if using_thermofun else "H2O(l)"
Enrique García Franco
@EnriqueGarciaFranco
Great, thanks
@allanleal

@allanleal In fact I use the synonyms idea in GEMSFITS to solve the problem that experimentalists use all sorts of names for phases and species, different from how they are in the chemical system

@gdmiron

Aspen has a compound search list, that is tricky to use.

By linking Formula, IUPAC Name and Industry Alias

say NaOH, Sodium Hydroxide and Caustic Soda

It is easily relatable by every user.

For example, academics use Sodium Hydroxide, but people operating equipment would probably refer to it as Caustic Soda