• Re: FEFLIOW 7.0 - Cannot find 'new functions for selection handling'


    I just learned today how to use IFM commands for selections on C++. As Björn explained you have to use a loop to visit all the items (elements or nodes) contained in a selection. I put here an example for a selection of elements. Code is in blue.

    1) Create a node selection in FEFLOW GUI and name it, i.e. "swamp". The plug-in needs to find which is the index of selection named "swamp". It is stored on variable int_sel_index

    [color=blue]int elem_sel_index = IfmFindSelection(pDoc, IfmSEL_ELEMENTAL, "swamp"); [/color]

    2) Then, ask FEFLOW the maximum possible capacity of an element selection:

    [color=blue]long number_of_elements = IfmGetSelectionCapacity(pDoc, IfmSEL_ELEMENTAL);[/color]

    3) Create an array (vector) where the element indexes that belong to "swamp" will be stored:

    [color=blue]std::vector<long> elem_indexes; [/color]

    Next comes the loop. I use more lines than necessary to show explicitly how it works. 4.1)  The FOR loop visits every element in the model. 4.2) IfmSelectionItemIsSet asks to the element with index = elem_counter if it belongs to selection elem_sel_index. If the element is in the selection the output if 1, if not it's 0. This value is stored on variable "belongs". 4.3) If the variable belongs is equal to one (element is in selection) the element index is stored in the array using the push.back function. When the loop ends the array named elem_indexes contains all the element indexes that belong to selection "swamp" created on FEFLOW GUI.

    [color=blue]for (long elem_counter=0; elem_counter < number_of_elements; elem_counter++)                              // 4.1
          int belongs = IfmSelectionItemIsSet(pDoc, IfmSEL_ELEMENTAL,elem_sel_index,elem_counter);    // 4.2
          if (belongs == 1){ elem_indexes.push_back(elem_counter); }                                                    // 4.3

    4) For example, if element selection "elem_indexes" is used to set K = 10 meters/day, another loop is used.

    [color=blue]long elem_indexes_length = static_cast<int>(elem_indexes.size());
    for (int n = 0; n < elem_indexes_length;n++)

        IfmSetMatConductivityValue2D(pDoc, elem_indexes[n], 10);
  • Re: IfmUpdateDisplay

    I think IfmUpdateDisplay only worked in the old Motif user interface. It does not trigger a display update since the new Qt GUI is used.
  • Re: Horizontally moving shoreline

    Yes, it works. I'm actually using it right now - not for moving shoreline, but for a river that goes dry parts of the year in some sections.
  • Re: Feflow 7 - Set up 2D rectangular grid of exact measurements, then make it 3D?

    This depends on the version you're using. Up to 6.2 you'll find an input box in the Mesh Generator toolbar - this is for the proposed number of elements. From 7.0 on, the whole meshing process is done via the new Meshing Panel. There you click on the entry for the respective superelement (your polygon) and enter the number of elements in the settings for the polygon.
  • Re: Horizontally moving shoreline

    There might be even an option without a plug-in: If the river bottom is implemented as a minimum-head constraint for the transfer BC, in the lastest FEFLOW versions (from patch 8 for FEFLOW 7.0), the transfer BC is internally turned off in case that the BC value (river water level) is below the minimum-head constraint (river bed elevation). With this, you can simulate a varying shoreline by simply using time-varying conditions for the water level in connection with a constraint representing the river bottom.
  • Re: Feflow 7 - Set up 2D rectangular grid of exact measurements, then make it 3D?

    For the supermesh, digitize a rectangular box of 1000x100 m. You can do this by activating the polygon option, hitting F2 and typing the coordinates for each corner node. Then switch to 'Quadrilateral mode' in the Supermesh menu and use the 'Transport Mapping' mesh generation algorithm in the Meshing panel with a number of 100000 elements. This will give you the first grid. For later refinement to half-meter elements, select all elements and click 'refine' in the Mesh Geometry toolbar.

    In FEFLOW which is primarily focused on flexible-mesh modelling, the generation of a rectangular grid is a rarely used 'special case' - thus the procedure might be less obvious thanin VM or GV where rectangular grids are (still) the standard.
  • Re: problems importing Observation Points

    The error bars to be drawn in the view require that a confidence interval is defined. Maybe during importing, you import the values, but forget to set or import values for the confidence interval.
  • Re: Node fixing

    Yes, smoothing only affects the selected nodes when a node selection is active.
  • Re: Getting Time step length during PreTimeStep callback

    Hi Eduardo,

    I think the reason is the following (without testing or looking at the actual FEFLOW code):
    OnTimeStepConstraint is called whenever a new time step length is determined. With the predictor-corrector scheme, it may happen that a step is calculated, but the result rejected due to a too large deviation from the previous one. In this case, a new time step length will be set, and OnTimeStepConstraint will be called again. I assume that at this time, the values you get via IfmGetResultsFlowHeadValue are the results of the previous rejected step.

  • Re: Finding time step length on PreTimeStep call back

    Hi Eduardo,

    The actual time step length can only be determined in the OnTimeStepConstraint callback, which might be called several times in a time step. FEFLOW itself cannot know what the final length of a time step will be before it is calculated as - using the predictor-corrector scheme - the simulation may be carried out several times with different time step sizes before actually accepting the result. PreTimeStep will only be called once, so it will not be useful for you. OnTimeStepConstraint, however, is called before the time step is actually simulated, so this should be where you actually put your code. Keep in mind, though, that it may be called several times before FEFLOW proceeds to the next step.


    PS: Merged your two topics.