Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Carbon Dioxide fluid properties #29

Merged
merged 5 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ if(DOXYGEN_FOUND)
air_err_u.png
air_err_w.png
)
file(GLOB_RECURSE RST_FILES ${PROJECT_SOURCE_DIR}/docs/*.rst)
set(HE_ERR_IMGS
he_err_c_p.png
he_err_c_v.png
Expand All @@ -46,6 +45,17 @@ if(DOXYGEN_FOUND)
he_err_u.png
he_err_w.png
)
set(CO2_ERR_IMGS
co2_err_c_p.png
co2_err_c_v.png
co2_err_h.png
co2_err_k.png
co2_err_mu.png
co2_err_rho.png
co2_err_s.png
co2_err_u.png
co2_err_w.png
)

add_custom_command(
OUTPUT
Expand All @@ -59,6 +69,7 @@ if(DOXYGEN_FOUND)
${N2_ERR_IMGS}
${AIR_ERR_IMGS}
${HE_ERR_IMGS}
${CO2_ERR_IMGS}
)

add_custom_command(
Expand Down Expand Up @@ -110,6 +121,19 @@ if(DOXYGEN_FOUND)
${PROJECT_SOURCE_DIR}/docs/pyplots/he.yml
)

add_custom_command(
OUTPUT
${CO2_ERR_IMGS}
COMMAND
${CMAKE_COMMAND} -E env "PYTHONPATH=${PROJECT_BINARY_DIR}/python/src:$ENV{PYTHONPATH}"
python3 plot_err.py co2.yml
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}/docs/pyplots
DEPENDS
${PROJECT_SOURCE_DIR}/docs/pyplots/plot_err.py
${PROJECT_SOURCE_DIR}/docs/pyplots/co2.yml
)

add_custom_command(
TARGET doc
POST_BUILD
Expand Down
5 changes: 5 additions & 0 deletions docs/classes/carbon-dioxide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Carbon Dioxide
==============

.. doxygenclass:: fprops::CarbonDioxide
:members:
32 changes: 32 additions & 0 deletions docs/fluids/carbon-dioxide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Carbon Dioxide
==============

Range of validity:

- Temperature: `216.592 - 1100 K`
- Pressure: to `800 MPa`

Computation of thermodynamic properties is based on :cite:t:`10.1063/1.555991`.
Viscosity is based on :cite:t:`10.1063/1.556013` and
thermal conductivity is based on :cite:t:`10.1063/1.2213631`.

Verification against CoolProp package
-------------------------------------

.. image:: ../pyplots/co2_err_rho.png

.. image:: ../pyplots/co2_err_u.png

.. image:: ../pyplots/co2_err_h.png

.. image:: ../pyplots/co2_err_s.png

.. image:: ../pyplots/co2_err_w.png

.. image:: ../pyplots/co2_err_c_p.png

.. image:: ../pyplots/co2_err_c_v.png

.. image:: ../pyplots/co2_err_mu.png

.. image:: ../pyplots/co2_err_k.png
17 changes: 17 additions & 0 deletions docs/pyplots/co2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
fprops:
name: co2
coolprop: CO2
fprops: CarbonDioxide
p: [
0.1, 0.2,
0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4,
5, 6, 8,
10, 15, 20, 25,
50, 75, 100,
200, 400, 600, 800
]
T: [
220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350,
400, 450, 500, 550,
600, 700, 800, 900, 1000, 1100
]
40 changes: 40 additions & 0 deletions docs/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,43 @@ @techreport{arp1989thermophysical
year={1989},
institution={}
}

@article{10.1063/1.555991,
year = {1996},
keywords = {CO2},
title = {{A New Equation of State for Carbon Dioxide Covering the Fluid Region from the Triple‐Point Temperature to 1100 K at Pressures up to 800 MPa}},
author = {Span, Roland and Wagner, Wolfgang},
journal = {Journal of Physical and Chemical Reference Data},
issn = {0047-2689},
doi = {10.1063/1.555991},
pages = {1509--1596},
number = {6},
volume = {25},
}

@article{10.1063/1.556013,
year = {1998},
keywords = {CO2},
title = {{The Viscosity of Carbon Dioxide}},
author = {Fenghour, A and Wakeham, William A and Vesovic, V},
journal = {Journal of Physical and Chemical Reference Data},
issn = {0047-2689},
doi = {10.1063/1.556013},
pages = {31--44},
number = {1},
volume = {27},
}

@article{10.1063/1.2213631,
year = {2006},
keywords = {CO2},
title = {{A Reference Multiparameter Thermal Conductivity Equation for Carbon Dioxide with an Optimized Functional Form}},
author = {Scalabrin, G. and Marchi, P. and Finezzo, F. and Span, R.},
journal = {Journal of Physical and Chemical Reference Data},
issn = {0047-2689},
doi = {10.1063/1.2213631},
abstract = {{A new thermal conductivity equation λ=λ(T,ρ) in a multiparameter format was developed for carbon dioxide through the application of an optimization technique of the functional form. The proposed equation is valid for temperatures from the triple point (Tt=216.592K; Pt=0.51795MPa) to 1000K and pressures up to 200MPa. The calculation of density, which is an independent variable of the equation, from the experimental (T,P) conditions is performed with a high accuracy equation of state for the fluid. The thermal conductivity equation shows an average absolute deviation of 1.19\% on the selected 1407 primary data points. Its performances are slightly better than those of the corresponding conventional model by Vesovic et al. [J. Phys. Chem. Ref. Data 19, 763 (1990)] available from the literature; moreover the new equation is simpler to use in particular for the near-critical region. Tables of generated values of carbon dioxide thermal conductivity are provided for check of the code implementations and for quick evaluations.}},
pages = {1549--1575},
number = {4},
volume = {35},
}
50 changes: 50 additions & 0 deletions include/CarbonDioxide.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#pragma once

#include "Helmholtz.h"
#include "TransportModels.h"

namespace fprops {

/// Carbon dioxide fluid properties
///
/// References:
/// 1. R. Span and W. Wagner. A New Equation of State for Carbon Dioxide Covering the Fluid Region
/// from the Triple Point Temperature to 1100 K at Pressures up to 800 MPa. J. Phys. Chem. Ref.
/// Data, 25:1509–1596, 1996. doi:10.1063/1.555991.
/// 2. G. Scalabrin, P. Marchi, F. Finezzo, and R. Span. A Reference Multiparameter Thermal
/// Conductivity Equation for Carbon Dioxide with an Optimized Functional Form. J. Phys. Chem.
/// Ref. Data, 35(4):1549–1575, 2006. doi:10.1063/1.2213631.
/// 3. A. Fenghour, W.A. Wakeham, and V. Vesovic. The viscosity of carbon dioxide. J. Phys. Chem.
/// Ref. Data, 27(1):31–44, 1998. 5. doi:10.1063/1.556013.
class CarbonDioxide : public Helmholtz {
public:
CarbonDioxide();

protected:
[[nodiscard]] double alpha(double delta, double tau) const override;
[[nodiscard]] double dalpha_ddelta(double delta, double tau) const override;
[[nodiscard]] double dalpha_dtau(double delta, double tau) const override;
[[nodiscard]] double d2alpha_ddelta2(double delta, double tau) const override;
[[nodiscard]] double d2alpha_dtau2(double delta, double tau) const override;
[[nodiscard]] double d2alpha_ddeltatau(double delta, double tau) const override;

[[nodiscard]] double mu_from_rho_T(double rho, double T) const override;
[[nodiscard]] double k_from_rho_T(double rho, double T) const override;

private:
IdealGasLead<double> lead;
IdealGasLogTau<double> log_tau;
IdealGasPlanckEinstein<double> pe;
IdealEnthalpyEntropyOffset<double> offset;

ResidualPower<double> power_r;
ResidualPowerExp<double, unsigned int> power_exp_r;
ResidualGaussian<double> gauss;
ResidualNonAnalytic<double> noan;

LennardJones<double> eta_0;
ModifiedBatshinskiHildebrand<double> eta_r;
ModifiedBatshinskiHildebrand<double> lambda_r;
};

} // namespace fprops
Loading