Simulation Parameters
When simulating an infusion using Lizzy, there are some simulation parameters which are assigned globally in the model. These control the frequency of solution write-outs, fill tolerance, and sensor behaviour.
These parameters are stored in a SimulationParameters data class.
The parameters that are stored in the class are the following:
output_interval: The interval of simulation time between solution write-outs [s] if no other conditions trigger a write-out. Default: -1 (write-out every numerical time step, usually undesired)fill_tolerance: Tolerance on the fill factor to consider a CV as filled. A CV is considered filled when its fill factor reaches1 - fill_tolerance. Default: 0.01 (i.e., filled when fill factor >= 0.99).end_step_when_sensor_triggered: If True, whenever a sensor is reached for the first time by the fluid, the current solution step is ended and a write-out is created. Default: Falselightweight: If True, the solver will not pack fields into aSolutionafter each solve step, saving memory and computation time but making impossible to save results to file.save_results()cannot be used in lightweight mode. Default: False
Assigning simulation parameters
The following operations are to be performed before the solver is initialised by calling initialise_solver().
Each simulation parameter can be assigned to the model by keyword, using the set_simulation_parameters() method:
model.set_simulation_parameters(output_interval=100)
In this example, we have told the solver to save a solution state every 100 seconds of simulation time.
To print the currently assigned simulation parameters to the console, we can use the print_simulation_parameters() method:
>>> model.print_simulation_parameters()
>>> Currently assigned simulation parameters:
- "output_interval": 100 [s],
- "fill_tolerance": 0.01,
- "end_step_when_sensor_triggered": False,