effluent.model¶
The package contains the Model class and helper
functions.
Classes¶
A complete model of an effluent discharge. |
Functions¶
|
Convert from external to internal config format. |
Module Contents¶
- class effluent.model.Model(pipe=None, ambient=None, output=None, solver=None, start='1970-01-01', stop='1970-01-01', step=86400)¶
A complete model of an effluent discharge.
The class contains all parameters necessary to execute a simulation, including information about the pipe discharge itself, the ambient ocean, parameters for the mixing process, the desired output format and numerical solver parameters.
- Parameters:
pipe (effluent.io.Pipe) – Pipe and effluent discharge parameters
ambient (effluent.io.Ambient) – Ambient ocean hydrography and currents
output (effluent.io.Output) – Output target and output format
solver (effluent.solver.Solver) – Physical parametrization and numerical solver
start – First simulated discharge time
stop – Last simulated discharge time
step – Seconds between each simulated discharge time
- static from_config(fname_or_dict)¶
Initialize a model object using the configuration format.
- Parameters:
fname_or_dict – Config dict or name of config file
- Returns:
An initialized object.
- Return type:
- irun()¶
Execute the simulation iteratively.
For each iteration, a new discharge time is simulated using the following algorithm:
Initial conditions are specified using
self.solver.set_init()Ambient conditions are specified using
self.solver.set_ambient()The numerical solution is computed using
self.solver.solve().The result is written to the output file using
self.output.write()The iterator yields the result
- Returns:
An iterator for simulating the discharge times sequentially.
- Return type:
- run()¶
Execute the simulation using repeated calls to
self.irun().The result is written to the output file.
- effluent.model.load_config(fname_or_dict)¶
Convert from external to internal config format.
The external config format is designed to be easy for the user, while the internal config format is structured as strictly one entry for each of the model subcomponent classes. The two formats are similar, but slightly reorganized.
- Parameters:
fname_or_dict – Either a dict, or the name of a file
- Returns:
A dict of config options, in internal config format
- Return type:
dict