You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

We will read the water levels at the center of each cell from a plain text comma separated values file (initialWaterLevelFM.csv) into the initialWaterLevels list.

Set intial confitions
# add initial conditions 
import csv

initialWaterLevels = []

with open(r"D:\Workshop\Data\initialWaterLevelFM.csv") as csvfile: 
    lines = csv.reader(csvfile, delimiter=',')

    for line in lines:
        initialWaterLevels.append(float(line[0]))

Once loaded, we set the initial values of the model :

Add values to model
fmModel.InitialWaterLevel.SetValues(initialWaterLevels)

To limit the calculation time, we change the maximum and initial delta t (time) to 1 hour using the SetModelProperty function.

Set dtMax and dtInitial
# 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()))

 

  • No labels