Defining a target of stacked 2d spheres
Closed this issue · 2 comments
Hi! Can you please help in defining a different 2d target geometry. I want to define small 2d spheres one below the other in a vertical line.
It'll be a great help!
Hey @ChetnaPH,
We can do this using by building a density in the species block, using expressions given in the maths parser.
I have included a simple input deck and a density plot which shows how this can be initialised. Here, I have used a series of lines to say that if we are in cells within the radius of a particular circle, set the density to the desired value, otherwise do not change the density of the species. This way we can build up the target one circle at a time. If you have many circles, you may want to automate the generation of this text.
begin:control
nx = 300
ny = 600
x_min = 0
x_max = 30.0e-6
y_min = 0
y_max = 60.0e-6
t_end = 1.0e-15
end:control
begin:boundaries
bc_x_min = open
bc_x_max = open
bc_y_min = open
bc_y_max = open
end:boundaries
begin:constant
r0 = 3.0e-6 # Sphere radius
x_cent = 15.0e-6 # Centre of sphere line in x
den_e = 1.0e20 # Sphere electron density
r2 = r0^2
end:constant
begin:species
name = electron
mass = 1
charge = -1
npart_per_cell = 50
density = 0
density = if ((x - x_cent)^2 + (y - 1.0*r0)^2 lt r2, den_e, density(electron))
density = if ((x - x_cent)^2 + (y - 3.0*r0)^2 lt r2, den_e, density(electron))
density = if ((x - x_cent)^2 + (y - 5.0*r0)^2 lt r2, den_e, density(electron))
density = if ((x - x_cent)^2 + (y - 7.0*r0)^2 lt r2, den_e, density(electron))
density = if ((x - x_cent)^2 + (y - 9.0*r0)^2 lt r2, den_e, density(electron))
density = if ((x - x_cent)^2 + (y - 11.0*r0)^2 lt r2, den_e, density(electron))
density = if ((x - x_cent)^2 + (y - 13.0*r0)^2 lt r2, den_e, density(electron))
density = if ((x - x_cent)^2 + (y - 15.0*r0)^2 lt r2, den_e, density(electron))
density = if ((x - x_cent)^2 + (y - 17.0*r0)^2 lt r2, den_e, density(electron))
density = if ((x - x_cent)^2 + (y - 19.0*r0)^2 lt r2, den_e, density(electron))
end:species
begin:output
dt_snapshot= 1.0e-15
number_density = always
end:output
I'm going to mark this issue as closed for now, but feel free to include any follow-up comments!
Cheers,
Stuart