Ansys Learning Forum Maintenance

NOTICE: We will be performing backend maintenance of our Learning Forum from April 5 to April 12, 2021. The result will be a new infrastructure but with little impact to user experience and design. Currently the forum is accessible in read-only mode as we complete our final migration. Thank you for your patience. For urgent issues please visit HERE.


Script for Generating of evenly spaced dipole in a circle FTDT — Ansys Learning Forum

Script for Generating of evenly spaced dipole in a circle FTDT

MANNANMANNAN Member Posts: 9
edited April 1 in Photonics

Dear @gsun and @troberts ,

I would like to know any script that will generate the dipoles in below mention pattern in the FTDT environment. in the XY plan


Looking forward to have a nice discussion

Regards

Mannan

Tagged:

Answers

  • greg_baethgegreg_baethge Ansys Employee Posts: 15

    Hi @MANNAN,

    Thanks for posting your question. I take the liberty to reply on behalf of my colleagues 😊 I don't think we really have any script example doing exactly this, but I don't think it is very difficult. The basic idea is to run 2 nested loops, one on the angle (theta) and one of the position of the dipole for a defined theta, and calculate the xy coordinates.

    For example, it could be something like:

    ntheta = 36; # number of angle points
    nr = 10; # number of point along each radius
    rmax = 5e-6; # max value of the radius
    theta = linspace(0, 360, ntheta);
    r = linspace(0, rmax, nr);
    for(i=1:ntheta) {
        for(j=1:nr) {
            x = r(j)*cos(theta(i)*pi/180);
            y = r(j)*sin(theta(i)*pi/180);
    
            adddipole;
            set("x", x);
            set("y", y);
        }
    }
    

    Note this script is probably incomplete: for instance, it will add a dipole at (0,0) for each value of theta while you probably only want 1 and there might be duplicate for theta=0 and theta=360.

Sign In or Register to comment.