Hi Krishna,

I'm also not an expert in MEEP, also just a beginner. But I was confused about 
your comparison with floating point numbers due to finite precision. It's also 
stated in the MEEP docs:

"

def __eq__(self, other):


Returns whether or not the two vectors are numerically equal. Beware of using 
this function after operations that may have some error due to the finite 
precision of floating-point numbers; use close instead.

"

Could it be that this is the reason? Have you tried "close" instead of the 
equality?

I was also wondering if this can work with the sub-pixel averaging. Or is this 
turned off when you provide a function as material? This is of course a 
different question.

Best,
Max

------ Originalnachricht------
Von: Krishna Nivedita G
Datum: Di., 10. Nov. 2020 08:49
An: meep-discuss@ab-initio.mit.edu;
Cc:
Betreff:[Meep-discuss] vary the dielectric constant in a point/region


Hi,

I am a very beginner to FDTD simulations. I already gave a function to 
calculate the refractive index in a cell. Now I have to make some fluctuations 
at some point say (-49.9, -49.9,0). I have provided my code below, but it 
doesn't seem to be giving me the required change.  Am I doing something wrong?

def indexret(p):      #####function to define ref.index
     if p==mp.Vector3(-49.9,-49.9,0):
               n=1.78-0.43*(np.exp(-((p.y)+50)/71))+0.5        #change at 
(-49.9,-49.9,0)
     else:
                n=1.78-0.43*(np.exp(-((p.y)+50)/71))
      return mp.Medium(index=n)

cell = mp.Vector3(140,100,0)
resolution=10
geometry = [mp.Block(center=mp.Vector3(),
                     size=mp.Vector3(140,100,0),
                     material=indexret)]

Please help.
Thank you .

--
Krishna Nivedita G,
Int.BS-MS,
School of Physics,
IISER Thiruvananthapuram.
_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to