@@ -8,9 +8,9 @@ using Interpolations
88# These are routines that help to create a LaMEM marker files from a ParaviewData structure, which can be used to perform geodynamic simulations
99# We also include routines with which we can read LaMEM *.pvtr files into julia
1010
11- export LaMEM_grid, ReadLaMEM_InputFile
12- export Save_LaMEMMarkersParallel, Save_LaMEMTopography
13- export GetProcessorPartitioning, ReadData_VTR, ReadData_PVTR, CreatePartitioningFile
11+ export LaMEM_grid, readLaMEM_InputFile
12+ export save_LaMEMMarkersParallel, save_LaMEMTopography
13+ export getProcessorPartitioning, readData_VTR, readData_PVTR, createPartitioningFile
1414
1515"""
1616Structure that holds information about the LaMEM grid (usually read from an input file).
@@ -164,14 +164,14 @@ end
164164
165165
166166"""
167- Grid::LaMEM_grid = ReadLaMEM_InputFile (file, args::Union{String,Nothing}=nothing)
167+ Grid::LaMEM_grid = readLaMEM_InputFile (file, args::Union{String,Nothing}=nothing)
168168
169169Parses a LaMEM input file and stores grid information in the `Grid` structure.
170170Optionally, you can pass LaMEM command-line arguments as well.
171171
172172# Example 1
173173```julia
174- julia> Grid = ReadLaMEM_InputFile ("SaltModels.dat")
174+ julia> Grid = readLaMEM_InputFile ("SaltModels.dat")
175175LaMEM Grid:
176176nel : (32, 32, 32)
177177marker/cell : (3, 3, 3)
@@ -183,7 +183,7 @@ z ϵ [-2.0 : 0.0]
183183
184184# Example 2 (with command-line arguments)
185185```julia
186- julia> Grid = ReadLaMEM_InputFile ("SaltModels.dat", args="-nel_x 64 -coord_x -4,4")
186+ julia> Grid = readLaMEM_InputFile ("SaltModels.dat", args="-nel_x 64 -coord_x -4,4")
187187LaMEM Grid:
188188 nel : (64, 32, 32)
189189 marker/cell : (3, 3, 3)
@@ -194,7 +194,7 @@ LaMEM Grid:
194194```
195195
196196"""
197- function ReadLaMEM_InputFile (file; args:: Union{String,Nothing} = nothing )
197+ function readLaMEM_InputFile (file; args:: Union{String,Nothing} = nothing )
198198
199199 # read information from file
200200 nmark_x = ParseValue_LaMEM_InputFile (file," nmark_x" ,Int64, args= args);
@@ -368,34 +368,34 @@ function Base.show(io::IO, d::LaMEM_grid)
368368end
369369
370370"""
371- Save_LaMEMMarkersParallel (Grid::CartData; PartitioningFile=empty, directory="./markers", verbose=true, is64bit=false)
371+ save_LaMEMMarkersParallel (Grid::CartData; PartitioningFile=empty, directory="./markers", verbose=true, is64bit=false)
372372
373373Saves a LaMEM marker file from the `CartData` structure `Grid`. It must have a field called `Phases`, holding phase information (as integers) and optionally a field `Temp` with temperature info.
374374It is possible to provide a LaMEM partitioning file `PartitioningFile`. If not, output is assumed to be for one processor. By default it is assumed that the partitioning file was generated on a 32bit PETSc installation. If `Int64` was used instead, set the flag.
375375
376- The size of `Grid` should be consistent with what is provided in the LaMEM input file. In practice, the size of the mesh can be retrieved from a LaMEM input file using `ReadLaMEM_InputFile `.
376+ The size of `Grid` should be consistent with what is provided in the LaMEM input file. In practice, the size of the mesh can be retrieved from a LaMEM input file using `readLaMEM_InputFile `.
377377
378378# Example
379379
380380```
381- julia> Grid = ReadLaMEM_InputFile ("LaMEM_input_file.dat")
381+ julia> Grid = readLaMEM_InputFile ("LaMEM_input_file.dat")
382382julia> Phases = zeros(Int32,size(Grid.X));
383383julia> Temp = ones(Float64,size(Grid.X));
384384julia> Model3D = CartData(Grid, (Phases=Phases,Temp=Temp))
385- julia> Save_LaMEMMarkersParallel (Model3D)
385+ julia> save_LaMEMMarkersParallel (Model3D)
386386Writing LaMEM marker file -> ./markers/mdb.00000000.dat
387387```
388388If you want to create a LaMEM input file for multiple processors:
389389```
390- julia> Save_LaMEMMarkersParallel (Model3D, PartitioningFile="ProcessorPartitioning_4cpu_1.2.2.bin")
390+ julia> save_LaMEMMarkersParallel (Model3D, PartitioningFile="ProcessorPartitioning_4cpu_1.2.2.bin")
391391Writing LaMEM marker file -> ./markers/mdb.00000000.dat
392392Writing LaMEM marker file -> ./markers/mdb.00000001.dat
393393Writing LaMEM marker file -> ./markers/mdb.00000002.dat
394394Writing LaMEM marker file -> ./markers/mdb.00000003.dat
395395```
396396
397397"""
398- function Save_LaMEMMarkersParallel (Grid:: CartData ; PartitioningFile= empty, directory= " ./markers" , verbose= true , is64bit= false )
398+ function save_LaMEMMarkersParallel (Grid:: CartData ; PartitioningFile= empty, directory= " ./markers" , verbose= true , is64bit= false )
399399
400400 x = ustrip .(Grid. x. val[:,1 ,1 ]);
401401 y = ustrip .(Grid. y. val[1 ,:,1 ]);
@@ -425,7 +425,7 @@ function Save_LaMEMMarkersParallel(Grid::CartData; PartitioningFile=empty, direc
425425 else
426426 Nprocx,Nprocy,Nprocz,
427427 xc,yc,zc,
428- nNodeX,nNodeY,nNodeZ = GetProcessorPartitioning (PartitioningFile, is64bit= is64bit)
428+ nNodeX,nNodeY,nNodeZ = getProcessorPartitioning (PartitioningFile, is64bit= is64bit)
429429 if verbose
430430 @show Nprocx,Nprocy,Nprocz, xc,yc,zc, nNodeX,nNodeY,nNodeZ
431431 end
@@ -557,13 +557,13 @@ function PetscBinaryWrite_Vec(filename, A)
557557end
558558
559559"""
560- nProcX,nProcY,nProcZ, xc,yc,zc, nNodeX,nNodeY,nNodeZ = GetProcessorPartitioning (filename; is64bit=false)
560+ nProcX,nProcY,nProcZ, xc,yc,zc, nNodeX,nNodeY,nNodeZ = getProcessorPartitioning (filename; is64bit=false)
561561
562562Reads a LaMEM processor partitioning file, used to create marker files, and returns the parallel layout.
563563By default this is done for a 32bit PETSc installation, which will fail if you actually use a 64bit version.
564564
565565"""
566- function GetProcessorPartitioning (filename; is64bit= false )
566+ function getProcessorPartitioning (filename; is64bit= false )
567567
568568 if is64bit
569569 typ= Int64
@@ -606,12 +606,12 @@ end
606606
607607
608608"""
609- coord, Data_3D_Arrays, Name_Vec = ReadData_VTR (fname)
609+ coord, Data_3D_Arrays, Name_Vec = readData_VTR (fname)
610610
611611Reads a VTR (structured grid) VTK file `fname` and extracts the coordinates, data arrays and names of the data.
612612In general, this only contains a piece of the data, and one should open a `*.pvtr` file to retrieve the full data
613613"""
614- function ReadData_VTR (fname, FullSize)
614+ function readData_VTR (fname, FullSize)
615615 file = open (fname, " r" )
616616
617617 header = true
@@ -815,13 +815,13 @@ function ReadBinaryData(file::IOStream, start_bin::Int64, Offset::Int64, BytesTo
815815end
816816
817817"""
818- Data::ParaviewData = ReadData_PVTR (fname, dir)
818+ Data::ParaviewData = readData_PVTR (fname, dir)
819819
820820Reads a parallel, rectilinear, `*.vts` file with the name `fname` and located in `dir` and create a 3D `Data` struct from it.
821821
822822# Example
823823```julia
824- julia> Data = ReadData_PVTR ("Haaksbergen.pvtr", "./Timestep_00000005_3.35780500e-01/")
824+ julia> Data = readData_PVTR ("Haaksbergen.pvtr", "./Timestep_00000005_3.35780500e-01/")
825825ParaviewData
826826 size : (33, 33, 33)
827827 x ϵ [ -3.0 : 3.0]
@@ -830,7 +830,7 @@ ParaviewData
830830 fields: (:phase, :density, :visc_total, :visc_creep, :velocity, :pressure, :temperature, :dev_stress, :strain_rate, :j2_dev_stress, :j2_strain_rate, :plast_strain, :plast_dissip, :tot_displ, :yield, :moment_res, :cont_res)
831831```
832832"""
833- function ReadData_PVTR (fname, dir)
833+ function readData_PVTR (fname, dir)
834834 file = open (joinpath (dir,fname), " r" )
835835
836836 header = true
@@ -860,9 +860,9 @@ function ReadData_PVTR(fname, dir)
860860 fname_piece = line_strip[1 : id_end]
861861
862862 if num_data_sets== 1
863- coord_x, coord_y, coord_z, Data_3D, Names, NumComp, ix,iy,iz = ReadData_VTR (joinpath (dir,fname_piece), FullSize);
863+ coord_x, coord_y, coord_z, Data_3D, Names, NumComp, ix,iy,iz = readData_VTR (joinpath (dir,fname_piece), FullSize);
864864 else
865- coord_x1, coord_y1, coord_z1, Data_3D1, Names, NumComp, ix,iy,iz = ReadData_VTR (joinpath (dir,fname_piece), FullSize);
865+ coord_x1, coord_y1, coord_z1, Data_3D1, Names, NumComp, ix,iy,iz = readData_VTR (joinpath (dir,fname_piece), FullSize);
866866 coord_x[ix] = coord_x1[ix];
867867 coord_y[iy] = coord_y1[iy];
868868 coord_z[iz] = coord_z1[iz];
@@ -925,11 +925,11 @@ function ReadData_PVTR(fname, dir)
925925end
926926
927927"""
928- Save_LaMEMTopography (Topo::CartData, filename::String)
928+ save_LaMEMTopography (Topo::CartData, filename::String)
929929
930930This writes a topography file `Topo` for use in LaMEM, which should have size `(nx,ny,1)` and contain the field `:Topography`
931931"""
932- function Save_LaMEMTopography (Topo:: CartData , filename:: String )
932+ function save_LaMEMTopography (Topo:: CartData , filename:: String )
933933
934934 if (size (Topo. z. val,3 ) != 1 )
935935 error (" Not a valid `CartData' Topography file (size in 3rd dimension should be 1)" )
@@ -972,14 +972,14 @@ function Save_LaMEMTopography(Topo::CartData, filename::String)
972972end
973973
974974"""
975- CreatePartitioningFile (LaMEM_input::String, NumProc::Int64; LaMEM_dir::String=pwd(), LaMEM_options::String="", MPI_dir="", verbose=true)
975+ createPartitioningFile (LaMEM_input::String, NumProc::Int64; LaMEM_dir::String=pwd(), LaMEM_options::String="", MPI_dir="", verbose=true)
976976
977977This executes LaMEM for the input file `LaMEM_input` & creates a parallel partitioning file for `NumProc` processors.
978978The directory where the LaMEM binary is can be specified; if not it is assumed to be in the current directory.
979979Likewise for the `mpiexec` directory (if not specified it is assumed to be available on the command line).
980980
981981"""
982- function CreatePartitioningFile (LaMEM_input:: String ,NumProc:: Int64 ; LaMEM_dir:: String = pwd (), LaMEM_options= " " , MPI_dir= " " , verbose= true )
982+ function createPartitioningFile (LaMEM_input:: String ,NumProc:: Int64 ; LaMEM_dir:: String = pwd (), LaMEM_options= " " , MPI_dir= " " , verbose= true )
983983
984984 # Create string to execute LaMEM
985985 mpi_str = MPI_dir* " mpiexec -n $(NumProc) "
0 commit comments