Open lbianchi-lbl opened 1 week ago
Originally reported by @fahim831 in watertap-org/watertap#1523
2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: WARNING: model contains export suffix 'scaling_factor' that contains 22 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: component keys that are not exported as part of the NL file. Skipping. 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Called fg_read, err: 0 (0 is good) 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: --------------------------------------------------- 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: DAE: 1 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Reading nl file: /var/folders/76/5rvzy41s10bbm5rpz0gq9gjw0000gp/T/tmpg408nnfu.pyomo.nl 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of constraints: 205 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of nonlinear constraints: 112 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of linear constraints: 93 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of inequalities: 0 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of variables: 211 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of integers: 0 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of binary: 0 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of objectives: 0 (Ignoring) 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of non-zeros in Jacobian: 548 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Explicit time variable: 0 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of derivatives: 6 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of differential vars: 6 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of algebraic vars: 199 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of state vars: 205 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: Number of degrees of freedom: 0 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: --------------------------------------------------- 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: [0]PETSC ERROR: Argument out of range 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: [0]PETSC ERROR: Input string 20>o has no integer value (do not include . in it) 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: [0]PETSC ERROR: WARNING! There are option(s) set that were not used! Could be the program crashed before they were used or a spelling mistake, etc! 2024-11-12 19:44:41 [INFO] idaes.solve.petsc-dae: [0]PETSC ERROR: Option left: name:-ts_adapt_type value: basic source: command line 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: [0]PETSC ERROR: Option left: name:-ts_max_snes_failuresdERROR: Stream handle closed with un-decoded characters in the decoder buffer 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: that was not emitted to the output stream(s): 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: b'\x820XiLo\xfe\xc31n\xa1\x1c\xb2\xfa</eY\x01b1\x82\xaa=o\x01 value: 200 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: source: command line\n[0]PETSC ERROR: Option left: name:-ts_monitor (no 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: value) source: command line\n[0]PETSC ERROR: Option left: 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: name:-ts_save_trajectory value: 1 source: command line\n[0]PETSC ERROR: 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: Option left: name:-ts_trajectory_type value: visualization source: command 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: line\n[0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: shooting.\n[0]PETSC ERROR: Petsc Release Version 3.19.2, Jun 01, 2023 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: \n[0]PETSC ERROR: /Users/fya/.idaes/bin/petsc on a named mac141200 by fya Tue 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: Nov 12 19:44:41 2024\n[0]PETSC ERROR: Configure options --force --with- 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: debugging=0 --with-shared-libraries=0 --with-mpi=0 --with-fortran-bindings=0 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: --download-metis --download-mumps --with-mumps-serial=1 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: --prefix=/Users/johneslick/src/petsc-dist\n[0]PETSC ERROR: #1 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: PetscOptionsStringToInt() at 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: /Users/johneslick/src/petsc-3.19.2/src/sys/objects/options.c:2244\n[0]PETSC 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: ERROR: #2 PetscOptionsGetInt() at 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: /Users/johneslick/src/petsc-3.19.2/src/sys/objects/options.c:2580\n[0]PETSC 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: ERROR: #3 PetscOptionsInt_Private() at 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: /Users/johneslick/src/petsc-3.19.2/src/sys/objects/aoptions.c:901\n[0]PETSC 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: ERROR: #4 TSSetFromOptions() at 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: /Users/johneslick/src/petsc-3.19.2/src/ts/interface/ts.c:124\n[0]PETSC ERROR: 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: #5 main() at /Users/johneslick/src/idaes-ext-build/petsc/petsc.c:256\n[0]PETSC 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: ERROR: PETSc Option Table entries:\n[0]PETSC ERROR: -AMPL (source: command 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: line)\n[0]PETSC ERROR: -dae_solve (source: command line)\n[0]PETSC ERROR: 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: -ts_adapt_type basic (source: command line)\n[0]PETSC ERROR: 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: -ts_exact_final_time matchstep (source: command line)\n[0]PETSC ERROR: 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: -ts_init_time 0.0 (source: command line)\n[0]PETSC ERROR: -ts_max_reject 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: 20>o\x01 (source: command line)\n[0]PETSC ERROR: -ts_max_snes_failuresd\x820Xi 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: Lo\xfe\xc31n\xa1\x1c\xb2\xfa</eY\x01b1\x82\xaa=o\x01 200 (source: command 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: line)\n[0]PETSC ERROR: -ts_max_time 7.0 (source: command line)\n[0]PETSC 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: ERROR: -ts_monitor (source: command line)\n[0]PETSC ERROR: -ts_save_trajectory 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: 1 (source: command line)\n[0]PETSC ERROR: -ts_trajectory_type visualization 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: (source: command line)\n[0]PETSC ERROR: -ts_type beuler (source: command 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: line)\n[0]PETSC ERROR: ----------------End of Error Message -------send entire 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: error message to petsc-maint@mcs.anl.gov----------\n' 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: ERROR: Solver (asl) returned non-zero return code (-6) 2024-11-12 19:44:42 [INFO] idaes.solve.petsc-dae: ERROR: See the solver log above for diagnostic information. Traceback (most recent call last): File "/Users/fya/Documents/GitHub/watertap/watertap/flowsheets/ccro/CCRO_dynamic.py", line 412, in <module> m = main() File "/Users/fya/Documents/GitHub/watertap/watertap/flowsheets/ccro/CCRO_dynamic.py", line 62, in main solve_dynamic(m) File "/Users/fya/Documents/GitHub/watertap/watertap/flowsheets/ccro/CCRO_dynamic.py", line 329, in solve_dynamic results = petsc.petsc_dae_by_time_element( File "/opt/anaconda3/envs/watertap-dev/lib/python3.8/site-packages/idaes/core/solvers/petsc.py", line 640, in petsc_dae_by_time_element res = solver_dae.solve( File "/opt/anaconda3/envs/watertap-dev/lib/python3.8/site-packages/pyomo/opt/base/solvers.py", line 628, in solve raise ApplicationError("Solver (%s) did not exit normally" % self.name) pyomo.common.errors.ApplicationError: Solver (asl) did not exit normally
The following script, adapted from the example in IDAES/examples, should be enough to trigger the error:
import numpy as np import pyomo.dae as pyodae import pyomo.environ as pyo import idaes.core.solvers.petsc as petsc # petsc utilities module # from idaes.core.solvers.features import dae # DAE example/test problem def dae(nfe=1): """This provides a DAE model for solver testing. The problem and expected result are from the problem given here: https://archimede.dm.uniba.it/~testset/report/chemakzo.pdf. Args: None Returns: (tuple): Pyomo ConcreteModel, correct solved value for y[1] to y[5] and y6 """ model = pyo.ConcreteModel(name="chemakzo") # Set problem parameter values model.k = pyo.Param([1, 2, 3, 4], initialize={1: 18.7, 2: 0.58, 3: 0.09, 4: 0.42}) model.Ke = pyo.Param(initialize=34.4) model.klA = pyo.Param(initialize=3.3) model.Ks = pyo.Param(initialize=115.83) model.pCO2 = pyo.Param(initialize=0.9) model.H = pyo.Param(initialize=737) # Problem variables ydot = dy/dt, # (dy6/dt is not explicitly in the equations, so only 5 ydots i.e. # y6 is an algebraic variable and y1 to y5 are differential variables) model.t = pyodae.ContinuousSet(bounds=(0, 180)) model.y = pyo.Var(model.t, [1, 2, 3, 4, 5], initialize=1.0) # model.y6 = pyo.Var(model.t, initialize=1.0) # model.ydot = pyodae.DerivativeVar(model.y, wrt=model.t) # dy/dt model.r = pyo.Var(model.t, [1, 2, 3, 4, 5], initialize=1.0) model.Fin = pyo.Var(model.t, initialize=1.0) # Equations @model.Constraint(model.t) def eq_ydot1(b, t): return b.ydot[t, 1] == -2.0 * b.r[t, 1] + b.r[t, 2] - b.r[t, 3] - b.r[t, 4] @model.Constraint(model.t) def eq_ydot2(b, t): return b.ydot[t, 2] == -0.5 * b.r[t, 1] - b.r[t, 4] - 0.5 * b.r[t, 5] + b.Fin[t] @model.Constraint(model.t) def eq_ydot3(b, t): return b.ydot[t, 3] == b.r[t, 1] - b.r[t, 2] + b.r[t, 3] @model.Constraint(model.t) def eq_ydot4(b, t): return b.ydot[t, 4] == -b.r[t, 2] + b.r[t, 3] - 2.0 * b.r[t, 4] @model.Constraint(model.t) def eq_ydot5(b, t): return b.ydot[t, 5] == b.r[t, 2] - b.r[t, 3] + b.r[t, 5] @model.Constraint(model.t) def eq_y6(b, t): return 0 == b.Ks * b.y[t, 1] * b.y[t, 4] - b.y6[t] @model.Constraint(model.t) def eq_r1(b, t): return b.r[t, 1] == b.k[1] * b.y[t, 1] ** 4 * b.y[t, 2] ** 0.5 @model.Constraint(model.t) def eq_r2(b, t): return b.r[t, 2] == b.k[2] * b.y[t, 3] * b.y[t, 4] @model.Constraint(model.t) def eq_r3(b, t): return b.r[t, 3] == b.k[2] / b.Ke * b.y[t, 1] * b.y[t, 5] @model.Constraint(model.t) def eq_r4(b, t): return b.r[t, 4] == b.k[3] * b.y[t, 1] * b.y[t, 4] ** 2 @model.Constraint(model.t) def eq_r5(b, t): return b.r[t, 5] == b.k[4] * b.y6[t] ** 2 * b.y[t, 2] ** 0.5 @model.Constraint(model.t) def eq_Fin(b, t): return b.Fin[t] == b.klA * (b.pCO2 / b.H - b.y[t, 2]) # Set initial conditions and solve initial from the values of differential # variables. y0 = {1: 0.444, 2: 0.00123, 3: 0.0, 4: 0.007, 5: 0.0} # initial differential vars for i, v in y0.items(): model.y[0, i].fix(v) discretizer = pyo.TransformationFactory("dae.finite_difference") discretizer.apply_to(model, nfe=nfe, scheme="BACKWARD") return ( model, 0.1150794920661702, 0.1203831471567715e-2, 0.1611562887407974, 0.3656156421249283e-3, 0.1708010885264404e-1, 0.4873531310307455e-2, ) # Get the model and known solution for y variables at t=180 minutes. m, y1, y2, y3, y4, y5, y6 = dae(nfe=10) # See the initial conditions: print("at t = 0:") print(f" y1 = {pyo.value(m.y[0, 1])}") print(f" y2 = {pyo.value(m.y[0, 2])}") print(f" y3 = {pyo.value(m.y[0, 3])}") print(f" y4 = {pyo.value(m.y[0, 4])}") print(f" y5 = {pyo.value(m.y[0, 5])}") # The command below will solve the problem. In this case, we want to read the saved # trajectory for each time element in the Pyomo.DAE problem (in this case there is # only 1) so we will need to provide solver options to save the trajectory to the PETSc # solver, a file name stub for variable information files, and a file stub for saving # the trajectory information. The options shown below will delete the trajectory # information written by PETSc and resave it as json. This allows us to cleanly read # the trajectory data for multiple time elements. result = petsc.petsc_dae_by_time_element( m, time=m.t, between=[m.t.first(), m.t.last()], ts_options={ "--ts_type": "cn", # Crank–Nicolson "--ts_adapt_type": "basic", "--ts_dt": 0.01, "--ts_save_trajectory": 1, }, ) tj = result.trajectory res = result.results
Originally reported by @fahim831 in watertap-org/watertap#1523
Symptoms
Possible causes
Reproducing the error
The following script, adapted from the example in IDAES/examples, should be enough to trigger the error: