Open nathmay opened 4 months ago
@nathmay This is expected. If the nominal is not solved, the method fails because it is not solved this variation.
Check which variation is the nominal before calling this method: app.available_variations.nominal_w_values_dict
This is the value that the method is using, if it is not {'cube_theta': '45deg'}, then you are passing a wrong value.
Thanks for the feedback
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
:
{'cavity_width': '26.7cm',
'cavity_depth': '27cm',
'cavity_height': '18.8cm',
'wg_width': '5cm',
'wg_depth': '7.8cm',
'wg_height': '1.8cm',
'plate_rad': '12cm',
'plate_t': '0.6cm',
'plate_buffer': '1.5cm',
'cube_dim': '4.8cm',
'cube_theta': '45deg'}
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.
Hope this helps!
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