-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
Description
A simulation I had set up for the interactive visualization tool runs in ~0.1 seconds on Windows. On Linux: it's 50% in ~0.1 seconds and 50% in 90-120 seconds.
If I have sim.root.input.solver.consistent_init_mode=1
I get the behavior described above. If I delete that entry (i.e. sim.root.input.solver.pop("consistent_init_mode")
, the simulation runs 100% in 0.1 seconds on Linux.
This happens with CADET-Core v5.0.0 - v5.0.4 and CADET-Python v1.0.4-1.1.0
PS: I can't append .h5 files, so here is a h5.txt file that you just need to rename to .h5
PS2: we never merged cadet/CADET-Python#10 so turning a CADET object back into Python to generate that CADET-Object is still tedious. Here's a Python script to generate the simulation in question:
import subprocess
from datetime import datetime
from addict import Dict
import numpy as np
from cadet import Cadet
sim = Cadet()
sim.root.input = Dict({
'model': {
'nunits': np.int64(3),
'connections': {
'connections_include_dynamic_flow': np.int64(1),
'nswitches': np.int64(2),
'switch_000': {
'connections': np.array(
[0.0000e+00, 1.0000e+00, -1.0000e+00, -1.0000e+00, 8.3333e-09,
0.0000e+00, 0.0000e+00, 0.0000e+00, 1.0000e+00, 2.0000e+00,
-1.0000e+00, -1.0000e+00, 8.3333e-09, 0.0000e+00, 0.0000e+00,
0.0000e+00]),
'section': np.int64(0)},
'switch_001': {
'connections': np.array(
[0.0000e+00, 1.0000e+00, -1.0000e+00, -1.0000e+00, 8.3333e-09,
0.0000e+00, 0.0000e+00, 0.0000e+00, 1.0000e+00, 2.0000e+00,
-1.0000e+00, -1.0000e+00, 8.3333e-09, 0.0000e+00, 0.0000e+00,
0.0000e+00]),
'section': np.int64(1)}},
'solver': {
'gs_type': np.int64(1),
'linear_solution_mode': np.int64(0),
'max_krylov': np.int64(0),
'max_restarts': np.int64(10),
'schur_safety': np.float64(1e-08)},
'unit_000': {
'inlet_type': np.bytes_(b'PIECEWISE_CUBIC_POLY'),
'ncomp': np.int64(1),
'unit_type': np.bytes_(b'INLET'),
'discretization': {
'nbound': np.array([0])},
'sec_000': {
'const_coeff': np.array([0.]),
'cube_coeff': np.array([0.]),
'lin_coeff': np.array([0.]),
'quad_coeff': np.array([0.])},
'sec_001': {
'const_coeff': np.array([1]),
'cube_coeff': np.array([0.]),
'lin_coeff': np.array([0]),
'quad_coeff': np.array([0.])},
'sec_002': {
'const_coeff': np.array([0]),
'cube_coeff': np.array([0.]),
'lin_coeff': np.array([0]),
'quad_coeff': np.array([0.])}},
'unit_001': {
'adsorption_model': np.bytes_(b'LINEAR'),
'col_dispersion': 5.75e-08,
'col_length': np.float64(0.02),
'col_porosity': 0.37,
'cross_section_area': np.float64(5.0265482457436686e-05),
'film_diffusion': np.array([0]),
'init_c': np.array([0]),
'init_cp': np.array([0]),
'init_q': np.array([0.]),
'ncomp': np.int64(1),
'par_diffusion': np.array([7.e-10]),
'par_porosity': np.float64(0.5),
'par_radius': np.float64(4.5e-05),
'par_surfdiffusion': np.array([0., 0.]),
'par_surfdiffusion_multiplex': np.int64(0),
'unit_type': np.bytes_(b'LUMPED_RATE_MODEL_WITH_PORES'),
'velocity': np.int64(1),
'adsorption': {
'adsorption_model': np.bytes_(b'LINEAR'),
'is_kinetic': np.False_,
'lin_ka': np.array([1.]),
'lin_kd': np.array([1.])},
'discretization': {
'fix_zero_surface_diffusion': np.False_,
'gs_type': np.True_,
'max_krylov': np.int64(0),
'max_restarts': np.int64(10),
'nbound': np.array([1]),
'ncol': 100,
'npar': np.int64(4),
'par_boundary_order': np.int64(2),
'par_disc_type': np.bytes_(b'EQUIDISTANT_PAR'),
'par_geom': np.bytes_(b'SPHERE'),
'reconstruction': np.bytes_(b'WENO'),
'schur_safety': np.float64(1e-08),
'use_analytic_jacobian': np.True_,
'consistency_solver': {
'init_damping': np.float64(0.01),
'max_iterations': np.int64(50),
'min_damping': np.float64(0.0001),
'solver_name': np.bytes_(b'LEVMAR'),
'subsolvers': np.bytes_(b'LEVMAR')},
'weno': {
'boundary_model': np.int64(0),
'weno_eps': np.float64(1e-10),
'weno_order': np.int64(3)}}},
'unit_002': {
'ncomp': np.int64(1),
'unit_type': np.bytes_(b'OUTLET'),
'discretization': {
'nbound': np.array([0])}}},
'return': {
'split_components_data': np.False_,
'split_ports_data': np.False_,
'write_sens_last': np.True_,
'write_solution_last': np.True_,
'write_solution_times': np.True_,
'unit_000': {
'write_coordinates': np.False_,
'write_sensdot_inlet': np.False_,
'write_sensdot_outlet': np.False_,
'write_sens_inlet': np.False_,
'write_sens_outlet': np.False_,
'write_soldot_inlet': np.False_,
'write_soldot_outlet': np.False_,
'write_solution_inlet': np.False_,
'write_solution_last_unit': np.False_,
'write_solution_outlet': np.False_},
'unit_001': {
'write_coordinates': np.False_,
'write_sensdot_bulk': np.False_,
'write_sensdot_flux': np.False_,
'write_sensdot_inlet': np.False_,
'write_sensdot_outlet': np.False_,
'write_sensdot_particle': np.False_,
'write_sensdot_solid': np.False_,
'write_sens_bulk': np.False_,
'write_sens_flux': np.False_,
'write_sens_inlet': np.False_,
'write_sens_outlet': np.False_,
'write_sens_particle': np.False_,
'write_sens_solid': np.False_,
'write_soldot_bulk': np.False_,
'write_soldot_flux': np.False_,
'write_soldot_inlet': np.False_,
'write_soldot_outlet': np.False_,
'write_soldot_particle': np.False_,
'write_soldot_solid': np.False_,
'write_solution_bulk': np.True_,
'write_solution_flux': np.False_,
'write_solution_inlet': np.True_,
'write_solution_last_unit': np.False_,
'write_solution_outlet': np.True_,
'write_solution_particle': np.False_,
'write_solution_solid': np.True_},
'unit_002': {
'write_coordinates': np.False_,
'write_sensdot_inlet': np.False_,
'write_sensdot_outlet': np.False_,
'write_sens_inlet': np.False_,
'write_sens_outlet': np.False_,
'write_soldot_inlet': np.False_,
'write_soldot_outlet': np.False_,
'write_solution_inlet': np.False_,
'write_solution_last_unit': np.False_,
'write_solution_outlet': np.False_}},
'sensitivity': {
'nsens': np.int64(0), 'sens_method': np.bytes_(b'ad1')},
'solver': {
'consistent_init_mode': np.int64(1),
'consistent_init_mode_sens': np.int64(1),
'nthreads': np.int64(1),
'user_solution_times': np.array([0., 3.03030303, 6.06060606, 9.09090909,
12.12121212, 15.15151515, 18.18181818, 21.21212121,
24.24242424, 27.27272727, 30.3030303, 33.33333333,
36.36363636, 39.39393939, 42.42424242, 45.45454545,
48.48484848, 51.51515152, 54.54545455, 57.57575758,
60.60606061, 63.63636364, 66.66666667, 69.6969697,
72.72727273, 75.75757576, 78.78787879, 81.81818182,
84.84848485, 87.87878788, 90.90909091, 93.93939394,
96.96969697, 100., 103.03030303, 106.06060606,
109.09090909, 112.12121212, 115.15151515, 118.18181818,
121.21212121, 124.24242424, 127.27272727, 130.3030303,
133.33333333, 136.36363636, 139.39393939, 142.42424242,
145.45454545, 148.48484848, 151.51515152, 154.54545455,
157.57575758, 160.60606061, 163.63636364, 166.66666667,
169.6969697, 172.72727273, 175.75757576, 178.78787879,
181.81818182, 184.84848485, 187.87878788, 190.90909091,
193.93939394, 196.96969697, 200., 203.03030303,
206.06060606, 209.09090909, 212.12121212, 215.15151515,
218.18181818, 221.21212121, 224.24242424, 227.27272727,
230.3030303, 233.33333333, 236.36363636, 239.39393939,
242.42424242, 245.45454545, 248.48484848, 251.51515152,
254.54545455, 257.57575758, 260.60606061, 263.63636364,
266.66666667, 269.6969697, 272.72727273, 275.75757576,
278.78787879, 281.81818182, 284.84848485, 287.87878788,
290.90909091, 293.93939394, 296.96969697, 300.]),
'sections': {
'nsec': np.int64(3),
'section_continuity': np.array([0]),
'section_times': np.array([0., 20., 30., 400.])},
'time_integrator': {
'abstol': 0.0001,
'algtol': 0.01,
'errortest_sens': np.False_,
'init_step_size': np.float64(1e-06),
'max_convtest_fail': np.int64(1000000),
'max_errtest_fail': np.int64(1000000),
'max_newton_iter': np.int64(1000000),
'max_newton_iter_sens': np.int64(1000000),
'max_steps': np.int64(1000000),
'max_step_size': np.float64(0.0),
'reltol': 0.001,
'reltol_sens': np.float64(1e-12)}}
})
sim.filename = "tmp.h5"
sim.save()
for i in range(10):
try:
start_time = datetime.now()
sim.run_load(timeout=1)
print(f"Sim took {datetime.now() - start_time}")
except subprocess.TimeoutExpired:
print("Sim timed out")
sim.root.input.solver.pop("consistent_init_mode")
print("Removed consistent_init_mode")
sim.save()
for i in range(10):
try:
start_time = datetime.now()
sim.run_load(timeout=1)
print(f"Sim took {datetime.now() - start_time}")
except subprocess.TimeoutExpired:
print("Sim timed out")
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo