# FENNECS ## Dependencies This code needs the following libraries to run: - futils for writing and reading to .h5 files https://c4science.ch/diffusion/FUTILS/ - bsplines for 2D b-splines interpolation, solving and evaluating the Poisson equation https://c4science.ch/source/spclibs/ WARNING: it is necessary to add the option "-DBSPLINES_USE_MUMPS=ON" during the compilation of spclibs with cmake - SINTEF SISL a C library for NURBS curves interrogation and calculating the distance to a NURBS curve https://github.com/SINTEF-Geometry/SISL - forSISL a library layer to use SINTEF SISL in Fortran https://github.com/rweed/forSISL WARNING: the compile options of forSISL must be modified to add the openmp compile options to allow threadsafe calls to the forSISL subroutines - xgrafix optional library to display a graphical interface during a run and show simulation variables https://ptsg.egr.msu.edu/ Each of these libraries must be compiled according to their respective instructions. ## Compilation To compile the program, the dependencies must first be compiled according to their respective instructions. A Makefile is found in the src folder and prior to the compilation the environment variable $PLATFORM must be defined to use the correct *.mk file, which includes options specific to gcc or intel compilers and specifies the paths to the different libraries. An example can be found and adapted in intel.mk and gcc.mk. To compile in linux: - modify the intel.mk or gcc.mk to point to the correct libraries path - $> export PLATFORM=intel - $> make release The code can also be compiled using cmake - $> mkdir build - $> cd build - $> cmake .. -DCMAKE_PREFIX_PATH=";" -DSISL= -DforSISL= - $> make ## Running the code An example of a simulation configuration can be found in wk/T-REX. The code can be run on a cluster using slurm, by calling the run.sh in command line. It may be necessary to add the command line: "ulimit -s unlimited" to the bashrc to avoid segmentation faults during execution. The code can be stopped using the stop.sh which will create a file called "mystop" containing the remaining number of time-steps to run. The geometry of the T-REX case can be generated using the .m file in geometries/experiment_upper. This function uses functions defined in the matlab folder. The resulting .h5 file must be moved to wk/T-REX. The magnetic field is generated with the file Draw_B_Ellip_10T_DNP_geom.m in magnet/10T_DNP/ which uses functions defined in magnet/cryogenic. The resulting .h5 file must be moved to wk/T-REX. ## Post-processing A number of post-processing routines using matlab have been written and can be found in the matlab folder. To open a hdf5 result file, use the class fennecshdf5 with "result=fennecshdf5(filename);". The object result can then be interrogated to access variables stored in the hdf5 file. ## Folder structure The root folder contains the following folders: - cmake: contains cmake configuration files - geometries: contains matlab routines to generate input geometries for FENNECS - magnet: contains matlab routines to generate input magnetic fields for FENNECS - matlab: contains matlab routines to do post-processing of the h5 files generated by FENNECS - python: contains non-functional preliminary routines in python to also do post-processing - src: contains the Fortran 90 and C source code of FENNECS - wk: working directory containing examples of simulation inputs