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

ModeFullVector: PETSc error: both n and N cannot be PETSC_DECIDE #9

Closed
sbuchbinder opened this issue Oct 14, 2019 · 2 comments
Closed

Comments

@sbuchbinder
Copy link

sbuchbinder commented Oct 14, 2019

I am trying to calculate the 2d cross section mode of a waveguide (built using StructuredMaterial3D).

num_modes = 1

# Calculate the input mode
domain_in = emopt.misc.DomainCoordinates(xmin=x0, xmax=x0,
                                         ymin=w_pml, ymax=Y - w_pml,
                                         zmin=w_pml, zmax=Z - w_pml,
                                         dx=dx, dy=dy, dz=dz)

mode_in = emopt.modes.ModeFullVector(wavelength=wavelength,
                                     eps=eps,
                                     mu=mu,
                                     domain=domain_in,
                                     n0=np.sqrt(eps_Si),
                                     neigs=num_modes
                                     )

When I try to run, I get an error:
Arguments are incompatible
Both n and N cannot be PETSC_DECIDE

Traceback (most recent call last):
File ".../my_file.py", line 105, in
neigs=num_modes
File ".../emopt/modes.py", line 1209, in init
self._A.setUp()
File "PETSc/Mat.pyx", line 570, in petsc4py.PETSc.Mat.setUp

Following https://lists.mcs.anl.gov/pipermail/petsc-users/2015-January/023985.html, I tried changing line 1207 of modes.py to:
self._A.setSizes([(Nfields*self._M*self._N, PETSc.DETERMINE), (Nfields*self._M*self._N, PETSc.DETERMINE)])

This gave an out of memory error (amusingly, Memory requested 18446744073709520896). Though my structure is significantly smaller than the one used in the examples/waveguide_modes/wg_modes_3D.py.

Any ideas?

@anstmichaels
Copy link
Owner

Odd, I havent seen this one before. Do you have an example file which produces the problem so that I can take a look? Does the wg_modes_3D.py example work on your machine? Also, what version of PETSc do you have installed?

@sbuchbinder
Copy link
Author

sbuchbinder commented Oct 19, 2019

I was able to figure this one out earlier today.

The key is to not have w_pml be a list (as returned from the sim object).

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

2 participants