Solver
HSSSimulations.Solver
— ModuleThe core logic for setting up and solving a simulation, including the heat transfer solver.
All the public functions in this module have been covered already in the main API section, and the Load Sets section.
Internal
HSSSimulations.Solver.makeLogger
— FunctionmakeLogger(debugGroups, logFile) -> LoggingExtras.TeeLogger
debugGroups
is a list of groups of debug messages to log to the logFile
. If it is set to true then all log groups in the package are used (see package_groups
), if it is set to false then no log groups are used.
User log groups can be added to the list, simple add your own string to the list and then set debug messages with the _group
field set to your string.
There is a special group called "misc"
that will catch any group not in the package_groups
list or in any additional group given by the user to the debugGroups list.
Load Step Solver
HSSSimulations.Solver.loadSolver!
— FunctionloadSolver!(
ls::HSSSimulations.Types.LoadStep,
results,
prob::Problem
) -> AbstractResult
Solves a single load and returns an array of the results.
Time Step Solver
HSSSimulations.Solver.timeSolver!
— FunctiontimeSolver!(
cts::AbstractResult,
pts::AbstractResult,
ls::HSSSimulations.Types.LoadStep,
prob::Problem
)
Solves a timestep by calculating new material propeties, setting ghost node boundary conditions, using an explicit finited difference method and then conditionally recoating the poweder (if the load specifies). The results are stored in the Results struct cr that is passed into the function.
Arguments
cts
: The struct that will be used to store the results from this solver.pts
: The results struct with the results from the previous step.
HSSSimulations.Solver.nanfiller!
— Functionnanfiller!(
cts::AbstractResult,
indᵢ::Vector{CartesianIndex{3}}
)
Fills non real cells with NaNs instead of the undef value there currently. Using NaN instead of zero both allows for a check to see if the cell has been initialised and makes them not show up in plots.
This needs to be called on all loads (not just recoat loads) as on the loads before recoat there are still imaginary nodes that need filling (for pretty plotting).
HSSSimulations.Solver.fdmSolver!
— FunctionfdmSolver!(
cts::AbstractResult,
indᵣ::Vector{CartesianIndex{3}},
p::Problem
)
Uses the explicit time step finite difference heat form of the heat equation to calculate the new results using ghost cell boundary conditions.
In simple terms this takes the avarage for all nodes for the one around the one being calculated (from the previous time step), and uses the difference between that and the temperature of the current node (for the previous time step) multiplied by the fourier number Fo
to calculate the temperature of that node for the current timestep. This is done for all real nodes. The ghost node padding of Tᵗ⁻¹ allows for this function to be run for all real nodes without having to change its behaviour for boudnary nodes.
Metadata Saving
HSSSimulations.Solver.startMetadata
— FunctionstartMetadata(problem, file)
Adds metadata to the results file. The data added here is stuff that is available at the start of the simulation, such as the problem description, the problem input and the start time.
HSSSimulations.Solver.finishMetadata
— FunctionfinishMetadata(problem::Problem, file)
Adds metadata to the results file. The data added here is stuff that is not available until the end of the simulation, such as the melt max array, the results index array and the simulation end time.
HSSSimulations.Types.makeDescription
— FunctionmakeDescription(problem::Problem) -> Any
Primaraly used for the show method for the Problem struct, but seperated into it's own function so the same formatting can be used for making a string to save to the results file. This is useful for having a summary of the simulation setup attached to the results for quick reference (The full problem struct is also saved, but that requires loading the results in a julia instance to read properly).