Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Optimization of an electron beam radius
Posted 2025年12月6日 GMT+8 19:52 Charged Particle Tracing, Optimization, Studies & Solvers Version 6.3 2 Replies
Please login with a confirmed email address before reporting spam
Good morning, I am performing a simulation for an electron accelerator which consists of a cathode, an initial accelerating potential and then the electron beam is guided by six coils on a target which is almost 1m far from the cathode. The simulation itself is ok and I can see the beam.
What I'd like to do next is performing an optimization of the radius of the beam with respect to the currents in the coils. To do so, I defined a boundary probe on the surface of my target with the expression called R_spot, where qy and qz are the position of particles in y and z.
Then I set up an optimization with objective function (spot_target - comp1.R_spot) where spot_target is defined as 1[mm] in my parameters. I ask for a minimization with control variables the six coils currents. But I keep getting this error and I don't understand how to resolve:
Error in sweep. - Parameters: "I_coil_1","20","I_coil_2","20","I_coil_3","20","I_coil_4","20","I_coil_5","20","I_coil_6","20" Cannot evaluate expression. Undefined variable. - Variable: comp1.qy - Geometry: geom1 - Boundary: 87 Failed to evaluate expression. - Expression: sqrt((comp1.qy^2)+(comp1.qz^2)) Failed to evaluate expression. - Expression: comp1.bnd1_operator1(sqrt((comp1.qy^2)+(comp1.qz^2))) Failed to evaluate variable. - Variable: comp1.R_spot - Defined as: comp1.bnd1_operator1(sqrt((comp1.qy^2)+(comp1.qz^2))) Failed to evaluate variable. - Variable: opt.obj1
I also watched the Optimization tutorials in the Learning Center. If someone can help me figuring out what I'm doing wrong I will be grateful since I'm few days into Comsol and I'm learning it by myself. Thank you in advance, Emanuele
Attachments:
