Error getting single phase heatCapacityCp

Error getting single phase heatCapacityCp

Postby ahmedsabriz » 31 October 2021, 12:23

Greetings, I am trying to get heatCapacityCp for calculation method in COBIA unit operation but getting the following error:
CAPE-OPEN error, caused by: in ICapeThermoMaterial::GetSinglePhaseProp of 'feed': no values set for heatCapacityCp, phase Vapor, CalcType mixture (2x)


Here is a sample code:
Code: Select all
CAPEOPEN_1_2::CapeThermoMaterial foo;
foo = feed->getMaterial()

CapeArrayStringImpl phaseLabels;
CapeArrayEnumerationImpl<CAPEOPEN_1_2::CapePhaseStatus> phaseStatus;
foo.GetPresentPhases(phaseLabels, phaseStatus);

CapeArrayRealImpl Cp;
Cp.resize(phaseLabels.size());

for (ConstCapeString phaseLabel : phaseLabels) {
   CapeArrayRealImpl phaseCp;
   foo.GetSinglePhaseProp(ConstCapeString(COBIATEXT("heatCapacityCp")),
      phaseLabel, ConstCapeString(COBIATEXT("mole")), phaseCp);
   Cp.emplace_back(phaseCp[0]);
}


I can clearly see the phase heatCapacityCp value for the mixture in COFE. So, I'm a bit confused about the error. Hope to get your help on it.
ahmedsabriz
 
Posts: 20
Joined: 07 June 2021, 13:54

Re: Error getting single phase heatCapacityCp

Postby jasper » 01 November 2021, 08:01

before you can get a property from a material object (short of the properties that are available at phase equilibrium, which are flow rate, composition, pressure, temperature and phase fraction), you must first calculate the property using CalcSinglePhaseProp.

Note that CAPE-OPEN unit operations may not have side effects on material objects connected to feeds, so this CalcSinglePhaseProp may not be performed on the feed material object itself. But you can duplicate the feed material object, and perform the calculation on the temporary material object that results from that. Or copy the feed to the product first, then perform the calculation.
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: Error getting single phase heatCapacityCp

Postby ahmedsabriz » 01 November 2021, 13:41

Turns out I overlooked this step indeed. Thanks as usual for great support and tips. Working as intended now.
ahmedsabriz
 
Posts: 20
Joined: 07 June 2021, 13:54


Return to Unit Operations

Who is online

Users browsing this forum: No registered users and 1 guest

cron