underworld3 icon indicating copy to clipboard operation
underworld3 copied to clipboard

[BUG] -AttributeError: 'NaturalBC' object has no attribute 'fn_F' when using add_natural_bc

Open Belay-129 opened this issue 4 months ago • 6 comments

Hi uw3 support team, I encountered an error when applying a natural boundary condition to the Poisson solver in Underworld3, which prevents the solve from running successfully.

poisson.add_dirichlet_bc([17.0], "Top") q_bottom = 0.065 # W/m2 poisson.add_natural_bc([q_bottom], "Bottom")

poisson.solve()

When applying a natural boundary condition to a Poisson solver, the following error occurs:

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

File src/underworld3/cython/petsc_generic_snes_solvers.pyx:872, in underworld3.cython.generic_solvers.SNES_Scalar.solve()

File src/underworld3/cython/petsc_generic_snes_solvers.pyx:194, in underworld3.cython.generic_solvers.SolverBaseClass._build()

File src/underworld3/cython/petsc_generic_snes_solvers.pyx:744, in underworld3.cython.generic_solvers.SNES_Scalar._setup_pointwise_functions()

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

Thanks for your time and help

Belay-129 avatar Sep 22 '25 06:09 Belay-129

Hi @Belay-129,

Please attach the example script you are running so we can debug. It also looks like you’re using an older version of Underworld, please update to the latest release, as some of these issues are already fixed.

Cheers, Thyagi

gthyagi avatar Sep 23 '25 01:09 gthyagi

Hi Thyagi, Thank you for your response. Could you please confirm the current version of Underworld? I checked on GitHub and found the version listed as: version = "0.99.0b"

This matches the version I already have installed. Cheers, Belay


From: Thyagarajulu Gollapalli @.> Sent: Tuesday, September 23, 2025 11:54 AM To: underworldcode/underworld3 @.> Cc: Belay Mino @.>; Mention @.> Subject: Re: [underworldcode/underworld3] [BUG] -AttributeError: 'NaturalBC' object has no attribute 'fn_F' when using add_natural_bc (Issue #25)

[https://avatars.githubusercontent.com/u/44185316?s=20&v=4]gthyagi left a comment (underworldcode/underworld3#25)https://github.com/underworldcode/underworld3/issues/25#issuecomment-3322098312

Hi @Belay-129https://github.com/Belay-129,

Please attach the example script you are running so we can debug. It also looks like you’re using an older version of Underworld, please update to the latest release, as some of these issues are already fixed.

Cheers, Thyagi

— Reply to this email directly, view it on GitHubhttps://github.com/underworldcode/underworld3/issues/25#issuecomment-3322098312, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BR5VEZYTWDBVDZVA7VR4PBT3UCR6XAVCNFSM6AAAAACHEFJ7TKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMRSGA4TQMZRGI. You are receiving this because you were mentioned.Message ID: @.***>

Belay-129 avatar Sep 23 '25 02:09 Belay-129

''' mesh = uw.meshing.UnstructuredSimplexBox( minCoords=(423755, -10000), maxCoords=(496255, 0), cellSize=1000, regular=False, ) '''

''' k_scalar = uw.discretisation.MeshVariable("k", mesh, 1) '''

''' T_soln = uw.discretisation.MeshVariable("T", mesh, 1) '''

''' Set up the Poisson system poisson = uw.systems.Poisson(mesh, u_Field=T_soln)

poisson.constitutive_model = uw.constitutive_models.DiffusionModel

poisson.constitutive_model.Parameters.diffusivity = k_scalar.sym[0]

poisson.f = 0 '''

BCs

''' poisson.add_dirichlet_bc([17.0], "Top") q_bottom = 0.065 #W/m2 poisson.add_natural_bc([q_bottom], "Bottom") '''

solve poisson.solve()

Belay-129 avatar Sep 23 '25 02:09 Belay-129

Hi Thyagi, Thank you for your response. Could you please confirm the current version of Underworld? I checked on GitHub and found the version listed as: version = "0.99.0b"

This matches the version I already have installed. Cheers, Belay

The version number may look the same, but we’ve recently pushed many important changes.

gthyagi avatar Sep 23 '25 04:09 gthyagi

Hello @gthyagi and @Belay-129, I found the cause of the issue and I'm investigating a fix. I'll give you some updates soon.

Cheers, JC

jcgraciosa avatar Sep 23 '25 04:09 jcgraciosa

Thank you Juan for updates.

Looking forward to hearing from you.

Thanks


From: jcgraciosa @.> Sent: Tuesday, September 23, 2025 2:12 PM To: underworldcode/underworld3 @.> Cc: Belay Mino @.>; Mention @.> Subject: Re: [underworldcode/underworld3] [BUG] -AttributeError: 'NaturalBC' object has no attribute 'fn_F' when using add_natural_bc (Issue #25)

[https://avatars.githubusercontent.com/u/12045001?s=20&v=4]jcgraciosa left a comment (underworldcode/underworld3#25)https://github.com/underworldcode/underworld3/issues/25#issuecomment-3322348452

Hello @gthyagihttps://github.com/gthyagi and @Belay-129https://github.com/Belay-129, I found the cause of the issue and I'm investigating a fix. I'll give you some updates soon.

Cheers, JC

— Reply to this email directly, view it on GitHubhttps://github.com/underworldcode/underworld3/issues/25#issuecomment-3322348452, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BR5VEZ5B3PTMN5G3HOA3BGL3UDCELAVCNFSM6AAAAACHEFJ7TKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMRSGM2DQNBVGI. You are receiving this because you were mentioned.Message ID: @.***>

Belay-129 avatar Sep 23 '25 04:09 Belay-129