Forum_general

General

At this page you can post questions or start discussions on general topics related to Delft3D Flexible Mesh.

Please select a proper category below (if possible), to post your message or reply to an existing post. Please add tags to your posts to simplify searching.

 

** PLEASE TAG YOUR POST! **

 

 

 

 


Message Boards

Dflow-FM with python (errors!)

SB
Seungjin Baek, modified 2 Years ago.

Dflow-FM with python (errors!)

Youngling Posts: 1 Join Date: 4/24/12 Recent Posts
Dear Community,

I've been following https://www.youtube.com/watch?v=m1il4xm2ZRQ (python scripting using D-Flow FM).
Everything works fine, but I have encountered a couple of errors that I can't fix.

1) It's setting up the initial condition and 'InterpolateSamplePoints' does not work.
# Add sample points to initial water level

from Libraries.SpatialOperations import *
samplePoints = AddSamplePoints(fmModel, fmModel.InitialWaterLevel, measuredWaterLevels, subsetName = "subset water level measurements", sampleOperationName = "measurements 1-Jan-2012")
InterpolateSamplePoints(samplePoints[0], samplePoints[1], interpName ="Interpolated water level measurements")


It's setting up the initial condition and 'InterpolateSamplePoints' does not work.

2) setting up time parameters does NOT work.I checked the variable 'timeStep' and verified they are correctly assigned values, but it seems 'SetModelProperty' is not properly setting up the parameters.

# Model parameters
# set model max and initial timestep size
timeStep = timedelta(hours=1)

SetModelProperty(fmModel, KnownProperties.DtMax, str(timeStep.total_seconds()))
SetModelProperty(fmModel, KnownProperties.DtInit, str(timeStep.total_seconds()))


Any help would be appreciated.
thanks.
MK
Michal Kleczek, modified 2 Years ago.

RE: Dflow-FM with python (errors!)

Padawan Posts: 53 Join Date: 10/23/14 Recent Posts
Dear Seungjin

Concerning your first issue, spatial operations did not/do not work properly in the Delft3D FM 1.3.2. There were apparently some framework issues, hence via Python it could not be used either. Note there is a new Beta-release Delft3D FM 1.3.4 where Spatial Operations were fixed and should work properly.

In reference to the second issue you have reported, have you tried to switch off and on your active model? I mean to close the tab FlowFM, which you have likely opened in your main window, and then reopen it again by double clicking on the model name (in this case FlowFM). You should then go again to the Time Frame and see updated values. Please let me know if it worked for you.
Unfortunately, at this point DeltaShell does not refresh the view when values are changed via Python.

Kind regards,
Michal
SB
Seungjin Baek, modified 2 Years ago.

RE: Dflow-FM with python (errors!)

Youngling Posts: 3 Join Date: 8/29/17 Recent Posts
Much appreciated!
I will try and see if that works. Thanks again.

Michal Kleczek:
Dear Seungjin

Concerning your first issue, spatial operations did not/do not work properly in the Delft3D FM 1.3.2. There were apparently some framework issues, hence via Python it could not be used either. Note there is a new Beta-release Delft3D FM 1.3.4 where Spatial Operations were fixed and should work properly.

In reference to the second issue you have reported, have you tried to switch off and on your active model? I mean to close the tab FlowFM, which you have likely opened in your main window, and then reopen it again by double clicking on the model name (in this case FlowFM). You should then go again to the Time Frame and see updated values. Please let me know if it worked for you.
Unfortunately, at this point DeltaShell does not refresh the view when values are changed via Python.

Kind regards,
Michal