[Python] Add transport_model override option to Solution constructor
This keyword argument allows the transport model specified in a CTI/XML file to be overridden when creating the object. Can be used to speed up Solution initialization by specifying 'transport_model=None', which is especially useful for large mechanisms where transport initialization scales as species number squared.
This commit is contained in:
parent
79b3a8ae39
commit
a981622981
3 changed files with 11 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
cdef class _SolutionBase:
|
||||
def __cinit__(self, infile='', phaseid='', phases=(), origin=None,
|
||||
source=None):
|
||||
source=None, **kwargs):
|
||||
# Shallow copy of an existing Solution (for slicing support)
|
||||
cdef _SolutionBase other
|
||||
if origin is not None:
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ class Solution(ThermoPhase, Kinetics, Transport):
|
|||
`Transport`. It defines very few methods of its own, and is provided so
|
||||
that a single object can be used to compute thermodynamic, kinetic, and
|
||||
transport properties of a solution.
|
||||
|
||||
To skip initialization of the Transport object, pass the argument
|
||||
`transport_model=None` to the `Solution` constructor.
|
||||
"""
|
||||
|
||||
class Interface(InterfacePhase, InterfaceKinetics):
|
||||
|
|
|
|||
|
|
@ -25,7 +25,13 @@ cdef class Transport(_SolutionBase):
|
|||
# The signature of this function causes warnings for Sphinx documentation
|
||||
def __init__(self, *args, **kwargs):
|
||||
if self.transport == NULL:
|
||||
self.transport = newDefaultTransportMgr(self.thermo)
|
||||
if 'transport_model' not in kwargs:
|
||||
self.transport = newDefaultTransportMgr(self.thermo)
|
||||
else:
|
||||
model = kwargs['transport_model']
|
||||
if not model:
|
||||
model = 'None'
|
||||
self.transport = newTransportMgr(stringify(model), self.thermo)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
property transport_model:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue