{ "cells": [ { "cell_type": "markdown", "id": "motivated-street", "metadata": {}, "source": [ "# Running a Simulation\n", "\n", "Now that we have tuned the simulation’s parameter it is time to run it. Because this is another notebook we copy the first cell of the [Pre Simulation Testing notebook](Pre_Simulation_Testing.html) and then run the simulation with only three lines of code.\n", "\n", "The YAML input file can be found at [input_file](https://raw.githubusercontent.com/murillo-group/sarkas/master/docs/documentation/Tutorial_NB/input_files/yukawa_mks_p3m.yaml) and this notebook at [notebook](https://raw.githubusercontent.com/murillo-group/sarkas/master/docs/documentation/Tutorial_NB/Simulation_Docs.ipynb)\n", "\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "inside-milan", "metadata": {}, "outputs": [], "source": [ "# Import the usual libraries\n", "import os\n", "\n", "# Import sarkas\n", "from sarkas.processes import Simulation\n", "\n", "# Create the file path to the YAML input file\n", "input_file_name = os.path.join('input_files', 'yukawa_mks_p3m.yaml')" ] }, { "cell_type": "markdown", "id": "covered-costume", "metadata": {}, "source": [ "Then we run our simulation with only three lines of code" ] }, { "cell_type": "code", "execution_count": 2, "id": "hydraulic-point", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[38;2;0;129;131m\n", "\n", "\n", "\n", "\n", "\n", " __ _ \n", "/ _\\ __ _ _ __| | ____ _ ___ \n", "\\ \\ / _` | '__| |/ / _` / __|\n", "_\\ \\ (_| | | | < (_| \\__ \\\n", "\\__/\\__,_|_| |_|\\_\\__,_|___/\n", " \n", "\n", "\u001b[0m\n", "An open-source pure-python molecular dynamics suite for non-ideal plasmas.\n", "\n", "\n", "\n", "\n", "\n", "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n", " Simulation \n", "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n", "\n", "Job ID: yocp\n", "Job directory: Simulations/yocp_pppm\n", "\n", "Equilibration dumps directory: \n", " Simulations/yocp_pppm/Simulation/Equilibration/dumps\n", "Production dumps directory: \n", " Simulations/yocp_pppm/Simulation/Production/dumps\n", "\n", "Equilibration Thermodynamics file: \n", " Simulations/yocp_pppm/Simulation/Equilibration/EquilibrationEnergy_yocp.csv\n", "Production Thermodynamics file: \n", " Simulations/yocp_pppm/Simulation/Production/ProductionEnergy_yocp.csv\n", "\n", "PARTICLES:\n", "Total No. of particles = 10000\n", "No. of species = 1\n", "Species ID: 0\n", "\tName: H\n", "\tNo. of particles = 10000 \n", "\tNumber density = 1.620000e+32 [N/m^3]\n", "\tAtomic weight = 1.0002 [a.u.]\n", "\tMass = 1.673000e-27 [kg]\n", "\tMass density = 2.710260e+05 [kg/m^3]\n", "\tCharge number/ionization degree = 1.0000 \n", "\tCharge = 1.602177e-19 [C]\n", "\tTemperature = 1.450565e+04 [K] = 1.250000e+00 [eV]\n", "\tDebye Length = 6.530052e-13 [1/m]\n", "\tPlasma Frequency = 1.675504e+16 [rad/s]\n", "\n", "SIMULATION AND INITIAL PARTICLE BOX:\n", "Units: mks\n", "Wigner-Seitz radius = 1.137973e-11 [m]\n", "No. of non-zero box dimensions = 3\n", "Box side along x axis = 3.472931e+01 a_ws = 3.952104e-10 [m]\n", "Box side along y axis = 3.472931e+01 a_ws = 3.952104e-10 [m]\n", "Box side along z axis = 3.472931e+01 a_ws = 3.952104e-10 [m]\n", "Box Volume = 6.172840e-29 [m^3]\n", "Initial particle box side along x axis = 3.472931e+01 a_ws = 3.952104e-10 [m]\n", "Initial particle box side along y axis = 3.472931e+01 a_ws = 3.952104e-10 [m]\n", "Initial particle box side along z axis = 3.472931e+01 a_ws = 3.952104e-10 [m]\n", "Initial particle box Volume = 6.172840e-29 [m^3]\n", "Boundary conditions: periodic\n", "\n", "ELECTRON PROPERTIES:\n", "Number density: n_e = 1.620000e+32 [N/m^3]\n", "Wigner-Seitz radius: a_e = 1.137973e-11 [m]\n", "Temperature: T_e = 1.450565e+07 [K] = 1.250000e+03 [eV]\n", "de Broglie wavelength: lambda_deB = 1.957093e-11 [m]\n", "Thomas-Fermi length: lambda_TF = 2.272532e-11 [m]\n", "Fermi wave number: k_F = 1.686470e+11 [1/m]\n", "Fermi Energy: E_F = 1.083628e+03 [eV]\n", "Relativistic parameter: x_F = 6.512461e-02 --> E_F = 1.082482e+03 [eV]\n", "Degeneracy parameter: Theta = 1.153532e+00 \n", "Coupling: r_s = 0.215046, Gamma_e = 0.101230\n", "Warm Dense Matter Parameter: W = 1.9838e-01\n", "Chemical potential: mu = -2.8605e-01 k_B T_e = -3.2996e-01 E_F\n", "\n", "POTENTIAL: yukawa\n", "electron temperature = 1.4506e+07 [K] = 1.2500e+03 [eV]\n", "kappa = 0.5008\n", "Gamma_eff = 101.23\n", "\n", "ALGORITHM: pppm\n", "Charge assignment order: 6\n", "FFT aliases: [3, 3, 3]\n", "Mesh: 64 x 64 x 64\n", "Ewald parameter alpha = 0.6220 / a_ws = 5.465900e+10 [1/m]\n", "Mesh width = 0.5426, 0.5426, 0.5426 a_ws\n", " = 6.1752e-12, 6.1752e-12, 6.1752e-12 [m]\n", "Mesh size * Ewald_parameter (h * alpha) = 0.3375, 0.3375, 0.3375 \n", " ~ 1/2, 1/2, 1/2\n", "rcut = 5.5100 a_ws = 6.270200e-11 [m]\n", "No. of PP cells per dimension = 6, 6, 6\n", "No. of particles in PP loop = 1078\n", "No. of PP neighbors per particle = 167\n", "PM Force Error = 5.800215e-06\n", "PP Force Error = 2.804557e-06\n", "Tot Force Error = 6.442673e-06\n", "\n", "THERMOSTAT: \n", "Type: berendsen\n", "First thermostating timestep, i.e. relaxation_timestep = 50\n", "Berendsen parameter tau: 1.000 [timesteps]\n", "Berendsen relaxation rate: 1.000 [1/timesteps] \n", "Thermostating temperatures: \n", "Species ID 0: T_eq = 1.450565e+04 [K] = 1.250000e+00 [eV]\n", "\n", "INTEGRATOR: \n", "Type: verlet\n", "Time step = 2.000000e-18 [s]\n", "Total plasma frequency = 1.675504e+16 [rad/s]\n", "w_p dt = 0.0335 ~ 1/29\n", "\n", "Equilibration: \n", "No. of equilibration steps = 5000 \n", "Total equilibration time = 1.0000e-14 [s] ~ 167 w_p T_eq \n", "snapshot interval step = 10 \n", "snapshot interval time = 2.0000e-17 [s] = 0.3351 w_p T_snap\n", "Total number of snapshots = 500 \n", "\n", "Production: \n", "No. of production steps = 5000 \n", "Total production time = 1.0000e-14 [s] ~ 167 w_p T_prod \n", "snapshot interval step = 10 \n", "snapshot interval time = 2.0000e-17 [s] = 0.3351 w_p T_snap\n", "Total number of snapshots = 500 \n", "\n", "\n", "------------------------ Initialization Times ------------------------ \n", "\n", "\n", "Potential Initialization Time: 0 hrs 0 min 6 sec\n", "\n", "Particles Initialization Time: 0 sec 1 msec 271 usec 628 nsec\n", "\n", "Total Simulation Initialization Time: 0 hrs 0 min 6 sec\n", "\n", "\n", "--------------------------- Equilibration ---------------------------- \n", "\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "739e8b90d6e14187abeffdd6ae4a5843", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/5000 [00:00**_NOTE:_** This simulation was run on a 2019 Dell XPS 8930 with Intel Core i7-8700K @ 3.70Ghz and 48GB of RAM running Ubuntu 18.04. Actual run times will be different on your computer.\n", "\n", "## Dumps\n", "Each dump is a [.npz](https://numpy.org/doc/stable/reference/generated/numpy.savez.html) file containing the following information for each of phase:\n", "\n", " Equilibration:\n", " id = particles id's numbers, \n", " names = species name of each particle,\n", " pos = Particles positions N x 3 array,\n", " vel = Particles velocities N x 3 array,\n", " acc = Particles acceleration N x 3 array,\n", " virial = Virial matrix N x 3 x 3 array,\n", " time = Time in seconds\n", "\n", " Production:\n", " id = particles id's numbers, \n", " names = species name of each particle,\n", " pos = Particles positions N x 3 array,\n", " vel = Particles velocities N x 3 array,\n", " acc = Particles acceleration N x 3 array,\n", " cntr = Number of times each particle has been folded back into the simulation box, N x 3 array,\n", " rdf_hist = Instantaneous Histogram of the Radial Distribution Function,\n", " virial = Virial matrix N x 3 x 3 array,\n", " time = Time in seconds\n", "\n", "This information is saved by the [.dump()](../../api/util_subpckg/InputOutput_mthds/sarkas.utilities.io.InputOutput.dump.html#sarkas.utilities.io.InputOutput.dump) method of the [InputOutput](../../api/util_subpckg/sarkas.utilities.io.InputOutput.html).\n", "\n", "The same method saves Energy and Temperature information in the Thermodynamics files also. This can be accessed by `sim.io.eq_energy_filename` and `sim.io.prod_energy_filename`. The information saved is the following:\n", "\n", " Time, Total Energy, Total Kinetic Energy, Potential Energy, Total Temperature\n", "\n", "In addition, in the case of multispecies plasmas, the kinetic energy and the temperature of each species will be saved.\n", "\n", "Once the simulation is complete it is time to analyze the data. Follow this [link](Post_Processing_Docs.html)." ] }, { "cell_type": "code", "execution_count": null, "id": "explicit-worse", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10" } }, "nbformat": 4, "nbformat_minor": 5 }