diff --git a/src/alfasim_score/converter/alfacase/_tests/test_convert_alfacase/test_create_alfacase.alfacase b/src/alfasim_score/converter/alfacase/_tests/test_convert_alfacase/test_create_alfacase.alfacase index b12d0b1..9124352 100644 --- a/src/alfasim_score/converter/alfacase/_tests/test_convert_alfacase/test_create_alfacase.alfacase +++ b/src/alfasim_score/converter/alfacase/_tests/test_convert_alfacase/test_create_alfacase.alfacase @@ -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 @@ -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 diff --git a/src/alfasim_score/converter/alfacase/_tests/test_convert_casing/test_convert_casing_list.yml b/src/alfasim_score/converter/alfacase/_tests/test_convert_casing/test_convert_casing_list.yml index 5ae2051..adb4659 100644 --- a/src/alfasim_score/converter/alfacase/_tests/test_convert_casing/test_convert_casing_list.yml +++ b/src/alfasim_score/converter/alfacase/_tests/test_convert_casing/test_convert_casing_list.yml @@ -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 @@ -122,4 +122,4 @@ value: 3535.0 top_of_filler: unit: m - value: 2833.0 + value: 3369.0 diff --git a/src/alfasim_score/converter/alfacase/convert_alfacase.py b/src/alfasim_score/converter/alfacase/convert_alfacase.py index b3a56a1..0da9874 100644 --- a/src/alfasim_score/converter/alfacase/convert_alfacase.py +++ b/src/alfasim_score/converter/alfacase/convert_alfacase.py @@ -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()) @@ -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. @@ -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() @@ -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, @@ -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(),