Presets: the Look and the Physics

A study usually has two independent halves: how it looks (layout, axes, colors, camera, labels) and what is computed (parameters, methods, sweep). PDEStudio keeps them apart with two kinds of presets:

Visual PresetSimulation Preset
HoldsLayout, plot axes, slider positions, camera, labels, exploration options, all UI stylesShared parameters, the active methods and their parameters, the sweep, the reference and post-processing functions
IgnoresEverything in the Simulation categoryEverything visual, and source files
Folder<save path>/Presets/<save path>/Presets/Simulation/
SaveSave Presets · save_plot_presetSave Sim Preset · save_sim_preset
ApplyUI → Presets + Apply · set_plot_preset!Simulation → Presets + Apply · set_sim_preset!
ResetClear Presets · set_plot_preset!()Reset Simulation · reset_sim_config!

Both are ordinary studio CSV files, so they can be versioned, shared and written by hand. Full exports (the CSV next to every exported figure) contain both halves; see File Operations.

In the Studio

  1. Select the category in the editor: UI for the look, Simulation for the physics. The two preset buttons follow the category: Save Presets / Clear Presets versus Save Sim Preset / Reset Simulation.
  2. Optional: select the scope Presets, the entry create_new, and type a description into the text box.
  3. Type a name into the filename box (Coarse Grid is stored as coarse_grid.csv) and click the save button.
  4. To apply a preset, select it under Presets (the description is shown in the text box) and click Apply. Applying a simulation preset sets the Run Simulation lock; click it to compute.

Preset files you copy into the folders appear in the list the next time you open the parameter menu of the Presets scope.

From Code

save_plot_preset("paper"; description = "Two columns, no titles")
save_sim_preset("coarse"; description = "N = 64, explicit methods only")

set_plot_preset!(:paper)      # the look
set_sim_preset!(:coarse)      # the physics (flags a re-run)
force_simulation()

reset_sim_config!()           # back to the configuration bound with set_sim_config!
set_plot_preset!()            # back to the default look

Built-in visual presets: :convergence, :publication, :heatmap, :component, :compact3d, :nolabels and :darkmode.

Replace or Patch

A simulation preset is applied in one of two modes:

  • replace (written into every preset saved by the studio): the preset is the simulation. Shared parameters, methods, active methods, sweep and functions all come from the file.
  • patch (the default for hand-written files): only the entries in the file change; everything else of the bound configuration stays. Ideal for small variations such as "high resolution" or "long time".

The mode is stored in the file (Metadata, Preset, mode, …) and can be overridden: set_sim_preset!(:coarse; mode = :patch). In both modes the source files of the bound configuration are kept, since a preset swaps parameters, not code.

Reset Simulation / reset_sim_config!() returns to the configuration last bound with set_sim_config! or loaded from a project CSV, discarding presets and editor changes applied since.

Writing Presets by Hand

Every row is Category, Scope, Parameter, Value; values use Julia literal syntax and are parsed safely (nothing is evaluated). A minimal patch preset, Presets/Simulation/hires.csv:

Category,Scope,Parameter,Value
Metadata,Preset,description,Four times the resolution
Simulation,Shared,N,400
Simulation,Sweep,cfl,"Float64[0.2, 0.4]"

The simulation rows a full (replace) preset contains:

CategoryScopeParameterValue (example)
SimulationSharedany shared parameter200, :advection_solver_1d, upwind
Simulationmethod nameany parameter override of that methodlax_friedrichs
SimulationConfigmethodsSymbol[:lax_friedrichs, :upwind]
SimulationConfigdefaults (active methods)Symbol[:upwind]
SimulationConfigreference, postprocessexact_solution, none
SimulationSweepeach swept parameter"Float64[0.3, 0.5]"
MetadataPresetdescription, type (simulation), modereplace

Text values are written as plain text (upwind); text that would read back as something else, such as 1e3, is written in quotes. A visual preset uses the categories Scene (scopes Plot, Layout, Camera, Labels, Exploration) and UI (one scope per style group, e.g. UI, export, animation_FPS, 30). Keys are always the backend names, never display labels.

Note

Applying a visual preset never changes the simulation, and applying a simulation preset never changes the look. Loading a full export CSV (load button, drag & drop or set_sim_config!("file.csv")) applies both.