On 08/30/2012 10:32 AM, David Libault wrote:
I have cloned the rc/sfepy.git installed it, modified the problem file as advised, and it works : I get a current intensity of 1 and -1 on Gamma_Left and Gamma_Right which is what I expected.
Great job !
From a user point of view, the 'el' or 'el_avg' syntax, is confusing... I am also confused by the term documentation : the term is described as an integral over a domain, but the computation is actually done over individual elements. An array is returned and we can't get the element each value of the array relates to... d_surface_flux.i1.Gamma_Left(coef.sigma, v) should return a scalar, and if we want the value over a specific element just define a domain that contains it and use d_surfacer_flux over it.
It's good to hear a feedback, thanks!
The reason for 'el_avg' is mainly to be able to visualize data defined inside elements using Mayavi, so you get a value for each element in a region. The same with 'el'. So now you can add it to the 'out' dict, and see how each border element contributes to the total flux.
If you just want a value of the integral, do:
pb.evaluate('d_surface_flux.2.Gamma_Right(coef.sigma, v)', mode='eval')
the mode argument).
Also, you can get to the elements/edges/faces etc. the values belong to, as you have the ProblemDefinition instance available - try
print pb.domain.regions['Gamma_Left'] # Edge ids. print pb.domain.regions['Gamma_Left'].edges # Edge nodes. print pb.domain.ed.facets[pb.domain.regions['Gamma_Left'].edges] # (group, element, local edge number). print pb.domain.ed.indices[pb.domain.regions['Gamma_Left'].edges]
Again, that is a user point of view : I have no idea what the implementation issues are behind, nor issues related to other FE problems !
It's just more general in this way - you can get what you request for. The main problem I see is that it is not properly documented in the tutorial/users' guide. My bad...
Le mercredi 29 août 2012 18:25:18 UTC+2, Robert Cimrman a écrit :
I have added the 'el' evaluation mode to d_surface_flux term, and it seems to work - get the latest sources from , and use
flux1 = pb.evaluate('d_surface_flux.i1.Gamma_Left(coef.sigma, v)', mode='el')
If that's ok, I will push it into the main repository.
Thanks, r.  git clone git://github.com/rc/sfepy.git
On 08/29/2012 06:07 PM, Robert Cimrman wrote:
On 08/29/2012 05:59 PM, Robert Cimrman wrote:
On 08/29/2012 05:21 PM, David Libault wrote:
Enclosed are a mesh file and a problem file for the 2D electrostatic problem without volume charge of a square of 1x1 on which 1 V is
2 opposite sides (Gamma_Left and Gamma_Right), and the default 0 Von Neumann boundary conditions on the 2 other sides.
The Electric field is evaluated as the gradient of V, and looks good
small, and Ey = 1 over the entire domain).
Yes, it looks good.
Flux 1 and Flux 2 evaluate the flux intensity of current with
sigma=1 across Gamma_Left and Gamma_Right. They should have opposite
and absolute value of 1.
It looks that the d_surface_flux is computed on each element of the
so the returned value is an array, but the values in the array are all
Shouldn't they be 1/(element surface) so that the sum of the array
the total flux over the all Gamma_Left or Gamma_Right surface ?
There is a glitch in using integrals I noticed when preparing the
Alec: once you use an integral for a volume integration (volume term),
should not use it for a surface term. If you do that, you should get an
and indeed, there is:
fmf_mulAB_nn(): ERR_BadMatch: (2 2 1) == (3 2 2) * (2 2 1)
Ha, you actually did not get this error, right? What's your platform and
printed just before your flux output. This should lead to raising an
but for some reason it does not, the exception is raised only when I
the relevant code piece with a debugger. If I just run the code, it
continues, and leads to wrong results you got. So this is definitely a
I am not sure why it behaves this way. It used to work.
So to fix you problem: replace flux1 = pb.evaluate('d_surface_flux.i1.Gamma_Left(coef.sigma, v)', mode='el_avg')
flux1 = pb.evaluate('d_surface_flux.2.Gamma_Left(coef.sigma, v)', mode='el_avg')
and do the same with flux2. The number is the quadrature order... Then
should get the "correct" fluxes. If fact, there is another problem -
mode divides the resulting integrated value in an element by the volume/area/length of that element. That's why you get 1 or -1, and the
and -9, as there are 9 edges on each of Gamma_Left, Gamma_Right.
So it seems another evaluation mode is needed (let's say called 'el') -
that just integrates a value over an element, without computing the
dividing by volume. Do you agree?