Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems under Matlab 2015b #4

Open
bwilfley opened this issue Aug 25, 2016 · 2 comments
Open

Problems under Matlab 2015b #4

bwilfley opened this issue Aug 25, 2016 · 2 comments

Comments

@bwilfley
Copy link

Hi,

I installed maxwellfdfd ( the "-main" branch) by zip file from the github page.
I'm on a mac running El Capitan and matlab 2015b

I ran two tests and saw two different problems.

First, I ran the "one-liner" on your web page:
[E, H] = maxwell_run(... 'OSC', 1e-9, 1550, ... 'DOM', {'vacuum', 'none', 1.0}, [-1100 1100; -1100 2600; 0 10], 10, BC.p, [100 100 0],... 'OBJ', {'CRC/Ag', 'k'}, ... Box([-1100 -80; 0 1000; 0 10]), ... Box([80 1100; 0 1000; 0 10]), ... 'SRCJ', PlaneSrc(Axis.y, -500, Axis.x), true);

The command ran to completion. I got a figure with a graphic showing the box and the silver slab, but no fields plotted. On inspection the E and H variables are 1x3 cells but the objects in the cells are empty arrays: [].

Second, I ran pointsrc_2d. The following output resulted:
maxwell_run begins. E-field grid type: primary time elapsed: 0.26361 sec in total, 0.26361 sec for initial setup Length Unit: 1.000000e-09 m wvlen = 20, freq = 61.9921 eV materials used: vacuum: eps = [1 0 0;0 1 0;0 0 1], mu = [1 0 0;0 1 0;0 0 1] time elapsed: 0.6788 sec in total, 0.41518 sec for nonuniform grid generation [Nx Ny Nz] = [120 120 1] time elapsed: 1.3 sec in total, 0.62124 sec for eps and mu assignment time elapsed: 1.6603 sec in total, 0.36024 sec for J assignment Error using * Inner matrix dimensions must agree. Error in MatrixEquation/matrix_op (line 104) A = PM * (this.Cm * INV_MU * this.Ce) * PM - this.omega^2 * EPS; Error in solve_eq_direct (line 6) [A, b] = eq.matrix_op(); Error in maxwell_run (line 404) [E, H] = solve_eq_direct(solveropts.eqtype, solveropts.pml, osc.in_omega0(), eps, mu, s_factor, J, M, grid3d); Error in pointsrc_2d (line 10) [E, H, obj_array, src_array, J] = maxwell_run(...

I set a breakpoint at MatrixEquation/matrix_op (line 104) and reran. I noticed that PM was empty and that this.pm was also empty.

Do you have any guidance?

Thanks very much.

Brian

@wsshin
Copy link
Owner

wsshin commented Aug 27, 2016

Thanks for pointing out the problems!

  1. In the one-liner, the last argument true should be false. The name of this argument is inspect_only, which, when set true, forces the solver to inspect the integrity of the arguments without solving the equation. This argument is useful when you want to test the integrity of the arguments before solving a large equation.

Alternatively, you can simply remove the last argument, because it is optional. Then the default behavior without the argument is to solve the equation.

I think the option is confusing for beginners, so removed it from the website.

  1. It turned out that this bug was introduced in the recent push: in the constructor of MatrixEquation, this.ft was being used before correctly set.

I made a correction, tested the example code, and pushed the correction. Please give it a try.

@rezamarzban
Copy link

Use 2017a,

The code is wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants