| import streamlit as st |
| import pandas as pd |
| from rockphypy import EM |
| from rockphypy import Fluid |
| import numpy as np |
| import matplotlib.pyplot as plt |
|
|
| |
| |
| from plotly.subplots import make_subplots |
| import plotly.graph_objects as go |
| import plotly.figure_factory as ff |
| import plotly.express as px |
| plt.rcParams['font.size']=14 |
| plt.rcParams['font.family']='arial' |
| |
| from rockphypy import QI, GM, Fluid |
|
|
| def RPT_template(las_file, well_data): |
| st.title('Rock physics template building') |
| if not las_file: |
| st.warning('No file has been uploaded') |
| st.write('Input parameters') |
| tab1, tab2, tab3, tab4 = st.tabs(["Matrix", "Cement", "Fluid", "RPT"]) |
| with tab1: |
| st.header("Matrix") |
| K0=st.number_input('Bulk modulus of matrix',value=36.6, placeholder="Type a number...") |
| G0=st.number_input('Shear modulus of matrix',value=45, placeholder="Type a number...") |
| D0=st.number_input('Density of matrix',value=2.65, placeholder="Type a number...") |
| phi_c=st.number_input(r'Critical porosity, $\rm \phi_c$',value=0.4, placeholder='Type a number...') |
| Cn=st.number_input('Number of contacts',value=10, placeholder='Type a number...') |
|
|
| |
|
|
| with tab2: |
| st.header("Cements") |
| Kc=st.number_input('Bulk modulus of cement',value=37, placeholder="Type a number...") |
| Gc=st.number_input('Shear modulus of cement',value=45, placeholder="Type a number...") |
| Dc=st.number_input('Density of cement',value=2.65, placeholder="Type a number...") |
| phib = st.number_input('Critical cement porosity',value=0.3,placeholder="Type a number ...") |
| |
|
|
| with tab3: |
| st.header("Fluid") |
| Kb=st.number_input('Bulk modulus of brine water',value=2.5, placeholder="Type a number...") |
| Db=st.number_input('Density of brine water',value=1.0, placeholder="Type a number...") |
| Ko=st.number_input('Bulk modulus of oil',value=1.5, placeholder="Type a number...") |
| Do=st.number_input('Density of oil',value=0.8, placeholder="Type a number...") |
| Kg=st.number_input('Bulk modulus of gas',value=0.8, placeholder="Type a number...") |
| Dg=st.number_input('Density of gas',value=0.05, placeholder="Type a number...") |
|
|
| |
| with tab4: |
| st.header('Rock physics template') |
| columns = list(well_data.columns) |
| |
| option=st.selectbox('Select curve for color',columns) |
| phi = np.linspace(0.1,phi_c,10) |
| sw=np.linspace(0,1,5) |
| sigma=20 |
| f=0.5 |
| values = st.slider('Select a range display', np.min(well_data[option]), np.max(well_data[option]), |
| (np.min(well_data[option]), np.max(well_data[option]))) |
| |
| |
| mask = (well_data[option] >= values[0]) & (well_data[option] <= values[1]) |
|
|
| |
| indices = well_data.index[mask] |
| |
| |
| |
| |
| Vp=1000000000*0.0003048/well_data['DT'][indices] |
| Vs=1000000000*0.0003048/well_data['DTS'][indices] |
| rhob=well_data['RHOB'][indices] |
| IP= Vp*rhob |
| PS= Vp/Vs |
| sand_model = st.selectbox('Rock physics model',('Stiffsand', 'Softsand', 'Contact Cement', 'Constant Cement', |
| 'Increase Cement', 'User inputs')) |
| if (sand_model=='Stiffsand'): |
| Kdry, Gdry = GM.stiffsand(K0, G0, phi, phi_c, Cn, sigma, f=0) |
| elif (sand_model=='Softsand'): |
| Kdry, Gdry = GM.softsand(K0, G0, phi, phi_c, Cn, sigma, f=0) |
| elif(sand_model=='Contact Cement'): |
| Kdry, Gdry = GM.contactcement(K0, G0, Kc, Gc, phi, phi_c, Cn, scheme=2) |
| Kdry[phi<phib]=np.nan |
| elif(sand_model == 'Constant Cement'): |
| Kdry, Gdry = GM.constantcement(phib,K0, G0, Kc, Gc, phi, phi_c, Cn, scheme=2) |
| Kdry[phi>phib]=np.nan |
| elif(sand_model == 'Increase Cement'): |
| Kdry, Gdry = GM.MUHS(K0, G0, Kc, Gc, phi, phib, phi_c, Cn, scheme=2) |
| Kdry[phi>phib]=np.nan |
| elif(sand_model == 'User inputs'): |
| Kdry, Gdry = GM.softsand(K0, G0, phi, phi_c, Cn, sigma, f=0) |
| |
| fluid_type = st.selectbox('Fluid type',('Gas','Oil')) |
| if (fluid_type=='Gas'): |
| fig=QI.plot_rpt(Kdry,Gdry,K0,D0,Kb,Db,Kg,Dg,phi,sw) |
| elif (fluid_type=='Oil'): |
| fig=QI.plot_rpt(Kdry,Gdry,K0,D0,Kb,Db,Ko,Do,phi,sw) |
| fig.set_size_inches(9, 6) |
| plt.grid() |
| plt.scatter(IP,PS, c=well_data[option][indices],edgecolors='grey',s=80,alpha=1,cmap='Greens_r') |
| cbar=plt.colorbar() |
| |
| cbar.set_label(option) |
| plt.xlabel('AI (m/s*g/cc)') |
| plt.xlim(1000,14000) |
| plt.ylim(1.4,2.8) |
| st.pyplot(fig) |
|
|
|
|
|
|