Solved

Source parallelogram

  • 28 August 2022
  • 2 replies
  • 51 views

Userlevel 1

Hi all,

Is there a simple way to define a 2D parallelogram source?

edit:

succeed usuing DAT file, and then import as source file:

file1 = open("paraleloid.DAT","w")
Nx = 20


A = 4
B = 12
H = 9
theta = 30
a = A/Nx
h = H/(6*Nx)
dx = h / np.tan(np.pi*theta/180)

Ny = H/h
Ny = round(Ny)

N = Ny*Nx

L0 = str(N) +" "+str(4)+"\n"
file1.writelines(L0)

for j in range(Ny):
    for i in range(Nx):
        
        L1 = str(round(i*a+j*dx,2))+" "+str(round(h*j,2))+" "+str(0) +" "+str(0) +" "+str(0) +" "+str(1)+" "+str(1)+"\n"

        file1.writelines(L1)

file1.close() #to change file access modes

Thanks,

Nadav

 

icon

Best answer by MichaelH 31 August 2022, 19:25

View original

2 replies

Userlevel 6
Badge +2

Hi Nadav,

Thanks for the post.  I also want to point out you can create any geometry in a CAD software, import this geometry via CAD Part: STEP/IGES/SAT, and then use Source Object to turn the CAD object into a source; this way you can define your source geometry with common practices rather than having to script out a specific shape.  Depending on the software you have and your ability to use CAD, this might be a useful alternative.  

Userlevel 1

Hi Michael,

 

Thanks for the answer.

 

Best regards,

Nadav

Reply