Hi,
I have finally started to work on term refactoring, see [1] (branch new_terms). So far, I have only the diffusion term (scalar unknowns), but it seems promising, as the term implementation is now just:
class NewDiffusionTerm(NewTerm): name = 'dw_new_diffusion' arg_types = (('material', 'virtual', 'state'), ('material', 'parameter_1', 'parameter_2')) modes = ('weak', 'eval')
def __call__(self, mat, virtual, state, **kwargs):
val = dot(virtual.grad(), dot(mat, state.grad()), 'ATB')
return val
- it would be quite easy (IMHO) to add new terms even for "ordinary" users, if things go well.
I am attaching a test script to try the new term - it is currently very slow, pure Python implementation relying on numpy dot() function called in sfepy.linalg.dot_sequences(), so I would like to know how slow it is on your computers, when compared with the original C implementation of the diffusion term (just replace dw_new_diffusion with dw_diffusion in the test script) on various sfepy installations. Both versions should give the same result.
The script can be run as
./simple.py test_new_terms.py
If things work out even for terms with vector and other variables, there should be a big potential to get the speed back using Cython (big IMHO).
I plan to merge the branch soon to master, and the new terms will co-exist with the old ones for some time.
So, comments/help/advice welcome! r.
participants (1)
-
Robert Cimrman