Hi Robert,

  I think I tried that. I modified your function for stress-strain as

def stress_strain(out, pb, state, extend=False):

"""

Calculate and output strain and stress for given displacements.

"""

from sfepy.base.base import Struct

import matplotlib.pyplot as plt

import matplotlib.font_manager as fm


ev = pb.evaluate


strain = ev('ev_cauchy_strain.2.Omega(u)', mode='el_avg')

stress = ev('ev_cauchy_stress.2.Omega(solid.D, u)', mode='el_avg')

pstress = ev('dw_piezo_coupling.2.Omega( solid.coupling, u, psi )', mode='el_avg')


out['cauchy_strain'] = Struct(name='output_data', mode='cell',

                               data=strain, dofs=None)

out['cauchy_stress'] = Struct(name='output_data', mode='cell',

                               data=stress, dofs=None)

out['piezo_stress'] = Struct(name='output_data', mode='cell',

                              data=pstress, dofs=None)

etc....


and it returned an error of "ValueError: unsupported evaluation mode in dw_piezo_coupling! (el_avg)"


Dennis



On Thursday, August 6, 2015 at 1:21:50 PM UTC-7, Robert Cimrman wrote:
Hi Dennis,

the piezo term can be used (IIRC) directly in post-processing to compute the
piezo-part of the stress - try passing mode='el_avg' into problem.evaluate().

r.

On 08/05/2015 03:11 PM, Dennis Perchak wrote:
> I have been doing some modeling of a piezoelectric system and it works
> well. One can apply a field and see the resulting deformation.  I also get
> how one can calculate the Cauchy strain and stress using the post-process
> hook and the terms 'ev_cauchy_strain.2.Omega(u)' and
> 'ev_cauchy_stress.2.Omega(solid.D, u)'.  But since the constitutive law for
> the stress is the Cauchy term + the piezo-coupling term, how does one
> evaluate the stress and output it for given displacements and fields?
>
> Dennis
>