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.
Dear developers of SfePy,
I am relatively new to SfePy. So this question may be very trivial. So how do I compute the linear traction force on surface given a set of nodal pressure values. I am aware that we have a term called "dw_surface_ltr" but the example shows the 'material' are computed on quad nodes. Thanks!
Hi Dio,
On 11/21/2017 11:59 AM, Dio Dwianto wrote:
> Hi Robert,
>
> I installed SfePy using the conda install. Would it be possible to get the
> "show_mesh_info.py" using the conda update?
Yes, but you need to wait for the next release.
> I tried fixing the region definitions and the boundary conditions according
> to the bounding box ranges :
>
> [image: Inline image 1]
>
> But I still haven't got the proper temperature distribution and I'm all out
> of ideas.
>
> [image: Inline image 2]
>
> Does it matter what kind and how many nodes we have in the mesh?
Unlike the original mesh, where the cylinder is along the x axis, your mesh
cylinder is along the z axis. The following changes are needed to make it work:
regions = {
'Omega' : 'all',
'Gamma_Left' : ('vertices in (z < 0.00001)', 'facet'),
'Gamma_Right' : ('vertices in (z > 999.99)', 'facet'),
# 'Gamma_Left' : ('vertices in (x < 0.00001)', 'facet'),
# 'Gamma_Right' : ('vertices in (x > 0.099999)', 'facet'),
}
def get_ic(coor, ic):
"""Non-constant initial condition."""
import numpy as nm
# Normalize z coordinate.
mi, ma = coor[:,2].min(), coor[:,2].max()
nx = (coor[:,2] - mi) / (ma - mi)
# # Normalize x coordinate.
# mi, ma = coor[:,0].min(), coor[:,0].max()
# nx = (coor[:,0] - mi) / (ma - mi)
return nm.where( (nx > 0.25) & (nx < 0.75 ), 8.0 * (nx - 0.5), 0.0 )
Also, to verify, that your regions are correct, use --save-regions-as-groups
option as follows:
./simple.py time_poisson.py --save-regions-as-groups --solve-not
and then display <mesh-name>_regions.vtk (steel_cylinder_regions.vtk in your case).
r.
> Thank you so much for your help,
>
> Dio
>
> On Sat, Nov 18, 2017 at 8:09 PM, Robert Cimrman <cimrman3(a)ntc.zcu.cz> wrote:
>
>> On 11/17/2017 08:46 PM, Dio Dwianto wrote:
>>
>>> Hi Robert,
>>>
>>> thank you very much for your reply, I really appreciate it. I do have some
>>> follow up questions and I hope you would be so kind to bear with me.
>>>
>>> I can't seem to find show_mesh_info.py at the Script folder, or any folder
>>> in my SfePy directory for that matter. Is there any way for me to update
>>> my
>>> scripts?
>>>
>>
>> How did you install sfepy? I have just noticed, that the show_mesh_info.py
>> script is missing in the latest release (2017.3) source distribution (will
>> be fixed in the next release). It is only in the git repository sources. It
>> shows for steel_cylinder.med:
>>
>> sfepy: CMesh: n_coor: 9878, dim 3, tdim: 3, n_el 44215
>> sfepy: element types: ['3_4']
>> sfepy: nodal BCs: []
>> sfepy: bounding box: x: [-500.0, 500.0], y: [-499.996756531,
>> 499.996756531], z: [0.0, 1000.0]
>> sfepy: centre: [ 7.83762706 1.08148282 496.65201085]
>>
>> and for cylinder.mesh:
>>
>> sfepy: CMesh: n_coor: 354, dim 3, tdim: 3, n_el 1348
>> sfepy: element types: ['3_4']
>> sfepy: nodal BCs: []
>> sfepy: bounding box: x: [-1.2246063538e-18, 0.1], y: [-0.02, 0.02], z:
>> [-0.019999827242, 0.019999872274]
>> sfepy: centre: [ 5.05445344e-02 -2.40167062e-05 -1.92192931e-05]
>>
>> Check the bounding box ranges with the region definitions (Gamma_Left,
>> Gamma_Right) in your file.
>>
>> I found some seemingly useful scripts like "mesh_generators.py" and
>>> "mesh_tools.py" (files attached) but I'm not sure how to use them because
>>> I don't see any line of codes where I could add a directory to my geometry
>>> file. Or do I use some command combinations on the Command Line?
>>>
>>
>> You normally need not to use the first one, if you already have a mesh.
>> The second one is useful for treating meshes coming from CT and similar
>> images.
>>
>> I'm also curious about these lines of codes
>>>
>>> [image: Inline image 1]
>>>
>>
>> This is just a definition of some function of coordinates that is used as
>> an initial condition.
>>
>>
>>> [image: Inline image 2]
>>>
>>
>> You can ignore those for now - the gen_lines() function is related to
>> probing the results. I recommend reading in detail the tutorial and the
>> primer chapters of the documentation.
>>
>> Cheers,
>> r.
>>
>>
>> what are these for? If I want to use the script to do some simulations for
>>> complex geometries, do I have to edit these codes accordingly?
>>>
>>>
>>
>>> Thanks again for your help and I hope you have a great weekend!
>>>
>>> Dio
>>>
>>>
>>>
>>>
>>>
>>> On Fri, Nov 17, 2017 at 2:52 PM, Robert Cimrman <cimrman3(a)ntc.zcu.cz>
>>> wrote:
>>>
>>> Hi Dio,
>>>>
>>>> On 11/16/2017 02:14 PM, Dio Dwianto wrote:
>>>>
>>>> Hi,
>>>>>
>>>>> I'm trying to use one of the example "time_poisson.py" for heat transfer
>>>>> simulation. I used my own mesh data ("steel_cylinder.med" ), which I
>>>>> created using Salome.
>>>>>
>>>>> Somehow I didn't get the temperature distribution like what we would
>>>>> have
>>>>> gotten if we run the "time_poisson.py", which looked like this
>>>>>
>>>>> [image: Inline image 1]
>>>>> Instead I could only get these results
>>>>>
>>>>> [image: Inline image 2]
>>>>>
>>>>> I attached the relevant files. Can somebody please tell me what I did
>>>>> wrong
>>>>> with the scripting?
>>>>>
>>>>>
>>>> You need to adjust the region definitions for the "steel_cylinder.med"
>>>> mesh - it has different dimensions than "cylinder.mesh". The mesh
>>>> dimensions can be easily printed using "script/show_mesh_info.py".
>>>>
>>>> Check the example [1] for a way that would work for both the meshes
>>>> (using
>>>> the mesh bounding box).
>>>>
>>>> r.
>>>>
>>>> Thanks for your help!
>>>>
>>>
>>
>
On 11/17/2017 08:46 PM, Dio Dwianto wrote:
> Hi Robert,
>
> thank you very much for your reply, I really appreciate it. I do have some
> follow up questions and I hope you would be so kind to bear with me.
>
> I can't seem to find show_mesh_info.py at the Script folder, or any folder
> in my SfePy directory for that matter. Is there any way for me to update my
> scripts?
How did you install sfepy? I have just noticed, that the show_mesh_info.py
script is missing in the latest release (2017.3) source distribution (will be
fixed in the next release). It is only in the git repository sources. It shows
for steel_cylinder.med:
sfepy: CMesh: n_coor: 9878, dim 3, tdim: 3, n_el 44215
sfepy: element types: ['3_4']
sfepy: nodal BCs: []
sfepy: bounding box: x: [-500.0, 500.0], y: [-499.996756531, 499.996756531], z:
[0.0, 1000.0]
sfepy: centre: [ 7.83762706 1.08148282 496.65201085]
and for cylinder.mesh:
sfepy: CMesh: n_coor: 354, dim 3, tdim: 3, n_el 1348
sfepy: element types: ['3_4']
sfepy: nodal BCs: []
sfepy: bounding box: x: [-1.2246063538e-18, 0.1], y: [-0.02, 0.02], z:
[-0.019999827242, 0.019999872274]
sfepy: centre: [ 5.05445344e-02 -2.40167062e-05 -1.92192931e-05]
Check the bounding box ranges with the region definitions (Gamma_Left,
Gamma_Right) in your file.
> I found some seemingly useful scripts like "mesh_generators.py" and
> "mesh_tools.py" (files attached) but I'm not sure how to use them because
> I don't see any line of codes where I could add a directory to my geometry
> file. Or do I use some command combinations on the Command Line?
You normally need not to use the first one, if you already have a mesh. The
second one is useful for treating meshes coming from CT and similar images.
> I'm also curious about these lines of codes
>
> [image: Inline image 1]
This is just a definition of some function of coordinates that is used as an
initial condition.
>
> [image: Inline image 2]
You can ignore those for now - the gen_lines() function is related to probing
the results. I recommend reading in detail the tutorial and the primer chapters
of the documentation.
Cheers,
r.
> what are these for? If I want to use the script to do some simulations for
> complex geometries, do I have to edit these codes accordingly?
>
> Thanks again for your help and I hope you have a great weekend!
>
> Dio
>
>
>
>
>
> On Fri, Nov 17, 2017 at 2:52 PM, Robert Cimrman <cimrman3(a)ntc.zcu.cz> wrote:
>
>> Hi Dio,
>>
>> On 11/16/2017 02:14 PM, Dio Dwianto wrote:
>>
>>> Hi,
>>>
>>> I'm trying to use one of the example "time_poisson.py" for heat transfer
>>> simulation. I used my own mesh data ("steel_cylinder.med" ), which I
>>> created using Salome.
>>>
>>> Somehow I didn't get the temperature distribution like what we would have
>>> gotten if we run the "time_poisson.py", which looked like this
>>>
>>> [image: Inline image 1]
>>> Instead I could only get these results
>>>
>>> [image: Inline image 2]
>>>
>>> I attached the relevant files. Can somebody please tell me what I did
>>> wrong
>>> with the scripting?
>>>
>>
>> You need to adjust the region definitions for the "steel_cylinder.med"
>> mesh - it has different dimensions than "cylinder.mesh". The mesh
>> dimensions can be easily printed using "script/show_mesh_info.py".
>>
>> Check the example [1] for a way that would work for both the meshes (using
>> the mesh bounding box).
>>
>> r.
>>
>> Thanks for your help!
Dear developer of sfepy:
My name is Yifan Dong.I installed sfepy using Anaconda3 on windows 7. And I tried to follow the guide in the primer to run the its2D_1.py test. But the error is No module named sfepy. How can I solve that?Do I need to add enviroment viriables?
I also tried to run it using spyder with ipython console.But when I follow the instructions, it is told that can't find the text"get_config()".Do you know what is the problem?
I know they are basic questions. But I am a newbie in python and sfepy and have tried for several days. So I have to ask for help. Do you have any suggestions on finding the answers of such basic qustions.I've read several books on python but am still confused in linking different python files. Because they are all talking about small programs and not big programs like sfepy. Python is different from matlab and c++ at linking files.
Thanks! And best wishes!
Yifan
2017-11-13
董一帆
Hi,
I'm trying to use one of the example "time_poisson.py" for heat transfer
simulation. I used my own mesh data ("steel_cylinder.med" ), which I
created using Salome.
Somehow I didn't get the temperature distribution like what we would have
gotten if we run the "time_poisson.py", which looked like this
[image: Inline image 1]
Instead I could only get these results
[image: Inline image 2]
I attached the relevant files. Can somebody please tell me what I did wrong
with the scripting?
Thanks for your help!
Hi
Has there been anyone who has used 1D elements to perform analysis of a system of beams?
I have not found much information regarding the use of 1D elements and how one would assign geometric properties to this type of element.
Any help would be much appreciated.
Kind regards
Mishal Mohanlal
Hi Robert,
do you know if somebody tried to build a python program with sfepy and PyInstaller?
I tried it and build a executable for Windows (.exe) with PyInstaller-3.2. The build process was fine, but running the program returned with problems during the sfepy imports.
Here is what happens currently when I start the exe file:
...
File "site-packages\sfepy\__init__.py", line 5, in <module>
File "site-packages\sfepy\version.py", line 52, in <module>
File "site-packages\sfepy\version.py", line 37, in get_basic_info
RuntimeError: cannot determine SfePy top level directory!
In my last post I mentioned problems running sfepy on Windows. Probably its better to solve that first. But I just wanted to ask if you have experiences with PyInstaller.
Thanks and regards,
Kathrin
Hi Robert,
until now I was running sfepy only on a Ubuntu machine. Today I did a installation on a Windows 7 64 bit machine.
Already the imports in my program end with errors, that are a bit weired. I boiled it down and tried the imports directly in my python shell:
from sfepy.discrete import Field
Error:
from .equations import Equations, Equation
from sfepy.discrete.common.extmods.cmesh import create_mesh_graph
ImportError: cannot import name create_mesh_graph
I tried that directly as well and it does not work. It seems to be some code compiled in C? Do I need to compile something or install some extensions?
Thank you and regards,
Kathrin