You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
export_field_file() in pyaedt/modules/PostProcessor.py has an optional argument variation_dict. By default, export_field_file() assigns this as: variation_dict = self._app.available_variations.nominal_w_values_dict (unless user passes a custom dictionary)
This works when all the design variables in the project are enabled for sweep. However, if 'sweep' is disabled for one or more design variables, variation_dict should exclude those variables. Otherwise, ofieldsreporter.ExportToFile() (used in export_field_file()) throws an error. The issue is that app.available_variations.nominal_w_values_dict by default includes all design variables, even those with sweep disabled. To curcumvent this, I had to manually pass a custom variation_dict to export_field_file(), including only sweep enabled variables.
PS: I have not tested this for export_field_file_on_grid() - which is a similar function, and has a similarly defined variation_dict. So it could also have the same problem.
Steps To Reproduce
Extract the attached zip file
Open the archived aedtz project in AnsysEDT (I used version 2023R2)
Make sure datapoints.pts is in working directory, and run the following:
frompyaedtimportHfssimportosapp=Hfss()
options= ['IncludePtInOutput:=', False, 'RefCSName:=', 'CubeCS']
# The following will throw an error:app.post.export_field_file("Volume_Loss_Density", filename=os.path.join(os.getcwd(),"loss.fld"),
sample_points_file=os.path.join(os.getcwd(),"data_points.pts"), export_with_sample_points=options,
intrinsics="2.45GHz")
The work around I found is to pass a variation_dict that includes only the sweep enabled variables. In this example, there are 12 design variables - but only one is sweep enabled: "cube_theta", set to "45deg" as nominal. So the following works:
Hi @Samuelopez-ansys , thanks for getting back! The nominal was in fact solved. This is what I meant by some variables having sweep disabled (sorry I didn't make that clear):
In this case, after the nominal configuration shown above is solved, I get the following from app.available_variations.nominal_w_values_dict:
The above causes export_field_file() to throw an error.
If I just pass variation_dict = {'cube_theta': '45deg'} (i.e. exclude the sweep disabled variables), then the exporting works as expected.
Before submitting the issue
Description of the bug
export_field_file()
in pyaedt/modules/PostProcessor.py has an optional argumentvariation_dict
. By default,export_field_file()
assigns this as:variation_dict = self._app.available_variations.nominal_w_values_dict
(unless user passes a custom dictionary)This works when all the design variables in the project are enabled for sweep. However, if 'sweep' is disabled for one or more design variables,
variation_dict
should exclude those variables. Otherwise,ofieldsreporter.ExportToFile()
(used inexport_field_file()
) throws an error. The issue is thatapp.available_variations.nominal_w_values_dict
by default includes all design variables, even those with sweep disabled. To curcumvent this, I had to manually pass a customvariation_dict
toexport_field_file()
, including only sweep enabled variables.PS: I have not tested this for
export_field_file_on_grid()
- which is a similar function, and has a similarly definedvariation_dict
. So it could also have the same problem.Steps To Reproduce
datapoints.pts
is in working directory, and run the following:The work around I found is to pass a
variation_dict
that includes only the sweep enabled variables. In this example, there are 12 design variables - but only one is sweep enabled: "cube_theta", set to "45deg" as nominal. So the following works:Export_Field_Test.zip
Which Operating System are you using?
Windows
Which Python version are you using?
3.10
Installed packages
The text was updated successfully, but these errors were encountered: