BS-SOLCTRA is an application used on development of the SCR-1 (Stellarator of Costa Rica 1) by the Plasma Group of the ITCR (Costa Rica’s Institute of Technology).

The BS-SOLCTRA code was used to calculate the magnetic fields and the magnetic structure that confines the plasma produced by the twelve modular cooper coils on the SCR-1. These magnetic fields are important to define the best electron cyclotron frequency heating (ECH) system. These magnetic fields are also needed to evaluate the confinement of the device.

How and where to get BS-Solctra

The BS-Solctra’s source code can be found in the Gitlab project here.

Follow the instructions to request access.

Compiling BS-Solctra

Compilation requirements

  • Intel’s compiler 2017.1 or above.
  • The GNU make utility. This will required to be installed with the build-essential package.

How to compile?

Once the system has all the requirements installed, the user can go to the source code directory and run make with one of the following options according to the binary that the user wants to generate.

  • No arguments (default): This option will clean the directory from outputs and will generate the binary version for ISA of the compiler host and with the floating point precision in fast.
  • mpi-icpc: This option will compile the BS-Solctra with the ISA of the compiler host. This version will have enabled OpenMP and the MPI and the optimization options to the max level (-O3). Also, this will add the compiler options of the floating point precision to precise (-fp-model precise) and to use the same as the source (-fp-model source).
  • mpi-icpc-serial: This compiler version will generate the binary for the ISA of the compiler host, similar to the previous options, but with the OpenMP off (a.k.a. no threading).
  • mpi-icpc-knl: This version will be similar to the mpi-icpc version but explicity using the ISA for the Knights Landing (-xMIC-AVX512 compiler option).
  • mpi-icpc-knl-g: Same as mpi-icpc-knl but with the debug option. This version is required to use the Intel’s Parallel Studio tool set.

Running BS-Solctra

Application Parameters

  • -precision: Sets the precision of how the results are going to be printed. Default: 5.
  • -steps: Sets the amount of steps that the application has to calculate per start point. Default: 500000.
  • -stepSize: Sets the size of the increase that the Runge-Kutta has to do per step. Default: 0.001.
  • -particles: Provides the path to the file with all the points that the application will use as start points.
  • -length: Sets the amount of points to read from the file of particles. If the value is lower that the amount of lines in the file, it will read only until that line number.
  • -mode: If this is set to “1”, the application will radius of the given point under calculation to see if the algorithm has converged and then finish the given algorithm execution for the current start point. Other way, it will end until reach the given amount of steps. Default: 1.
  • -id: This will set the id of the current execution. This id will be used to name the output of the application and the directory of the results of the execution (“results_<id>”).
  • -resources: This will set the directory where the description files for each coil are located.

Running on Kabre

Before start this, first read the Kabre documentation at here

$ cat submit.pbs
#PBS -N my-bs-solctra-execution
#PBS -q phi-n2h72
#PBS -l nodes=2:ppn=8
#PBS -l walltime=12:00:00
#PBS -d /home/ldcl289/bs-solctra

export NP=$PBS_NP
export LENGTH=$((NP * 4))
export KMP_AFFINITY=noverbose,warnings,respect,granularity=fine,duplicates,scatter,0,0
export OMP_SCHEDULE=dynamic,4
export OMP_NESTED=true

export ID=${PBS_JOBID}

rm -Rf results_${ID}
module load bs-solctra

mpirun -np ${NP} bs-solctra -length $LENGTH -particles particles.txt -id $ID -resource resources 


Luis Diego Chavarría’s masters thesis is a good source of information on the parallelization of BS-SOLCTRA.


Date Editor Details
Luis Diego Chavarria Ledezma Initial version of this document.