ansys / ansys/pyfluent

Saving residuals to external file

Open
#4,912 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
497
Forks
77
Avg merge
22h 37m
Merged PRs (30d)
45

Description

Dear support,

I am trying to export my residuals into an external file (for simulation logging and data convergence check). I have set the residual configuration like this:

```
# Get residuals state
residuals_state = session.settings.solution.monitor.residual.get_state()

# Modify state
residuals_state['equations'] = {'continuity': {'absolute_criteria': 1e-3, 'check_convergence': False, 'monitor': True},
'energy': {'absolute_criteria': 1e-6, 'check_convergence': False, 'monitor': True},
'nut': {'absolute_criteria': 1e-3, 'check_convergence': False, 'monitor': True},
'x-velocity': {'absolute_criteria': 1e-3, 'check_convergence': False, 'monitor': True},
'y-velocity': {'absolute_criteria': 1e-3, 'check_convergence': False, 'monitor': True}}

residuals_state['options'] = {'criterion_type': 'absolute',
'n_display': 1000,
'n_save': 1000,
'normalize': False,
'plot': True,
'print': True,
'residual_values': {'compute_local_scale': False, 'scale_residuals': True}}

# Set residuals state
session.settings.solution.monitor.residual.set_state(residuals_state)
```

This works fine but as soon as I use:

`session.settings.solution.monitor.residual.write(file_name='.\\residuals.out')`

the residuals or any other reports aren't printed anymore in the terminal and only 1 iteration is printed in the file 'residuals.out'. It seems that the write method disrups the whole data logging process and I am not sure how to handle it. Can I get some support on this? Thank you in advance!

Contributor guide

Open the contributing guide

Research direction

Start with the residual monitor API entry point, especially residual.write, and reproduce the supplied configuration while comparing terminal output with residuals.out over multiple iterations. Done means writing residuals externally no longer stops normal terminal or report logging and the file contains the expected iteration history.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.