Assign and mixed space #3953
-
Hello, I am trying to solve a nonlinear problem which has two scalar variables. I have set up a mixed function space psi, alpha = Function(W) I need to assign an initial condition psi.assign(ic) But I get an error: 'Indexed' object has no attribute 'assign'. Please can you help? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Try with
|
Beta Was this translation helpful? Give feedback.
-
You'll need to give a name to the whole
|
Beta Was this translation helpful? Give feedback.
-
The Camassa-Holm equation example is good for this too.
From: Josh Hope-Collins ***@***.***>
Date: Friday, 10 January 2025 at 13:47
To: firedrakeproject/firedrake ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [firedrakeproject/firedrake] Assign and mixed space (Discussion #3953)
You are still using sigma, u = Function(W) to set up the form, so you don't have a handle to the full Function. You need to pass this handle to solve so that it knows what to solve for. Here you are passing solve a Function that does not appear in the form.
Have you looked at any of the nonlinear examples? You can look over this one for a scalar nonlinear example: https://www.firedrakeproject.org/demos/burgers.py.html and this one for a mixed nonlinear example showing how to create a Function and use it in a nonlinear form: https://www.firedrakeproject.org/demos/navier_stokes.py.html
—
Reply to this email directly, view it on GitHub<#3953 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABOSV4UKYOQWCWPGIE2JYLD2J7FPDAVCNFSM6AAAAABUV3KJQ2VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNZZHAZTONA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
You are still using
sigma, u = Function(W)
to set up the form, so you don't have a handle to the fullFunction
. You need to pass this handle tosolve
so that it knows what to solve for. Here you are passingsolve
aFunction
that does not appear in the form.Have you looked at any of the nonlinear examples? You can look over this one for a scalar nonlinear example: https://www.firedrakeproject.org/demos/burgers.py.html and this one for a mixed nonlinear example showing how to create a
Function
and use it in a nonlinear form: https://www.firedrakeproject.org/demos/navier_stokes.py.html