This page was generated from docs/Examples/EOS_calculations/Example5b_Visualizing_EOSs_Density_Pressure.ipynb. Interactive online version: Binder badge.

Python Notebook Download

This notebook shows how to visualize how CO2 density relates to pressure and temperature using an EOS

[1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import DiadFit as pf
import CoolProp.CoolProp as CP
pf.__version__
[1]:
'0.0.91'

Install DiadFit if you havent already! You might also have to install CoolProp if you want to use Span and Wagner EOS - the error message will give you instructions, else reach out

[3]:
#!pip install --upgrade DiadFit

Calculations of CO2 density as a function of pressure and temperature

[2]:
# Make a linearly spaced vector of pressures,

# we do 2 here to get a smoother curve and combine
P=np.linspace(100, 2000*10**6, 100)
Psmall=np.linspace(0, 100, 100)
P_combo=np.concatenate((Psmall, P))

# calculating for different temperatures 1300-1000 celcius
CalcD_P_1300=CP.PropsSI('D', 'P', P_combo, 'T', 1300+273.15, 'CO2')
CalcD_P_1200=CP.PropsSI('D', 'P', P_combo, 'T', 1200+273.15, 'CO2')
CalcD_P_1100=CP.PropsSI('D', 'P', P_combo, 'T', 1100+273.15, 'CO2')
CalcD_P_1000=CP.PropsSI('D', 'P', P_combo, 'T', 1000+273.15, 'CO2')

Some things to allow us to plot in pressure vs. depth space

[3]:
rho=2700 # Crustal density
P_axis_min=0 # Min pressure to show
P_axis_max=20 # Max pressure to show
# Calculating how they relate to each other
D_axis_min=100000*P_axis_min/(9.8*rho)
D_axis_max=100000*P_axis_max/(9.8*rho)