The contents of this repository are described below: -
- inputs: Constains the following files: -
- comp_data.txt: Contains composition value inside the nanowires and noise in the composition profile.
- parameters_data.txt: Contains simulation parameters such as mobility, free energy barrier, gradient energy coefficient, and stability factor for the numerical scheme.
- radius_data.txt: The two nanowire radii values (can be different in case crossing nanowires and equal in case of single nanowire configuration).
- system_data.txt: Contains the system size data and the grid spacing used for the structured mesh.
- time_data.txt: Contains the simulation time, the user time-step (intervals at which to print the output), and the numerical scheme time-step.
- visualize: Contains the following files: -
- vtkfile.c: Code for converting the binary output time-series data into VTK datasets.
- visualize.sh: Script for compiling and executing the vtkfile code.
- src: Contains the source Cuda C files. The main code file is nanowire3D.cu. All other code files are function files which nanowire3D.cu file calls for different calculations.
- mayavi_plots3D: Contains mayavi_visualization.py script for converting the binary output time-series data files into 3D plots directly. The output is stored in the plots3D/ directory as PNG image files. The image files are combined to form an animated GIF named animation.gif.
- output: Contains output binary time-series data files generated from a particular simulation run. Subsequent simulation runs overwrite files into this directory and delete files from the previous run. Hence, users are advised to store the generated simulation data to a different folder for future use.
The code is written for Linux-based operating systems with Nvidia CUDA-enabled GPUs. The following is a list of dependencies that are used in the code: -
- cuFFT
- nvcc
- gcc
- GSL
- Paraview (for visualization and data analysis of VTK datasets)
- Python3 (preferably Python3.7)
- Mayavi (for generating 3D plots directly)
The compilation and execution of the simulation code are handled by the nanowire_cuda.sh script (to be executed from the nanowireCUDA3D/ directory).
The command format: ./nanowire_cuda.sh ARG1 ARG2
The following command line arguments are to be used for different configurations: -
First command line argument:
- NEW: For a fresh simulation run.
- RESTART: For a restarted simulation run.
Second command line argument:
- DEG90: 90 degree configuration between two crossing nanowires.
- DEG60: 60 degree configuration between two crossing nanowires.
- DEG45: 45 degree configuration between two crossing nanowires.
- DEG30: 30 degree configuration between two crossing nanowires.
- SINGLE_WIRE: For single nanowire configuration.
- MULT_JUNC: For nanowire grid consisting of 9 junctions.
A sample command for a new simulation for 90 degree configuration is as follows:
$ ./nanowire_cuda.sh NEW DEG90
The binary simulation output time-series data in the output/ directory can be used for all post-processing operations. The binary data converted into VTK datasets in the visualize/vtk_data/ directory can be directly loaded into Paraview and visualized. Paraview also provides many filters for data analysis purposes.
Another option is to make on-the-fly plots directly from the binary data generated. This can be achieved using the mayavi_visualization.py script in the mayavi_plots3D/ directory. To generate the plots, type the following command after the simulation run has finished:
$ cd mayavi_plots3D/
$ python3 mayavi_visualization.py
Output in the form of PNG snapshots will be stored in mayavi_plots3D/plots3D/ directory. Also, an animated gif of the simulation named animation.gif will be stored in the mayavi_plots3D/ directory.
- For the RESTART simulation type, keep the binary data in the output/ directory corresponding to the last time-step from which the simulation needs to restart. Accordingly, update the start_time in the inputs/time_data.txt file to this last time-step from which to restart the simulation.
- The code can also be run in the Windows operating system. In that case the bash script files cannot be used, rather the user has to compile the code manually using the compilation commands provided in the assets/ directory without the -lgsl and -lm flags, and with a suitable random number generator for windows.