HDF5 Utilities
To use HDF5 functionality,
pkg> add HDF5
julia> using Quaycle
julia> using HDF5This package provides a bunch of utilities, such as storing simulation properties and writing ODE solution on the fly to HDF5 format file for postprocessing on different platform and package version. We currently don't support automatically saving green's function to HDF5 due to its limitation of natively storing complex number.
It's worth mention that JLD and JLD2 are also excellent alternatives but they storing the whole type information that may broke read when this package changes or remove certain type definitions. Users may choose them as auxiliary tools.
Public Interface
Quaycle.store — Methodstore(filename::AbstractString, p::AbstractProperty)Store property in HDF5.
Arguments
filename::AbstractString: file name to be usedp::AbstractProperty: property to be saved
Quaycle.@getprop — Macro@getprop filenameRead property stored in HDF5.
Arguments
filename: file name. Assume it has one and only one kind of property group.
Quaycle.@store — Macro@store filename::AbstractString p::AbstractPropertyMacro shortcut for storing property in HDF5.
Arguments
filename::AbstractString: file name to be usedp::AbstractProperty: property to be saved
Quaycle.h5trimsolution — Methodh5trimsolution(fin::S, fout::S, tstr, ustrs::AbstractVector,
predu::Function, predt::Function=(x)->true; nstep::Integer=10000) where STrim the solution in and HDF5 file fin, for instance by using wsolve, according to prediction functions predu and predt for fields specified by ustrs. Time data field is denoted by tstr. Outputs are stored in fout.
Quaycle.wsolve — Methodwsolve(prob::ODEProblem, alg::OrdinaryDiffEqAlgorithm,
file, nstep, getu, ustrs, tstr; kwargs...)Write the solution to HDF5 file while solving the ODE. The interface is exactly the same as solve an ODEProblem except a few more about the saving procedure. Notice, it will set save_everystep=false so to avoid memory blow up. The return code will be written as an attribute in tstr data group.
Extra Arguments
file::AbstractString: name of file to be savednstep::Integer: number of steps after which a saving operation will be performedgetu::Function: function handler to extract desired solution for savingustr::AbstractVector: list of names to be assigned for each components, whose length must equal the length ofgetuoutputtstr::AbstractString: name of time data
KWARGS
stride::Integer=1: downsampling rate for saving outputsappend::Bool=false: if true then append solution after the end offileforce::Bool=false: force to overwrite the existing solution file
Quaycle.𝐕𝚬′ — MethodRetrieve velocity and strain rate
Quaycle.𝐕𝚯 — MethodRetrieve velocity and state.
Quaycle.𝐕𝚯𝚫 — MethodRetrieve velocity, state and slip.
Quaycle.𝐕𝚯𝚬 — MethodRetrieve velocity, state and strain.
Quaycle.𝐕𝚯𝚬′ — MethodRetrieve velocity, state and strain rate.
Quaycle.𝐕𝚯𝚬′𝚫 — MethodRetrieve velocity, state, strain rate and slip.
Quaycle.𝐕𝚯𝚬𝚺 — MethodRetrieve velocity, state, strain and stress.
Quaycle.@h5savecallback — Macro@h5savecallback(filename, tend, nsteps, usize, T)Construct a FunctionCallingCallback for incrementally stored output into HDF5 file. This callback function only works for naive output arrays whose shape look like A[..., :, :, :, ...]. It is suggested to use this macro at top-level scope since it contains eval.
Arguments
filename: file name to be storedtend: end time of simulationnsteps: afternstepssteps, a saving operation is performed otherwise caching themT: type of stored data