@Craig_Hamel
Sorry for the big delay getting back to this… typical struggles of side projects!
Here’s the output showing my Julia version and the package versions after running pkg> up
just now. And after running that, I’m still getting the following errors, which I’ll show below.
Version Info:
julia> versioninfo()
Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin22.4.0)
CPU: 8 Ă— Apple M2
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
Environment:
DYLD_LIBRARY_PATH = /opt/intel/oneapi/compiler/2022.2.0/mac/compiler/lib/intel64_mac:/opt/intel/oneapi/compiler/2022.2.0/mac/compiler/lib
(@v1.10) pkg> st
Status `~/.julia/environments/v1.10/Project.toml`
[f57ae99e] Exodus v0.13.1
[91a5bcdd] Plots v1.40.4
[24249f21] SymPy v2.0.1
So then, what I tried running was simply:
julia> include("new_write_example_from_scratch.jl")
where, the new_write_example_from_scratch.jl
file contains the following code:
using Exodus
# data to write
coords = [
1.0 0.5 0.5 1.0 0.0 0.0 0.5 1.0 0.0
1.0 1.0 0.5 0.5 1.0 0.5 0.0 0.0 0.0
]
conn = [
1 2 4 3
2 5 3 6
3 6 7 9
4 3 8 7
]
# make some hack variables to write
v_nodal_1 = rand(9)
v_nodal_2 = rand(9)
v_elem_1 = rand(4)
v_elem_2 = rand(4)
# set the types
maps_int_type = Int32
ids_int_type = Int32
bulk_int_type = Int32
float_type = Float64
# initialization parameters
num_dim, num_nodes = size(coords)
num_elems = size(conn, 2)
num_elem_blks = 1
num_side_sets = 0
num_node_sets = 0
# make init
init = Initialization{
bulk_int_type(num_dim), bulk_int_type(num_nodes), bulk_int_type(num_elems),
bulk_int_type(num_elem_blks), bulk_int_type(num_side_sets), bulk_int_type(num_node_sets)
}()
exo = ExodusDatabase{maps_int_type, ids_int_type, bulk_int_type, float_type}(
"test_write.e", "w", init
)
# how to write coordinates
write_coordinates(exo, coords)
# how to write a block
write_block(exo, 1, "QUAD4", conn)
# need at least one timestep to output variables
write_time(exo, 1, 0.0)
# write number of variables and their names
write_names(exo, NodalVariable, ["v_nodal_1", "v_nodal_2"])
write_names(exo, ElementVariable, ["v_elem_1", "v_elem_2"])
# write variable values the 1 is for the time step
write_values(exo, NodalVariable, 1, "v_nodal_1", v_nodal_1)
write_values(exo, NodalVariable, 1, "v_nodal_2", v_nodal_2)
# the first 1 is for the time step
# and the second 1 is for the block number
write_values(exo, ElementVariable, 1, 1, "v_elem_1", v_elem_1)
write_values(exo, ElementVariable, 1, 1, "v_elem_2", v_elem_2)
# don't forget to close the exodusdatabase, it can get corrupted otherwise if you're writing
close(exo)
Running the above gives the following output:
julia> include("new_write_example_from_scratch.jl")
ERROR: LoadError: UndefVarError: `error` not defined
Stacktrace:
[1] (ExodusDatabase{Int32, Int32, Int32, Float64})(file_name::String, mode::String, init::Initialization{2, 9, 4, 1, 0, 0})
@ Exodus ~/.julia/packages/Exodus/6y2Sw/src/ExodusTypes.jl:495
[2] top-level scope
@ ~/Documents/bob/code/julia/exodus_jl_test/new_write_example_from_scratch.jl:42
[3] include(fname::String)
@ Base.MainInclude ./client.jl:489
[4] top-level scope
@ REPL[7]:1
in expression starting at /Users/browningfamjam/Documents/bob/code/julia/exodus_jl_test/new_write_example_from_scratch.jl:42
julia>
Hopefully this is clear and reboots our conversation. Let me know if this is possibly a version issue as I’d still love to be using your package with my masher, which would hopefully be a helpful use case offering you some feedback.