Code Monkey home page Code Monkey logo

Comments (5)

wsshin avatar wsshin commented on August 20, 2024

Hi Tyler,

I cannot reproduce this problem myself. Could you send me a minimum example that generates this problem?

Wonseok

On Jan 4, 2016, at 20:21 , Tyler Hughes [email protected] wrote:

When giving maxwell_run 'SRCJ' an array of source objects, I recieve this error:

Incorrect number of right hand side elements in dot name assignment Missing [] around left hand side is a likely cause

changing line 49 from

    thisgt = gt

to

    if (length(this) == 1)
        thisgt = gt;
    else
        for i = (1:length(this))
            this(i)gt = gt;
        end
    end
end

seems to fix the issue temporarily


Reply to this email directly or view it on GitHub #1.

from maxwellfdfd.

twhughes avatar twhughes commented on August 20, 2024

Try this script. It is possible that this issue is due to me not understanding the primal / dual grid constraints.

PhaseShiftedSource.m.gz

from maxwellfdfd.

twhughes avatar twhughes commented on August 20, 2024

Could you also send me your working example of correctly using an array of source objects in maxwell_run()? This may help me understand what is going wrong here.

At least in my copy, (which is older) It seems like more of a syntax error with function set_gridtype(this, gt) in Source.m not being set up to set the grid type for each source array element.

from maxwellfdfd.

wsshin avatar wsshin commented on August 20, 2024

It turns out that this is a combination of two problems.

  1. It turns out that there was actually a problem in handling an array of instances of Source in io/build_system.m. I have fixed it and pushed the change to GitHub. You can also fix it yourself by changing
        src = arg;
        src.set_gridtype(ge);
        srcj_array = [srcj_array(1:end), src];

to

            srcj_array_curr = arg;
            for src = srcj_array_curr
                src.set_gridtype(ge);
            end
            srcj_array = [srcj_array(1:end), srcj_array_curr];

and also

            src = arg;
            src.set_gridtype(alter(ge));
            srcm_array = [srcm_array(1:end), src];

to

            srcm_array_curr = arg;
            for src = srcm_array_curr
                src.set_gridtype(alter(ge));
            end
            srcm_array = [srcm_array(1:end), srcm_array_curr];
  1. After you fix this bug, now you get another error message about x-grid generation upon execution of the script you attached earlier. This is due to the wrong location of the sources as you suspected.
    You can easily fix this problem by shifting the source distribution slightly. For example, you can change
    z = X/2 - 1
    to
    z = X/2 - 0.5
    in your script.

The reason this solves the problem is as follows. The x-polarized point sources should be located at the midpoints of x edges of the Yee grid cells. Therefore, while constructing the point sources by iterating i over -z:1:z in your script, MaxwellFDFD tries to generate a grid such that -z:1:z are located at the midpoints of the grid cells.

Note that as a result MaxwellFDFD attempts to put x = ±L at the midpoints of the grid cells. However, your Box([-L, L; -L, L; 0, 1], [dl,dl, 1]) tries to put x = ±L at the end points (rather than midpoints) of grid cells. These two constraints conflict, so the x-grid construction fails.

By making sure that the x-locations of your x-polarized points sources are different from x = ±L, you can successfully create the grid.

Hope this helps!

Wonseok

On Jan 5, 2016, at 15:17 , Tyler Hughes [email protected] wrote:

Could you also send me your working example of correctly using an array of source objects in maxwell_run()? This may help me understand what is going wrong here.

At least in my copy, (which is older) It seems like more of a syntax error with function set_gridtype(this, gt) in Source.m not being set up to set the grid type for each source array element.


Reply to this email directly or view it on GitHub #1 (comment).

from maxwellfdfd.

twhughes avatar twhughes commented on August 20, 2024

Thanks for looking into this issue and for the instructive response about the grid generation issue. I was quite confused about it before but I believe this clears up the issues I was having with it.

Thanks again!

Tyler

from maxwellfdfd.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.