Skip to content

Commit

Permalink
Fix top of filler positions;
Browse files Browse the repository at this point in the history
PWPA-1982
  • Loading branch information
Gabriel Antão committed Jul 1, 2024
1 parent fa97d10 commit 65265c2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ wells:
unit: mm
material: N-80
top_of_filler:
value: 2833.0
value: 1000.0
unit: m
filler_material: cement
material_above_filler: fluid_default
Expand Down Expand Up @@ -532,7 +532,7 @@ wells:
unit: mm
material: SDSS/125KSI
top_of_filler:
value: 2833.0
value: 3369.0
unit: m
filler_material: cement
material_above_filler: fluid_default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
value: 1000.0
top_of_filler:
unit: m
value: 2833.0
value: 1000.0
- filler_material: cement
hanger_depth:
unit: m
Expand Down Expand Up @@ -122,4 +122,4 @@
value: 3535.0
top_of_filler:
unit: m
value: 2833.0
value: 3369.0
30 changes: 24 additions & 6 deletions src/alfasim_score/converter/alfacase/convert_alfacase.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
def filter_duplicated_materials(
material_list: List[MaterialDescription],
) -> List[MaterialDescription]:
"""Remove the duplicated materials parsed by the reader"""
"""Remove the duplicated materials parsed by the reader."""
filtered = {material.name: material for material in material_list}
return list(filtered.values())

Expand All @@ -62,9 +62,19 @@ def __init__(self, score_reader: ScoreInputReader):
self.well_start_position = self.general_data["water_depth"] + self.general_data["air_gap"]

def _get_position_in_well(self, position: Scalar) -> Scalar:
"""Get the position relative to the well start position"""
"""Get the position relative to the well start position."""
return position - self.well_start_position

def _get_section_top_of_filler(
self, filler_depth: Scalar, hanger_depth: Scalar, final_depth: Scalar
) -> Scalar:
"""Get the depth of filler in the current casing section."""
if filler_depth > final_depth:
return final_depth
if filler_depth <= hanger_depth:
return hanger_depth
return filler_depth

def _convert_well_trajectory(self) -> ProfileDescription:
"""
Convert the trajectory for the imported well.
Expand All @@ -75,7 +85,7 @@ def _convert_well_trajectory(self) -> ProfileDescription:
return ProfileDescription(x_and_y=XAndYDescription(x=x, y=y))

def convert_materials(self) -> List[MaterialDescription]:
"""Convert list of materials from SCORE file"""
"""Convert list of materials from SCORE file."""
material_descriptions = []
material_list = (
self.score_input.read_cement_material()
Expand Down Expand Up @@ -123,18 +133,25 @@ def _convert_casing_list(self) -> List[CasingSectionDescription]:
"""Create the description for the casings."""
casing_sections = []
for casing in self.score_input.read_casings():
# TODO: FIX the TOC (create a function to calculate the end of TOC for the sections)
for i, section in enumerate(casing["sections"], 1):
hanger_depth = self._get_position_in_well(section["top_md"])
settings_depth = self._get_position_in_well(section["base_md"])
filler_depth = self._get_position_in_well(casing["top_of_cement"])
top_of_filler = self._get_section_top_of_filler(
filler_depth, hanger_depth, settings_depth
)
casing_sections.append(
CasingSectionDescription(
name=f"{casing['function'].value}_{casing['type'].value}_{i}",
hanger_depth=self._get_position_in_well(section["top_md"]),
settings_depth=self._get_position_in_well(section["base_md"]),
hanger_depth=hanger_depth,
settings_depth=settings_depth,
hole_diameter=casing["hole_diameter"],
outer_diameter=section["outer_diameter"],
inner_diameter=section["inner_diameter"],
inner_roughness=CASING_DEFAULT_ROUGHNESS,
material=section["material"],
top_of_filler=self._get_position_in_well(casing["top_of_cement"]),
top_of_filler=top_of_filler,
filler_material=CEMENT_NAME,
# TODO PWPA-1970: review this fluid default with fluid actually used by SCORE file
material_above_filler=FLUID_DEFAULT_NAME,
Expand Down Expand Up @@ -265,6 +282,7 @@ def build_well(self) -> WellDescription:
)

def build_case_description(self) -> CaseDescription:
""" "Create the description for the alfacase."""
return CaseDescription(
name=self.general_data["case_name"],
nodes=self.build_nodes(),
Expand Down

0 comments on commit 65265c2

Please sign in to comment.