underworldcode / underworld3

https://underworldcode.github.io/underworld3/
18 stars 10 forks source link

Error when trying to add a natural BC with Poisson solver #254

Open bknight1 opened 1 week ago

bknight1 commented 1 week ago

Describe the bug When adding natural BCs:

A_diffusion.add_natural_bc([0], mesh.boundaries.Left.name)
A_diffusion.add_natural_bc([0], mesh.boundaries.Right.name)
A_diffusion.add_natural_bc([0], mesh.boundaries.Top.name)
A_diffusion.add_natural_bc([0], mesh.boundaries.Bottom.name)

When attempting to solve, I get the following error:

AttributeError                            Traceback (most recent call last)
Cell In[27], line 1
----> 1 A_diffusion.solve()

File [~/Documents/Research/GitHub/underworld3/src/underworld3/cython/petsc_generic_snes_solvers.pyx:858](http://localhost:8888/lab/tree/Coupled_diffusion/~/Documents/Research/GitHub/underworld3/src/underworld3/cython/petsc_generic_snes_solvers.pyx#line=857), in underworld3.cython.generic_solvers.SNES_Scalar.solve()

File [~/Documents/Research/GitHub/underworld3/src/underworld3/cython/petsc_generic_snes_solvers.pyx:176](http://localhost:8888/lab/tree/Coupled_diffusion/~/Documents/Research/GitHub/underworld3/src/underworld3/cython/petsc_generic_snes_solvers.pyx#line=175), in underworld3.cython.generic_solvers.SolverBaseClass._build()

File [~/Documents/Research/GitHub/underworld3/src/underworld3/cython/petsc_generic_snes_solvers.pyx:730](http://localhost:8888/lab/tree/Coupled_diffusion/~/Documents/Research/GitHub/underworld3/src/underworld3/cython/petsc_generic_snes_solvers.pyx#line=729), in underworld3.cython.generic_solvers.SNES_Scalar._setup_pointwise_functions()

AttributeError: 'NaturalBC' object has no attribute 'fn_F'

Looking through dev, it looks like NaturalBC has attribute 'fn_f' and EssentialBC is 'fn', although I may be wrong.

Cheers

bknight1 commented 1 week ago

I'm trying to set zero flux on each boundary for the multicomponent diffusion benchmark

lmoresi commented 1 week ago

OK - I'll take a look - but shouldn't a zero flux be the same as no BC ?

bknight1 commented 1 week ago

It should be. I had missed something when setting up my terms that's why it wasn't solving, not the BCs.