Skip to content

Commit

Permalink
Merge pull request #31 from MarekMatejak/ClimateChange
Browse files Browse the repository at this point in the history
RC 1.3.0
  • Loading branch information
MarekMatejak authored Nov 24, 2020
2 parents 662909b + 4a98b5f commit b8bbc79
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 28 deletions.
54 changes: 37 additions & 17 deletions Chemical/Examples.mo
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,24 @@ extends Modelica.Icons.ExamplesPackage;
annotation (preferredView = "info");
end Water_gas;

record Water_liquid "H2O(l)"
record Water_liquid_without_selfClustering "H2O(l) without self-clustering"
extends Chemical.Interfaces.Incompressible.SubstanceData(
MolarWeight=0.018015,
DfH=-285840,
DfG=-237190,
Cp=75.3,
References={
"http://www.vias.org/genchem/standard_enthalpies_table.html"});

annotation (preferredView = "info", Documentation(info="<html>
<p><br><span style=\"font-family: Courier New;\">&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
</html>"));
end Water_liquid_without_selfClustering;
// Cv=74.539,

// Enthalpy as in H2O(l) = with assumption that hydrogen bonds do not have significant enthaplies

record Water_liquid "H2O(l) with self-clustering"
extends Chemical.Interfaces.Incompressible.SubstanceData(
MolarWeight=0.018015,
DfH=-285830,
Expand All @@ -213,9 +230,6 @@ extends Modelica.Icons.ExamplesPackage;
<p><span style=\"font-family: Courier New;\">&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
</html>"));
end Water_liquid;
// Cv=74.539,

// Enthalpy as in H2O(l) = with assumption that hydrogen bonds do not have significant enthaplies

record Water_IceIh "H2O(s) - Ice I h"
extends Chemical.Interfaces.Incompressible.SubstanceData(
Expand Down Expand Up @@ -1285,8 +1299,8 @@ extends Modelica.Icons.ExamplesPackage;
annotation (Placement(transformation(extent={{-46,6},{46,96}})));
/*volume_start(
displayUnit="l") = 0.001, */
Components.Substance H2O_gaseuous(redeclare package stateOfMatter =
Interfaces.IdealGas, substanceData=Chemical.Examples.Substances.Water_gas(),
Components.Substance H2O_gaseuous(redeclare package stateOfMatter
= Interfaces.IdealGas, substanceData=Chemical.Examples.Substances.Water_gas(),
mass_start=0.000106537)
annotation (Placement(transformation(extent={{28,50},{8,70}})));
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature
Expand Down Expand Up @@ -2172,15 +2186,16 @@ extends Modelica.Icons.ExamplesPackage;
annotation (Placement(transformation(extent={{-26,-80},{2,20}})));

Chemical.Components.Substance Pb(substanceData=Substances.Lead_solid(),
use_mass_start=false, amountOfSubstance_start=1)
use_mass_start=false,
amountOfSubstance_start=50)
annotation (Placement(transformation(extent={{50,-66},{30,-46}})));
Chemical.Components.Substance HSO4(substanceData=
Substances.HydrogenSulfate_aqueous(), use_mass_start=false, amountOfSubstance_start=1)
annotation (Placement(transformation(extent={{-2,-70},{-22,-50}})));
Chemical.Components.Substance PbSO4_(substanceData=
Substances.LeadSulfate_solid(), use_mass_start=false,
amountOfSubstance_start=0.001)
annotation (Placement(transformation(extent={{50,-32},{30,-12}})));
amountOfSubstance_start(displayUnit="mol") = 1e-03)
annotation (Placement(transformation(extent={{52,-30},{32,-10}})));
Chemical.Components.Substance H(substanceData=Substances.Proton_aqueous(),
use_mass_start=false, amountOfSubstance_start=1)
annotation (Placement(transformation(extent={{-2,-42},{-22,-22}})));
Expand All @@ -2207,11 +2222,12 @@ extends Modelica.Icons.ExamplesPackage;
Chemical.Components.ElectronTransfer electrone1
annotation (Placement(transformation(extent={{-72,-38},{-52,-18}})));
Chemical.Components.Substance PbO2(substanceData=
Substances.LeadDioxide_solid(), use_mass_start=false, amountOfSubstance_start=1)
Substances.LeadDioxide_solid(), use_mass_start=false,
amountOfSubstance_start=50)
annotation (Placement(transformation(extent={{-10,-10},{10,10}}, origin={
-60,-58})));
Components.Substance H2O(substanceData=Substances.Water_liquid(),
mass_start=0.2)
mass_start(displayUnit="g") = 0.114)
annotation (Placement(transformation(extent={{-2,-8},{-22,12}})));
Chemical.Components.Substance PbSO4(substanceData=
Substances.LeadSulfate_solid(), use_mass_start=false,
Expand All @@ -2227,6 +2243,8 @@ extends Modelica.Icons.ExamplesPackage;
annotation (Placement(transformation(extent={{-56,40},{-36,60}})));

Real density, molality, totalmolality, voltage;
inner Modelica.Fluid.System system(T_ambient=299.15)
annotation (Placement(transformation(extent={{62,64},{82,84}})));
equation
density = solution1.solution.m/solution1.solution.V;
totalmolality = solution1.solution.n/((H2O.x*solution1.solution.n)*H2O.substanceData.MolarWeight);
Expand All @@ -2242,7 +2260,7 @@ extends Modelica.Icons.ExamplesPackage;
color={158,66,200},
thickness=0.5));
connect(PbSO4_.port_a, electrodeReaction1.products[1]) annotation (Line(
points={{30,-22},{26,-22},{26,-2},{16,-2},{16,-6},{11.3333,-6}},
points={{32,-20},{26,-20},{26,-2},{16,-2},{16,-6},{11.3333,-6}},
color={158,66,200},
thickness=0.5));
connect(HSO4.solution, solution1.solution) annotation (Line(
Expand Down Expand Up @@ -2290,7 +2308,7 @@ extends Modelica.Icons.ExamplesPackage;
points={{46,-66},{46,-74.92},{51.2,-74.92}},
color={127,127,0}));
connect(PbSO4_.solution, anode.solution) annotation (Line(
points={{46,-32},{46,-74.92},{51.2,-74.92}},
points={{48,-30},{48,-74.92},{51.2,-74.92}},
color={127,127,0}));
connect(PbO2.solution, cathode.solution) annotation (Line(
points={{-66,-68},{-66,-70},{-60,-70},{-60,-76.92},{-52.8,-76.92}},
Expand Down Expand Up @@ -2324,8 +2342,10 @@ extends Modelica.Icons.ExamplesPackage;
-76.92}},
color={127,127,0}));

connect(electrone.solution, PbSO4_.solution)
annotation (Line(points={{46,2},{46,-30},{48,-30}}, color={127,127,0}));
annotation (
experiment(StopTime=50500, __Dymola_Algorithm="Dassl"),
experiment(StopTime=50000, __Dymola_Algorithm="Dassl"),
Documentation(revisions=
"<html>
<p><i>2015-2018</i></p>
Expand Down Expand Up @@ -6800,8 +6820,8 @@ extends Modelica.Icons.ExamplesPackage;
Modelica.Fluid.Sensors.TraceSubstancesTwoPort etchanolFlow(substanceName="C2H5OH",
redeclare package Medium = Medium)
annotation (Placement(transformation(extent={{18,48},{38,68}})));
Modelica.Fluid.Sensors.MassFlowRate massFlowRate(redeclare package Medium =
Medium)
Modelica.Fluid.Sensors.MassFlowRate massFlowRate(redeclare package Medium
= Medium)
annotation (Placement(transformation(extent={{48,48},{68,68}})));
equation
connect(fluidConversion1.solution, simpleSolution1.solution) annotation (
Expand Down Expand Up @@ -6938,7 +6958,7 @@ extends Modelica.Icons.ExamplesPackage;
<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\">
<tr>
<td>[Nelabhotla2019]</td>
<td>Anirudh Bhanu Teja Nelabhotla, Rune Bakke, Carlos Dinamarca,
<td>Anirudh Bhanu Teja Nelabhotla, Rune Bakke, Carlos Dinamarca,
\"Performance Analysis of Biocathode in Bioelectrochemical CO2 Reduction\"
Catalysts, 9, 683, 2019,
<a href=\"https://doi.org/10.3390/catal9080683\">doi:10.3390/catal9080683</a>.
Expand Down
Binary file modified Chemical/Resources/Documentation/Chemical.docx
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ convertModifiers("Physiolibrary.Molar.FlowConcentrationMeasure", fill("",0) , {"

convertModifiers("Chemical.Components.Substance",{"amountOfSubstance_start"},{"use_mass_start=false", "amountOfSunstance_start=%amountOfSubstance_start%"}, true);
convertModifiers("Chemical.Components.Substance",{"substanceData"},{"substanceData=%substanceData%()"}, true);

18 changes: 9 additions & 9 deletions Chemical/package.mo
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,9 @@ package Chemical "Physical Chemistry (version 1.3.0)"
end if;

// 0 = substrates.q * actualStream(substrates.h_outflow) + products.q * actualStream(products.h_outflow);
/* 0 = sum(substrates[j].q*(if
/* 0 = sum(substrates[j].q*(if
(substrates[j].q > 0) then h_mix else inStream(substrates[j].h_outflow)) for j in 1:nS)
+sum(products[k].q * (if
+sum(products[k].q * (if
(products[k].q > 0) then h_mix else inStream(products[k].h_outflow)) for k in 1:nP);
*/
annotation (
Expand Down Expand Up @@ -893,8 +893,8 @@ package Chemical "Physical Chemistry (version 1.3.0)"
"Mole fraction of the macromolecule (all form of in the conformation)";

public
Interfaces.SolutionPort subunitSolution(redeclare package stateOfMatter =
stateOfMatter) "The port to connect all subunits"
Interfaces.SolutionPort subunitSolution(redeclare package stateOfMatter
= stateOfMatter) "The port to connect all subunits"
annotation (Placement(transformation(extent={{-70,92},{-50,112}}),
iconTransformation(extent={{30,50},{50,70}})));
Interfaces.SubstancePort_a port_a annotation (Placement(transformation(
Expand Down Expand Up @@ -1214,7 +1214,7 @@ package Chemical "Physical Chemistry (version 1.3.0)"
annotation(Dialog(group = "Initialization"));

Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b fluidPorts[nFluidPorts](redeclare
each package Medium = Medium)
each package Medium = Medium)
"Fluid inlets and outlets"
annotation (Placement(transformation(extent={{-40,-10},{40,10}},
origin={100,0},
Expand Down Expand Up @@ -3732,8 +3732,8 @@ of the modeller. Increase nFuildPorts to add an additional fluidPort.
// They hack the Kirchhof's flow equation to be counted as the sum from all connected substances in the solution.

//amount of substances
Modelica.SIunits.AmountOfSubstance n "Amount of the solution";
flow Modelica.SIunits.AmountOfSubstance nj
Modelica.SIunits.AmountOfSubstance n(max=Modelica.Constants.inf) "Amount of the solution";
flow Modelica.SIunits.AmountOfSubstance nj(max=Modelica.Constants.inf)
"Amount of the substance (fictive flow to calculate total extensive property in solution as sum from all substances)";

//mass of substances
Expand Down Expand Up @@ -4340,8 +4340,8 @@ of the modeller. Increase nFuildPorts to add an additional fluidPort.
preferredView="info",
version="1.3.0",
versionBuild=1,
versionDate="2020-11-19",
dateModified = "2020-11-19 15:14:41Z",
versionDate="2020-11-24",
dateModified = "2020-11-24 14:14:41Z",
conversion(
from(version="1.1.0", script="modelica://Chemical/Resources/Scripts/Dymola/ConvertChemical_from_1.1_to_1.2.mos"),
from(version="1.0.0", script="modelica://Chemical/Resources/Scripts/Dymola/ConvertChemical_from_1.0_to_1.2.mos")),
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ Modelica Library of Chemical processes

## Current release

Download [Chemical 1.2.0 (2020-11-19)](../../archive/v1.2.0.zip)

Download [Chemical 1.3.0 (2020-11-24)](../../archive/v1.3.0.zip)


## Main references
* Documentations
Expand Down

0 comments on commit b8bbc79

Please sign in to comment.