Re: What is the best way to set "options 'save_steps'" interactively?

Hi Robert,
Thanks for the quick reply! I have tried the options you have suggested but I have not had success. When I attempt to set problem.conf.options.save_steps, I find that the options dictionary is apparently empty. I have attached a simplified version of my working 2D diffusion code and mesh for reference. The line-numbers where I am attempting to investigate and set the save_steps parameter are at 217-221. Please let me know if you have any further advice! Dumping a .vtk every timestep for my simulation run-time builds up gb's of data rather quickly.
Cheers,
James

Hi James,
One option is to simply save the solution at steps you need manually:
for step, time, state in tss(save_results=False):
if (step % 5) == 0: # Choose your condition.
print("saving step: " + str(step))
filename = problemInstance.get_output_name(suffix=suffix % step)
problemInstance.save_state(filename, state,
post_process_hook=None,
file_per_var=None,
ts=tss.ts)
Another options is to use:
from sfepy.base.base import Struct
options = Struct(name='options', save_steps=50)
...
problemInstance.conf.options = options
for step, time, state in tss():
print("step: " + str(step))
- problemInstance.conf.options needs to be a Struct (an object with options as attributes), not a dict. The fact, that the default value of problemInstance.conf.options is a dict is misleading, and will be fixed.
Does this help?
Cheers, r.
On 10/24/2017 06:17 PM, James Martino wrote:
Hi Robert,
Thanks for the quick reply! I have tried the options you have suggested but I have not had success. When I attempt to set problem.conf.options.save_steps, I find that the options dictionary is apparently empty. I have attached a simplified version of my working 2D diffusion code and mesh for reference. The line-numbers where I am attempting to investigate and set the save_steps parameter are at 217-221. Please let me know if you have any further advice! Dumping a .vtk every timestep for my simulation run-time builds up gb's of data rather quickly.
Cheers,
James
SfePy mailing list sfepy@python.org https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/

Hi Robert,
Thanks again for your quick reply! This cleared everything up for me and I have full control over dump steps now. Much appreciated!
James
On Tue, Oct 24, 2017 at 5:40 PM, Robert Cimrman <cimrman3@ntc.zcu.cz> wrote:
Hi James,
One option is to simply save the solution at steps you need manually:
for step, time, state in tss(save_results=False): if (step % 5) == 0: # Choose your condition. print("saving step: " + str(step)) filename = problemInstance.get_output_name(suffix=suffix %
step) problemInstance.save_state(filename, state, post_process_hook=None, file_per_var=None, ts=tss.ts)
Another options is to use:
from sfepy.base.base import Struct options = Struct(name='options', save_steps=50) ... problemInstance.conf.options = options for step, time, state in tss(): print("step: " + str(step))
- problemInstance.conf.options needs to be a Struct (an object with options as attributes), not a dict. The fact, that the default value of problemInstance.conf.options is a dict is misleading, and will be fixed.
Does this help?
Cheers, r.
On 10/24/2017 06:17 PM, James Martino wrote:
Hi Robert,
Thanks for the quick reply! I have tried the options you have suggested but I have not had success. When I attempt to set problem.conf.options.save_steps, I find that the options dictionary is apparently empty. I have attached a simplified version of my working 2D diffusion code and mesh for reference. The line-numbers where I am attempting to investigate and set the save_steps parameter are at 217-221. Please let me know if you have any further advice! Dumping a .vtk every timestep for my simulation run-time builds up gb's of data rather quickly.
Cheers,
James
SfePy mailing list sfepy@python.org https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
SfePy mailing list sfepy@python.org https://mail.python.org/mm3/mailman3/lists/sfepy.python.org/
participants (2)
-
James Martino
-
Robert Cimrman