JARA2i.chReac

Chemical reactions

Information


 

Chemical reactions



This package contains classes modeling chemical reactions.





Figure 1.Classes included in chReac.mo.



Package Content

NameDescription
JARA2i.chReac.chReacGasB chReacGasB Partial model - Chemical reaction in gas phase: all products and reactives are gases.
JARA2i.chReac.chReacLiqB chReacLiqB Partial model - Chemical reaction in liquid phase: all products and reactives are liquids.


JARA2i.chReac.chReacGasB JARA2i.chReac.chReacGasB

Partial model - Chemical reaction in gas phase: all products and reactives are gases.

JARA2i.chReac.chReacGasB

Information


                        Chemical reaction in gas phase: all products and reactives are gases.
This partial model has to be completed with an expression for the calculation of the reaction velocity (reactionRate[:]).

Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
IntegernumChR1Number of chemical reactions
RealstoichCoef[numChR, nComp] Stoichometric coefficients of the chemical reactions. Sign criterium: Reactives are negative. Products are positive.
Realeps1E-8Small parameter to avoid by-zero division
RealperfGasConst Constant of the perfect gases [M*L**2*t**-2*T**-1]

Connectors

TypeNameDescription
cutGasRinMolGas flow - Connector Resistive

Modelica definition

partial model chReacGasB 
  "Partial model - Chemical reaction in gas phase: all products and reactives are gases." 
  
   extends interf.gasFlow1I;
  
   parameter Integer numChR = 1 "Number of chemical reactions";
  
   parameter Real stoichCoef[numChR,nComp] "Stoichometric coefficients of the chemical reactions.     
                                             Sign criterium: Reactives are negative.
                                             Products  are positive.";
   parameter Real eps = 1E-8 "Small parameter to avoid by-zero division";
  
   parameter Real perfGasConst(  unit="M*L**2*t**-2*T**-1") 
    "Constant of the perfect gases";
  
protected 
   Real reactionRate[ numChR](  unit="mol.L-3.t-1") 
    "Velocity of the chemical reactions";
   Real gasV(                   unit="L3") "Gas volume";
  
equation 
   // State equation of the perfect gases
   ( inMol.pressG + eps)  * gasV = sum(inMol.molG[i] for i in 1:nComp) * perfGasConst * inMol.tempG;
   // Interactive parameters for Ejs
  
   // Change in the component mass due to the chemical reaction
   for i in 1:nComp loop
      for j in 1:numChR loop
         inMol.molGF[i] = - gasV * stoichCoef[j,i] * reactionRate[j];
      end for;
   end for;
  
   // Flow of energy
   inMol.energyGF = 0;
  
  
end chReacGasB;

JARA2i.chReac.chReacLiqB JARA2i.chReac.chReacLiqB

Partial model - Chemical reaction in liquid phase: all products and reactives are liquids.

JARA2i.chReac.chReacLiqB

Information


                        Chemical reaction in liquid phase: all products and reactives are liquids.
This partial model has to be completed with expression for the calculation of the reaction velocity (reactionRate[:]).

Table 1. Interactive variables.
stoichCoefInitial[numChR,nComp] Stoichometric coefficients of the chemical reactions. Sign criterium: Reactives are negative. Products are positive.
density[nComp] Density of the pure components.
molecWeigth[nComp] Molecular weight of the components.



Parameters

TypeNameDefaultDescription
IntegernComp1Number of components
BooleanEjsfalseGlobal parameter - Runtime interactivity
BooleanSysquakefalseGlobal parameter - Batch interactivity
IntegernumChR1Number of chemical reactions
RealstoichCoefInitial[numChR, nComp] Stoichometric coefficients of the chemical reactions. Sign criterium: Reactives are negative. Products are positive.
RealdensityInitial[nComp] Density of the pure components [M.L-3]
RealmolecWeightInitial[nComp] Molecular weigth of the components [M.mol-1]

Connectors

TypeNameDescription
cutLiquidRinMassConnector for the liquid flow

Modelica definition

partial model chReacLiqB 
  "Partial model - Chemical reaction in liquid phase: all products and reactives are liquids." 
  
   extends interf.liqFlow1I;
  
   outer parameter Boolean Ejs = false 
    "Global parameter - Runtime interactivity";
   outer parameter Boolean Sysquake = false 
    "Global parameter - Batch interactivity";
  
   parameter Integer numChR = 1 "Number of chemical reactions";
  
   parameter Real stoichCoefInitial[numChR,nComp] "Stoichometric coefficients of the chemical reactions.     
                                                    Sign criterium: Reactives are negative.
                                                                    Products  are positive.";
   parameter Real densityInitial[nComp](     unit="M.L-3") 
    "Density of the pure components";
   parameter Real molecWeightInitial[nComp]( unit="M.mol-1") 
    "Molecular weigth of the components";
  
   Real stoichCoef[numChR,nComp](     unit="", start=stoichCoefInitial) "Stoichometric coefficients of the chemical reactions.     
                                       Sign criterium: Reactives are negative. Products  are positive.";
   Real density[nComp](               unit="M.L-3", start=densityInitial) 
    "Density of the pure components";
   Real molecWeight[nComp](           unit="M.mol-1", start=molecWeightInitial) 
    "Molecular weigth of the components";
  
   Real reactionRate[ numChR]( unit="mol.L-3.t-1") "Velocity of the reactions";
  
   Real fluidV(                 unit="L3") "Liquid volume";
   Real molF[  nComp](          unit="mol.t-1") 
    "Molar flow due to the reactions";
   Real parcFluidV[  nComp](    unit="L3") "Volume of each component";
  
equation 
   // Interactive parameters for Ejs
   if Ejs then
      for i in 1:numChR loop
         for j in 1:nComp loop
            der(stoichCoef[i,j]) = 0;
         end for;
      end for;
    
      for i in 1:nComp loop
         der(density[i]) = 0;
         der(molecWeight[i]) = 0;
      end for;
   end if;
  
   // Sysquake
   if Sysquake then
      stoichCoef   = stoichCoefInitial;
      density      = densityInitial;
      molecWeight  = molecWeightInitial;
   end if;
  
   // Volume of each liquid component and total volume
   for i in 1:nComp loop
      parcFluidV[i] * density[i] = inMass.massL[i];
   end for;
  
   fluidV = sum(parcFluidV[i] for i in 1:nComp);
  
   // Mass change due to the reactions
   for i in 1:nComp loop
      inMass.massLF[i] = molecWeight[i] * molF[i];
   end for;
  
   for i in 1:nComp loop
      for j in 1:numChR loop
         molF[i]  = - fluidV * stoichCoef[j,i] * reactionRate[j];
      end for;
   end for;
  
   // Flow of energy
   inMass.energyLF = 0;
  
  
end chReacLiqB;

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