Dear Robert,
I have a 2D body of hyperelastic material which contracts and I would like
to compute the total force developed by the body from the cauchy stress. I
am trying to follow some of your indications I found in this group, but I
still couldn't make it works. Could you please help me to fix the problem?
I am getting the following error:
key = (region.name, integral.order, integration)
AttributeError: 'dict' object has no attribute 'name'
I am trying to do the following, inside stress_strain post-processing
function:
def stress_strain(out, problem, state, extend = False ):
from sfepy.base.base import Struct
from sfepy.mechanics.tensors import StressTransform
from sfepy.mechanics.tensors import transform_data
from sfepy.discrete.common.mappings import get_normals
ev = problem.evaluate
field = problem.fields['displacement']
region = problem.domain.regions['Gamma']
integral = problem.integrals['i2']
n = get_normals(field,integral,regions)
stress = ev('dw_tl_fib_a.1.Omega(f1.fmax, f1.eps_opt, f1.s, f1.fdir,
f1.act, v, u )',mode='qp', term_mode= 'stress');
F = ev('ev_def_grad.1.Omega(u)',mode='el_avg');
transform = StressTransform(F)
Cstress = transform.get_cauchy_from_2pk(stress)
T = Cstress*n;
Force = ev('ev_surface_integrate.2.Gamma(T)')
And here it is part of the problem configuration file.
fields = {
'displacement': ('real', 'vector', 'Omega', 1),
}
materials = {
'solid' : (None, 'get_elastic_pars'),
'load' : (None, 'linear_tension'),
'f1' : 'get_pars_fibres1',
}
variables = {
'u': ('unknown field', 'displacement', 0),
'v': ('test field', 'displacement', 'u'),
}
regions = {
'Omega' : 'all',
'Fix1' : ('vertices in x < %.10f' % (fix_point + eps2), 'facet'),
'Fix2' : ('vertices in x > %.10f' % (fix_point - eps2), 'facet'),
'Fix' : ('r.Fix1 *v r.Fix2', 'facet'),
'Gamma' : ('vertices of surface','edge'),
}
ebcs = {
'fixb' : ('Fix', {'u.all' : 0.0}),
}
integrals = {
'i1' : ('v', 1),
'i2' : ('s', 2),
}

In examples/large_deformation/hyperelastic.py a rotation by displacements is applied. By using a similar function the vectors defining the force couples could be defined for dw_surface_ltr (IMHO). Does it make sense?
r.
----- Reply message -----
From: "Andre Smit" <freev...(a)gmail.com>
To: <sfepy...(a)googlegroups.com>
Subject: Torque
Date: Sat, Dec 18, 2010 05:10
What is the best way to apply a torque load to a model?
--
Andre
--
You received this message because you are subscribed to the Google Groups "sfepy-devel" group.
To post to this group, send email to sfepy...(a)googlegroups.com.
To unsubscribe from this group, send email to sfepy-devel...(a)googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.

Hi all,
Problem description file and error output below. I don't understand what
this error means or why I am getting it. At this point I'm still trying to
learn my way around sfepy and I'm not 100% comfortable with the underlying
math either. So this file might not make sense as far as what it appears to
be trying to model, and my error could be in the code or in the math itself.
I'm running the problem description file using simple.py from within a tmux
session on Ubuntu 14.04 in anaconda. The anaconda environment uses python
2.7 so that mayavi will also work.
Thanks in advance for any help.
-Yoni
Problem description:
filename_mesh = sfepy_dir + '/meshes/2d/square_quad.mesh'
regions = {
'Omega': 'all',
'Gamma_Top': ('vertices in (y == 0.4)', 'facet'),
'Gamma_Bottom': ('vertices in (y == -0.5)', 'facet'),
'Gamma_Left': ('vertices in (x == -0.5)', 'facet'),
'Gamma_Right': ('vertices in (x == 0.4)', 'facet')
}
fields = {
'head': ('real', 1, 'Omega', 1),
'reservoir_height': ('real', 1, 'Omega', 1)
}
variables = {
'u' : ('unknown field', 'head', 0, 1),
'l' : ('test field', 'head', 'u'),
'h' : ('unknown field', 'reservoir_height', 0, 1),
'l2' : ('test field', 'reservoir_height', 'h'),
}
ebcs = {
'u1' : ('Gamma_Left', {'u.0' : 2.0}),
'u2' : ('Gamma_Right', {'u.0' : -2.0}),
'u3' : ('Gamma_Top', {'u.0' : 5.0}),
'u4' : ('Gamma_Bottom', {'u.0' : 0.0})
}
integrals = {
'i' : 2
}
materials = {
'storativity' : ({'name': 'S',
'values': {'val' : 1.0}}),
'HParam': ({'name': 'hp',
'values': {'val' : 0.2}})
}
equations = {
'diffusion' :
"""
dw_volume_dot.i.Omega(S.val, l, du/dt)
= dw_electric_source.i.Omega(S.val, l2, h)
"""
}
solvers = {
'ts' : ('ts.simple', {
't0' : 0.0,
't1' : 10.0,
'dt' : None,
'n_step' : 11, # Has precedence over dt.
}),
'newton' : ('nls.newton', {
'i_max' : 1,
'eps_a' : 1e-10,
}),
'ls' : ('ls.scipy_direct', {}),
}
Error:
File "/home/yoni/anaconda3/envs/mayavi_env/lib/python2.7/site-
packages/sfepy/script/simple.py", line 184, in <module>
main()
File "/home/yoni/anaconda3/envs/mayavi_env/lib/python2.7/site-
packages/sfepy/script/simple.py", line 177, in main
app = PDESolverApp(conf, options, output_prefix)
File "/home/yoni/anaconda3/envs/mayavi_env/lib/python2.7/site-
packages/sfepy/applications/pde_solver_app.py", line 137, in __init__
self.problem = Problem.from_conf(conf, init_equations=is_eqs, **kwargs)
File "/home/yoni/anaconda3/envs/mayavi_env/lib/python2.7/site-
packages/sfepy/discrete/problem.py", line 173, in from_conf
obj.set_equations(conf.equations, user={'ts' : obj.ts})
File "/home/yoni/anaconda3/envs/mayavi_env/lib/python2.7/site-
packages/sfepy/discrete/problem.py", line 464, in set_equations
variables = Variables.from_conf(self.conf_variables, self.fields)
File "/home/yoni/anaconda3/envs/mayavi_env/lib/python2.7/site-
packages/sfepy/discrete/variables.py", line 156, in from_conf
var = Variable.from_conf(key, val, fields)
File "/home/yoni/anaconda3/envs/mayavi_env/lib/python2.7/site-
packages/sfepy/discrete/variables.py", line 847, in from_conf
special=special, key=key, history=history)
File "/home/yoni/anaconda3/envs/mayavi_env/lib/python2.7/site-
packages/sfepy/discrete/variables.py", line 1338, in __init__
special, flags, **kwargs)
File "/home/yoni/anaconda3/envs/mayavi_env/lib/python2.7/site-
packages/sfepy/discrete/variables.py", line 878, in __init__
self._set_kind(kind, order, primary_var_name, special=special)
File "/home/yoni/anaconda3/envs/mayavi_env/lib/python2.7/site-
packages/sfepy/discrete/variables.py", line 887, in _set_kind
raise ValueError('order %d already used!' % order)
ValueError: order 0 already used!

Hi,
It seems that postprocessing involving mayavi is not working in python 3.6,
simply because mayavi so far only support python 2. Am I correct?
Regards,
Firdaus

Hello,
Thank you to everyone for all the effort that has been put into SfePy,
it is a pleasure to use.
I am trying to solve a transient diffusion problem similar to the
poisson_periodic_boundary_condition.py example but on a mesh of
hexahedral elements. The example works well with the provided tet
mesh. When I switch to a hex mesh the solution has some problems. The
solution on gridpoints just outside the source region goes below zero
at early times and the solution has some waves along line x=y=z.
It seem like the elements may be read in wrong but I cannot figure out
the problem. I create the hex mesh, test_hex.mesh, with this Python
code:
import numpy as np
from sfepy.mesh.mesh_generators import gen_block_mesh
from sfepy.discrete.fem.meshio import MeditMeshIO
mesh = gen_block_mesh(np.array((10,10,1)),
np.array((11,11,2)),
np.array((5.0,5.0,0.5)), mat_id=9, verbose=True)
m = MeditMeshIO("dummy_name")
m.write("test_hex.mesh", mesh)
The attached code is a simplification of the
poisson_periodic_boundary_condition.py example, I removed the periodic
boundary condition and the time-dependent material properties.
with_tet_mesh.py gives good results and with_hex_mesh.py shows the
problem.
I am running Python 2.7.13 and SfePy version 2017.2; I get the same
result from the current SfePy github master. I run the code with the
command python simple.py with_hex_mesh.py.
Can someone help me understand where I am going wrong?
Thanks,
Jason

Hi all
I am new in sfepy and I have a simple question. I don't know which provided integration term is appropriate to compute the following formula:
\int_{\Omega} u_1 * \grad(u_2) \cdot \grad(v) dx, where u_1 and u_2 are unknowns and v are test function.
If you have any idea to solve this problem, please let me know.
Thank you very much
Best

Hi all
I am new in sfepy and I have a simple question. I don't know which provided integration term is appropriate to compute the following formula:
\int_{\Omega} u_1 * \grad(u_2) \cdot \grad(v) dx, where u_1 and u_2 are unknowns and v are test function.
If you have any idea to solve this problem, please let me know.
Thank you very much
Best