feflowlib - feflow2ogs#
Section author: Julian Heinze (Helmholtz Centre for Environmental Research GmbH - UFZ)
Introduction#
feflowlib can be used as a Python-library to easily access FEFLOW data and prepare it for OGS.
feflow2ogs is the corresponding command line interface that combines the most important feflowlib-functions into a tool.
Together they are referred as FEFLOW-converter, as they allow the conversion of data stored in FEFLOW binary format to VTK format (.vtu) and the preparation of OGS-models.
This converter was developed in the Python language and interacts with the Python API of FEFLOW.
pyvista is used especially for the creation of unstructured grids.
With the usage of ogs6py it is possible to create a prj-file from the converted model to enable simulations with OGS.
At the moment steady state diffusion, liquid flow, hydro thermal and component/mass transport processes are supported to set up the prj-file.
Features#
All in all, the converter can be used to convert steady state diffusion, liquid flow, hydro thermal and component/mass transport models from FEFLOW.
This includes the conversion of the bulk mesh together with the boundary conditions, as well as the creation of the corresponding mesh vtk-files.
In addition, (in)complete prj-files can be created automatically.
The prj-file is set up of a model-specific part and a part that is read from a template and defines the solver and process configuration.
This means that the converter supplies a suggestion for a prj-file, which is not guaranteed
to be working.
The current status enables:
Main features#
- conversion of FEFLOW meshes 
- extraction of boundary condition 
- creation of OGS-models for - steady state diffusion,- liquid flow,- hydro thermaland- component transportprocesses
- usage via command line interface or as Python library 
specific features#
- get point, cells and celltypes to array according to pyvista convention for pyvista.UnstructuredGrid 
- write MaterialIDs to a dictionary 
- write point and cell data with MaterialIDs to dictionaries that match the points and cells of the input data 
- convert only the geometry of input data 
- update the geometry with point and cell data 
- convert the geometry with point and cell data 
- extraction and writing of material specific meshes that represent inhomogeneous material properties 
- prepare FEFLOW data for ogs simulation with tools that allow: - creation of (in)complete - prj-filesfor- OGS- model specific elements refer to mesh, material properties, parameter, boundary conditions 
- templates define the solver, time loop, process, output 
 
- writing of boundary conditions to separate - .vtu-files
 
Data flow chart#
The following diagram shows the data flow that feflowlib is intended to enable.
feflow2ogs summarizes all the necessary features from the feflowlib to allow this data flow.
Requirements#
- Running via Docker 
OR:
- FEFLOW 
- ogstools with feflow ( - pip install ogstools[feflow])
Installation#
The converter requires FEFLOW to be installed. There are different ways to fulfill this requirement, either one installs FEFLOW or works with a Docker container that has FEFLOW installed.
Note
If you use an old version of FEFLOW, make sure it is compatible with Python 3.10, as this is a requirement for using of ogstools and the FEFLOW-converter.
Depending on the Linux distribution used, different steps are possible to install FEFLOW. The DHI supports the installation of FEFLOW on Ubuntu. Instructions for installing from an apt repository can be found on their website. Additionally, the environment variables must be set correctly to find the FEFLOW installation in Python. The following three variables need to be set:
export PYTHONPATH=/opt/feflow/8.0/python
export LD_LIBRARY_PATH=/opt/feflow/8.0/lib64:/opt/feflow/common/qt/lib64:/opt/feflow/common/lib64
export FEFLOW80_ROOT=/opt/feflow/8.0
DHI, the developer of FEFLOW, do not support macOS. So, it is needed to use the Docker container or a virtual machine.
FEFLOW is fully supported on Windows. The installation is according to the official website.
The installation of the FEFLOW converter with ogstools is optional.
The option can be selected with the following pip-command.
pip install ogstools[feflow]
Command line usage#
feflow2ogs is a command line interface of the converter that summarizes the main functions to provide the user with an accessible application.
This tool converts FEFLOW binary files to VTK format.
usage: feflow2ogs [-h] [-i INPUT] [-o OUTPUT]
                  [{geo_surface,geometry,properties,properties_surface,OGS_steady_state_diffusion,OGS_liquid_flow,OGS_hydro_thermal,OGS_component_transport}]
                  [{BC,no_BC}]
Positional Arguments#
- case
- Possible choices: geo_surface, geometry, properties, properties_surface, OGS_steady_state_diffusion, OGS_liquid_flow, OGS_hydro_thermal, OGS_component_transport - Different cases can be chosen for the conversion: 1. “geometry” to convert only the geometries of the mesh. 2. “properties” to convert all the mesh properties to nodes and cells. 3. “surface” to convert only the surface of the mesh. 4. “properties_surface” to convert the surface with properties. 5. “OGS_steady_state_diffusion” to prepare an OGS-project according to a steady state diffusion process. 6. “OGS_liquid_flow” to prepare an OGS-project according to a liquid flow process. 7. “OGS_hydro_thermal” to prepare an OGS-project according to a hydro_thermal process. 8. “OGS_component_transport” to prepare an OGS-project according to a component transport process. - Default: “OGS_steady_state_diffusion” 
- BC
- Possible choices: BC, no_BC - This argument specifies whether the boundary conditions is written. It should only be used if the input data is 3D. The boundary condition need to be extracted, when an OGS simulation wants to be setup. - Default: “BC” 
Named Arguments#
- -i, --input
- The path to the input FEFLOW file. 
- -o, --output
- The path to the output VTK file. 
API usage#
In addition, it may be used as Python package. Further information can be found at: ogstools.feflowlib package.
Example#
Following examples demonstrate the usage of the feflowlib::
