Replies: 3 comments 10 replies
-
Hi @bgvinayk, thanks for reporting this issue. Chemical equilibrium calculations can fail for a variety of reasons (for example, input conditions may be outside the range of validity of some internal thermodynamic models, or the algorithm has difficulty converging with certain initial conditions). You provide an example above, but it does not contain the details necessary to reproduce the failure. Could you please review this and provide a complete example of a failed chemical equilibrium calculation?
What may be happening is that some changes in the algorithm is causing errors in your calculations that were not happening before. The failed calculation continues up to the maximum number of iterations (currently 200 by default). You then get the impression that the latest version is not as fast as before. The example requested above would be very helpful to find out.
I suspect that you installed an older version of Reaktoro, but still rely on a newer version of Optima in the same environment. This may be the cause of the
See above. I look forward to receiving a complete example of your failing equilibrium calculation. If you want to reverse the algorithmic behavior of Reaktoro v2.9 to that of v2.8 and before, do the following: options EquilibriumOptions()
options.optima.backtracksearch.apply_min_max_fix_and_accept = True
solver = EquilibriumSolver(specs)
solver.setOptions(options) |
Beta Was this translation helpful? Give feedback.
-
On a separate issue, instead of |
Beta Was this translation helpful? Give feedback.
-
Hi @allanleal, from reaktoro import *
import time
startTime = time.time()
db = PhreeqcDatabase("minteq.v4.dat")
solution = AqueousPhase(speciate("H O Ca Mg Na K Zn Fe Mn C Si P S Cl F N Ba Sr Al Cu"))
solution.setActivityModel(ActivityModelDebyeHuckelPHREEQC())
gases = GaseousPhase("CO2(g)")
gases.setActivityModel(ActivityModelPengRobinson())
system = ChemicalSystem(db, solution, gases)
specs = EquilibriumSpecs(system)
specs.temperature()
specs.pressure()
specs.pH()
options = EquilibriumOptions()
options.optima.backtracksearch.apply_min_max_fix_and_accept = True
solver = EquilibriumSolver(specs)
solver.setOptions(options)
water_mass = 1000
P = 1
Tc = 40
'pH = 8.7'
pH = 8.8
'pH = 8.9'
state = ChemicalState(system)
state.pressure(P, "atm")
state.temperature(Tc, "celsius")
state.set("H2O" , water_mass, "kg")
state.set("Na+" , 2, "mol")
state.set("K+" , 0, "mol")
state.set("Ca+2" , 54, "g")
state.set("Mg+2" , 9, "g")
state.set("Ba+2" , 0, "g")
state.set("Sr+2" , 0.2, "g")
state.set("Fe+2" , 0, "g")
state.set("Zn+2" , 0, "g")
state.set("Al+3" , 0, "g")
state.set("Mn+2" , 0, "g")
state.set("Cu+2" , 0, "g")
state.set("NH3" , 0, "g")
state.set("CO3-2" , 2.5, "mol")
state.set("H4SiO4" , 1.3, "mol")
state.set("SO4-2" , 1, "mol")
state.set("PO4-3" , 0, "g")
state.set("Cl-" , 1.34, "mol")
state.set("NO3-" , 0, "g")
state.set("F-" , 0, "g")
conditions = EquilibriumConditions(specs)
conditions.temperature(Tc, "celsius")
conditions.pressure(P, "atm")
conditions.pH(pH)
result = solver.solve(state, conditions)
print("Duration: ", time.time()-startTime, "seconds") |
Beta Was this translation helpful? Give feedback.
-
I have been running equilibrium calculations in latest version as shown in image below. It runs slower compared to previous version and gives warnings.
I tried to install older version but getting vector too long error.
Please help regarding this issue. Thank you.
Edit on 30.10.23 by @allanleal: Using syntax highlighting for given Python example.
Beta Was this translation helpful? Give feedback.
All reactions