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),
}
I am trying to model Stokes flow at very high viscosities (~10^20), from my results it looks like I cannot achieve this and am better suited using viscosities of ~10^5 or so. I know there is this older post [1] which states:
"A word of warning though: SfePy does not
have a dedicated Navier-Stokes solver (the Newton (+ and direct) solver use
that is in the navier_stokes.py example is rather naive, and works for small
problems with only, with viscosity "high enough")"
Has there been a different solver implemented since this was posted? If not, what do you recommend to work with such large viscosities?
Thank you
[1] "Problem with the mesh while trying to solve the Navier Stokes equations with sfepy"
Hello,
I'm been aware of SfePy for a very long time, but only recently have actually been trying it. I've been surprised at how *simple* it is to get things going, it's a great package. Thanks a lot for making it.
What I'm trying to do is solve a scattering problem from electromagnetism. I'm working with a 3D vector electric field (of complex numbers). So far as I can tell, I've been able to get the weak form of the problem, and it's boundary conditions, implemented correctly.
There are two things I'd like that are not working at the moment. I'd could really use some guidance, so would appreciate any help. These are:
1) I'd like to evaluate a surface integral of the electric field intensity I = |E|^2 = E dot conj(E), where E is a vector, dot is the dot product, and conj is the complex conjugate. I'm implementing my own term for this, which I think should be nearly the same as the existing IntegrateSurfaceTerm. However, it appears that the complex numbers are complicating things. The function method of my new term is apparently called twice in 'eval' mode, once for the real part and once for the imag part. Looking at the source code of Term, this seems to be the implemented behavior. Is it possible to get the function method called with the complex numbers themselves? If not, what is the recommended technique for doing operations in which the real parts and the imag parts do not separate cleanly (like for the magnitude of a complex vector)? If it helps, I only need things like these in eval mode, not as part of the solved equations.
2) I'd like to evaluate the magnetic field H from the electric field E. This is simply H = -1j * c * curl(E), where c is a constant (material parameter) and curl is the vector curl operation. The vector field E is solved for as part of my problem. What is the best way to add the equation for H into the problem? I don't see a curl operation anywhere. Do I need a custom term or can I do this with existing terms? It is fully determined by E, as above.
Thanks for your help,
Irwin