Skip to content
Snippets Groups Projects
Commit 22ae3d8d authored by Antoine Cyril David Hoffmann's avatar Antoine Cyril David Hoffmann :seedling:
Browse files

cleaning scripts

parent 6e4eb098
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
gyacomo_dir=$(pwd) gyacomo_dir=$(pwd)
echo "Setup of a new problem in /simulations"
# Check if an argument is provided # Check if an argument is provided
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then
echo "- using 2D Z-pinch parameter" echo "- 2D Z-pinch parameter"
echo " (you can ask for a cyclone base case by adding "CBC" after the call of the script)" echo " (add "CBC" for a cyclone base case)"
inputfile=$gyacomo_dir/scripts/parameter_files/parameters_Zpinch.in inputfile=$gyacomo_dir/scripts/parameter_files/parameters_Zpinch.in
else else
# Check the value of the argument # Check the value of the argument
if [ "$1" = "help" ]; then if [ "$1" = "CBC" ]; then
echo "This script setup a new simulation directory in /simulation" echo "- CBC parameter"
echo "The basic setup is a small 2D z-pinch simulation."
echo "You can ask a cyclone base case (more expensive) by typing sh new_prob.sh CBC"
exit 1
elif [ "$1" = "CBC" ]; then
echo "- using CBC parameter"
inputfile=$gyacomo_dir/scripts/parameter_files/parameters_CBC.in inputfile=$gyacomo_dir/scripts/parameter_files/parameters_CBC.in
elif [ "$1" = "ZBC" ]; then elif [ "$1" = "ZBC" ]; then
echo "- using Zpinch parameter" echo "- 2D Z-pinch parameter"
inputfile=$gyacomo_dir/scripts/parameter_files/parameters_Zpinch.in inputfile=$gyacomo_dir/scripts/parameter_files/parameters_Zpinch.in
else else
echo "ERROR STOP unknown entry" echo "- ERROR STOP unknown entry"
echo "(usage: sh new_prob.sh [CBC or ZBC (opt)])" echo " (usage: sh new_prob.sh [CBC or ZBC (opt)] [folder_name (opt)])"
exit 1 exit 1
fi fi
fi fi
echo "Setup of a new problem in the simulations directory..."
mkdir -p $gyacomo_dir/simulations mkdir -p $gyacomo_dir/simulations
cd $gyacomo_dir/simulations cd $gyacomo_dir/simulations
...@@ -45,7 +40,7 @@ get_next_problem_folder() { ...@@ -45,7 +40,7 @@ get_next_problem_folder() {
# Function to display usage information # Function to display usage information
usage() { usage() {
echo "- usage: $0 [base_case_type] [folder_name]" echo "- usage: $0 [base_case_type] [folder_name]"
echo "If folder_name is not provided, default is the next available 'problem_xx'" echo " If folder_name is not provided, default is the next available 'problem_xx'"
exit 1 exit 1
} }
...@@ -59,7 +54,7 @@ folder_name="${2:-$(get_next_problem_folder)}" ...@@ -59,7 +54,7 @@ folder_name="${2:-$(get_next_problem_folder)}"
# Check if the executable exists # Check if the executable exists
if [ ! -x $gyacomo_dir/bin/gyacomo23_dp ]; then if [ ! -x $gyacomo_dir/bin/gyacomo23_dp ]; then
echo "Error: Executable 'bin/gyacomo23_dp' not found or not executable. Please compile the code first." echo "- Error: Executable 'bin/gyacomo23_dp' not found or not executable. Please compile the code first."
exit 1 exit 1
fi fi
...@@ -70,7 +65,7 @@ mkdir -p "$folder_name" ...@@ -70,7 +65,7 @@ mkdir -p "$folder_name"
cp $inputfile "$folder_name/params.in" cp $inputfile "$folder_name/params.in"
# Copy the marconi job submission example # Copy the marconi job submission example
cp $gyacomo_dir/scripts/parameter_files/submit_marconi_example.cmd "$folder_name/submit_marconi.cmd" cp $gyacomo_dir/scripts/shell_scripts/submit_marconi_example.cmd "$folder_name/submit_marconi.cmd"
# Copy tutorial file # Copy tutorial file
cp $gyacomo_dir/scripts/tutorials/tutorial.md "$folder_name/." cp $gyacomo_dir/scripts/tutorials/tutorial.md "$folder_name/."
...@@ -82,6 +77,11 @@ ln -s $gyacomo_dir/bin/gyacomo23_dp "$folder_name/gyacomo.exe" ...@@ -82,6 +77,11 @@ ln -s $gyacomo_dir/bin/gyacomo23_dp "$folder_name/gyacomo.exe"
ln -s $gyacomo_dir/scripts/python_utilities/minimal_analysis.py "$folder_name/." ln -s $gyacomo_dir/scripts/python_utilities/minimal_analysis.py "$folder_name/."
ln -s $gyacomo_dir/scripts/python_utilities/movie.py "$folder_name/." ln -s $gyacomo_dir/scripts/python_utilities/movie.py "$folder_name/."
echo "- folder 'simulations/$folder_name' created with symbolic link to the executable." echo "- simulations/$folder_name created"
echo "- check the tutorial file in there!" echo " (check the tutorial file in there)"
echo "...done"
\ No newline at end of file echo "You can now run Gyacomo with"
echo " cd simulations/$folder_name"
echo " mpirun -np 4 ./gyacomo.exe 1 4 1"
echo "Then use the example analysis script"
echo " python3 minimal_analysis.py"
\ No newline at end of file
...@@ -17,7 +17,7 @@ echo '==============================================' ...@@ -17,7 +17,7 @@ echo '=============================================='
# 1. Prelude # 1. Prelude
# 1.1 - First, we clone the repository. # 1.1 - First, we clone the repository.
echo "1. Clone the directory " echo "1/6 Clone the directory "
git clone https://gitlab.epfl.ch/ahoffman/gyacomo.git &> gyacomo_clone.out git clone https://gitlab.epfl.ch/ahoffman/gyacomo.git &> gyacomo_clone.out
cd gyacomo cd gyacomo
...@@ -44,12 +44,12 @@ mkdir lib ...@@ -44,12 +44,12 @@ mkdir lib
# Each of these libraries must be installed in the `/lib` folder (here `/gyacomo/lib`). # Each of these libraries must be installed in the `/lib` folder (here `/gyacomo/lib`).
echo " repository cloned" echo " repository cloned"
echo ______________________________________________ echo "______________________________________________"
############################################# #############################################
### 2. Futils installation ### 2. Futils installation
# 2.1 - We navigate to our `lib` folder and clone first the `futils` library. # 2.1 - We navigate to our `lib` folder and clone first the `futils` library.
echo "2. Installing Futils" echo "2/6 Installing Futils"
cd lib cd lib
echo " clone repository" echo " clone repository"
git clone https://c4science.ch/diffusion/FUTILS/futils.git &> futils_clone.out git clone https://c4science.ch/diffusion/FUTILS/futils.git &> futils_clone.out
...@@ -79,11 +79,11 @@ make install &> futils_make_install.out ...@@ -79,11 +79,11 @@ make install &> futils_make_install.out
# 2.7 - We can test now the installation and linkage of futils by typing `make` in `/gyacomo`. The compilation should pass the previously observed error and halt now with an error at the call of `fftw` routines in `src.fourier_mod.F90`. # 2.7 - We can test now the installation and linkage of futils by typing `make` in `/gyacomo`. The compilation should pass the previously observed error and halt now with an error at the call of `fftw` routines in `src.fourier_mod.F90`.
cd ../../ cd ../../
echo " Futils installed" echo " Futils installed"
echo ______________________________________________ echo "______________________________________________"
############################################# #############################################
### 3. FFTW3 installation ### 3. FFTW3 installation
echo "3. Installing FFTW3" echo "3/6 Installing FFTW3"
echo " download source" echo " download source"
# 3.1 - We download the `fftw` zip directory, unzip it, and navigate to the directory. # 3.1 - We download the `fftw` zip directory, unzip it, and navigate to the directory.
wget http://www.fftw.org/fftw-3.3.10.tar.gz &> wget_fftw3.out wget http://www.fftw.org/fftw-3.3.10.tar.gz &> wget_fftw3.out
...@@ -118,12 +118,12 @@ cd ../ ...@@ -118,12 +118,12 @@ cd ../
# 3.8 - We test the installation and linkage by typing `make` in `/gyacomo`. The compilation should halt with an error at the call of `FM` routines in the `src/coeff_mod.F90` file. # 3.8 - We test the installation and linkage by typing `make` in `/gyacomo`. The compilation should halt with an error at the call of `FM` routines in the `src/coeff_mod.F90` file.
echo " FFTW3 installed" echo " FFTW3 installed"
echo ______________________________________________ echo "______________________________________________"
############################################# #############################################
## 4. FM installation ## 4. FM installation
echo "4. Installing FM" echo "4/6 Installing FM"
# 4.1 - Navigate back to the main `lib` directory (e.g., `/gyacomo/lib/`) and download the zipped folder. # 4.1 - Navigate back to the main `lib` directory (e.g., `/gyacomo/lib/`) and download the zipped folder.
echo " download source" echo " download source"
...@@ -168,24 +168,24 @@ mv *.mod mod ...@@ -168,24 +168,24 @@ mv *.mod mod
cd ../ cd ../
echo " FM installed" echo " FM installed"
echo ______________________________________________ echo "______________________________________________"
############################################# #############################################
# 5 compilation of GYACOMO # 5 compilation of GYACOMO
cd ../ cd ../
echo "5. Compilation of GYACOMO" echo "5/6 Compilation of GYACOMO"
make 2>&1 | tee make.out make 2>&1 | tee make.out
echo ______________________________________________ echo "______________________________________________"
############################################# #############################################
# 6. setup of a testcase # 6. setup of a testcase
echo "6. Test case setup" echo "6/6 Test case setup"
make new_prob make new_prob
echo "-- GYACOMO is ready --" echo "-- GYACOMO is ready --"
echo "you can test running it using:" echo "you can test running it using:"
echo "cd gyacomo/simulations/problem_01" echo "cd gyacomo/simulations/problem_01"
echo "mpirun -np 4 ./gyacomo.exe 1 4 1" echo "mpirun -np 4 ./gyacomo.exe 1 4 1"
echo ______________________________________________ echo "______________________________________________"
############################################# #############################################
# 7. Epilogue # 7. Epilogue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment