Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thermal conductivity to DustyGas in python. #988

Merged
merged 3 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions interfaces/cython/cantera/_cantera.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ cdef extern from "cantera/transport/DustyGasTransport.h" namespace "Cantera":
void setMeanParticleDiameter(double) except +translate_exception
void setPermeability(double) except +translate_exception
void getMolarFluxes(double*, double*, double, double*) except +translate_exception
CxxTransport& gasTransport() except +translate_exception


cdef extern from "cantera/transport/TransportData.h" namespace "Cantera":
Expand Down
5 changes: 4 additions & 1 deletion interfaces/cython/cantera/examples/transport/dusty_gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
The Dusty Gas model is a multicomponent transport model for gas transport
through the pores of a stationary porous medium. This example shows how to
create a transport manager that implements the Dusty Gas model and use it to
compute the multicomponent diffusion coefficients.
compute the multicomponent diffusion coefficients and thermal conductivity.

Requires: cantera >= 2.5.0
"""
Expand All @@ -29,6 +29,9 @@
# print the multicomponent diffusion coefficients
print(g.multi_diff_coeffs)

# print the thermal conductivity of the gas phase
print(g.thermal_conductivity)

# compute molar species fluxes
T1, rho1, Y1 = g.TDY

Expand Down
5 changes: 5 additions & 0 deletions interfaces/cython/cantera/test/test_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ def test_molar_fluxes(self):
# Not sure why the following condition is not satisfied:
# self.assertNear(sum(fluxes1) / sum(abs(fluxes1)), 0.0)

def test_thermal_conductivity(self):
gas1 = ct.Solution('h2o2.xml', transport_model='multicomponent')
gas1.TPX = self.phase.TPX

self.assertEqual(self.phase.thermal_conductivity, gas1.thermal_conductivity)

class TestWaterTransport(utilities.CanteraTest):
"""
Expand Down
11 changes: 10 additions & 1 deletion interfaces/cython/cantera/transport.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ cdef class Transport(_SolutionBase):
return self.transport.electricalConductivity()

property thermal_conductivity:
"""Thermal conductivity. [W/m/K]."""
"""
Thermal conductivity. [W/m/K]
Returns thermal conductivity of the ideal gas object using the multicomponent
model. The value is not specific to the dusty gas model.
"""
def __get__(self):
return self.transport.thermalConductivity()

Expand Down Expand Up @@ -276,6 +280,11 @@ cdef class DustyGasTransport(Transport):
def __set__(self, value):
(<CxxDustyGasTransport*>self.transport).setPermeability(value)

property thermal_conductivity:
def __get__(self):
return (<CxxDustyGasTransport*>self.transport).gasTransport().thermalConductivity()
speth marked this conversation as resolved.
Show resolved Hide resolved


def molar_fluxes(self, T1, T2, rho1, rho2, Y1, Y2, delta):
"""
Get the molar fluxes [kmol/m^2/s], given the thermodynamic state at
Expand Down