Skip to content
/ AQUA Public

A Collection of H2O Equations of State for Planetary Models

License

Notifications You must be signed in to change notification settings

mnijh/AQUA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AQUA-Equation of State

License: MIT License Release

Header

A tabulated equation of state for water based on "AQUA: A Collection of H2O Equations of State for Planetary Models" by Haldemann et al. (2020). It combines the equation of state of Mazevet et al. (2019) with other equation of state at lower temperatures and pressures, namely:

  • Feistel & Wagner (2006) (Ice-Ih)
  • Journaux et al. (2020) (Ice-II, -III, -V, -VI)
  • French & Redmer (2015) (Ice VII, X)
  • Wagner & Pruss (2002) (liquid and gas, below 1 GPa and below 1200 K)
  • Brown (2018) (liquid and supercritical above 1 GPa, below 6'000 K)
  • CEA package by Gordon (1994) and McBride (1996)

The equation of state was constructed in pressure - temperature space but we also provide density - temperature and density - internal energy tables. Besides pressure and temperature the tables provide data of the density, adiabatic temperature gradient, entropy, internal energy and bulk speed of sound of water. For a limited region where CEA was used, we also provide the mean molecular weight, ionization fraction and dissociation fraction of water.

The repository further contains a simple Fortran module to access the tabulated data.

This repository is available under the MIT license. If you use content of this repository cite:

@article{haldemann_aqua_2020,
	title = {{AQUA}: a collection of {H2O} equations of state for planetary models},
	volume = {643},
	copyright = {© ESO 2020},
	issn = {0004-6361, 1432-0746},
	shorttitle = {{AQUA}},
	url = {https://www.aanda.org/articles/aa/abs/2020/11/aa38367-20/aa38367-20.html},
	doi = {10.1051/0004-6361/202038367},
	language = {en},
	urldate = {2020-11-10},
	journal = {Astronomy \& Astrophysics},
	author = {Haldemann, J. and Alibert, Y. and Mordasini, Ch. and Benz, W.},
	month = nov,
	year = {2020},
	pages = {A105},
}

Download the Equation of State Tables

The easiest way to get the equation of state tables is cloning this repository. Since the tables are rather large for a github repository, we use git-lfs (git large file storage) to manage the table files. Hence before cloning the repository please make sure you have installed git-lfs, otherwise the tables will show up as empty pointers. Install is pretty easy,

git lfs install

will do the job.

After that you can simply clone the repository using

git clone git@github.com:mnijh/AQUA.git

To reduce bandwidth usage, we compressed the tables into .zip files. Hence, you need to extract them first, before you can use them.

# For Linux and Mac.
cd Tables
unzip aqua_eos_pt_v1_0.zip
unzip aqua_eos_rhot_v1_0.zip
unzip aqua_eos_rhou_v1_0.zip
# On windows, just use the file explorer to extract them...

If you don't want to clone the github repository, you can either download the repository as a .zip file or download each table separately, after you opened them here on the github website (see Tables).

Using the Fortran module

In the Fortran directory, we provide a simple Fortran-95 module to evaluate the tabulated data.

In order to use the Fortran module, first clone or download the repository. Next, within your main Fortran program make sure that before you evaluate any AQUA data, to load the tables using one of the load routines:

!! The path variable should point to the directory where the tables are stored.
call LOAD_TABLE_PT(path)
call LOAD_TABLE_RhoT(path)
call LOAD_TABLE_RhoU(path)

Then the AQUA tables can be evaluated using one of the functions

EOS_PT = INTERPOLATE_AQUA_PT(P,T) !! P in Pa, T in K
  
!! EOS_PT contains (density [kg/m^3], adiabatic temperature gradient, entropy [J/kg/K], internal energy [J/kg], bulk speed of sound [m/s], mean molecular weight [g/mol], ionization fraction = N_e/N_tot, dissociation fraction = 1 - N_H2O/N_tot)
EOS_RhoT = INTERPOLATE_AQUA_RhoT(Rho,T) !! Rho in kg/m^3, T in K
  
!! EOS_RhoT contains (pressure [Pa], adiabatic temperature gradient, entropy [J/kg/K], internal energy [J/kg], bulk speed of sound [m/s], mean molecular weight [g/mol], ionization fraction = N_e/N_tot, dissociation fraction = 1 - N_H2O/N_tot)
EOS_RhoU = INTERPOLATE_AQUA_RhoU(Rho,U) !! !! Rho in kg/m^3, U in J/kg
  
!! EOS_RhoU contains (pressure [Pa], temperature [K], adiabatic temperature gradient, entropy [J/kg/K], bulk speed of sound [m/s], mean molecular weight [g/mol], ionization fraction = N_e/N_tot, dissociation fraction = 1 - N_H2O/N_tot)

For the sake of simplicity a bilinear interpolation scheme is used here to evaluate the tabulated data. More accurate interpolation can be achieved using a hermite spline interpolation, e.g. PCHIP - Piecewise Cubic Hermite Interpolant Package.

The following code snippet should illustrate the basic usage as outlined above.

PROGRAM MY_PROGRAM
  USE AQUA_EOS,only: LOAD_TABLE_PT,INTERPOLATE_AQUA_PT,DIM_OUTPUT
  USE AQUA_EOS,only: LOAD_TABLE_RhoT,INTERPOLATE_AQUA_RhoT
  USE AQUA_EOS,only: LOAD_TABLE_RhoU,INTERPOLATE_AQUA_RhoU
  IMPLICIT NONE
  
  CHARACTER(LEN=200) :: path  !! READ_TABLE expects a string of length 200
  REAL(8) :: P,T,EOS_PT(DIM_OUTPUT),EOS_PT(DIM_OUTPUT),EOS_PT(DIM_OUTPUT)
  
  !! The path variable should point to the directory
  !! where the tables are stored.
  path = '../Table'
  !! Before evaluating the first time the equation of state
  CALL LOAD_TABLE_PT(path)
  CALL LOAD_TABLE_RhoT(path)
  CALL LOAD_TABLE_RhoU(path)
  
  P = 1.0D9 !! Pressure in Pa
  T = 999.0 !! Temperature in K
  
  !! Evaluate AQUA P-T Table
  EOS_PT = INTERPOLATE_AQUA_PT(P,T) 
  
  !! EOS_PT contains [density [kg/m^3], adiabatic temperature gradient,
  !! entropy [J/kg/K], internal energy [J/kg], bulk speed of sound [m/s],
  !! mean molecular weight [g/mol], ionization fraction = N_e/N_tot, 
  !! dissociation fraction = 1 - N_H2O/N_tot)
  
  T   = 999.0 !! Temperature in K
  Rho = 1.0D3 !! density [kg/m^3]
  
  !! Evaluate AQUA Rho-T Table
  EOS_RhoT = INTERPOLATE_AQUA_RhoT(Rho,T) 
  
  !! EOS_RhoT contains (pressure [Pa], adiabatic temperature gradient, 
  !! entropy [J/kg/K], internal energy [J/kg], bulk speed of sound [m/s],
  !! mean molecular weight [g/mol], ionization fraction = N_e/N_tot, 
  !! dissociation fraction = 1 - N_H2O/N_tot)
  
  Rho = 1.0D3 !! density [kg/m^3]
  U   = 1.0D6 !! internal energy [J/kg]
  
  !! Evaluate AQUA Rho-U Table
  EOS_RhoU = INTERPOLATE_AQUA_RhoU(Rho,U) 
  
  !! EOS_RhoU contains (pressure [Pa], temperature [K], 
  !! adiabatic temperature gradient, entropy [J/kg/K], bulk speed of sound [m/s], 
  !! mean molecular weight [g/mol], ionization fraction = N_e/N_tot,
  !! dissociation fraction = 1 - N_H2O/N_tot)
  
  RETURN
 END PROGRAM MY_PROGRAM

Compilation

No special dependencies are required to compile the AQUA_EoS module. Using for example the gfortancompiler

gfortran -pedantic -c aqua_eos.f95

will create the needed files necessary to link to your main code.

Options

Some options can be set to change the behavior of the Fortran module. The options will mainly activate or deactivate checks if the input is beyond the tabulated range. When set

safe_mode = .true. ![default = .true.]

then all options listed below will be evaluated. If set false, then no checks will be performed. Only deactivate safe mode if you know you will not leave the table domain.

!! If outside tabulated range, write error message
notify_outside_table  = .true. ![default = .true.]
!! If outside tabulated range, stop, otherwise evaluate at last P,T inside tabluated range.
stop_outside_table    = .true. ![default = .true.]

The options can be set either in the source code of the module or set them somewhere in the parent program, e.g.,

PROGRAM MY_PROGRAM
  USE AQUA_EOS,only: safe_mode,notify_outside_table,stop_outside_table
  IMPLICIT NONE
  
  safe_mode = .true.
  notify_outside_table  = .true.
  stop_outside_table    = .false.
  
  ...
  
END PROGRAM MY_PROGRAM

Known Issues

  • Grid spacing of the rho-T and rho-U tables is not small enough around 1000 kg/m^3. (planed fix for v0.2)

References

License

MIT License

Copyright (c) 2020, Jonas Haldemann

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A Collection of H2O Equations of State for Planetary Models

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published