[1D] Fix up getters/setters/default values for radiation values
This commit is contained in:
parent
49c963143e
commit
bade514587
7 changed files with 39 additions and 18 deletions
|
|
@ -201,11 +201,12 @@ public:
|
|||
* 1991]. This model considers the radiation of CO2 and H2O.
|
||||
*/
|
||||
void enableRadiation(bool doRadiation) {
|
||||
if (doRadiation) {
|
||||
m_do_radiation = true;
|
||||
} else {
|
||||
m_do_radiation = false;
|
||||
}
|
||||
m_do_radiation = doRadiation;
|
||||
}
|
||||
|
||||
//! Returns `true` if the radiation term in the energy equation is enabled
|
||||
bool radiationEnabled() const {
|
||||
return m_do_radiation;
|
||||
}
|
||||
|
||||
//! Set the emissivities for the boundary values
|
||||
|
|
|
|||
|
|
@ -432,6 +432,7 @@ cdef extern from "cantera/oneD/StFlow.h":
|
|||
void setTransport(CxxTransport&) except +
|
||||
void setPressure(double)
|
||||
void enableRadiation(cbool)
|
||||
cbool radiationEnabled()
|
||||
double pressure()
|
||||
void setFixedTempProfile(vector[double]&, vector[double]&)
|
||||
void setBoundaryEmissivities(double, double)
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ f.flame.set_transient_tolerances(default=tol_ts)
|
|||
f.set_initial_guess(fuel='C2H6')
|
||||
|
||||
# Set the boundary emissivities
|
||||
f.flame.set_boundary_emissivities(0.0, 0.0)
|
||||
f.set_boundary_emissivities(0.0, 0.0)
|
||||
# Turn radiation off
|
||||
f.flame.radiation_enabled(0)
|
||||
f.radiation_enabled = False
|
||||
|
||||
# First disable the energy equation and solve the problem without
|
||||
# refining the grid
|
||||
|
|
@ -86,7 +86,7 @@ plt.ylim(0,2500)
|
|||
plt.xlim(0.000, 0.020)
|
||||
|
||||
# Turn on radiation and solve again
|
||||
f.flame.radiation_enabled(1)
|
||||
f.radiation_enabled = True
|
||||
f.solve(loglevel = 1, refine_grid = 0)
|
||||
f.show_solution()
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,20 @@ class FlameBase(Sim1D):
|
|||
def soret_enabled(self, enable):
|
||||
self.flame.soret_enabled = enable
|
||||
|
||||
@property
|
||||
def radiation_enabled(self):
|
||||
"""
|
||||
Get/Set whether or not to include radiative heat transfer
|
||||
"""
|
||||
return self.flame.radiation_enabled
|
||||
|
||||
@radiation_enabled.setter
|
||||
def radiation_enabled(self, enable):
|
||||
self.flame.radiation_enabled = enable
|
||||
|
||||
def set_boundary_emissivities(self, e_left, e_right):
|
||||
self.flame.set_boundary_emissivities(e_left, e_right)
|
||||
|
||||
@property
|
||||
def grid(self):
|
||||
""" Array of grid point positions along the flame. """
|
||||
|
|
|
|||
|
|
@ -393,9 +393,12 @@ cdef class _FlowBase(Domain1D):
|
|||
def set_boundary_emissivities(self, e_left, e_right):
|
||||
self.flow.setBoundaryEmissivities(e_left, e_right)
|
||||
|
||||
#turn radiation solving on / off
|
||||
def radiation_enabled(self, do_Radiation):
|
||||
self.flow.enableRadiation(do_Radiation)
|
||||
property radiation_enabled:
|
||||
""" Determines whether or not to include radiative heat transfer """
|
||||
def __get__(self):
|
||||
return self.flow.radiationEnabled()
|
||||
def __set__(self, do_radiation):
|
||||
self.flow.enableRadiation(<cbool>do_radiation)
|
||||
|
||||
|
||||
cdef CxxIdealGasPhase* getIdealGasPhase(ThermoPhase phase) except *:
|
||||
|
|
|
|||
|
|
@ -386,8 +386,6 @@ class TestDiffusionFlame(utilities.CanteraTest):
|
|||
self.sim = ct.CounterflowDiffusionFlame(self.gas, initial_grid)
|
||||
self.sim.flame.set_steady_tolerances(default=tol_ss)
|
||||
self.sim.flame.set_transient_tolerances(default=tol_ts)
|
||||
self.sim.flame.radiation_enabled(0)
|
||||
self.sim.flame.set_boundary_emissivities(0,0)
|
||||
|
||||
# Set properties of the fuel and oxidizer mixtures
|
||||
self.sim.fuel_inlet.mdot = mdot_fuel
|
||||
|
|
@ -451,8 +449,10 @@ class TestDiffusionFlame(utilities.CanteraTest):
|
|||
self.solve_fixed_T()
|
||||
self.assertEqual(nPoints, len(self.sim.grid))
|
||||
self.assertArrayNear(Tfixed, self.sim.T)
|
||||
self.sim.flame.radiation_enabled(1)
|
||||
self.sim.flame.set_boundary_emissivities(0.25,0.15)
|
||||
self.assertFalse(self.sim.radiation_enabled)
|
||||
self.sim.radiation_enabled = True
|
||||
self.assertTrue(self.sim.radiation_enabled)
|
||||
self.sim.set_boundary_emissivities(0.25,0.15)
|
||||
|
||||
self.solve_mix()
|
||||
data = np.empty((self.sim.flame.n_points, self.gas.n_species + 4))
|
||||
|
|
@ -531,8 +531,7 @@ class TestCounterflowPremixedFlame(utilities.CanteraTest):
|
|||
|
||||
sim.set_refine_criteria(ratio=3, slope=0.2, curve=0.4, prune=0.02)
|
||||
sim.energy_enabled = True
|
||||
sim.flame.radiation_enabled(0)
|
||||
sim.flame.set_boundary_emissivities(0,0)
|
||||
self.assertFalse(sim.radiation_enabled)
|
||||
sim.solve(loglevel=0, refine_grid=True)
|
||||
|
||||
data = np.empty((sim.flame.n_points, gas.n_species + 4))
|
||||
|
|
|
|||
|
|
@ -29,8 +29,11 @@ StFlow::StFlow(IdealGasPhase* ph, size_t nsp, size_t points) :
|
|||
m_trans(0),
|
||||
m_jac(0),
|
||||
m_ok(false),
|
||||
m_epsilon_left(0.0),
|
||||
m_epsilon_right(0.0),
|
||||
m_do_soret(false),
|
||||
m_transport_option(-1)
|
||||
m_transport_option(-1),
|
||||
m_do_radiation(false)
|
||||
{
|
||||
m_type = cFlowType;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue