Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
scrollbar |
---|
We start by reading the waterlevels at the cell centers from a CSV (Comma separated values) file into the initialWaterLevels list.
Code Block | ||||
---|---|---|---|---|
| ||||
# add initial conditions
import csv
initialWaterLevels = []
with open("D:\\Workshop\\Data\\initial.csv") as csvfile:
lines = csv.reader(csvfile, delimiter=',')
for line in lines:
initialWaterLevels.append(float(line[0]))
|
Then we add the list of values to the model :
Code Block | ||||
---|---|---|---|---|
| ||||
fmModel.InitialWaterLevels.SetValues(initialWaterLevels) |
To limit the calculation time we change the maximum and initial delta t (time) to 1 hour using the SetModelProperty" function.
Code Block | ||||
---|---|---|---|---|
| ||||
# 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())) |
scrollbar |
---|