Hi, I am trying to create a 2D sinusoidal (or cos) structure using
functions but I am running into some problems.  Hopefully someone here
can give me a hand.  I am attaching a picture of the structure I would
like to describe.

In essence, I need to define a function where meep will check if the
y-axis value (let's call it "p") in the box is greater than the value
returned from cos(x).  This means that for every xy pair, a pre-defined
value would be given if the y position is lower or higher than the
cos(x).

On Mon, 12 Feb 2007, Nicolas Tetreault wrote:
I was thinking of something around the lines of this:

(define (f p x)
(if (> (vector-y p) (cos(vector-x x)) 1 0))

This is a bit confused.

The argument to the material function should be a single vector3 p, in which case it contains both the x and y components.

Second, it doesn't make sense to return 1 or 0...the dielectric function should ordinarily be at least 1 everywhere, and certainly shouldn't be zero for a non-dispersive material.

(Your parentheses are also wrong...)

You should have something like:

(define (f p)
        (if (> (vector3-y p) (cos (vector3-x p))) 1 12))

this returns 1 above cos(x) and 12 below cos(x) ... change 12 to whatever dielectric constant you want to use

Then when describing the geometry:

(make block (center 0 0 0) (size 1 1 infinity)
       (material (make material-function (epsilon-func f))))

This part is fine.

Steven

_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to