1D ODE with non-constant coefficients. #2686
-
Dear community, I've been trying to set up a very simple example of a 1D ODE in weak form. The equation contains the radial part of the scalar Laplacian in 2D and so there are metric scale factors giving non-constant coefficients. I have implemented something that I think is plausible but it doesn't give the correct solution. The (very short) script and the problem are explained at https://github.com/ethrelfall/further-Firedrake. Please, is someone able to say how to do this properly? (Search for matching discussions returned nowt.) Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Code looks ok at a glance. Are you comparing with the exact solution applied to w, not the coordinate, by any chance?
…________________________________________
From: ethrelfall ***@***.***>
Sent: 13 December 2022 17:19
To: firedrakeproject/firedrake
Cc: Subscribed
Subject: [firedrakeproject/firedrake] 1D ODE with non-constant coefficients. (Discussion #2686)
Dear community,
I've been trying to set up a very simple example of a 1D ODE in weak form. The equation contains the radial part of the scalar Laplacian in 2D and so there are metric scale factors giving non-constant coefficients.
I have implemented something that I think is plausible but it doesn't give the correct solution. The (very short) script and the problem are explained at https://github.com/ethrelfall/further-Firedrake.
Please, is someone able to say how to do this properly?
(Search for matching discussions returned nowt.)
Thanks!
—
Reply to this email directly, view it on GitHub<#2686>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABOSV4WJWQTC6TMYUUDYXCTWNCV2TANCNFSM6AAAAAAS5O3MTI>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Oh, I see the problem. Your RHS is v*w*dx but it should be q*v*dx where q is set to -1.
…________________________________________
From: Cotter, Colin J ***@***.***>
Sent: 13 December 2022 18:50
To: firedrakeproject/firedrake
Subject: Re: [firedrakeproject/firedrake] 1D ODE with non-constant coefficients. (Discussion #2686)
Code looks ok at a glance. Are you comparing with the exact solution applied to w, not the coordinate, by any chance?
________________________________________
From: ethrelfall ***@***.***>
Sent: 13 December 2022 17:19
To: firedrakeproject/firedrake
Cc: Subscribed
Subject: [firedrakeproject/firedrake] 1D ODE with non-constant coefficients. (Discussion #2686)
Dear community,
I've been trying to set up a very simple example of a 1D ODE in weak form. The equation contains the radial part of the scalar Laplacian in 2D and so there are metric scale factors giving non-constant coefficients.
I have implemented something that I think is plausible but it doesn't give the correct solution. The (very short) script and the problem are explained at https://github.com/ethrelfall/further-Firedrake.
Please, is someone able to say how to do this properly?
(Search for matching discussions returned nowt.)
Thanks!
—
Reply to this email directly, view it on GitHub<#2686>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABOSV4WJWQTC6TMYUUDYXCTWNCV2TANCNFSM6AAAAAAS5O3MTI>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Your analytical solution is not correct; if I add a correction term to your rhs as in |
Beta Was this translation helpful? Give feedback.
-
oh ah you multiplied through by r! sorry!
On 13 Dec 2022, at 18:54, ethrelfall ***@***.***> wrote:
Thanks so much for taking a look. But why should I NOT have \int r v dx on the RHS (wh. w=r in the script), as in the formula in the readme - ?
—
Reply to this email directly, view it on GitHub<#2686 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABOSV4UO3RTIMMREJUEIXC3WNDA43ANCNFSM6AAAAAAS5O3MTI>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Your analytical solution is not correct; if I add a correction term to your rhs as in
L = ((w+1.5/w**2)*v)*dx
, what you wrote down becomes the exact solution.