This package contains classes modeling chemical reactions.
Name | Description |
---|---|
![]() | Partial model - Chemical reaction in gas phase: all products and reactives are gases. |
![]() | Partial model - Chemical reaction in liquid phase: all products and reactives are liquids. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Integer | numChR | 1 | Number of chemical reactions |
Real | stoichCoef[numChR, nComp] | Stoichometric coefficients of the chemical reactions. Sign criterium: Reactives are negative. Products are positive. | |
Real | eps | 1E-8 | Small parameter to avoid by-zero division |
Real | perfGasConst | Constant of the perfect gases [M*L**2*t**-2*T**-1] |
Type | Name | Description |
---|---|---|
cutGasR | inMol | Gas flow - Connector Resistive |
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;
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. |
Type | Name | Default | Description |
---|---|---|---|
Integer | nComp | 1 | Number of components |
Boolean | Ejs | false | Global parameter - Runtime interactivity |
Boolean | Sysquake | false | Global parameter - Batch interactivity |
Integer | numChR | 1 | Number of chemical reactions |
Real | stoichCoefInitial[numChR, nComp] | Stoichometric coefficients of the chemical reactions. Sign criterium: Reactives are negative. Products are positive. | |
Real | densityInitial[nComp] | Density of the pure components [M.L-3] | |
Real | molecWeightInitial[nComp] | Molecular weigth of the components [M.mol-1] |
Type | Name | Description |
---|---|---|
cutLiquidR | inMass | Connector for the liquid flow |
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;