geolib.models.dgeoflow.dgeoflow_model

Classes

DGeoFlowModel(*args, **data)

D-Geoflow is software for soft soil piping calculations.

DGeoFlowObject(**data)

class geolib.models.dgeoflow.dgeoflow_model.DGeoFlowModel(*args, **data)

D-Geoflow is software for soft soil piping calculations.

This model can read, modify and create .flox files

add_boundary_condition(points, head_level, label='', notes='', scenario_id=None)

Add boundary conditions to the model

Parameters:
  • points (List[Point]) – list of Point classes, in clockwise order (non closed simple polygon)

  • head_level (float) – level of the hydraulic head for the boundary condition

  • label (str) – label defaults to empty string

  • notes (str) – notes defaults to empty string

  • scenario_id (int) – scenario to add to, defaults to 0

Returns:

id of the boundary conditions collection

Return type:

int

add_calculation(scenario_index=None, label='Calculation', notes='', set_current=True)

Add a new calculation to the model.

Parameters:
  • scenario_index (Optional[int]) – The scenario index to add the calculation to, defaults to the current scenario.

  • label (str) – Label for the calculation.

  • notes (str) – Notes for the calculation.

  • set_current (bool) – Whether to make the new calculation the current calculation.

Return type:

int

Returns:

the id of the new stage

add_layer(points, soil_code, label='', notes='', scenario_id=None)

Add a soil layer to the model

Parameters:
  • points (List[Point]) – list of Point classes, in clockwise order (non closed simple polygon)

  • soil_code (str) – code of the soil for this layer

  • label (str) – label defaults to empty string

  • notes (str) – notes defaults to empty string

  • scenario_id (int) – scenario to add to, defaults to 0

Returns:

id of the added layer

Return type:

int

add_meshproperties(element_size=1.0, label='', scenario_id=None, layer_id=None)

Add a mesh properties to the model

Parameters:
  • element_size (float) – size of the mesh elements for the discretization, defaults to 1.0

  • scenario_id (int) – scenario to add to, defaults to 0

  • layer_id (int) – layer to add to

  • label (str)

Returns:

id of the added meshproperties collection

Return type:

int

add_scenario(label='Scenario', notes='', set_current=True)

Add a new scenario to the model.

Parameters:
  • label (str) – Label for the scenario.

  • notes (str) – Notes for the scenario.

  • set_current (bool) – Whether to make the new scenario the current scenario.

Return type:

int

Returns:

the id of the new stage

add_soil(soil)

Add a new soil to the model. The code must be unique, the id will be generated

Parameters:

soil (Soil) – a new soil

Returns:

id of the added soil

Return type:

int

add_stage(scenario_index=None, label='Stage', notes='', set_current=True)

Add a new stage to the model at the given scenario index.

Parameters:
  • scenario_index (Optional[int]) – The scenario index to add the stage to, defaults to the current scenario.

  • label (str) – Label for the stage.

  • notes (str) – Notes for the stage.

  • set_current – Whether to make the new stage the current stage.

Return type:

int

Returns:

the id of the new stage

property console_flags_post: List[str]
current_calculation_index: int
current_id: int
current_scenario: int
current_scenario_index: int
current_stage_index: int
property custom_console_path: Path
datastructure: DGeoFlowStructure

This is the base class for all models in GEOLib.

Note that datastructure is a SerializeAsAny type, which means that the inheriting class is serialized according to its own definition (duck-typing). This is needed since Pydantic v2 as the default behavior has changed: https://docs.pydantic.dev/latest/concepts/serialization/#subclass-instances-for-fields-of-basemodel-dataclasses-typeddict

property default_console_path: Path
edit_soil(code, **kwargs)

Edit an existing soil with parameter names based on the soil class members

Parameters:
  • code (str) – the code of the soil

  • kwargs (dict) – the parameters and new values for example ‘cohesion=2.0, friction_angle=25.0’

Returns:

the edited soil

Return type:

PersistableSoil

edit_soil_by_name(name, **kwargs)

Edit an existing soil with parameter names based on the soil class members

Parameters:
  • name (str) – the name of the soil

  • kwargs (dict) – the parameters and new values for example ‘cohesion=2.0, friction_angle=25.0’

Returns:

the edited soil

Return type:

PersistableSoil

get_layer(scenario_id, layer_id)

Enables easy access to the soil in the internal dict-like datastructure. Also enables edit/delete for individual soils.

Parameters:
  • scenario_id (int)

  • layer_id (int)

Return type:

PersistableSoilLayer

get_result(scenario_index, calculation_index)

Returns the results of a scenario. Calculation results are based on analysis type and calculation type.

Parameters:
  • scenario_index (int) – Index of a scenario.

  • calculation_index (int) – Index of a calculation.

Returns:

Dictionary containing the analysis results of the scenario.

Return type:

dict

Raises:

ValueError – No results or calculationsettings available

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'current_calculation_index': FieldInfo(annotation=int, required=False, default=0), 'current_id': FieldInfo(annotation=int, required=False, default=-1), 'current_scenario': FieldInfo(annotation=int, required=False, default=-1), 'current_scenario_index': FieldInfo(annotation=int, required=False, default=0), 'current_stage_index': FieldInfo(annotation=int, required=False, default=0), 'datastructure': FieldInfo(annotation=DGeoFlowStructure, required=False, default=DGeoFlowStructure(soillayers=[SoilLayerCollection(ContentVersion='2', Id='14', SoilLayers=[])], soils=SoilCollection(ContentVersion='2', Soils=[PersistableSoil(Code='H_Aa_ht_new', Id='2', Name='Embankment new', Notes='', HorizontalPermeability=0.01, VerticalPermeability=0.01), PersistableSoil(Code='H_Aa_ht_old', Id='3', Name='Embankment old', Notes='', HorizontalPermeability=0.01, VerticalPermeability=0.01), PersistableSoil(Code='H_Rk_k_shallow', Id='4', Name='Clay, shallow', Notes='', HorizontalPermeability=0.01, VerticalPermeability=0.01), PersistableSoil(Code='H_Rk_k_deep', Id='5', Name='Clay, deep', Notes='', HorizontalPermeability=0.01, VerticalPermeability=0.01), PersistableSoil(Code='H_Rk_ko', Id='6', Name='Organic clay', Notes='', HorizontalPermeability=0.01, VerticalPermeability=0.01), PersistableSoil(Code='H_vhv_v', Id='7', Name='Peat, shallow', Notes='', HorizontalPermeability=0.01, VerticalPermeability=0.01), PersistableSoil(Code='H_vbv_v', Id='8', Name='Peat, deep', Notes='', HorizontalPermeability=0.01, VerticalPermeability=0.01), PersistableSoil(Code='Sand', Id='9', Name='Sand', Notes='', HorizontalPermeability=30.0, VerticalPermeability=30.0), PersistableSoil(Code='P_Rk_k&s', Id='10', Name='Clay with silt', Notes='', HorizontalPermeability=0.1, VerticalPermeability=0.1), PersistableSoil(Code='H_Ro_z&k', Id='11', Name='Sand with clay', Notes='', HorizontalPermeability=1.0, VerticalPermeability=1.0), PersistableSoil(Code='Sand, less permeable', Id='12', Name='Sand, less permeable', Notes='', HorizontalPermeability=15.0, VerticalPermeability=15.0), PersistableSoil(Code='Sand, permeable', Id='13', Name='Sand, permeable', Notes='', HorizontalPermeability=45.0, VerticalPermeability=45.0)]), soilvisualizations=SoilVisualisation(ContentVersion='2', SoilVisualizations=[]), projectinfo=ProjectInfo(Analyst='', ApplicationCreated='', ApplicationModified='', ContentVersion='2', Created=datetime.date(2024, 9, 10), CrossSection='', Date=datetime.date(2024, 9, 10), IsDataValidated=False, LastModified=datetime.date(2024, 9, 10), LastModifier='GEOLib', Path='', Project='', Remarks='Created with GEOLib 2.5.0'), geometries=[Geometry(ContentVersion='2', Id='1', Layers=[])], boundary_conditions=[BoundaryConditionCollection(ContentVersion='2', Id='15', BoundaryConditions=[])], scenarios=[Scenario(ContentVersion='2', Id='0', Label='Scenario 1', Notes=None, GeometryId='1', SoilLayersId='14', Stages=[PersistableStage(Label='Stage 1', Notes=None, BoundaryConditionCollectionId='15')], Calculations=[PersistableCalculation(Label='Calculation 1', Notes=None, CalculationType=<CalculationTypeEnum.GROUNDWATER_FLOW: 'GroundwaterFlow'>, CriticalHeadId=None, CriticalHeadSearchSpace=PersistableCriticalHeadSearchSpace(MinimumHeadLevel=0.0, MaximumHeadLevel=1.0, StepSize=0.1), PipeTrajectory=None, MeshPropertiesId='16', ResultsId=None)])], mesh_properties=[MeshProperty(ContentVersion='2', Id='16', MeshProperties=[])], groundwater_flow_results=[], pipe_length_results=[], critical_head_results=[])), 'filename': FieldInfo(annotation=Union[Path, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

property output: GroundwaterFlowResult | PipeLengthResult | CriticalHeadResult

Access internal dict-like datastructure of the output.

Requires a successful execute.

parse(*args, **kwargs)

Parse input or outputfile to Model, depending on extension.

property parser_provider_type: Type[DGeoFlowParserProvider]

Returns the parser provider type of the current concrete class.

Raises:

NotImplementedError – If not implemented in the concrete class.

Returns:

Type[BaseParserProvider] – Concrete parser provider.

property points

Enables easy access to the points in the internal dict-like datastructure. Also enables edit/delete for individual points.

property scenarios: List[Scenario]
serialize(location)

Support serializing to directory while developing for debugging purposes.

Parameters:

location (Union[Path, BinaryIO])

set_calculation_type(scenario_index=0, calculation_index=0, calculation_type=CalculationTypeEnum.GROUNDWATER_FLOW)

Sets the calculation type of a calculation.

Parameters:
  • scenario_index (int) – The scenario index to add to, defaults to 0.

  • calculation_index (int) – The calculation index to add to, defaults to 0.

  • calculation_type (CalculationTypeEnum) – The calculation type, defaults to GROUNDWATER_FLOW.

Return type:

None

set_critical_head_boundary_condition(scenario_index=0, calculation_index=0, boundary_condition_id=None)

Sets the critical head boundary condition for a calculation.

Parameters:
  • scenario_index (int) – The scenario index to add to, defaults to 0.

  • calculation_index (int) – The calculation index to add to, defaults to 0.

  • boundary_condition_id (int) – The id of the critical head boundary condition.

Return type:

None

set_critical_head_search_parameters(scenario_index=0, calculation_index=0, minimum_head_level=0, maximum_head_level=1, step_size=0.1)

Sets the critical head search parameters condition for a calculation.

Parameters:
  • scenario_index (int) – The scenario index to add to, defaults to 0.

  • calculation_index (int) – The calculation index to add to, defaults to 0.

  • minimum_head_level (float) – The minimum head level to search at, defaults to 0.

  • maximum_head_level (float) – The maximum head level to search at, defaults to 1.

  • step_size (float) – The step size to search with, defaults to 0.1.

Return type:

None

set_pipe_trajectory(scenario_index=0, calculation_index=0, pipe_trajectory=None)

Sets the pipe trajectory for a calculation.

Parameters:
  • scenario_index (int) – The scenario index to add to, defaults to 0.

  • calculation_index (int) – The calculation index to add to, defaults to 0.

  • pipe_trajectory (PipeTrajectory) – The pipe trajectory.

Return type:

None

property soils: SoilCollection

Enables easy access to the soil in the internal dict-like datastructure. Also enables edit/delete for individual soils.

class geolib.models.dgeoflow.dgeoflow_model.DGeoFlowObject(**data)
Parameters:

data (Any)

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'datastructure': FieldInfo(annotation=Union[Annotated[BaseModelStructure, SerializeAsAny], NoneType], required=False, default=None), 'filename': FieldInfo(annotation=Union[Path, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.