Hi Robert,

When I try the extend_cell_data on the surface of a cube, I get an error: "ValueError: The weights and list don't have the same length."  I attached the file.  It uses a mesh that is provided with sfepy.. can you take a look?

This is another example where the flux doesn't make sense.  If I use only vertices on one face as the source then the flux values are good.  But if you run the file as-is, the source extends a bit into the adjacent faces, and the flux results are incorrect.  The electric field values look okay, and the voltage field looks fine.  My results are as follows:

Source flux:  1.09348063065
Sink flux:  -0.90821822135
Block flux:  -0.040501111711
Entire surf:  0.298397270469 0.0181174920822 -0.0124582155367
Source surf area: 3.05555373528
Sink surf area: 1.0


I'm pretty sure there is an issue with the surface_flux function.  Is this something you will be able to look at?  I'm trying to decide whether to continue investing in this or switch to another tool/software.

Thanks,

Geoff



On Monday, August 4, 2014 8:54:36 AM UTC-4, Robert Cimrman wrote:
On 08/04/2014 02:31 PM, Robert Cimrman wrote:
> On 08/03/2014 05:44 PM, Geoff Wright wrote:
>> Hi Robert,
>>
>> I will try this tomorrow and let you know.  My platform is 64bit Ubuntu, I
>> cloned the repo on 7/22 so I'm at
>> revision 433a3bc2a6a84d93145b04ee7d3debb493de0e50.
>>
>> The linear system converges nicely and the voltage values look nice and
>> smooth so I don't think there is anything grossly wrong.  I think theres
>> some issue with how flux is being integrated that is not exposed with the
>> flat cylinder example.
>>
>> I tried a similar test with a simple cube on Friday, and the results were
>> correct when I had the source and sink on opposing faces of the cube.
>>   However, once I included more of the orthogonal faces in the source, I saw
>> the issue again.  I'll post the mesh and the python script for this
>> tomorrow.
>>
>> One more thing I wanted to try is to look at the flux values across the
>> whole surface under some of these scenarios.  I understand that I can pull
>> out the surface values using mode='el', and same them in the vtk output
>> file.  But I'm not sure how to map them back to the appropriate vertex
>> positions in order to visualize the flux.  Can you suggest the best way of
>> doing this?  I'll post a screenshot once I have it.
>
> Something like this?
>
>      from sfepy.discrete.fem.utils import extend_cell_data
>
>      aa = pb.evaluate('d_surface_flux.2.Gamma_Left(coef.sigma, v)', mode='el')
>      flux = extend_cell_data(aa, pb.domain, 'Gamma_Left', is_surface=True)

FYI: Try using

flux = extend_cell_data(aa, pb.domain, 'Gamma_Left', val=0.0,
                             is_surface=True)

to fill the other cells by zeros instead of min. value of the flux.

>      out['flux'] = Struct(name='flux field', mode='cell', data=flux, dofs=None)