Utilities
Fimbul.make_schedule Function
make_schedule(forces, durations::Vector{Float64};
num_reports = missing,
report_interval = missing,
num_cycles = 1
)Create a simulation schedule from a set of durations and associated forces.
This function generates a detailed schedule based on user-defined durations and associated forcing conditions. It allows for flexible reporting intervals within each period and supports repeating the schedule for multiple cycles.
Arguments
forces: Vector of forcing conditions, one for each perioddurations: Vector of durations (in seconds) for each period
Keyword Arguments
num_reports::Union{Int,Vector{Int},Missing}=missing: Number of reports desired within each period. Can be a single integer applied to all periods or a vector specifying the number of reports for each period. Ifmissing, the function will usereport_intervalinstead.report_interval::Union{Real,Vector{Real},Missing}=missing: Time interval (in seconds) between reports within each period. Can be a single value applied to all periods or a vector specifying the interval for each period. Ifmissing, the function will usenum_reportsinstead.num_cycles::Int=1: Number of times to repeat the entire schedule.
NOTE: Either num_reports or report_interval must be specified, but not both. If none are provided, the function defaults to 5 reports per period.
make_schedule(forces, periods; start_year=missing, num_years=1, report_interval=14day)Create a simulation schedule with time steps and forces for multi-period reservoir simulations using actual dates to define periods.
This function generates a detailed schedule based on user-defined periods and associated forcing conditions. It automatically handles multi-year simulations with periodic patterns and provides fleible time step control within each period.
Arguments
forces: Vector of forcing conditions, one for each period. Each element should contain well controls, boundary conditions, or other simulation drivers for the corresponding period.periods: Vector of time period definitions. Length should be one more thanforcesto define period boundaries. Periods can be specified with month numbers, (month, day) tuples, (month, day, hour) tuples, or month name strings.
Keyword Arguments
start_year::Union{Int,Missing}=missing: Starting year for the simulation. Ifmissing, uses the current year.num_years::Int=1: Number of years to simulate with the periodic schedule.report_interval::Union{Real,Vector}=14day: Time step size within each period. Can be a single value applied to all periods or a vector with specific intervals for each period.
Returns
dt: Vector of time step sizes in seconds for the entire simulationforce_vec: Vector of forcing conditions corresponding to each time steptimestamps: Vector of DateTime objects marking the time points
Example
# Define seasonal operations: charge in summer, rest in winter
forces = [charge_controls, rest_controls]
periods = ["June", "September", "December"] # June-Sep charge, Sep-Dec rest
dt, forces, times = make_schedule(forces, periods;
num_years=3, report_interval=7si_unit(:day))Fimbul.make_utes_schedule Function
make_utes_schedule(forces_charge, forces_discharge, forces_rest; kwargs...)Create a specialized schedule for Underground Thermal Energy Storage (UTES)
This function generates a three-phase operational schedule typical for thermal energy storage:
Charging phase: Inject hot water to store thermal energy
Rest phase: No well activity
Discharging phase: Extract stored thermal energy for heating applications
The schedule automatically handles seasonal operations with user-defined charge and discharge periods, typically aligned with energy availability (summer charging) and demand (winter discharging).
NOTE: The function does not validate that the provided forcing conditions are appropriate for UTES operations. It is up to the user to ensure that the forces_charge, forces_discharge, and forces_rest inputs contain suitable well controls.
Arguments
forces_charge: Forcing conditions during charging phase (hot water injection)forces_discharge: Forcing conditions during discharging phase (thermal energy extraction)forces_rest: Forcing conditions during rest periods (no well activity)
Keyword Arguments
charge_period=["June", "September"]: Start and end of charging phase (seemake_schedulefor valid formats)discharge_period=["December", "March"]: Start and end of discharging phase (seemake_schedulefor valid formats)start_year::Union{Int,Missing}=missing: Starting year for simulation. Defaults to current year.num_years::Int=5: Number of operational years to simulate.kwargs...: Additional arguments passed tomake_schedule()(e.g.,report_interval).
Returns
dt: Vector of time step sizes in secondsforces: Vector of forcing conditions for each time steptimestamps: Vector of DateTime objects for temporal tracking
Example
# Standard ATES schedule: charge Jun-Sep, discharge Dec-Mar
dt, forces, times = make_utes_schedule(
charge_forces, discharge_forces, rest_forces;
charge_period = ["June", "September"],
discharge_period = ["December", "March"],
num_years = 5,
report_interval = 7si_unit(:day)
)Notes
Rest periods are automatically inserted between charge and discharge phases
The function handles year transitions and ensures chronological ordering
Periods with zero duration are automatically filtered out