


{"id":285117,"date":"2023-05-22T11:37:46","date_gmt":"2023-05-22T11:37:46","guid":{"rendered":"\/forum\/forums\/topic\/topology-inverse-design-mesh-interpolation\/"},"modified":"2023-05-22T11:37:46","modified_gmt":"2023-05-22T11:37:46","slug":"topology-inverse-design-mesh-interpolation","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/topology-inverse-design-mesh-interpolation\/","title":{"rendered":"Topology inverse design mesh interpolation"},"content":{"rendered":"<p>Dear ansys team .<br \/>TLDR: why does topological optimization use the spatial interpolation of &#8220;specified position&#8221;, instead of &#8220;nearest mesh cell&#8221;, it creates errors.&nbsp;<\/p>\n<p>Long:<br \/>I am learning how to use the topological optimization in lumopt + FDTD. when working on my project, I stumbled upon FDTD mesh grid vs optimised geomtry error, which I also found how to recreate using the following example.<\/p>\n<p>following the 2d example in y splitter topology example &nbsp;<a href=\"https:\/\/optics.ansys.com\/hc\/en-us\/articles\/1500007182141-Inverse-Design-of-a-Splitter-Using-Topology-Optimization\">link <\/a>the example runs ok as-is.&nbsp;<br \/>However, when changing line 26 in file &#8220;splitter_base_2D_TE_topology.lsf&#8221; to<br \/>set(&#8216;x max&#8217;,-opt_size_x\/2 &#8211; 0.5e-7);&nbsp;<br \/>which means making the input waveguide to be outside of the optimization area, I get this error:<br \/><span>&nbsp; File &#8220;C:\\Program Files\\Lumerical\\v231\\api\\python\\lumopt\\geometries\\topology.py&#8221;, line 158, in check_param_count_matches_bounds&nbsp;<\/span><br \/><span>UserWarning: Project file structure &#8216;initial_guess&#8217; reports 13832 parameters where expected 13741. This can occur when the number of x, y coordinates specificed to LumOpt do not match the dimensions of the FDTD grid. Try using similar or divisible delta values (size of a pixel) across all the axes.<\/span><\/p>\n<p>Note that the amount of displacment is important, -0.5e-7 will cause the error, whereas -1e-7 wont.&nbsp;<br \/>Also note, I didnt change the optimization area, the FDTD size, the mesh grid setting or anything relevant. just the WG<br \/><span style=\"text-decoration: underline\">my debugging:<br \/><\/span>after adding a breakpoint in topology.py, line 185<br \/>I noticed that indeed the &#8220;opt_fields&#8221; x resolution is of 152, whereas the x_geo resolution is of 151.<br \/>I think that somehow changing the wg position changes the mesh.<br \/><span style=\"text-decoration: underline\">possible fix I found:<br \/><\/span>change lines 366-367 in topology.py to:&nbsp;<\/p>\n<p>set_spatial_interp(sim.fdtd, &#8216;opt_fields&#8217;, &#8216;nearest mesh cell&#8217;)<br \/>set_spatial_interp(sim.fdtd, &#8216;opt_fields_index&#8217;, &#8216;nearest mesh cell&#8217;).<br \/>Then optimization runs OK.<\/p>\n<p><span style=\"text-decoration: underline\">My question<\/span>: why does the spatial interpolation of opt_fields &amp; opt_fields_index set to &#8220;specifed postion&#8221;? The goal should be to force that three data positions are identical: &nbsp;<\/p>\n<ul>\n<li>opt_fields (for gradient calcualtion)<\/li>\n<li>opt_fields_index (for reading the eps )<\/li>\n<li>import object(through which the epsilon is changed)<\/li>\n<\/ul>\n<p>&nbsp;Then why not force all three to &#8220;snap&#8221; to the same grid? is it because I cant set the import object to snap to the FDTD mesh?<br \/>Thanks, Noam<\/p>\n","protected":false},"template":"","class_list":["post-285117","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["285485","30281"],"_bbp_author_ip":["23.217.200.46"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["460"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["285117"],"_bbp_forum_id":["27833"],"_bbp_engagement":["30281","285485"],"_bbp_voice_count":["2"],"_bbp_reply_count":["2"],"_bbp_last_reply_id":["286276"],"_bbp_last_active_id":["286276"],"_bbp_last_active_time":["2023-05-30 07:44:50"]},"test":"nbadtapple-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/285117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/285117\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=285117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}