In [3]:
    
using Dierckx, DataFrames, PyPlot, JLD, CoolProp, CSV
include("SetPyPlot.jl")
SetPyPlot.setrcparam()
@load "input_param.jld"
    
    
    Out[3]:
This data is obtained from the following webpage: Source: http://nlog.nl/reservoireigenschappen
In [4]:
    
phi_data = CSV.read("TNO_data.csv")
perm_data = dropmissing(phi_data, :Perm_arith)
    
    Out[4]:
In [5]:
    
figure(figsize=(4,3))
plot(phi_data.Basis_tvd_m, phi_data.Porositeit, "o")
xlabel("Depth [m]")
ylabel("Porosity [vol%]")
savefig("figs/porosity_depth.png")
savefig("figs/porosity_depth.svg")
    
    
In [20]:
    
# plotyy(x1, y1, x2, y2; fig_size, x_label, y1_label, y2_label, y1_style, y2_style)
SetPyPlot.plotyy(phi_data.Basis_tvd_m, phi_data.Porositeit, 
    perm_data.Basis_tvd_m, perm_data.Perm_arith, y1_style = "ob", y2_style="vr", 
    x_label="Depth [m]", y1_label="Porosity [vol%]", y2_label="mili Darcy")
# plot(phi_data.Basis_tvd_m, phi_data.Perm_arith)
savefig("figs/porosity_perm_depth.png")
savefig("figs/porosity_perm_depth.svg")
    
    
In [32]:
    
p_local_ref = CSV.read("p_profile_local_refine.csv")
p_peaceman = CSV.read("p_profile_coarse_peaceman.csv")
figure(figsize=(4,3))
plot(p_local_ref.x_m, p_local_ref.p_pa./1e5, "-", label="Locally refined grid")
plot(p_peaceman.x_m, p_peaceman.p_pa./1e5, "--", label="Peaceman model")
legend()
xlabel("Distance between wells [m]")
ylabel("Pressure [bar]")
tight_layout()
savefig("figs/pressure_profile.png")
savefig("figs/pressure_profile.svg")
    
    
In [8]:
    
df_geo = CSV.read("geothermal_final_results.csv")
    
    Out[8]:
In [9]:
    
flow_rates = df_geo[:q_m3_s] # [m^3/s]
k          = df_geo[:k_m2]   # [m^2]
L          = df_geo[:L_m]    # [m]
flow_range = union(flow_rates)
k_range    = union(k)
L_range    = union(L)
    
    
    Out[9]:
In [10]:
    
k_range
    
    Out[10]:
In [11]:
    
line_style = ["-", "--", "-.", "-", ":"]
for L_well in L_range
    figure(figsize=(5,3))
    xlabel("Permeability [m\$^2\$]")
    ylabel("Practical recovery factor [-]")
    i=0
    for q in flow_range
        i+=1
        df_temp = df_geo[(df_geo[:q_m3_s].==q) .& (df_geo[:L_m].==L_well), :]
        plot(df_temp[:k_m2], df_temp[:R_pr], line_style[i], label = "q = $(q*3600) m\$^3\$/h")
    end
    legend()
    plot([0, 1e-12], [0,0], "--k")
    axis([0, 1e-12, -1,1])
#     title("L = $L_well [m]")
    savefig("figs/practical_recovery_perm.png")
end
    
    
    
    
    
    
    
    
In [12]:
    
for L_well in L_range
    figure(figsize=(4,3))
    xlabel("Permeability [m\$^2\$]")
    ylabel("Zero-emission recovery factor [-]")
    i=0
    for q in flow_range
        i+=1
        df_temp = df_geo[(df_geo[:q_m3_s].==q) .& (df_geo[:L_m].==L_well), :]
        plot(df_temp[:k_m2], df_temp[:R_ze], line_style[i], label = "q = $(q*3600) m\$^3\$/h")
#         plot(df_temp[:k_m2], df_temp[:R_pr], label = "q = $(q*3600) m\$^3\$/h")
    end
    legend()
    plot([0, 1e-12], [0,0], "--k")
    axis([0, 1e-12, -1,1])
    title("L = $L_well [m]")
end
    
    
    
    
    
    
    
In [13]:
    
for k_res in k_range
    figure(figsize=(5,3))
    xlabel("Flow rate \L[m^3/h]")
    ylabel("Practical recovery factor [-]")
    i=0
    for L_well in L_range
        i+=1
        df_temp = df_geo[(df_geo[:k_m2].==k_res) .& (df_geo[:L_m].==L_well), :]
        plot(df_temp[:q_m3_s]*3600, df_temp[:R_pr], line_style[i], alpha = 0.5, label = "L = $L_well [m]")
    end
    legend()
    #plot([0, 1e-12], [0,0], "--k")
    #axis([0, 1e-12, -1,1])
    title("k = $(k_res*1e12) [D]")
end
    
    
In [14]:
    
for k_res in k_range
    figure(figsize=(4,3))
    xlabel("Flow rate [m\$^3\$/h]")
    ylabel("Project life time [year]")
    i=0
    for L_well in L_range
        i+=1
        df_temp = df_geo[(df_geo[:k_m2].==k_res) .& (df_geo[:L_m].==L_well), :]
        plot(df_temp[:q_m3_s]*3600, df_temp[:t_life_s]/(3600*24*365), line_style[i], alpha = 0.8, label = "L = $L_well [m]")
    end
    legend()
    #plot([0, 1e-12], [0,0], "--k")
    #axis([0, 1e-12, -1,1])
#     plot(df_geo[:q_m3_s]*3600, df_geo[:t_life_s]/(3600*24*365), "o")
    savefig("figs/project_life_time.png")
#     title("k = $(k_res*1e12) [D]")
end
    
    
    
    
    
    
    
    
    
In [15]:
    
figure(figsize=(4,3))
semilogy(df_geo[:q_m3_s]*3600, df_geo[:c_CO2], alpha = 0.5, "o")
semilogy([0, 260], [em_gas, em_gas]*1e3, "--k")
xlabel("Flow rate [m\$^3\$/h]")
ylabel("CO\$_2\$ emission [kg CO\$_2\$/MJ]")
axis([0, 260, 1e-2, 3])
savefig("figs/CO2_emission_flow.png")
    
    
    
In [16]:
    
figure(figsize=(4,3))
semilogy(df_geo[:k_m2], df_geo[:c_CO2], alpha = 0.5, "o")
semilogy([0, 1.1e-12], [em_gas, em_gas]*1e3, "--k")
xlabel("Permeability [m\$^2\$]")
ylabel("CO\$_2\$ emission [kg CO\$_2\$/MJ]")
axis([0, 1.1e-12, 1e-2, 3])
savefig("figs/CO2_emission_full_perm.png")
    
    
    
In [68]:
    
figure(figsize=(4,3))
semilogy(df_geo[:k_m2], df_geo[:c_CO2]*0.15, alpha = 0.5, "o")
semilogy([0, 1.1e-12], [em_gas, em_gas]*1e3, "--k")
xlabel("Permeability [m\$^2\$]")
ylabel("CO\$_2\$ emission [kg CO\$_2\$/MJ]")
axis([0, 1.1e-12, 1e-3, 4e-1])
savefig("figs/CO2_emission_perm.png")
    
    
    
In [52]:
    
T_c = 2.0+273.15 # [K]
T_h = 22+273.15 # [K]
COP_th = T_h/(T_h-T_c)
COP_air = 2.0 # average value (per unit electricity)
COP_geo = 5.0 # shallow heat (comes from the sun)
COP_methane = 1.0 # ignoring heat loss
t_life_crit = 30       # years
c_CO2_crit  = em_gas*1e3*2.0 # kg/MJ
u_ht = 1.0 # W/m2/K
A_ht = 4*10.0*3.0 # only surrounding walls
Q_heat = u_ht*A_ht*(T_h-T_c)/1000 # kJ/s
n_houses = 400 # number of houses to be covered by the geothermal project
m_water = Q_heat*1000*n_houses/(PropsSI("HMASS", "T", 80+273.15, "P", 1e5, "H2O")-PropsSI("HMASS", "T", 40+273.15, "P", 1e5, "H2O"))
q_water = m_water/PropsSI("D", "T", 40+273.15, "P", 1e5, "H2O") # [m3/s]
df_practical = df_geo[(df_geo[:t_life_s].>(30.0*24*3600)) & (df_geo[:R_ze].>0.0) & (df_geo[:c_CO2].<c_CO2_crit), :]
    
    
    
In [53]:
    
flow_rates_pr = df_practical[:q_m3_s] # [m^3/s]
k_pr          = df_practical[:k_m2]   # [m^2]
L_pr          = df_practical[:L_m]    # [m]
flow_range_pr = union(flow_rates_pr)
k_range_pr    = union(k_pr)
L_range_pr    = union(L_pr)
    
    
In [54]:
    
k_range_pr
    
    
In [55]:
    
figure(figsize=(5,3))
plot(df_practical[:q_m3_s]*3600, df_practical[:c_CO2], alpha = 0.5, "o")
plot([0, 260], [em_gas, em_gas]*1e3, "--k")
xlabel("Flow rate [m^3/h]")
ylabel("CO2 emission [kg CO2/MJ]")
tight_layout()
savefig("carbon_emission_geothermal.png")
    
    
The theoretical COP can be calculated based on the temperature of the outside (temperature outside of the house, where heat is extracted) and the desirable temperature inside (where heat is delivered). It is calculated by $$COP_{th} = \frac{T_h}{T_h-T_c}$$
In [56]:
    
df_current = df_geo[df_geo[:COP].<1.0, :]
    
    
    Out[56]:
:MW_CO2
 :MW_coal
 :MW_gas
 :e_igcc
 :e_ngcc
 :e_pc
 :em_coal
 :em_gas
 :eta_driver
 :eta_pump
 :ex_ccs
 :ex_coal
 :ex_gas
 :η_igcc
 :η_ngcc
 :η_pc
In [57]:
    
figure(figsize=(5,3))
plot(df_geo[:k_m2]*1e12, df_geo[:COP], "o", alpha = 0.5)
plot([0,1.1], [1.0, 1.0], "--k", label = "methane")
plot([0,1.1], [2.0, 2.0], "-r", label = "heat pump")
plot([0,1.1], [5.0, 5.0], ":g", label = "geo heat pump")
axis([0,1.05,0,40])
legend()
ylabel("COP")
xlabel("Permeability [D]")
    
    
    
    Out[57]:
In [58]:
    
figure(figsize=(4,3))
semilogy(df_geo[:k_m2]*1e12, df_geo[:COP], "o", alpha = 0.5)
semilogy([0,1.1], [0.8, 0.8], "--k", label = "methane")
semilogy([0,1.1], [1.0, 1.0], "-r", label = "heat pump")
semilogy([0,1.1], [2.0, 2.0], ":g", label = "geo heat pump")
axis([0,1.05,0,40])
legend()
ylabel("COP")
xlabel("Permeability [D]")
savefig("figs/COP_alternatives.png")