underworld3 icon indicating copy to clipboard operation
underworld3 copied to clipboard

Issue using function.evaluate

Open bknight1 opened this issue 1 year ago • 5 comments

I'm having an issue evaluating on the swarm. I need to first do an evaluate on the mesh for the swarm evaluate to then work. No issues with the evalf function though.

Sorry for the poor screen shot to show the issue, I'll try to make a basic example later today.

Screenshot 2024-02-27 at 12 18 15

bknight1 avatar Feb 27 '24 04:02 bknight1

Not sure what Fe is? Maybe it's not available in the first case? A basic example would be awesome thanks.

julesghub avatar Feb 27 '24 05:02 julesghub

I had this problem during a swarm setup - some points very close to (or maybe even slightly outside) the element boundary due to perturbation of the initial position. Evalf does not care, evaluate blows up horribly.

This seems to be a recent problem along with other interpolation difficulties we have had crop up.

Ben, did the swarm move ? Can you re-validate or rebuild the local element ownership and see if they are up to date before the interpolation operation ?

lmoresi avatar Feb 27 '24 07:02 lmoresi

The swarm didn't move @lmoresi, so I'm not sure what's going on. If I evaluate on the mesh first it works.

I've attached a script showing the issue using the hot pipe basic example. Ex_diffusion_generic_solver.txt

bknight1 avatar Feb 28 '24 01:02 bknight1

Hi @bknight1 @lmoresi ,

I made a small change in the script, replaced swarm.data with swarm.data[1:] then it worked. Note: evaluate work for all other np. array datasets except swarm.data

### what it looks like using evaluate, no change from pre-solve
with swarm.access():
    print(swarm.data[1:])
    T_data_ps = uw.function.evaluate(T.sym[0], swarm.data[1:])
    plt.scatter(swarm.data[1:][:,0], swarm.data[1:][:,1], c=np.abs(T_data_ps), cmap="jet")

This led me nowhere in my quick debugging effort. May be for you it can lead somewhere.

gthyagi avatar Feb 28 '24 04:02 gthyagi

@bknight1 - can you check this is still broken in the current dev branch so we can investigate

lmoresi avatar Apr 03 '24 09:04 lmoresi

Re-run the example which is now producing the correct result.

bknight1 avatar Aug 01 '24 03:08 bknight1