Skip to content
Snippets Groups Projects
Commit d5a10957 authored by Julian Heinze's avatar Julian Heinze
Browse files

introduce subdomain

parent b7e6e4cc
No related branches found
No related tags found
1 merge request!240feflowlib: rename boundary conditions to subdomains
...@@ -56,7 +56,7 @@ class FeflowModel: ...@@ -56,7 +56,7 @@ class FeflowModel:
self.mesh = convert_properties_mesh(self._doc) self.mesh = convert_properties_mesh(self._doc)
self.dimension = self._doc.getNumberOfDimensions() self.dimension = self._doc.getNumberOfDimensions()
self.setup_prj() # _project object with default values is initialized here self.setup_prj() # _project object with default values is initialized here
self._init_boundary_conditions() self._init_subdomains()
self._mesh_saving_needed = True self._mesh_saving_needed = True
@property @property
...@@ -72,7 +72,7 @@ class FeflowModel: ...@@ -72,7 +72,7 @@ class FeflowModel:
bulk_mesh["MaterialIDs"] = self.mesh["MaterialIDs"] bulk_mesh["MaterialIDs"] = self.mesh["MaterialIDs"]
return bulk_mesh return bulk_mesh
def _init_boundary_conditions(self) -> None: def _init_subdomains(self) -> None:
""" """
The boundary meshes for a ogs model. The boundary meshes for a ogs model.
...@@ -80,9 +80,7 @@ class FeflowModel: ...@@ -80,9 +80,7 @@ class FeflowModel:
""" """
# ToDo: Introduce this behaviour to feflowlib.tools with a type. # ToDo: Introduce this behaviour to feflowlib.tools with a type.
# And return type of name for cell and pt BC should be the same not possix Path... # And return type of name for cell and pt BC should be the same not possix Path...
_boundary_conditions = _tools.extract_point_boundary_conditions( _subdomains = _tools.extract_point_boundary_conditions(self.mesh)
self.mesh
)
if self.dimension == 3 and ( if self.dimension == 3 and (
( (
...@@ -98,11 +96,9 @@ class FeflowModel: ...@@ -98,11 +96,9 @@ class FeflowModel:
cell_bc_path, cell_bc_path,
cell_bc_mesh, cell_bc_mesh,
) = _tools.extract_cell_boundary_conditions(self.mesh) ) = _tools.extract_cell_boundary_conditions(self.mesh)
_boundary_conditions[cell_bc_path] = cell_bc_mesh _subdomains[cell_bc_path] = cell_bc_mesh
self.boundary_conditions: dict[ self.subdomains: dict[str, pv.UnstructuredGrid] = _subdomains
str, pv.UnstructuredGrid
] = _boundary_conditions
@property @property
def process(self) -> str: def process(self) -> str:
...@@ -250,19 +246,19 @@ class FeflowModel: ...@@ -250,19 +246,19 @@ class FeflowModel:
Save the converted FEFLOW model. Saves the meshes only if they have not been saved previously. Save the converted FEFLOW model. Saves the meshes only if they have not been saved previously.
or 'force_saving' is true. or 'force_saving' is true.
:param output_path: The path where the mesh, boundary meshes and project file will be written. :param output_path: The path where the mesh, subdomains and project file will be written.
""" """
if output_path is None: if output_path is None:
output_path = self.mesh_path output_path = self.mesh_path
self.project.write_input(prjfile_path=output_path.with_suffix(".prj")) self.project.write_input(prjfile_path=output_path.with_suffix(".prj"))
if self._mesh_saving_needed or force_saving: if self._mesh_saving_needed or force_saving:
self.mesh.save(output_path.with_suffix(".vtu")) self.mesh.save(output_path.with_suffix(".vtu"))
for name, boundary_mesh in self.boundary_conditions.items(): for name, subdomain in self.subdomains.items():
boundary_mesh.save(output_path.parent / (name + ".vtu")) subdomain.save(output_path.parent / (name + ".vtu"))
self._mesh_saving_needed = False self._mesh_saving_needed = False
else: else:
logger.info( logger.info(
"The mesh and boundary meshes have already been saved. As no changes have been detected, saving of the mesh is skipped. The project file is saved (again)." "The mesh and subdomains have already been saved. As no changes have been detected, saving of the mesh is skipped. The project file is saved (again)."
) )
def run( def run(
...@@ -271,7 +267,7 @@ class FeflowModel: ...@@ -271,7 +267,7 @@ class FeflowModel:
""" """
Run the converted FEFLOW model. Run the converted FEFLOW model.
:param output_path: The path where the mesh, boundary meshes and project file will be written. :param output_path: The path where the mesh, subdomains and project file will be written.
""" """
self.save(output_path, overwrite) self.save(output_path, overwrite)
self.project.run_model() self.project.run_model()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment