• Re: Leakage BCs in large-scale models: leakGRM

    Please contact Bernhard Becker:

    Bernhard Becker, RWTH Aachen,
    Institut für Wasserbau und
    Wasserwirtschaft,
    b.becker@iww.rwth-aachen.de
  • Re: Re: setPowerPoint

    Scripts are not required to develop a plugin. If you want to develop plugins using the FEFLOW API (IFM) you need to code in C/C++ and compile. Use the compiled file as a plugin within FEFLOW as you also would do with the existing VaryingBC plugin. Use the Plugin panel: http://www.feflow.info/html/help71/feflow/mainpage.htm#t=14_References%2FGUI%2FPanels%2Fpanel_plugins.html
  • Re: IfmUpdateDisplay

    A reference is provided here: http://www.feflow.info/html/help71/feflow/mainpage.htm#t=13_Programming%2FIFM%2Fifm_constants.htm
  • Re: IfmUpdateDisplay

    Please find a snippet below illustrating the usage. The script has not been carefully tested. Accordingly, I cannot give any warranty that the script is working properly.

    [font=courier][color=blue]
    This script shows how to use time-dependent material properties
    ### Time-dependent material properties will be stored within a dac-file
    ### In this example an artificial groundwater recharge is assigned
    ### which varies in time and in space
    ### Requirement: math module
    ### Assumption layered based model

    import sys
    import os
    import math
    sys.path.append('C:\\Program Files\\DHI\\2017\\FEFLOW 7.1\\bin64')
    import ifm


    def preTimeStep(d):
    global nElements, nDimensions
    t = doc.getAbsoluteSimulationTime()
    print >> sys.stdout, t
    e0 = int(math.floor(t))
    x0 = doc.getX(e0)
    y0 = doc.getY(e0)

    for nElement in range(0, nElements):
    x = doc.getX(nElement)
    y = doc.getY(nElement)
    doc.setMatFlowSinkSource(nElement, t*math.hypot(x-x0,y-y0))

    try:
    # Get current working directory
    dir = os.getcwd()

    # Definition of files
    FEM_FILE = dir + "\\..\\femdata\\AssignTimeDependentMaterial.fem"
    FEM_FILE__id_OUT = dir + "\\..\\results\\AssignTimeDependentMaterial_id.dac"

    # Load document
    doc = ifm.loadDocument(FEM_FILE)

    # Get number of elements
    nElements = doc.getNumberOfElementsPerLayer()

    # Set parameter ID
    ParamID = 107  #ID for In/outflow on top or bottom for 3D

    if nDimensions == 2:
    print >> sys.stdout, "The groundwater recharge is only represented by the source/sink parameter in 2D models."
    print >> sys.stdout, "Use paremeter ID 113 for In/outflow on top/bottom and impose the elements."

    if nDimensions == 3:

    # Allow parameter recording
    ParaMeterRec = 1  # 0 = no recording, 1 = recording

    # Enable parameter recording for groundwater recharge
    doc.enableParamRecording(ParamID, ParaMeterRec)

    # Start Simulator
    doc.startSimulator(FEM_FILE__id_OUT)

    # Strop Simulator
    doc.stopSimulator()

    except Exception as err:
    sys.exit(-1);
    [/color][/font]
  • Re: Is Node in Node Selection?

    Please find a snippet below illustrating the usage. The script has not been carefully tested. Accordingly, I cannot give any warranty that the script is working properly.

    [color=blue][font=courier]
    import sys, os
    sys.path.append('C:\\Program Files\\DHI\\2017\\FEFLOW 7.1\\bin64')
    import ifm

    try:
        def no_selection(n_selections):
            assert (n_selections != 0),"No selections are available"

        cwd = os.getcwd()
        FEM_FILE_in = cwd + "\\..\\femdata\\box.fem"
        FEM_FILE_out = cwd + "\\..\\femdata\\box_out.fem"


        doc = ifm.loadDocument(FEM_FILE_in)
        sel_type=1 # nodal=0, elemental=1
        n_selections = doc.getNumberOfSelections(sel_type)
        n_elements = doc.getNumberOfElements()
        n_dimensions=doc.getNumberOfDimensions()
        new_selection_id = 0

        if n_selections == 0:
            print no_selection(n_selections)

        print "FEM_FILE in: " + FEM_FILE_in
        print "FEM_FILE in: " + FEM_FILE_out
        print "Number of selections: " + str(n_selections)
        print "Available selections:"
        for selection in range(0,n_selections-1):
            print " ", doc.getSelectionName(sel_type,selection)

        selection_members_list_all = []

        for selection in range(0, n_selections):
            selection_members_list_current = []
            for element_id in range(0, n_elements):

                if doc.selectionItemIsSet(sel_type, selection, element_id) == 1:
                    selection_members_list_current.append(element_id)

            selection_members_list_all.append(selection_members_list_current)

        # Make selection sets
        selection_set_list = []
        for i in range(0, n_selections):
            selection_set_list.append(set(selection_members_list_all[i]))

        # Intersect two selections
        for selection in range(0,n_selections-1):

            name_new_selection = "INTERSECT_" + str(doc.getSelectionName(sel_type, selection)) + "_" + str(doc.getSelectionName(sel_type, selection + 1))
            doc.createSelection(sel_type, name_new_selection)
            selection_members_list_current =  list(selection_set_list[selection].intersection(selection_set_list[selection+1]))

            new_selection_id = doc.findSelection(sel_type, name_new_selection)

            for element in range(0, n_elements):
                if element in selection_members_list_current:
                    doc.setSelectionItem(sel_type, new_selection_id, element)

        # Union two selections
        for selection in range(0, n_selections - 1):

            name_new_selection = "UNION_" + str(doc.getSelectionName(sel_type, selection)) + "_" + str(doc.getSelectionName(sel_type, selection + 1))
            doc.createSelection(sel_type, name_new_selection)
            selection_members_list_current = list(selection_set_list[selection].union(selection_set_list[selection + 1]))

            new_selection_id = doc.findSelection(sel_type, name_new_selection)

            for element in range(0, n_elements):
                if element in selection_members_list_current:
                    doc.setSelectionItem(sel_type, new_selection_id, element)

        # Difference between selection i and i-1
        for selection in range(0, n_selections - 1):

            name_new_selection = "DIFFERENCE_" + str(doc.getSelectionName(sel_type, selection)) + "_" + str(doc.getSelectionName(sel_type, selection + 1))
            doc.createSelection(sel_type, name_new_selection)
            selection_members_list_current = list(
                selection_set_list[selection].difference(selection_set_list[selection + 1]))

            new_selection_id = doc.findSelection(sel_type, name_new_selection)

            for element in range(0, n_elements):
                if element in selection_members_list_current:
                    doc.setSelectionItem(sel_type, new_selection_id, element)

        # Symmetric difference of two selections in two directions
        for selection in range(0, n_selections - 1):

            name_new_selection = "SYMMETRIC_DIFFERENCE_" + str(doc.getSelectionName(sel_type, selection)) + "_" + str(
                doc.getSelectionName(sel_type, selection + 1))
            doc.createSelection(sel_type, name_new_selection)
            selection_members_list_current = list(
                selection_set_list[selection].symmetric_difference(selection_set_list[selection + 1]))

            new_selection_id = doc.findSelection(sel_type, name_new_selection)

            for element in range(0, n_elements):
                if element in selection_members_list_current:
                    doc.setSelectionItem(sel_type, new_selection_id, element)

        # Save new fem file with new selection sets
        doc.saveDocument(FEM_FILE_out)

    except Exception as err:
    print >> sys.stderr, 'Error: ' + str(err) + '!'
    sys.exit(-1);
    [/font][/color]

  • Re: FePEST and Porosity

    It's difficult to give recommendations without knowing the details of the model. I suggest to contact the FEFLOW Support: https://www.mikepoweredbydhi.com/support
  • Re: 3d printing

    At the moment, FEFLOW does not allow the export of *.obj and *.stl file formats. Reading routines for pre-processing are available.
  • Re: Time-step size

    It's difficult to give recommendations without knowing the details of the model. I suggest to contact the FEFLOW Support: https://www.mikepoweredbydhi.com/support
  • Re: setPowerPoint

    The name convention of power-related API functions are slightly different in Python. Please find a small snippet below illustrating the usage. The script has not been carefully tested.

    [font=courier][color=blue]
    import sys, os
    sys.path.append('C:\\Program Files\\DHI\\2017\\FEFLOW 7.1\\bin64')
    import ifm
    import pandas as pd

    try:
        #Get current working directory
        cwd = os.getcwd()

        #Definition of files
        FEM_FILE_IN = cwd + "\\..\\femdata\\feflow_file.fem"
        FEM_FILE_OUT = cwd + "\\..\\femdata\\feflow_file_OUT.fem"
        TS_FILE = cwd + "\\..\\import+export\\TS_IN.csv"

        print "Input: " + FEM_FILE_IN
        print "Output: " + FEM_FILE_OUT
        print "Input TS: " + TS_FILE

        #Read TS-file and create new Data Frame
        if TS_FILE.endswith(".xlsx"):
            df=pd.read_excel(TS_FILE)
        elif TS_FILE.endswith(".csv"):
            df=pd.read_table(TS_FILE, sep=";")

        #Load FEFLOW document
        doc=ifm.loadDocument(FEM_FILE_IN)

        #Loop through columns in Data Frame
        for nPOWID, column in enumerate(df):

            if nPOWID > 0:
                #Make new TS
                doc.powerCreateCurve(nPOWID)

                #Set type of interpolation: ConstantSteps=1, Linear=2, AKIMA1=3, AKIMA2=4
                InterpolationKind=2
                doc.powerSetInterpolationKind(nPOWID,InterpolationKind)

                #Set power mode: Linear=0, Cyclic=1 (cyclic must have identical start and end values)
                PowerMode=0
                doc.powerSetCyclic(nPOWID,PowerMode)

                #Get time and value by looping through row of each column
                for index_val, series_val in df[column].iteritems():
                    time = df.Time[index_val]
                    doc.powerSetPoint(nPOWID, time, series_val)
                    doc.powerSetComment(nPOWID, column)
                   
        #Save FEFLOW document
        doc.saveDocument(FEM_FILE_OUT)

    except Exception as err:
        print>>sys.stderr,'Error: '+str(err)+'!'
        sys.exit(-1);
    [/color][/font]

  • Re: parameter zone

    After you edited and saved the fem-file you need to refresh by clicking on Edit and then on Reload FEM file...