Coder Social home page Coder Social logo

Fix adiabatic_flame.py module about ctwrap HOT 7 CLOSED

ischoegl avatar ischoegl commented on June 24, 2024
Fix adiabatic_flame.py module

from ctwrap.

Comments (7)

ischoegl avatar ischoegl commented on June 24, 2024

Both groups point to the same flame object ... Python treats everything as a reference

from ctwrap.

ischoegl avatar ischoegl commented on June 24, 2024

This may require a second flame object. Note that simulations can be restarted, see:
https://github.com/Cantera/cantera/blob/d8e62addc8bc535588cbf8d1bd832010b22acf1f/interfaces/cython/cantera/onedim.py#L96

from ctwrap.

DavidAkinpelu avatar DavidAkinpelu commented on June 24, 2024
Process Process-1:
Traceback (most recent call last):
  File "/home/david/anaconda3/envs/ctwrap/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/home/david/anaconda3/envs/ctwrap/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/home/david/ctwrap/ctwrap/simulation.py", line 752, in worker
    obj.run(group, config, **kwargs)
  File "/home/david/ctwrap/ctwrap/simulation.py", line 143, in run
    self.data = self._module.run(name, **config, **kwargs)
  File "/home/david/ctwrap/ctwrap/modules/adiabatic_flame.py", line 104, in run
    g.solve(loglevel)  # don't use 'auto' on subsequent solves
  File "/home/david/anaconda3/envs/ctwrap/lib/python3.7/site-packages/cantera/onedim.py", line 864, in solve
    return super().solve(loglevel, refine_grid, auto)
  File "interfaces/cython/cantera/onedim.pyx", line 1139, in cantera._cantera.Sim1D.solve
cantera._cantera.CanteraError: 
***********************************************************************
CanteraError thrown by OneDim::timeStep:
Time integration failed.
***********************************************************************

from ctwrap.

DavidAkinpelu avatar DavidAkinpelu commented on June 24, 2024

This is what I am trying to do.

    # set up flame object
    width = domain.width.m_as('meter')
    f = ct.FreeFlame(gas, width=width)
    f.set_refine_criteria(ratio=3, slope=0.06, curve=0.12)
    if loglevel > 0:
        f.show_solution()

    out = {}

    # Solve with mixture-averaged transport model
    f.transport_model = 'Mix'
    f.solve(loglevel=loglevel, auto=True)

    # Solve with the energy equation enabled
    if loglevel > 0:
        f.show_solution()
    msg = '    {0:s}: mixture-averaged flamespeed = {1:7f} m/s'
    print(msg.format(name, f.velocity[0]))

    group = name + "_mix"
    out[group] = f

    f_sol = f.to_solution_array()

    # Solve with multi-component transport properties
    g = ct.FreeFlame(gas, width=width)
    g.set_initial_guess(data=f_sol)
    g.set_refine_criteria(ratio=3, slope=0.06, curve=0.12)
    g.transport_model = 'Multi'
    g.solve(loglevel)  # don't use 'auto' on subsequent solves
    if loglevel > 0:
        g.show_solution()
    msg = '    {0:s}: multi-component flamespeed  = {1:7f} m/s'
    print(msg.format(name, g.velocity[0]))

from ctwrap.

ischoegl avatar ischoegl commented on June 24, 2024

Ok. The restart doesn’t appear to work. Can you troubleshoot this in a jupyter notebook (I.e. without ctwrap)

from ctwrap.

DavidAkinpelu avatar DavidAkinpelu commented on June 24, 2024

Okay

from ctwrap.

ischoegl avatar ischoegl commented on June 24, 2024

When you set g, the gas won’t have the correct composition any longer

from ctwrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.