Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #7 from equinor:crushed
Browse files Browse the repository at this point in the history
Crushed
  • Loading branch information
smolvik1 authored Jun 5, 2022
2 parents 0638f8d + 199c859 commit 0903d11
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 23 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## 1.0.0
* Erosion calculator with option for crushed particles
3 changes: 2 additions & 1 deletion forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from lib2to3.pytree import Base
from flask_wtf import FlaskForm
from wtforms import SubmitField, SelectField, DecimalField, HiddenField
from wtforms import SubmitField, SelectField, DecimalField
from wtforms.validators import DataRequired, NumberRange
from data import materials_tuples, erosion_models_tuples

Expand All @@ -19,6 +19,7 @@ class BaseForm(FlaskForm):
# Particle input
erosive_agent = SelectField('Select erosive agent', id='particle',default='quartz', choices=[('quartz', 'Quartz sand')], validators=[DataRequired()])
Q_s = DecimalField('Sand production rate [g/s]', id='particle', default=0.1)
crushed = SelectField('Particle sphericity', id='particle', default='False', choices=[('False', 'Uncrushed'), ('True', 'Crushed')], validators=[DataRequired()])

# PVT input
rho_l = DecimalField('Liquid Density [kg/m³]', id='pvt', default=1000, places=0, validators=[DataRequired(), NumberRange(min=1, max=1500)])
Expand Down
54 changes: 32 additions & 22 deletions modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def getVariables(erosion_model=None):
'particle_diameter': {'uom': 'mm', 'description': 'Particle diameter'},
'material': {'uom': '', 'description': 'Material exposed to erosion'},
'rho_p': {'uom': 'kg/m3', 'description': 'Particle density'},
'crushed': {'uom': 'True/False', 'description': 'Crushed particles'},
'q_sand' : {'uom': 'g/s', 'description': 'Sand production rate'},
'rho_l': {'uom': 'kg/m3', 'description': 'Liquid density'},
'mu_l': {'uom': 'kg/ms', 'description': 'Liquid viscosity'},
Expand All @@ -62,16 +63,16 @@ def getVariables(erosion_model=None):
'At': {'uom': 'm2', 'description': 'Target area. Set to minimum flow area of the valve'}
}

bendDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'material', 'rho_p', 'rho_l', 'mu_l', 'rho_g', 'mu_g', 'v_l_s', 'v_g_s', 'R', 'GF'}}
teeDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'material', 'rho_p', 'rho_l', 'mu_l', 'rho_g', 'mu_g', 'v_l_s', 'v_g_s', 'GF'}}
straightDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'v_l_s', 'v_g_s'}}
weldedDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'material', 'location', 'rho_l', 'rho_g', 'v_l_s', 'v_g_s', 'alpha'}}
manifoldDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'material', 'rho_p', 'rho_l', 'mu_l', 'rho_g', 'mu_g', 'v_l_s', 'v_g_s', 'manifold_diameter', 'GF'}}
reducerDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'material', 'rho_l', 'rho_g', 'v_l_s', 'v_g_s', 'reduced_diameter', 'GF', 'alpha'}}
probeDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'material', 'rho_l', 'rho_g', 'v_l_s', 'v_g_s', 'alpha'}}
flexibleDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'material', 'rho_l', 'mu_l', 'rho_g', 'mu_g', 'v_l_s', 'v_g_s', 'mbr'}}
chokeGalleryDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'material', 'R_c', 'rho_l', 'mu_l', 'rho_g', 'mu_g', 'v_l_s', 'v_g_s', 'gap', 'H', 'GF'}}
nozzlevalveDict = {key: allVariables[key] for key in allVariables.keys()&{'particle_diameter', 'material', 'v_l_s', 'v_g_s', 'At', 'GF'}}
bendDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'material', 'rho_p', 'crushed', 'rho_l', 'mu_l', 'rho_g', 'mu_g', 'v_l_s', 'v_g_s', 'R', 'GF'}}
teeDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'material', 'rho_p', 'crushed', 'rho_l', 'mu_l', 'rho_g', 'mu_g', 'v_l_s', 'v_g_s', 'GF'}}
straightDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'crushed', 'v_l_s', 'v_g_s'}}
weldedDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'crushed', 'material', 'location', 'rho_l', 'rho_g', 'v_l_s', 'v_g_s', 'alpha'}}
manifoldDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'crushed', 'material', 'rho_p', 'rho_l', 'mu_l', 'rho_g', 'mu_g', 'v_l_s', 'v_g_s', 'manifold_diameter', 'GF'}}
reducerDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'crushed', 'material', 'rho_l', 'rho_g', 'v_l_s', 'v_g_s', 'reduced_diameter', 'GF', 'alpha'}}
probeDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'crushed', 'material', 'rho_l', 'rho_g', 'v_l_s', 'v_g_s', 'alpha'}}
flexibleDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'crushed', 'material', 'rho_l', 'mu_l', 'rho_g', 'mu_g', 'v_l_s', 'v_g_s', 'mbr'}}
chokeGalleryDict = {key: allVariables[key] for key in allVariables.keys()&{'internal_diameter', 'particle_diameter', 'crushed', 'material', 'R_c', 'rho_l', 'mu_l', 'rho_g', 'mu_g', 'v_l_s', 'v_g_s', 'gap', 'H', 'GF'}}
nozzlevalveDict = {key: allVariables[key] for key in allVariables.keys()&{'particle_diameter', 'crushed', 'material', 'v_l_s', 'v_g_s', 'At', 'GF'}}

if erosion_model == 'bend':
return bendDict
Expand All @@ -97,11 +98,9 @@ def getVariables(erosion_model=None):
return bendDict

def materialProperties(material, returnvariable):

properties = materialDict
if material == 'list':
return list(properties.keys())

if material == 'properties':
return properties

Expand All @@ -117,6 +116,7 @@ def calcRelErosion(erosion_model):
D = float(request.form['internal_diameter'])

erosive_agent = request.form['erosive_agent']
crushed = request.form['crushed'] == 'True' # Converts to a boolean, True or False

material = request.form['material']

Expand Down Expand Up @@ -150,7 +150,8 @@ def calcRelErosion(erosion_model):
D=float(request.form['internal_diameter']),
d_p=float(request.form['particle_diameter']),
material=material,
rho_p=erosiveAgentDict[erosive_agent]['rho_p']
rho_p=erosiveAgentDict[erosive_agent]['rho_p'],
crushed=crushed
)

elif erosion_model == 'tee':
Expand All @@ -162,13 +163,15 @@ def calcRelErosion(erosion_model):
GF=float(request.form['GF']),
d_p=float(request.form['particle_diameter']),
material=material,
rho_p=erosiveAgentDict[erosive_agent]['rho_p']
rho_p=erosiveAgentDict[erosive_agent]['rho_p'],
crushed=crushed
)

elif erosion_model == 'straight_pipe':
E_rel = erosion.straight_pipe(
v_m=v_m,
D=D
D=D,
crushed=crushed
)

elif erosion_model == 'welded_joint':
Expand All @@ -180,7 +183,8 @@ def calcRelErosion(erosion_model):
h=float(request.form['h']),
alpha=float(request.form['alpha']),
location=request.form['Location'],
material=material
material=material,
crushed=crushed
)

elif erosion_model == 'manifold':
Expand All @@ -193,7 +197,8 @@ def calcRelErosion(erosion_model):
d_p=float(request.form['particle_diameter']),
Dm=float(request.form['Dman']),
rho_p=erosiveAgentDict[erosive_agent]['rho_p'],
material=material
material=material,
crushed=crushed
)

elif erosion_model == 'reducer':
Expand All @@ -205,7 +210,8 @@ def calcRelErosion(erosion_model):
d_p=float(request.form['particle_diameter']),
GF=float(request.form['GF']),
alpha=float(request.form['alpha']),
material=material
material=material,
crushed=crushed
)

elif erosion_model == 'probes':
Expand All @@ -215,7 +221,8 @@ def calcRelErosion(erosion_model):
D=D,
d_p=float(request.form['particle_diameter']),
alpha=float(request.form['alpha']),
material=material
material=material,
crushed=crushed
)

elif erosion_model == 'flexible':
Expand All @@ -226,7 +233,8 @@ def calcRelErosion(erosion_model):
D=D,
mbr=float(request.form['mbr']),
d_p=float(request.form['particle_diameter']),
material=material
material=material,
crushed=crushed
)

elif erosion_model == 'choke_gallery':
Expand All @@ -240,7 +248,8 @@ def calcRelErosion(erosion_model):
R_c=float(request.form['R_c']),
gap=float(request.form['gap']),
H=float(request.form['H']),
material=material
material=material,
crushed=crushed
)

elif erosion_model == 'nozzlevalve_wall':
Expand All @@ -249,7 +258,8 @@ def calcRelErosion(erosion_model):
d_p=float(request.form['particle_diameter']),
GF=float(request.form['GF']),
At=float(request.form['At']),
material=material
material=material,
crushed=crushed
)

else:
Expand Down

0 comments on commit 0903d11

Please sign in to comment.