dera Roberts,

Your comments were so helpful, thanks :). 

I am doing the changes in both functions, and I have some questions. When you said to compute eps directly in .get_fargs and stored as self.eps0, then the deps is computed in fiber_function and we would need to have ts (time stepper) also as a parameter, not?

I mean, to define our new class as:

        - ts         : :class:`TimeStepper` instance
        - material_1 : :math:`f_{\rm max}`
        - material_2 : :math:`\varepsilon_{\rm opt}`
        - material_3 : :math:`s`
        - material_4 : :math:`\ul{d}`
        - material_5 : :math:`A`
        - material_6 : :math:`\nu`
        - material_7 : :math:`\kappa`
        - virtual    : :math:`\ul{v}`
        - state      : :math:`\ul{u}`
    name = 'dw_tl_fib_a2'
    arg_types = ('ts', 'material_1', 'material_2', 'material_3',
                 'material_4', 'material_5', 'material_6', 
                 'material_7', 'virtual', 'state')
    arg_shapes = {'ts' :'1, 1', 'material_1' : '1, 1', 'material_2' : '1, 1',
                  'material_3' : '1, 1', 'material_4' : 'D, 1',
                  'material_5' : '1, 1', 'material_6' : '1, 1',
                  'material_7' : '1, 1',
                  'virtual' : ('D', 'state'), 'state' : 'D'}
    family_data_names = ['green_strain']

and then do:

def get_fargs(self, ts, mat1, mat2, mat3, mat4, mat5, mat6, mat7, virtual, state,
                  mode=None, term_mode=None, diff_var=None, **kwargs):

but I am missing how to calculate eps0 here sorry :(

El viernes, 23 de octubre de 2015, 13:51:27 (UTC+2), Patricia Garcia Cañadilla escribió:
It helps a lot :)!!! 

I will do try this!

Thank you very much for you help :D!

El viernes, 23 de octubre de 2015, 13:28:10 (UTC+2), Robert Cimrman escribió:
On 10/23/2015 12:39 PM, Patricia Garcia Cañadilla wrote:
> Dear Robert,
> Yes :), it would be nice if we could easily implement this in sfepy
> by modifying fibre_function i and creating a new term very similar to
> FibresActiveTLTerm. I am very new in this field, so could you give me some
> key starting points on how to do it?


1. make a copy of FibresActiveTLTerm (-> FibresActive2TLTerm (better name?))
and fibre_function() (-> fibre_function2() (better name?)) in the same file.

2. modify the attributes of the new class:

    - name (dw_tl_fib_a2?)
    - arg_types, arg_shapes - add kappa

3. add the new material argument also to .get_fargs()

See also [1] but do no worry - here it is just the above.


Then you would need to compute the rate of the fibre deformation eps. The fibre
deformation is computed in fibre_function(), line 16. It might be better to
compute that directly in .get_fargs(), and store the current eps as self.eps0
in the class, to be able to get the rate as deps = (eps - eps0) / dt.

Then having eps and deps, update the new fibre_function2() to compute the
active tension (fmode == 0), as well as its derivative w.r.t. eps (fmode == 1),
just like it is done in fibre_function()

> Another quick question, is, regarding the first term in the expression of
> active stress which is "viscosity coefficient*strain rate", is what you
> refer when you said  "creating a new term", and then the exponential term
> should be introduced by modifying the term_fibers?

Above I am talking about adding the "exp{k min(0;de/dt}}" to the exponential
term. FibresActiveTLTerm in sfepy is exactly the exponential term without the
"exp{k min(0;de/dt}}" part. But you can add also "viscosity coefficient*strain
rate" in there, so that the new term computes the entire relation (9). If you
manage to add there the exponential part, adding this is trivial. :)

Does this help?


> Thank you very much!
> El viernes, 23 de octubre de 2015, 11:33:27 (UTC+2), Robert Cimrman
> escribió:
>> Dear Patricia,
>> On 10/23/2015 10:39 AM, Patricia Garcia Cañadilla wrote:
>>> Dear Robert,
>>> I would like to the model the viscoelastic behavior of active fibers, as
>>> you done in the paper: "Modelling heart tissue using a composite muscle
>>> model with blood perfusion" or as here:
>> and
>>> I was wondering if is easy to implemented in sfepy and/or if there is
>> some
>>> predefined term in Sfepy, since for example the term "dw_tl_fib_a"
>> doesn't
>>> include the "exp{k min(0;de/dt}}" that appears in the paper.
>> The model from the "Modelling heart tissue using a composite muscle model
>> with
>> blood perfusion" paper would be pretty easy to add, yes. It would involve
>> modifying fibre_function() in sfepy/terms/ and creating a
>> new
>> term very similar to FibresActiveTLTerm. Would you give it a shot? :)
>> As for the cardiac model, it would certainly be possible to implement
>> those
>> fibres in sfepy, but not that easy - the model is quite complex. The
>> biggest
>> issue are the internal unknown variables (the contractile element
>> deformation
>> epsilon_c), that evolve in quadrature points - those are not supported
>> (yet).
>> r.