new interactive example with time stepping

80 views
Skip to first unread message

Robert Cimrman

unread,
Mar 18, 2015, 8:10:50 AM3/18/15
to sfepy...@googlegroups.com
Hi,

I have just updated the time stepping solvers in sfepy for interactive use, as
demonstrated in the new example [1]. For basic use, ignore the probing code -
the time stepper can be used as simply as:

tss = SimpleTimeSteppingSolver({'t0' : 0.0, 't1' : 100.0, 'n_step' : 11},
problem=problem)
tss.init_time()
for step, time, state in tss():
pass

r.

[1] http://sfepy.org/doc-devel/examples/diffusion/time_poisson_interactive.html

Jan Heczko

unread,
Mar 6, 2017, 9:01:05 AM3/6/17
to sfepy-devel
Hi,

I tried to use this approach ([1]) to solve a diffusion problem with a field-dependent material as in [2], but I got:
ValueError: material data not set! (call time_update())

By adding some print-calls to the material-defining function, I found out that the function gets called, but with mode='special' instead of 'qp'.
As a result None is returned instead of the values that correspond to the initial conditions.

My question(s):
- Is the SimpleTimeSteppingSolver usable for such problem? Is there an example?
- Should I use/implement a different time-stepper?

Thanks,
Jan

[2] http://sfepy.org/doc-devel/examples/diffusion/poisson_field_dependent_material.html

Jan Heczko

unread,
Mar 8, 2017, 9:59:22 AM3/8/17
to sfepy-devel
Update: There was a mistake in naming the materials. With things corrected, however, the problem remains.
I attach the file (oxygen_diffusion.py). Running it results in
ValueError: data of variable are not set! (q, step 0)

When the material parameters are set to constants, the computation runs.
The same happens when using the config-file with `ts` time-stepper, e.g. changing [2] to time-dependent problem (time_field_dependent.py).

J.
time_field_dependent.py
oxygen_difusion.py

Robert Cimrman

unread,
Mar 11, 2017, 6:46:04 PM3/11/17
to sfepy...@googlegroups.com
Hi Jan,

SimpleTimeSteppingSolver just calls Problem.solve(), so it should update the
materials as usual (= also in QP). I will check it when I get to it.

r.

Robert Cimrman

unread,
Mar 13, 2017, 4:49:18 AM3/13/17
to sfepy...@googlegroups.com
Hi Jan,

the problem is, that the material update is called before the initial time
step, and the initial conditions (i.e., the values of DOFs in variables) are
not set yet. I will make a PR fixing that soon.

r.

Jan Heczko

unread,
Mar 13, 2017, 6:23:17 AM3/13/17
to sfepy-devel
Yes, that's probably the reason, why I added
    if ts.step == 0:
        state
= problem.create_state()
        state
.apply_ic()
        problem
.equations.variables.set_data(state())
to `get_reaction_coefs`. But even with that piece of code, the solution fails in the second step. The error message says `step 0`, but it is actually the second time-step.

I was hoping to only get some clues to fix things myself, but you doing the work is ok as well :-)
J.

Robert Cimrman

unread,
Mar 13, 2017, 6:26:20 AM3/13/17
to sfepy...@googlegroups.com
Try [1], please. The time_field_dependent.py example seems to be working. With
oxygen_difusion.py I no longer get the exception, but NaNs are in the solution
- this might be unrelated to the issue, though.

r.

[1] https://github.com/sfepy/sfepy/pull/369

Jan Heczko

unread,
Mar 13, 2017, 9:12:29 AM3/13/17
to sfepy-devel
Works for me.
The NaNs are most probably a convergence-related issue, but that is what I actually wanted to work on.
Thanks a lot for fixing the solver!

Robert Cimrman

unread,
Mar 13, 2017, 9:21:24 AM3/13/17
to sfepy...@googlegroups.com
OK, I will merge the PR.

r.
Reply all
Reply to author
Forward
0 new messages