Skip to content

Commit

Permalink
Deprecating ConstDensityThermo class
Browse files Browse the repository at this point in the history
  • Loading branch information
decaluwe committed Jun 11, 2019
1 parent 0ed2b38 commit 7325d5e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions data/inputs/sofc.cti
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ species( name = "electron", atoms = "E:1",
# consider the oxygen sublattice. The only species we define are a
# lattice oxygen, and an oxygen vacancy. Again, the density is a
# required input, but is not used here, so may be set arbitrarily.
incompressible_solid(name = "oxide_bulk",
lattice(name = "oxide_bulk",
elements = "O E",
species = "Ox VO**",
density = (0.7, 'g/cm3'),
site_density = (0.0176, 'g/cm3'),
initial_state = state( temperature = tt,
pressure = OneAtm,
mole_fractions = "Ox:0.95 VO**:0.05")
Expand Down
8 changes: 7 additions & 1 deletion include/cantera/thermo/ConstDensityThermo.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ namespace Cantera
* The density is assumed to be constant, no matter what the concentration of
* the solution.
*
* @deprecated To be removed after Cantera 2.5.0. Replaceable with LatticePhase
* or IdealSolidSolnPhase
*
* @ingroup thermoprops
*/
class ConstDensityThermo : public ThermoPhase
{
public:
//! Constructor.
ConstDensityThermo() {}
ConstDensityThermo() {
warn_deprecated("class ConstDensityThermo", "To be removed after Cantera "
"2.5.0. Consider replacing with LatticePhase or IdealSolidSolnPhase\n");
}

virtual std::string type() const {
return "ConstDensity";
Expand Down
14 changes: 11 additions & 3 deletions interfaces/cython/cantera/ctml_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,16 @@ def build(self, p):


class incompressible_solid(phase):
"""An incompressible solid."""
"""An incompressible solid.
.. deprecated:: 2.5
To be deprecated with version 2.5, and removed thereafter.
This phase pointed to an ill-considered constant_density ThermoPhase
model, which assumed a constant mass density. This underlying phase is
simultaneously being deprecated. Please consider switching to
either `IdealSolidSolution` or `lattice` phase, instead.
"""
def __init__(self,
name = '',
elements = '',
Expand Down Expand Up @@ -2295,15 +2304,14 @@ def __init__(self,
initial_state, options)
self._tr = transport
self._n = site_density
self._species = species

if name == '':
raise CTI_Error('sublattice name must be specified')
if species == '':
raise CTI_Error('sublattice species must be specified')
if site_density is None:
raise CTI_Error('sublattice '+name
+' site density must be specified')

def build(self,p, visible = 0):
#if visible == 0:
# return
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/test/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def test_sofc(self):

self.assertNear(gas_a.P, ct.one_atm)
self.assertNear(anode_bulk['electron'].X, 1.0)
self.assertNear(oxide_a.density, 700)
self.assertNear(oxide_a.density_mole, 17.6)

def test_diamond(self):
gas, solid = ct.import_phases('diamond.cti', ['gas','diamond'])
Expand Down

0 comments on commit 7325d5e

Please sign in to comment.