ansys / pyfluent

Pythonic interface to Ansys Fluent
https://fluent.docs.pyansys.com
MIT License
251 stars 42 forks source link

Add the Ability to Neatly Display Settings State. #3017

Open dnwillia-work opened 1 month ago

dnwillia-work commented 1 month ago

📝 Description of the feature

Now that many Fluent solver settings are available in a hierarchical tree via the setup object it would be helpful to be able to display these in a human readable format. I can already do something like this today:

import pprint
solver.file.read(file_type='case', file_name='elbow.cas.h5')
s = solver.setup.boundary_conditions.get_state()
p = pprint.PrettyPrinter(indent=2, depth=4, compact=True, sort_dicts=True)
p.pprint(s)

which is good, as it produces output which is more readable that just using print directly:

{ 'interior': { 'interior--elbow-fluid': { 'interior': None,
                                           'name': 'interior--elbow-fluid'}},
  'non_reflecting_bc': { 'general_nrbc': {'sigma': 0.15, 'sigma2': 5.0},
                         'turbo_sepcific_nrbc': {'enable': False}},
  'perforated_wall': { 'model_setup': { 'injection': [ { 'coupled': True,
                                                         'extraction_thread': False,
                                                         'injection_thread': False,
                                                         'static': True,
                                                         'static_setup': { 'method': -1},
                                                         'uniform': True}],
                                        'ninjections': 1,
                                        'urf': 1},
                       'setup_method': 'None'},
  'pressure_outlet': { 'outlet': { 'momentum': { 'avg_pressure_spec': False,
                                                 'backflow_dir_spec_method': 'Normal '
                                                                             'to '
                                                                             'Boundary',
                                                 'backflow_pressure_spec': 'Total '
                                                                           'Pressure',
                                                 'backflow_reference_frame': 'Absolute',
                                                 'gauge_pressure': { 'option': 'value',
                                                                     'value': 0},
                                                 'pressure_profile_multiplier': 1.0,
                                                 'prevent_reverse_flow': False,
                                                 'radial_equ_pressure_distribution': False,
                                                 'target_mass_flow_rate': False},
                                   'name': 'outlet',
                                   'thermal': { 'backflow_total_temperature': { 'option': 'value',
                                                                                'value': 300}},
                                   'turbulence': { 'backflow_turbulent_intensity': 0.05,
                                                   'backflow_turbulent_viscosity_ratio': 4,
                                                   'turbulence_specification': 'Intensity '
                                                                               'and '
                                                                               'Viscosity '
                                                                               'Ratio'}}},
  'settings': { 'advanced': { 'batch_thread_update': False,
                              'delay_model_change_update': False},
                'mass_flow': True,
                'pressure_outlet': { 'average_pressure': False,
                                     'bin_count': 65,
                                     'blending_factor': 0.0},
                'target_mass_flow_rate_settings': { 'under_relaxation_factor': 0.05,
                                                    'verbosity': False}},
<snip> <snip>

It would be great if we could add additional Fluent specific filters to this in order to chop it down:

Maybe other things are needed too.

💡 Steps for implementing the feature

Not 100% sure but it seems like we would need a separate interface to provide the ability to display the entire tree or different parts of it, both textually and graphically.

🔗 Useful links and references

No response

prmukherj commented 1 month ago

@gyeole, how practical is it to have these kinds of filtering mentioned: