Posted Fri, 13 Jan 2017 23:51:00 GMT by adacovsk
Hi,

Just curious how I can use IfmUpdateDisplay in a callback so that I can see updates to the mesh. Currently I have to reload the file in order for the display to update, and I would rather update it during the simulation so the user can see changes to the geometry. I've attached an example of what the plug-in does. Not sure how to pass IfmModule pMod in a callback??

Thanks,

Adam
Posted Wed, 25 Jan 2017 06:45:04 GMT by Denim Umeshkumar Anajwala
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.
Posted Tue, 31 Jan 2017 22:35:17 GMT by adacovsk
Thanks Peter. Is there another way of going about updating the display?
Posted Mon, 06 Feb 2017 10:09:35 GMT by Björn Kaiser
An update of the display should be automatically triggered as soon you went through a callback. If it does not work please let me know the name of the callback you are using. Thank you in advance.
Posted Mon, 13 Mar 2017 20:08:58 GMT by adacovsk
void CTmaDevelopmentV2::PreTimeStep (IfmDocument pDoc) with IfmSetZ

While the elevation values are updated (also the continuous, fringe, and isolines), but not the actual 3d graphics

Thanks,

Adam
Posted Tue, 14 Mar 2017 11:39:41 GMT by Björn Kaiser
Thanks for the note, Adam. I was able to reproduce your observation. For me it seems to be a bug. I will let you know as soon as possible about any updates.
Posted Tue, 14 Mar 2017 12:31:30 GMT by Björn Kaiser
The bug has been confirmed by the development which will be fixed with the next Update. Please let me know if you need a hotfix. In this context, the display update for geometry changes will only work in the callback PostTimeStep. This is intended to reduce overhead during the numerical simulations.
Posted Tue, 14 Mar 2017 20:04:32 GMT by adacovsk
I see, makes sense. No need for a hotfix.

I was just curious if I could call an update myself to keep overhead low: I would be concerned if it updated the geometry after every IfmSetZ since I am making lots of geometry changes each PreTimeStep.

If I am understanding correctly, I should call PostTimeStep and it will automatically update the geometry? If so, this solves my issue. Obviously, updating during both Pre and PostTimeStep would not be ideal

Thanks,

Adam
Posted Wed, 15 Mar 2017 07:56:11 GMT by Björn Kaiser
Thanks Adam. Yes that's correct, if you call PostTimeStep the geometry will be updated.
Posted Thu, 11 May 2017 07:03:12 GMT by Björn Kaiser
Hi Adam,

Good news. FEFLOW 7.1 has a new API function which allows you to record time-dependent parameters in a dac-file: [font=courier][color=blue]IfmEnableParamRecording()[/color][/font]. The FEFLOW help provides a table with parameters. Each parameter with a prefix [font=courier][color=blue]P_[/color][/font] is recordable. Accordingly, your parameter of interest is [font=courier][color=blue]P_ELEV[/color][/font]

I think this is exactly what you are looking for.

Cheers
Björn
Posted Mon, 15 May 2017 20:07:02 GMT by adacovsk
Hehe, I don't think it's quite what I was looking for (maybe I'm wrong), but this is interesting nonetheless and I will likely use it in the future, thank you! I'm actually developing a plug-in that modifies a bunch of different time-dependent parameters that include loading (the big bump in the picture) and consolidation.

Regards,

Adam
Posted Fri, 25 May 2018 07:22:33 GMT by Jarrah Muller Civil Engineer
I can't see any reference to the parameter recording in the API index. Is it documented?
Posted Thu, 21 Jun 2018 14:39:53 GMT by Björn Kaiser
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]
Posted Thu, 21 Jun 2018 14:43:38 GMT by Björn Kaiser
A reference is provided here: http://www.feflow.info/html/help71/feflow/mainpage.htm#t=13_Programming%2FIFM%2Fifm_constants.htm

You must be signed in to post in this forum.