72 lines
2.1 KiB
Python
72 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
import numpy as np
|
|
import sys
|
|
import getopt
|
|
import math
|
|
import h5py
|
|
import matplotlib.pyplot as plt
|
|
import os
|
|
|
|
#input from KATRIN
|
|
cylinder_radius = 4.5 #cm
|
|
cylinder_height = 1000 #cm
|
|
n_electron_total = 1E6 #1/cm^3 von Laura
|
|
temperature = 30 #K
|
|
|
|
#input from ACRONYM
|
|
particle_updates_per_second_1CPU = 5E5 #grob abgeschätzt
|
|
|
|
# Parameter
|
|
me = 9.1094e-28 # Electron mass (g)
|
|
e = 4.8032068e-10 # Elementary charge (statcoulomb)
|
|
k = 1.380658e-16 # Boltzmann constant (erg / K)
|
|
c = 29979245800. # Speed of light (cm/s)
|
|
|
|
# Derived quanteties
|
|
debye_lentgh = np.sqrt(k * temperature / (4.0 * np.pi * n_electron_total * e * e))
|
|
dx = np.sqrt(0.5) * debye_lentgh
|
|
print("dx = {:.2e} [cm]".format(dx))
|
|
|
|
particles_per_cell = n_electron_total * np.power(dx, 3)
|
|
print("particles per cell = {}".format(np.ceil(particles_per_cell)))
|
|
|
|
EB_dt_rescale = np.sqrt(3.)
|
|
dt_cfl = dx / (EB_dt_rescale * c) #minimum auch von anderen dt, aber cfl ist am kleinsten
|
|
print("dt = {:.2e} [s]".format(dt_cfl))
|
|
|
|
plasma_frequency = np.sqrt(n_electron_total * 4 * np.pi * e*e /me)
|
|
print("Plasma Frequency = {:.2e} [Hz]".format(plasma_frequency))
|
|
|
|
nx_x = int(cylinder_radius*2/dx)
|
|
nx_y = int(cylinder_radius*2/dx)
|
|
nx_z = int(cylinder_height/dx)
|
|
print("nx, ny, nz: {} {} {}".format(nx_x, nx_y, nx_z))
|
|
|
|
number_of_cells = nx_x * nx_y * nx_z
|
|
print("number of cells = {:.2e}".format(number_of_cells))
|
|
|
|
number_of_particles = number_of_cells * particles_per_cell
|
|
print("Number of particles = {:.2e}".format(number_of_particles))
|
|
|
|
timesteps_total = int(1/(plasma_frequency*dt_cfl))
|
|
print("Number of timesteps = {:.2e}".format(timesteps_total))
|
|
|
|
particle_updates = timesteps_total * number_of_particles
|
|
print("Particle updates = {:.2e}".format(particle_updates))
|
|
|
|
CPUh = int(particle_updates / particle_updates_per_second_1CPU/3600)
|
|
print("CPUh = {:.2e}".format(CPUh))
|
|
|
|
|
|
# CPU Aufteilung
|
|
nx_min = 32 #minimale anzahl an zellen pro CPU
|
|
CPU_x = 10
|
|
CPU_y = 10
|
|
CPU_z = nx_z/nx_min
|
|
|
|
CPU_total = CPU_x * CPU_y * CPU_z
|
|
print("Number of used CPUs = {:.2e}".format(CPU_total))
|
|
|
|
time_for_simulation = np.ceil(CPUh/CPU_total)
|
|
print("The simulation would take: {}h".format(time_for_simulation))
|