Git Product home page Git Product logo

thermodynamics's Introduction

Estimation of activity coefficients for aqueous organic redox-flow batteries: Theoretical basis and equations

Generating the paper pre-print using LaTeX

The pre-print of the paper can be generated by executing the "main.tex" file in the "final_version_LaTeX" folder.

In the folder "Sections", the code used to generate the figures can be accessed, and will look something like this:

\begin{figure}[!hbtp]
    \begin{subfigure}[hb]{0.49\textwidth}
        \resizebox{\linewidth}{!}{\begin{tikzpicture}
            \pgfplotsset{
                scale only axis,
            }
            %axis options:
            \begin{axis}[
              xlabel=b (mol/kg),
              ylabel= $\phi_{NaCl} $,
              legend pos=north west,
              xmin = 0,
              xmax = 5,
              cycle list name=temperaturelist
            ]
              \addplot+[only marks] table[y index =1]{\PhiNaClExp};
              \addplot+[only marks]  table[y index =2]{\PhiNaClExp};
              \addplot+[only marks] table[y index =3]{\PhiNaClExp};
              \addplot+[only marks] table[y index =4]{\PhiNaClExp};
              \addplot+[only marks] table[y index =5]{\PhiNaClExp};
              \addplot+[only marks] table[y index =6]{\PhiNaClExp};
              \addplot+[t1, no markers]  table[y index =1]{\PhiNaClCalc};
              \addplot+[t2, no markers] table[y index =2]{\PhiNaClCalc};
              \addplot+[t3, no markers] table[y index =3]{\PhiNaClCalc};
               \addplot+[t4, no markers] table[y index =4]{\PhiNaClCalc};
               \addplot+[t5, no markers] table[y index =5]{\PhiNaClCalc};
               \addplot+[t6, no markers] table[y index =6]{\PhiNaClCalc};
            \end{axis}
          \end{tikzpicture}
        }
        \caption{}
    \end{subfigure}
    \hfill
    %crop 1
    \begin{subfigure}[hb]{0.49\textwidth}
        \resizebox{\linewidth}{!}{\begin{tikzpicture}
            \pgfplotsset{
                scale only axis,
            }
            %axis options:
            \begin{axis}[
              xlabel=b (mol/kg),
              ylabel= $\gamma_s $,
              legend pos=north west,
              xmin = 0,
              xmax = 5,
              ymax = 1.01,
              cycle list name=temperaturelist
            ]
            \addplot+[only marks] table[y index =1]{\GammaNaClExp};
            \addplot+[only marks]  table[y index =2]{\GammaNaClExp};
            \addplot+[only marks] table[y index =3]{\GammaNaClExp};
            \addplot+[only marks] table[y index =4]{\GammaNaClExp};
            \addplot+[only marks] table[y index =5]{\GammaNaClExp};
            \addplot+[only marks] table[y index =6]{\GammaNaClExp};
            \addplot+[t1, no markers]  table[y index =1]{\GammaNaClCalc};
            \addplot+[t2, no markers] table[y index =2]{\GammaNaClCalc};
            \addplot+[t3, no markers] table[y index =3]{\GammaNaClCalc};
             \addplot+[t4, no markers] table[y index =4]{\GammaNaClCalc};
             \addplot+[t5, no markers] table[y index =5]{\GammaNaClCalc};
             \addplot+[t6, no markers] table[y index =6]{\GammaNaClCalc};
            \end{axis}
          \end{tikzpicture}
        }
        \caption{ }
    \end{subfigure}
    \vspace*{0.5cm}
    \newline
    \begin{subfigure}[hb]{\textwidth}
        \centering
        \resizebox{\linewidth}{!}{
            \begin{tikzpicture} 
            \begin{axis}[%
            hide axis,
            xmin=10,
            xmax=50,
            ymin=0,
            ymax=0.4,
            legend style={draw=white!15!black,
            cells={align=center},
            legend columns=7}
            ]

            \addlegendimage{only marks}
            \addlegendentry{literature values};


            \addlegendimage{t1,only marks, mark=triangle*}
            \addlegendentry{0°C \\ \cite{clarkeEvaluationThermodynamicFunctions1985} \cite{partanenTraceableValuesActivity2020} \cite{gibbardLiquidvaporEquilibriumAqueous1974}};


            \addlegendimage{t2, only marks, mark=diamond*}
            \addlegendentry{10°C\\ \cite{clarkeEvaluationThermodynamicFunctions1985} \cite{partanenTraceableValuesActivity2020}};
            
            \addlegendimage{t3, only marks, mark=otimes}
            \addlegendentry{15°C\\ \cite{clarkeEvaluationThermodynamicFunctions1985} \cite{partanenTraceableValuesActivity2020}};

            \addlegendimage{t4, only marks, mark=star}
            \addlegendentry{25°C\\ \cite{clarkeEvaluationThermodynamicFunctions1985} \cite{partanenTraceableValuesActivity2020} \cite{gibbardLiquidvaporEquilibriumAqueous1974}};

            \addlegendimage{t5, only marks, mark=diamond}
            \addlegendentry{40°C\\ \cite{clarkeEvaluationThermodynamicFunctions1985} \cite{partanenTraceableValuesActivity2020}};

            \addlegendimage{t6, only marks, mark=triangle}
            \addlegendentry{60°C\\ \cite{clarkeEvaluationThermodynamicFunctions1985} \cite{partanenTraceableValuesActivity2020}};

            \addlegendimage{}
            \addlegendentry{calculated values};

            \addlegendimage{t1, no markers}
            \addlegendentry{0°C};

            \addlegendimage{t2, no markers}
            \addlegendentry{10°C};

            \addlegendimage{t3, no markers}
            \addlegendentry{15°C};

            \addlegendimage{t4, no markers}
            \addlegendentry{25°C};

            \addlegendimage{t5, no markers}
            \addlegendentry{40°C};

            \addlegendimage{t6, no markers}
            \addlegendentry{60°C};

            \end{axis}
        \end{tikzpicture}
        }
    \end{subfigure}
    \caption{Reference literature values and calculated values for (a) the osmotic coefficient and (b) the activity coefficient of NaCl(aq) as a function of molality and temperature}
    \label{NaClresults}
\end{figure}

The input data, e.g. \GammaNaClCalc, is generated in the "Header.tex" file using the \pgfplotstableread command:

\pgfplotstableread[col sep=comma]{Data/gammaNaClExp.csv}{\GammaNaClExp}
\pgfplotstableread[col sep=comma]{Data/gammaNaClCalc.csv}{\GammaNaClCalc}
\pgfplotstableread[col sep=comma]{Data/phiNaClExp.csv}{\PhiNaClExp}
\pgfplotstableread[col sep=comma]{Data/phiNaClCalc.csv}{\PhiNaClCalc}
\pgfplotstableread[col sep=comma]{Data/phiNaClresiduals.csv}{\PhiNaClresiduals}
\pgfplotstableread[col sep=comma]{Data/gammaNaClresiduals.csv}{\GammaNaClresiduals}

\pgfplotstableread[col sep=comma]{Data/gammaKClExp.csv}{\GammaKClExp}
\pgfplotstableread[col sep=comma]{Data/gammaKClCalc.csv}{\GammaKClCalc}
\pgfplotstableread[col sep=comma]{Data/phiKClExp.csv}{\PhiKClExp}
\pgfplotstableread[col sep=comma]{Data/phiKClCalc.csv}{\PhiKClCalc}
\pgfplotstableread[col sep=comma]{Data/phiKClresiduals.csv}{\PhiKClresiduals}
\pgfplotstableread[col sep=comma]{Data/gammaKClresiduals.csv}{\GammaKClresiduals}

\pgfplotstableread[col sep=comma]{Data/CaClExp.csv}{\GammaCaClExp}
\pgfplotstableread[col sep=comma]{Data/CaClCalc.csv}{\GammaCaClCalc}
\pgfplotstableread[col sep=comma]{Data/phiCaClExp.csv}{\PhiCaClExp}
\pgfplotstableread[col sep=comma]{Data/phiCaClCalc.csv}{\PhiCaClCalc}
\pgfplotstableread[col sep=comma]{Data/phiCaClresiduals.csv}{\PhiCaClresiduals}
\pgfplotstableread[col sep=comma]{Data/gammaCaClresiduals.csv}{\GammaCaClresiduals}

\pgfplotstableread[col sep=comma]{Data/phiNaClFP.csv}{\PhiNaClFP}
\pgfplotstableread[col sep=comma]{Data/phiKClFP.csv}{\PhiKClFP}
\pgfplotstableread[col sep=comma]{Data/phiCaClFP.csv}{\PhiCaClFP}

\pgfplotstableread[col sep=comma]{Data/LNaClFP.csv}{\LNaClFP}
\pgfplotstableread[col sep=comma]{Data/LNaClFPexp.csv}{\LNaClFPexp}
\pgfplotstableread[col sep=comma]{Data/CpNaClFP.csv}{\CpNaClFP}
\pgfplotstableread[col sep=comma]{Data/CpNaClFPexp.csv}{\CpNaClFPexp}

\pgfplotstableread[col sep=comma]{Data/rawcurves.csv}{\rawcurves}
\pgfplotstableread[col sep=comma]{Data/deconvolutedcurves.csv}{\deconvolutedcurves}
\pgfplotstableread[col sep=comma]{Data/heatingcurve1.csv}{\heatingcurva}
\pgfplotstableread[col sep=comma]{Data/heatingcurve2.csv}{\heatingcurvb}
\pgfplotstableread[col sep=comma]{Data/heatingcurve5.csv}{\heatingcurvc}
\pgfplotstableread[col sep=comma]{Data/heatingcurve05.csv}{\heatingcurvd}

The .csv files located in the "Data" folder are themselves generated using the MATLAB code located in the "MATLAB_code" folder

MATLAB code

#NaCl Folder

For convenience, input files are available in both .xslx and .txt format and correspond to data manually copied from the reference paper indicated in the paper manuscript. Authors are indicated in the file header.

The file "FittingVirialCoefficientsToClarkeData.m" makes use of the data from the paper from Clarke et al. compiled in the file "data_NaCl.txt"

Data = readmatrix('Data_NaCl.txt');

The formulas described in the manuscript are applied to calculate the activity coefficient and osmotic coefficient from this input data. For the complete virial matrix, coefficients were hard-coded from the paper of Clarke et al. into the Matlab code.

Figure 2 is generated using the VisulaisationSurfaceXX.m" files.

For the reduced virial matrix, the procedure makes use of the MATLAB curve fitting tool (cftool in the command line) and the files "ReducedMatrixFitEnthalpy.m", "ReducedMatrixFitHeatCapacity.m" and "ReducedMatrixFitOsmoticCoefficient.m".

#KCl and CaCl2 folders

Similar files are available in the KCl and CaCl2 folders, although the input files may be compiled from different sources indicated in the manuscript.

thermodynamics's People

Contributors

anon75014 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.