Hi Robert,

Thanks for the fast response!  The poisson_neuman example is making sense to me now, but when I take a step closer to my real problem, I'm still having some issues with the flux.  I attached the mesh, problem definition and a screenshot of the result.

The intention was to have a sphere inside another sphere, with the source defined as a region on the inner sphere, and the sink defined as a region on the outer sphere.  All other surfaces are supposed to have zero flux.  However, if you look at the flux results, computed similar to before, I get the following:

Source flux: 0.978
Sink flux: -1.592
Block flux: -1.592
Entire Surf: -1.608

Whereas I expected source and sink to be equal and opposite, block and entire surf to be zero.

Any thoughts will be much appreciated.  Thanks!

Geoff



On Thursday, July 31, 2014 7:19:20 PM UTC-4, Geoff Wright wrote:
Hi Robert,

I'm new to sfepy and having a good experience so far.  But I've been having some issues understanding the d_surface_flux function.. a couple of questions that might help:

1. In the poisson_neumann example, if I add a post_process function which evaluates various surface fluxes the results are not what I would expect.  Here is my post_process function:

def post_process(out, pb, state, extend=False):
    from sfepy.base.base import Struct

    flx = pb.evaluate('d_surface_flux.2.Gamma(coef.sigma, t)', mode='el_avg')
    print "Flux, entire surface:", np.sum(flx), flx.max(), flx.min()

    snkf = pb.evaluate('d_surface_flux.2.Gamma_Left(coef.sigma, t)', mode='eval')
    print "Sink flux: ", snkf

    srcf = pb.evaluate('d_surface_flux.2.Gamma_Right(coef.sigma, t)', mode='eval')
    print "Source flux: ", srcf

    blkf = pb.evaluate('d_surface_flux.2.Gamma_N(coef.sigma, t)', mode='eval')
    print "Block flux: ", blkf

    return out

I would expect that "Flux, entire surface" would be approximately zero, and the sink flux and source flux should be approximately equal but opposite sign, and block flux to be zero.  Since Gamma_N is supposed to have a zero neumann condition on it my understanding is that flux would only be present over Gamma_Left and Gamma_Right and that they would be equal but opposite sign.  What am I missing here?


2. If I compute surface_flux using mode='el_avg' and then sum the results, why is that number not equal to surface_flux computed with mode='eval'?  Whats the difference?


Thanks for your help,

Geoff