diff --git a/docs/src/user_guide/4_runtime_and_solvers.md b/docs/src/user_guide/4_runtime_and_solvers.md index e46e5e95..579332f5 100644 --- a/docs/src/user_guide/4_runtime_and_solvers.md +++ b/docs/src/user_guide/4_runtime_and_solvers.md @@ -36,4 +36,14 @@ In XCALibre.jl the `run!` function is used to start a simulation, which will dis ```@docs; canonical=false run!() ``` ---- \ No newline at end of file + +## Restarting simulations +--- + +It should be noted that when running a simulation with `run!`, the solution fields in the `Physics` model are mutated. Thus, running the simulation from the previous solution is simply a matter of reissuing the `run!` function. At present, this has the side effect of overwriting any existing solution files (`.vtk` or `.vtu`). Users must be aware of this behaviour. + +In some cases, it may be desirable to solve a problem with a steady solver and use the solution to run transient simulations. This is possible using the `change` function. + +```@docs; canonical=false +XCALibre.ModelPhysics.change +``` \ No newline at end of file diff --git a/src/ModelPhysics/3_physics_API.jl b/src/ModelPhysics/3_physics_API.jl index 03913754..91f6917d 100644 --- a/src/ModelPhysics/3_physics_API.jl +++ b/src/ModelPhysics/3_physics_API.jl @@ -1,5 +1,25 @@ export change +""" + change(model::Physics, property, value) => updatedModel::Physics + +A convenience function to change properties of an exisitng `Physics` model. + +# Input arguments +- `model::Physics` a `Physics` model to modify +- `property` is a symbol specifying the property to change +- `value` is the new setting for the specified `property` + +# Output + +This function return a new `Physics` object + +# Example + +To change a model to run a transient simulation e.g. after converging in steady state + + modelTransient = change(model, :time, Transient()) +""" function change(model::Physics, property, value) @assert property ∈ fieldnames(Physics) throw(ArgumentError( """$value is not in Physics.