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

access the objective function during optimisation #2910

Open
poutine-dejeuner opened this issue Sep 18, 2024 · 0 comments
Open

access the objective function during optimisation #2910

poutine-dejeuner opened this issue Sep 18, 2024 · 0 comments

Comments

@poutine-dejeuner
Copy link

poutine-dejeuner commented Sep 18, 2024

From the meepcon2022 tutorial notebook, there is a cell in which the optimisation problem is set up. The objective function J is defined. How can I access the value of the objective function J? More generally, I am interested in how to reproduce the same eigenmode computation from a simulation object directly.

`TE0 = mpa.EigenmodeCoefficient(sim,
mp.Volume(center=mp.Vector3(x=-Sx/2 + pml_size + 2waveguide_length/3),
size=mp.Vector3(y=1.5)),mode)
TE_top = mpa.EigenmodeCoefficient(sim,
mp.Volume(center=mp.Vector3(Sx/2 - pml_size - 2
waveguide_length/3,arm_separation/2,0),
size=mp.Vector3(y=arm_separation)),mode)
TE_bottom = mpa.EigenmodeCoefficient(sim,
mp.Volume(center=mp.Vector3(Sx/2 - pml_size - 2*waveguide_length/3,-arm_separation/2,0),
size=mp.Vector3(y=arm_separation)),mode)
ob_list = [TE0,TE_top,TE_bottom]

def J(source,top,bottom):
power = npa.abs(top/source) ** 2 + npa.abs(bottom/source) ** 2
return npa.mean(power)

opt = mpa.OptimizationProblem(
simulation = sim,
objective_functions = J,
objective_arguments = ob_list,
design_regions = [design_region],
frequencies=frequencies`

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

1 participant