Skip to content

Installation ​

Installing LaMEM can simply be done through the package manager:

julia
julia>]
pkg>add LaMEM

which will download the binaries along with PETSc and mpiexec for your system.

You can test if it works on your machine with

julia
pkg> test LaMEM

Running LaMEM from the julia REPL ​

Running LaMEM from within julia can be done with the run_lamem function:

LaMEM.Run.run_lamem Function
julia
run_lamem(ParamFile::String, cores::Int64=1, args:String=""; wait=true, deactivate_multithreads=true, logfile=nothing, append=nothing)

This starts a LaMEM simulation, for using the parameter file ParamFile on cores number of cores. Optional additional command-line parameters can be specified with args.

Use logfile to additionally save the LaMEM output to a file, while still showing it in the REPL. A name without an extension gets ".log" appended, so logfile="test" writes to "test.log".

By default a restart (args containing -mode restart) appends to an existing logfile, so the log of a simulation that was restarted stays in one file, while a normal run starts a fresh one. Set append=true or append=false to decide this yourself.

Example:

You can call LaMEM with:

julia
julia> using LaMEM
julia> ParamFile="../../input_models/BuildInSetups/FallingBlock_Multigrid.dat";
julia> run_lamem(ParamFile)

Do the same on 2 cores with a command-line argument as:

julia
julia> ParamFile="../../input_models/BuildInSetups/FallingBlock_Multigrid.dat";
julia> run_lamem(ParamFile, 2, "-nstep_max = 1")

Save the output to "test.log" as well as showing it in the REPL:

julia
julia> run_lamem(ParamFile, 1, "-nstep_max = 1", logfile="test")

Restarting the simulation adds its output to the same "test.log":

julia
julia> run_lamem(ParamFile, 1, "-mode restart", logfile="test")
source
julia
run_lamem(model::Model, cores::Int64=1, args::String=""; wait=true, add_APS=false, logfile=nothing)

Performs a LaMEM run for the parameters specified in model.

  • cores: number of MPI cores to use

  • args: additional command-line arguments passed to LaMEM

  • wait: if true, wait for the simulation to finish before returning

  • add_APS: if true, write accumulated plastic strain (APS) to marker files. Requires LaMEM ≥ 2.2.1 (header 1211215). Default is false (LaMEM ≥ 2.2.0).

  • logfile: if given, the LaMEM output is written to this file in addition to being shown in the REPL. A name without an extension gets ".log" appended, and a relative name ends up in model.Output.out_dir, next to the other output of the run.

  • append: whether to add the output to an existing logfile instead of replacing it. By default this happens for a restart (args containing -mode restart), so that the log of a simulation that was restarted stays in one file.

Example

julia
julia> run_lamem(model, 1, logfile="test")                   # saved to <out_dir>/test.log
julia> run_lamem(model, 1, "-mode restart", logfile="test")  # appended to the same file
source

Running LaMEM from outside julia ​

If you, for some reason, do not want to run LaMEM through julia but instead directly from the terminal or powershell, you will have to add the required dynamic libraries and executables. Do this with:

LaMEM.Run.show_paths_LaMEM Function
julia
show_paths_LaMEM()

The downloaded LaMEM binaries can also be called from outside julia (directly from the terminal). In that case, you will need to set load correct dynamic libraries (such as PETSc) and call the correct binaries.

This function shows this for your system.

source