Versions Compared

Key

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

scrollbar

When adding boundary conditions to the model you must first declare the type of the boundary you want to add. This is done as follows for a waterlevel timeseries:

Code Block
languagepy
titleCreare timeseries boundaries
flowLeftBoundaryCondition = AddFlowBoundaryCondition(fmModel, leftBoundary.Name, FlowBoundaryQuantityType.WaterLevel, BoundaryConditionDataType.TimeSeries)
flowTopBoundaryCondition = AddFlowBoundaryCondition(fmModel, topBoundary.Name, FlowBoundaryQuantityType.WaterLevel, BoundaryConditionDataType.TimeSeries)
flowBottomBoundaryCondition = AddFlowBoundaryCondition(fmModel, bottomBoundary.Name, FlowBoundaryQuantityType.WaterLevel, BoundaryConditionDataType.TimeSeries)
flowRightBoundaryCondition = AddFlowBoundaryCondition(fmModel, rightBoundary.Name, FlowBoundaryQuantityType.WaterLevel, BoundaryConditionDataType.TimeSeries)

 

This can be now been seen on the map on top of the boundary :

 

 

Now we declare a timeseries as We continue by declaring start and end time of our timeseries (and model later on) and a list of [datetimeboundary, valueboundary condition] . To do this we need to import the datetime and time classes from the python datetime library.pairs.

Code Block
titleCreate timeseries
import Libraries.Wps as wps

startTime = datetime(2014,1,1, 12,0,0)
endTime = datetime(2014,1,12, 12,0,0)

boundaryConditionSets = [[leftBoundary,flowLeftBoundaryCondition],
                        [topBoundary,flowTopBoundaryCondition],
                        [bottomBoundary, flowBottomBoundaryCondition],
                        [rightBoundary, flowRightBoundaryCondition]]

 

We go through the list call

Code Block
languagepy
titleAdd WPS boundary conditions
for boundaryConditionSet in boundaryConditionSets:
    # get timeseries for each support point using wps service
    timeSeries = wps.GetTidalPredictForLineString(boundaryConditionSet[0].Geometry, EPSGCode, startTime, endTime, wps.Frequency.Hourly)

    # add resultTimeSeries to support points
    for supportPointIndex in range(len(timeSeries)):
        resultTimeSeries = timeSeries[supportPointIndex]
        AddTimeSeriesToSupportPoint(fmModel, boundaryConditionSet[1], supportPointIndex, resultTimeSeries)

 

The result can be viewed double clicking the boundary on the map and looking at the boundary conditions editor :

Here you can see that for the left boundary there is a waterlevel timeseries declared on the nodes 0 (LeftBoundary_0001), 2 (LeftBoundary_0003) and 5 (LeftBoundary_0006)

 

scrollbar