JARA2i.phase

Models describing phase changes

Information


Models describing phase changes



This package includes classes describing phase changes.


Figure 1.Classes included in phase.mo.



Package Content

NameDescription
JARA2i.phase.boilingB boilingB Boiling model
JARA2i.phase.condensB condensB Condensation model
JARA2i.phase.phaseChgB phaseChgB Partial model - Model describing a phase change
JARA2i.phase.vapPressB vapPressB Boundary condition for the partial pressure of one of the component of a gas mixture


JARA2i.phase.boilingB JARA2i.phase.boilingB

Boiling model

JARA2i.phase.boilingB

Information


                       This class models the boiling phenomenon and it inherits from the phaseChgB class.
The boiling process is modeled as a variable structure system with two states: boiling and not-boiling.
The transition conditions are the following:
  1. Old state: not-boiling. State transition condition: the liquid temperature reaches the boiling point (it depends on the vapor pressure and the liquid composition).
    Completion of this condition gives - New state: boiling.
  2. Old state: boiling. State transition condition: the phase-change mass-flow between the liquid CV and the gaseous CV is not greater than zero.
    The flow-sign is positive when it goes from the liquid CV to the gaseous CV.
    Completion of this condition gives - New state: not-boiling.
In order to avoid numeric problems, the model has been formulated applying the constraint relaxation technique.
Setting liquid temperature equal to the boiling temperature is equivalent to establishing that the phase-change mass-flow ''instantaneously'' reaches the appropriate value.
Instead of setting explicitly the constraint on the liquid temperature, the dynamic of the boiling mass-flow can be modeled so that it makes the system evolve ''fast enough'' to the temperature constraint fulfillment.
Arbitrarily, the flow has been defined in this model as proportional to the difference between the liquid temperature and the boiling one
.
This condition and the expressions for the phase-change flow composition permit calculating the phase change mass-flow of all the liquid mixture components.
The user has to assign a value to the parameter κb adequate to the experiment.
The relative error made can be estimated as:
.
This class has to be completed with expressions to compute the temperature at the boiling point(tempBoiling) and the composition (mass fraction of each component) of the vapor flowing from the liquid, due to the boiling (compVaporBoil).

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealmassEnthalpyLRef[nComp]zeros(nComp)Specific (per mass) enthalpy of the liquid components at the reference temperature [L2.t-2]
RealmolEnthalpyGRef[nComp]zeros(nComp)Specific (per mol) enthalpy of the gas components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for the enthalpy [T]
RealCpCoefML[nComp, 7] Liquid components: coefficients of the specific (per mass) heat capacity Cp unit: L2.t-2.T-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6
RealCpCoefNG[nComp, 7] Vapor components: coefficients of the specific (per mol) heat capacity at constant pressure. Cp unit: M.L2.t-2.T-1.mol-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6
RealmolecWeigth[nComp] Molecular weigth of the components [M.mol-1]
Realeps1E-8Small constant to avoid by-zero division
RealKprop [M.t-1.T-1]

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow - Connector R. Connector for the liquid flow.
cutGasRoutMolGas flow - Connector Resistive.

Modelica definition

model boilingB "Boiling model" 
  
   extends phaseChgB;
  
   parameter Real Kprop(  unit="M.t-1.T-1");
  
   Boolean boiling(    start = false, fixed=true) "True:  the liquid is boiling
                                                       False: the liquid is not boiling";
   Boolean noBoiling(  start = true, fixed=true) "True : the liquid is not boiling         
                                                       False: the liquid is boiling";
  
   Real tempBoiling(            unit="K") "Temperature of the boiling point";
   Real compVaporBoil[  nComp] "Composition (mass fraction of each component)
                                            of the vapor flowing from the liquid, due to the boiling";
  
   Real error(     unit="T") 
    "Difference between the liquid temperature and its boiling temperature";
  
equation 
   // Boiling condition
   boiling   = pre(noBoiling) and not inMass.tempL < tempBoiling or 
               pre(boiling)   and not ( totalMassF < - eps or not ( sum(inMass.massL[i] for i in 1:nComp) > eps));
  
   noBoiling = pre(boiling)   and ( totalMassF < - eps or not ( sum(inMass.massL[i] for i in 1:nComp) > eps)) or 
               pre(noBoiling) and not ( not inMass.tempL < tempBoiling);
  
   // Difference between the liquid temperature and its boiling temperature
   error = inMass.tempL - tempBoiling;
  
   // Mass flow due to the boiling
  
   0 = if boiling then totalMassF - Kprop * error else inMass.massLF[1];
  
   if nComp > 1 then
      for i in 1:(nComp-1) loop
         0 = if boiling then 
                  compVaporBoil[i] - inMass.massLF[i] / ( totalMassF + eps) else 
                  inMass.massLF[i+1];
      end for;
   end if;
  
   // Direction of the flow
   flowIsPosit = true;
  
  
end boilingB;

JARA2i.phase.condensB JARA2i.phase.condensB

Condensation model

JARA2i.phase.condensB

Information


                       This class models the condensation phenomenon and it inherits from the phaseChgB class.
The condensation process is modeled as a variable structure system with two states: condensation and not-condensation.
The transition conditions are the following:
  1. Old state: not-condensation. State transition condition: the liquid temperature reaches the condensation point (it depends on the vapor pressure and the liquid composition).
    Completion of this condition gives - New state: condensation.
  2. Old state: condensation. State transition condition: the phase-change mass-flow between the gaseous CV and the liquid CV is not greater than zero.
    The flow-sign is positive when it goes from the gaseous CV to the liquid CV .
    Completion of this condition gives - New state: not-condensation.
In order to avoid numeric problems, the model has been formulated applying the constraint relaxation technique.
Setting vapor temperature equal to the condensation temperature is equivalent to establishing that the phase-change mass-flow ''instantaneously'' reaches the appropriate value.
Instead of setting explicitly the constraint on the vapor temperature, the dynamic of the condensation mass-flow can be modeled so that it makes the system evolve ''fast enough'' to the temperature constraint fulfillment.
Arbitrarily, the flow has been defined in this model as proportional to the difference between the vapor temperature and the condensation one
.
This condition and the expressions for the phase-change flow composition permit calculating the phase change mass-flow of all the vapor mixture components.
The user has to assign a value to the parameter Kprop adequate to the experiment.
The relative error made can be estimated as:
.
This class has to be completed with expressions to compute the temperature at the condensation point(tempCondens) and the composition (mass fraction of each component) of the liquid flowing from the vapor, due to the condensation(compLiqCond).

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealmassEnthalpyLRef[nComp]zeros(nComp)Specific (per mass) enthalpy of the liquid components at the reference temperature [L2.t-2]
RealmolEnthalpyGRef[nComp]zeros(nComp)Specific (per mol) enthalpy of the gas components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for the enthalpy [T]
RealCpCoefML[nComp, 7] Liquid components: coefficients of the specific (per mass) heat capacity Cp unit: L2.t-2.T-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6
RealCpCoefNG[nComp, 7] Vapor components: coefficients of the specific (per mol) heat capacity at constant pressure. Cp unit: M.L2.t-2.T-1.mol-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6
RealmolecWeigth[nComp] Molecular weigth of the components [M.mol-1]
Realeps1E-8Small constant to avoid by-zero division
RealKprop [mol.t-1.T-1]

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow - Connector R. Connector for the liquid flow.
cutGasRoutMolGas flow - Connector Resistive.

Modelica definition

model condensB "Condensation model" 
  
   extends phaseChgB;
  
   parameter Real Kprop( unit="mol.t-1.T-1");
  
protected 
   Boolean condens(    start=false, fixed=true) "True:  the liquid is condensing
                                                     False: the liquid is not condensing";
   Boolean noCondens(  start=true, fixed=true) "True : the liquid is not condensing         
                                                     False: the liquid is condensing";
  
   Real tempCondens(            unit="T") "Temperature of the dew point";
   Real compLiqCond[  nComp] "Composition (mass fraction of each component)
                                            of the liquid flowing from the vapor, due to the condensation";
  
   Real error(    unit="T") 
    "Difference between the liquid temperature and its dew temperature";
  
equation 
   // Condensation
   condens   = pre(noCondens) and not outMol.tempG > tempCondens or 
               pre(condens)   and not ( totalMolF > eps or not ( sum(outMol.molG[i] for i in 1:nComp) > eps));
  
   noCondens = pre(condens)   and ( totalMolF > eps or not ( sum(outMol.molG[i] for i in 1:nComp) > eps)) or 
               pre(noCondens) and not ( not outMol.tempG > tempCondens);
  
   // Difference between the liquid temperature and its dew temperature
   error =  outMol.tempG - tempCondens;
  
   // Mass flow due to the condensation
   0 = if condens then totalMolF - Kprop * error else outMol.molGF[1];
  
   if nComp > 1 then
      for i in 1:(nComp-1) loop
         0 = if condens then 
                  compLiqCond[i] - outMol.molGF[i] / ( totalMolF + eps) else 
                  outMol.molGF[i+1];
      end for;
   end if;
  
   // Flow direction
   flowIsPosit = false;
  
  
end condensB;

JARA2i.phase.phaseChgB JARA2i.phase.phaseChgB

Partial model - Model describing a phase change

JARA2i.phase.phaseChgB

Information


                       This class inherits from interf.heteroFlow2I.
                       This class includes equations to describe the enthalpy flow associated to the phase change.
The stirred mixture approximation has been applied to the temperature of the flow between the two control volumes (CVs).
That is, the flow temperature is equal to the temperature of the fluid contained in the CV from which the fluid comes.
This class is the superclass of the classes modelling the condensation and boiling (i.e., condensB and boiling classes).

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
RealmassEnthalpyLRef[nComp]zeros(nComp)Specific (per mass) enthalpy of the liquid components at the reference temperature [L2.t-2]
RealmolEnthalpyGRef[nComp]zeros(nComp)Specific (per mol) enthalpy of the gas components at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for the enthalpy [T]
RealCpCoefML[nComp, 7] Liquid components: coefficients of the specific (per mass) heat capacity Cp unit: L2.t-2.T-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6
RealCpCoefNG[nComp, 7] Vapor components: coefficients of the specific (per mol) heat capacity at constant pressure. Cp unit: M.L2.t-2.T-1.mol-1 Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6
RealmolecWeigth[nComp] Molecular weigth of the components [M.mol-1]
Realeps1E-8Small constant to avoid by-zero division

Connectors

TypeNameDescription
cutLiquidRinMassLiquid flow - Connector R. Connector for the liquid flow.
cutGasRoutMolGas flow - Connector Resistive.

Modelica definition

partial model phaseChgB 
  "Partial model - Model describing a phase change" 
  
   extends JARA2i.interf.heteroFlow2I;
  
   parameter Real massEnthalpyLRef[nComp]( unit="L2.t-2") =         zeros(nComp) 
    "Specific (per mass) enthalpy of the liquid components at the reference temperature";
   parameter Real molEnthalpyGRef[nComp](  unit="M.L2.t-2.mol-1") = zeros(nComp) 
    "Specific (per mol) enthalpy of the gas components at the reference temperature";
   parameter Real tempRef(                 unit="T") = 298 
    "Reference temperature for the enthalpy";
  
   parameter Real CpCoefML[nComp,7] "Liquid components: coefficients of the specific (per mass) heat capacity 
                                      Cp unit: L2.t-2.T-1                   
                                      Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6";
   parameter Real CpCoefNG[nComp,7] "Vapor components: coefficients of the specific (per mol) heat capacity 
                                      at constant pressure. Cp unit: M.L2.t-2.T-1.mol-1 
                                      Cp[i] = CpCoef[i,1] + CpCoef[i,2]*T + ... + CpCoef[i,7]*T**6";
  
   parameter Real molecWeigth[nComp](  unit="M.mol-1") 
    "Molecular weigth of the components";
  
   parameter Real eps = 1E-8 "Small constant to avoid by-zero division";
  
   Real totalMassF(            unit="M.t-1") 
    "Total mass-flow due to the phase change";
   Real totalMolF(             unit="mol.t-1") 
    "Total molar-flow due to the phase change";
   Real tempF(                 unit="T") 
    "Temperature of the flow between the phases";
   Real massHeatPhaseChg(      unit="L2.t-2") 
    "Change-of-phase heat per mass unit";
   Real massEnthalpyL[ nComp]( unit="L2.t-2") 
    "Specific (per mass) enthalpy of the liquid components";
   Real molEnthalpyL[ nComp](  unit="M.L2.t-2.mol-1") 
    "Molar enthalpy of the liquid components";
   Real molEnthalpyG[ nComp](  unit="M.L2.t-2.mol-1") 
    "Molar enthalpy of the vapor components";
   Real massEnthalpyG[ nComp]( unit="L2.t-2") 
    "Specific (per mass) enthalpy of the vapor components";
  
   Boolean flowIsPosit "True:  flow from liquid to vapor phase
                             False: flow from vapor to liquid phase";
  
equation 
   // Total mass flow due to the phase change. Positive: flow from liquid to vapor phase.
   totalMassF = sum(inMass.massLF[i] for i in 1:nComp);
   totalMolF  = -sum(outMol.molGF[i] for i in 1:nComp);
   for i in 1:nComp loop
      molecWeigth[i] * outMol.molGF[i] + inMass.massLF[i] = 0;
   end for;
  
   // Relationship between the molar enthalpy and the specific (per mass) enthalpy
   for i in 1:nComp loop
      molecWeigth[i] * molEnthalpyG[i] = massEnthalpyG[i];
      molecWeigth[i] * molEnthalpyL[i] = massEnthalpyL[i];
   end for;
  
   // Temperature of the change-of-phase flow
   tempF = if flowIsPosit then inMass.tempL else outMol.tempG;
  
   // Enthalpy flow associated to the change-of-phase mass flow. Positive: flow from liquid to vapor 
   inMass.energyLF = if flowIsPosit then 
                          -sum(outMol.molGF[i]  * molEnthalpyG[i] for i in 1:nComp) else 
                           sum(inMass.massLF[i] * massEnthalpyL[i] for i in 1:nComp);
   outMol.energyGF + inMass.energyLF = 0;
  
   // Specific (per mass) enthalpy of the liquid components
   for i in 1:nComp loop
      massEnthalpyL[i] = massEnthalpyLRef[i] +
                         CpCoefML[i,1] *       ( tempF    - tempRef)     +
                         CpCoefML[i,2] * 1/2 * ( tempF^ 2 - tempRef^ 2)  +
                         CpCoefML[i,3] * 1/3 * ( tempF^ 3 - tempRef^ 3)  +
                         CpCoefML[i,4] * 1/4 * ( tempF^ 4 - tempRef^ 4)  +
                         CpCoefML[i,5] * 1/5 * ( tempF^ 5 - tempRef^ 5)  +
                         CpCoefML[i,6] * 1/6 * ( tempF^ 6 - tempRef^ 6)  +
                         CpCoefML[i,7] * 1/7 * ( tempF^ 7 - tempRef^ 7);
   end for;
  
   // Molar enthalpy of the liquid components
   for i in 1:nComp loop
      molEnthalpyG[i]   = molEnthalpyGRef[i] +
                          CpCoefNG[i,1] *       ( tempF    - tempRef)     +
                          CpCoefNG[i,2] * 1/2 * ( tempF^ 2 - tempRef^ 2)  +
                          CpCoefNG[i,3] * 1/3 * ( tempF^ 3 - tempRef^ 3)  +
                          CpCoefNG[i,4] * 1/4 * ( tempF^ 4 - tempRef^ 4)  +
                          CpCoefNG[i,5] * 1/5 * ( tempF^ 5 - tempRef^ 5)  +
                          CpCoefNG[i,6] * 1/6 * ( tempF^ 6 - tempRef^ 6)  +
                          CpCoefNG[i,7] * 1/7 * ( tempF^ 7 - tempRef^ 7);
    end for;
  
   // Change-of-phase heat per mass unit 
   // Positive: boiling of a mass unit of liquid mixture
   // Negative: condensation of a mass unit of the vapor mixture  
   massHeatPhaseChg =  ( -sum(outMol.molGF[i] * molEnthalpyG[i] for i in 1:nComp) -
                         sum(inMass.massLF[i] * massEnthalpyL[i] for i in 1:nComp))  / ( totalMassF + eps);
  
  
end phaseChgB;

JARA2i.phase.vapPressB JARA2i.phase.vapPressB

Boundary condition for the partial pressure of one of the component of a gas mixture

JARA2i.phase.vapPressB

Information


                      This class imposes the following boundary condition on the control volume (CV) to which it is connected: 
the partial pressure of the evapComp component of the gas mixture contained in the CV has a determined value, independently of the gas flow between the CV and its enviroment.
In order to model this condition, it has been assumed that the molar flow of the evapComp component is proportional to the actual value of the component pressure and its setpoint value.
The user has to provide the value of the two following signals: the temperature setpoint for the evapComp component flowing into the CV (setPointSignal[2])
and the vapor-pressure setpoint for the evapComp component (setPointSignal[1].
Additionally, the user has to specify the number of the component whose vapor pressure is set (evapComp parameter).
It has been applied the stirred mixture approximation.

Parameters

TypeNameDefaultDescription
IntegerevapComp Number of the component whose vapor pressure is set
IntegernComp1Number of components
RealmolEnthalpyRef0Molar enthalpy of the component at the reference temperature [M.L2.t-2.mol-1]
RealtempRef298Reference temperature for the enthalpy [T]
RealCpCoefN[1, 7] Coefficients of the molar heat capacity at constant pressure, of the evapComp component Cp = CpCoefN(1,1) + CpCoefN(1,2)*T + ...
RealKprop1E4Coefficient relating the molar flow of the evapComp component and the pressure difference [mol.L.t.M-1]
Realeps1E-4Small constant to avoid by-zero division

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive
cutReceiversetPointSignalSetpoint signals [vaporPressSP, tempEvapSP]

Modelica definition

model vapPressB 
  "Boundary condition for the partial pressure of one of the component of a gas mixture" 
  
   parameter Integer evapComp 
    "Number of the component whose vapor pressure is set";
  
   extends JARA2i.interf.gasFlow1I;
  
   cutsB.cutReceiver setPointSignal(  dim=2, signal={vaporPressSP,tempEvapSP}) 
    "Setpoint signals [vaporPressSP, tempEvapSP]";
  
   Real vaporPressSP(   unit="M.L-1.t-2") 
    "Vapor-pressure setpoint for the evapComp component";
   Real tempEvapSP(     unit="T") 
    "Temperature of the component flowing into the control volume";
  
   parameter Real molEnthalpyRef(  unit="M.L2.t-2.mol-1") = 0 
    "Molar enthalpy of the component at the reference temperature";
   parameter Real tempRef(   unit="T") = 298 
    "Reference temperature for the enthalpy";
   parameter Real CpCoefN[ 1,7] "Coefficients of the molar heat capacity at constant pressure,
                                               of the evapComp component 
                                               Cp = CpCoefN(1,1) + CpCoefN(1,2)*T + ...";
  
   parameter Real Kprop(  unit="mol.L.t.M-1") = 1E4 
    "Coefficient relating the molar flow of the evapComp component and the pressure difference";
   parameter Real eps =     1E-4 "Small constant to avoid by-zero division";
  
protected 
   Real pressErr(      unit="M.L-1.t-2") 
    "Difference between the parcial-pressure setpoint and its actual value";
   Real vaporPress(    unit="M.L-1.t-2") 
    "Partial pressure of the evapComp component";
   Real aux[nComp+2] "Dummy variables";
   Real dummy1 "Dummy variable";
   Real dummy2 "Dummy variable";
  
   Real molEnthalpy( unit="M.L2.t-2.mol-1") 
    "Molar enthalpy of the evapComp component";
   Real tempF(       unit="T") "Temperature of the evapComp-component flow";
  
   Boolean flowIsPosit "Direction of the evapComp-component flow";
  
equation 
   // Vapor pressure of the evapComp component
   vaporPress = inMol.pressG  * inMol.molG[evapComp] / ( sum(inMol.molG[i] for i in 1:nComp) + eps);
  
   // Difference between the vapor-pressure setpoint and its actual value
   pressErr = vaporPressSP + eps - vaporPress;
  
   // Flow of the evapComp component
   inMol.molGF[evapComp] = - Kprop * pressErr;
  
   // The flow of all the other components is zero
   aux = { dummy1, inMol.molGF, dummy2};
   aux[1:evapComp] = 0;
   aux[(evapComp+2):(nComp+2)] = 0;
  
   // Molar enthalpy of the evapComp component
   for i in 1:nComp loop
      molEnthalpy[i] = molEnthalpyRef[i] +
                       sum( CpCoefN[i,j] * 1/j * ( tempF^ j - tempRef^ j)  for j in 1:7);
   end for;
  
   // Enthalpy flow
   inMol.energyGF = inMol.molGF[evapComp] * molEnthalpy;
  
   // Flow temperture
   flowIsPosit = inMol.molGF[evapComp] / ( abs(  inMol.molGF[evapComp])  + eps);
   tempF = 0.5 * ( 1 + flowIsPosit)  * inMol.tempG - 0.5 * ( flowIsPosit -1)  * tempEvapSP;
  
  
end vapPressB;

HTML-documentation generated by Dymola Tue Jul 24 19:08:19 2007.