forked from Thosse/BoltzPy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
67 lines (64 loc) · 2.51 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Desired Command / Road Map
import boltzpy as bp
import numpy as np
exisiting_simulation_file = None
if exisiting_simulation_file is not None:
sim = bp.Simulation.load(exisiting_simulation_file)
else:
sim = bp.Simulation(exisiting_simulation_file)
sim.add_specimen(mass=2, collision_rate=[50])
sim.add_specimen(mass=3, collision_rate=[50, 50])
sim.setup_time_grid(max_time=1,
number_time_steps=201,
calculations_per_time_step=5)
sim.setup_position_grid(grid_dimension=1,
grid_shape=(31, ),
grid_spacing=0.5)
sim.set_velocity_grids(grid_dimension=2,
maximum_velocity=1.5,
shapes=[(7, 7),
(9, 9)]) # shapes were before :(5, 5),(7, 7)
sim.geometry = bp.Geometry(
sim.p.shape,
[bp.ConstantPointRule(
initial_rho=[1.0, 1.0],
initial_drift=[[0.0, 0.0], [0.0, 0.0]],
initial_temp=[.50, .50],
velocity_grids=sim.sv,
affected_points=[0],
species=sim.s),
bp.InnerPointRule(
initial_rho=[1.0, 1.0],
initial_drift=[[0.0, 0.0], [0.0, 0.0]],
initial_temp=[.50, .50],
affected_points=np.arange(1, 30),
velocity_grids=sim.sv,
species=sim.s),
bp.BoundaryPointRule(
initial_rho=[1.0, 1.0],
initial_drift=[[0.0, 0.0], [0.0, 0.0]],
initial_temp=[.6, .6],
affected_points=[30],
reflection_rate_inverse=[.3, .3],
reflection_rate_elastic=[.3, .3],
reflection_rate_thermal=[0.3, .3],
absorption_rate=[0.1, .1],
surface_normal=np.array([1, 0], dtype=int),
velocity_grids=sim.sv,
species=sim.s)
]
)
# sim.geometry.rules[0].plot(sim.sv, sim.s, 0)
sim.scheme.OperatorSplitting = "FirstOrder"
sim.scheme.Transport = "FiniteDifferences_FirstOrder"
sim.scheme.Transport_VelocityOffset = np.array([0.0, 0.0])
sim.scheme.Collisions_Generation = "Simple" # "UniformComplete"
sim.scheme.Collisions_Computation = "EulerScheme"
# print(sim.__str__(write_physical_grids=True))
sim.coll.setup(sim.scheme, sim.sv, sim.s)
# bp.collisions.plot(sim.sv, sim.coll.relations)
sim.save()
sim.compute()
sim.animate()
# sim.create_animation(np.array([['Mass']]),
# sim.s.specimen_array[0:1])