Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ FFMPEG = "0.4"
FileIO = "1"
GDAL_jll = "300 - 304"
GLMakie = "0.8 - 0.11, 0.13"
GMT = "1"
GMT = ">=1.17"
GeoParams = "0.2 - 0.7"
Geodesy = "1"
GeometryBasics = "0.1 - 0.5"
Expand Down
28 changes: 21 additions & 7 deletions src/LaMEM_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -406,19 +406,28 @@ function save_LaMEM_markers_parallel(Grid::CartData; PartitioningFile = empty, d
y = ustrip.(Grid.y.val[1, :, 1])
z = ustrip.(Grid.z.val[1, 1, :])

if haskey(Grid.fields, :Phases)
Phases = Grid.fields[:Phases]
Phases = if haskey(Grid.fields, :Phases)
Grid.fields[:Phases]
else
error("You must provide the field :Phases in the structure")
end

if haskey(Grid.fields, :Temp)
Temp = Grid.fields[:Temp]
Temp = if haskey(Grid.fields, :Temp)
Grid.fields[:Temp]
else
if verbose
println("Field :Temp is not provided; setting it to zero")
end
Temp = zeros(size(Phases))
zeros(size(Phases))
end

APS = if haskey(Grid.fields, :APS)
Grid.fields[:APS]
else
if verbose
println("Field :APS is not provided; setting it to zero")
end
zeros(size(Phases))
end

if PartitioningFile == empty
Expand Down Expand Up @@ -459,10 +468,11 @@ function save_LaMEM_markers_parallel(Grid::CartData; PartitioningFile = empty, d
part_z = ustrip.(Grid.z.val[x_start[n]:x_end[n], y_start[n]:y_end[n], z_start[n]:z_end[n]])
part_phs = Phases[x_start[n]:x_end[n], y_start[n]:y_end[n], z_start[n]:z_end[n]]
part_T = Temp[x_start[n]:x_end[n], y_start[n]:y_end[n], z_start[n]:z_end[n]]
part_APS = APS[x_start[n]:x_end[n], y_start[n]:y_end[n], z_start[n]:z_end[n]]
num_particles = size(part_x, 1) * size(part_x, 2) * size(part_x, 3)

# Information vector per processor
num_prop = 5 # number of properties we save [x/y/z/phase/T]
num_prop = 6 # number of properties we save [x/y/z/phase/T/APS]
lvec_info = num_particles

lvec_prtcls = zeros(Float64, num_prop * num_particles)
Expand All @@ -472,6 +482,7 @@ function save_LaMEM_markers_parallel(Grid::CartData; PartitioningFile = empty, d
lvec_prtcls[3:num_prop:end] = part_z[:]
lvec_prtcls[4:num_prop:end] = part_phs[:]
lvec_prtcls[5:num_prop:end] = part_T[:]
lvec_prtcls[6:num_prop:end] = part_APS[:]

# Write output files
if ~isdir(directory)
Expand Down Expand Up @@ -552,7 +563,10 @@ function PetscBinaryWrite_Vec(filename, A)
n = length(A)
nummark = A[1] # number of markers

write(f, hton(Float64(1211214))) # header (not actually used)
# header number encodes the version of particle data file
# version with APS is 1211215
# version without APS was 1211214
write(f, hton(Float64(1211215))) # header
write(f, hton(Float64(nummark))) # info about # of markers written

for i in 2:n
Expand Down
Loading