Child pages
  • Create a Delft3D Flexible Mesh model

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


We start by creating a script. In the toolbox tool window on the right, click on the scripting folder ("scripts" ) and select "Add new script". This will add a new script (with the name you provided) to your "scripts" folder and open opens the scripting editor (see Scripting editor overview for more details on the editor). 

To create a new flow flexible mesh model we start by adding the following lines:

Code Block
titleCreating a new FM model
from Libraries.FlowFlexibleMeshFunctions import *

fmModel = WaterFlowFMModel()

In the first line we declare that we want to use a library. The first part "from Libraries.FlowFlexibleMeshFunctions" specifies where the library is located. In this case, it is located in the Libraries folder (under the scripting folder "scripts") in the file The second part, "import *", indicates which functionality functionalities we want to use from this library. An asterisk, in this case, means that all the functionality functionalities contained in the file will be available after importing it. It is also possible to select only some parts using a comma separated list. For example, if you only wanted to use the function WaterFlowFMModel, you could use: "from Libraries.FlowFlexibleMeshFunctions import WaterFlowFMModel".

The second line assigns a new WaterFlowFMModel object instance to the variable fmModel. The FlowFlexibleMeshFunctions library defines how a WaterFlowFMModel object must be constructed.

To run the script select the lines and press CTRL + ENTER. The variable fmModel will then contain an instance of a flow flexible mesh model object. It is usually a good idea to run the import command after you type it in, because this will add the functions and types to the code completion. This will make it easier to create the next lines of code. It will also provide documentation for the functions and types.

You will be able to view the model by adding the following lines :

Code Block
titleAdding the model to the project
from Libraries.StandardFunctions import *


The first (import ..) line adds all the functions from the StandardFunctions library.  The second line adds the model in the fmModel variable to the current project. 

After running these lines, the model will be placed in the project explorer: