Dear all, First of all, thanks a lot for your time last Friday, and your help both for the implementation and for the installation of Firedrake. I am now trying to implement the equations we discussed on Friday, for the 3D potential flow equations. As a reminder, I solve the equations for phi, h, but also phi_s which is a 3D function, but is only updated at the free surface. However, I would like to update the interior nodes of phi_s as well, by copying the value of its surface nodes, as soon as they are updated (that is, simultaneously with solving the coupled equations). Is there a way to do this? I attach a short pdf summarising the equations, the current implementation and the issue I get. Thank you very much, Floriane
To rephrase that: The 2D function: phis(x,y) should become a 3D function: phis_extended(x,y,z) independent of z, i.e., its value does not vary in the z-direction but can vary in the horizontal and time. How does one do that in FD? ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Floriane Gidel [RPG] <mmfg@leeds.ac.uk> Sent: Thursday, December 10, 2015 4:53 PM To: firedrake@imperial.ac.uk Subject: [firedrake] 2D to 3D function Dear all, First of all, thanks a lot for your time last Friday, and your help both for the implementation and for the installation of Firedrake. I am now trying to implement the equations we discussed on Friday, for the 3D potential flow equations. As a reminder, I solve the equations for phi, h, but also phi_s which is a 3D function, but is only updated at the free surface. However, I would like to update the interior nodes of phi_s as well, by copying the value of its surface nodes, as soon as they are updated (that is, simultaneously with solving the coupled equations). Is there a way to do this? I attach a short pdf summarising the equations, the current implementation and the issue I get. Thank you very much, Floriane
Hi Onno and Floriane, I've done this by defining two functions, phi_2d and phi_3d, living in the 2d and 3d meshes. First you solve phi_2d, and then you copy it's nodal values to phi_3d using a custom pyop2 kernel (see the attached file). Naturally the horizontal function space of phi_2d and phi_3d must be the same. This works fine for common Pn, PnDG function spaces. If you are using more exotic function spaces, this is not sufficient (for example in RT spaces the nodal values depend on the jacobian, which will be different in 2d and 3d). Cheers, Tuomas On 12/10/2015 09:16 AM, Onno Bokhove wrote:
To rephrase that:
The 2D function: phis(x,y) should become
a 3D function: phis_extended(x,y,z) independent of z, i.e.,
its value does not vary in the z-direction but can vary in the horizontal and time.
How does one do that in FD?
------------------------------------------------------------------------ *From:* firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Floriane Gidel [RPG] <mmfg@leeds.ac.uk> *Sent:* Thursday, December 10, 2015 4:53 PM *To:* firedrake@imperial.ac.uk *Subject:* [firedrake] 2D to 3D function
Dear all,
First of all, thanks a lot for your time last Friday, and your help both for the implementation and for the installation of Firedrake.
I am now trying to implement the equations we discussed on Friday, for the 3D potential flow equations. As a reminder, I solve the equations for phi, h, but also phi_s which is a 3D function, but is only updated at the free surface. However, I would like to update the interior nodes of phi_s as well, by copying the value of its surface nodes, as soon as they are updated (that is, simultaneously with solving the coupled equations). Is there a way to do this?
I attach a short pdf summarising the equations, the current implementation and the issue I get.
Thank you very much,
Floriane
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
Hi Tuomas, Thanks for your quick answer. The issue in our case is that we need to solve the equations for phi_2d and phi_3d simultaneously, as a coupled system. So if we use a 2D and a 3D functions, we need to find a way to copy the nodal values of phi_2d to phi_3d while solving the equations, which I'm not sure we can do with this method... Thanks, Floriane ________________________________ De : firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> de la part de Tuomas Karna <tuomas.karna@gmail.com> Envoyé : jeudi 10 décembre 2015 17:40 À : firedrake@imperial.ac.uk Objet : Re: [firedrake] 2D to 3D function Hi Onno and Floriane, I've done this by defining two functions, phi_2d and phi_3d, living in the 2d and 3d meshes. First you solve phi_2d, and then you copy it's nodal values to phi_3d using a custom pyop2 kernel (see the attached file). Naturally the horizontal function space of phi_2d and phi_3d must be the same. This works fine for common Pn, PnDG function spaces. If you are using more exotic function spaces, this is not sufficient (for example in RT spaces the nodal values depend on the jacobian, which will be different in 2d and 3d). Cheers, Tuomas On 12/10/2015 09:16 AM, Onno Bokhove wrote: To rephrase that: The 2D function: phis(x,y) should become a 3D function: phis_extended(x,y,z) independent of z, i.e., its value does not vary in the z-direction but can vary in the horizontal and time. How does one do that in FD? ________________________________ From: firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk> <firedrake-bounces@imperial.ac.uk><mailto:firedrake-bounces@imperial.ac.uk> on behalf of Floriane Gidel [RPG] <mmfg@leeds.ac.uk><mailto:mmfg@leeds.ac.uk> Sent: Thursday, December 10, 2015 4:53 PM To: firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> Subject: [firedrake] 2D to 3D function Dear all, First of all, thanks a lot for your time last Friday, and your help both for the implementation and for the installation of Firedrake. I am now trying to implement the equations we discussed on Friday, for the 3D potential flow equations. As a reminder, I solve the equations for phi, h, but also phi_s which is a 3D function, but is only updated at the free surface. However, I would like to update the interior nodes of phi_s as well, by copying the value of its surface nodes, as soon as they are updated (that is, simultaneously with solving the coupled equations). Is there a way to do this? I attach a short pdf summarising the equations, the current implementation and the issue I get. Thank you very much, Floriane _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
OK I see. The pyop2 method requires that you first solve the 2d field, then copy it to the 3d nodes. So it won't work for the coupled system solve you're dealing with. - Tuomas On 12/10/2015 10:02 AM, Floriane Gidel [RPG] wrote:
Hi Tuomas,
Thanks for your quick answer. The issue in our case is that we need to solve the equations for phi_2d and phi_3d simultaneously, as a coupled system. So if we use a 2D and a 3D functions, we need to find a way to copy the nodal values of phi_2d to phi_3d while solving the equations, which I'm not sure we can do with this method...
Thanks,
Floriane
------------------------------------------------------------------------ *De :* firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> de la part de Tuomas Karna <tuomas.karna@gmail.com> *Envoyé :* jeudi 10 décembre 2015 17:40 *À :* firedrake@imperial.ac.uk *Objet :* Re: [firedrake] 2D to 3D function Hi Onno and Floriane,
I've done this by defining two functions, phi_2d and phi_3d, living in the 2d and 3d meshes. First you solve phi_2d, and then you copy it's nodal values to phi_3d using a custom pyop2 kernel (see the attached file). Naturally the horizontal function space of phi_2d and phi_3d must be the same.
This works fine for common Pn, PnDG function spaces. If you are using more exotic function spaces, this is not sufficient (for example in RT spaces the nodal values depend on the jacobian, which will be different in 2d and 3d).
Cheers,
Tuomas
On 12/10/2015 09:16 AM, Onno Bokhove wrote:
To rephrase that:
The 2D function: phis(x,y) should become
a 3D function: phis_extended(x,y,z) independent of z, i.e.,
its value does not vary in the z-direction but can vary in the horizontal and time.
How does one do that in FD?
------------------------------------------------------------------------ *From:* firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Floriane Gidel [RPG] <mmfg@leeds.ac.uk> *Sent:* Thursday, December 10, 2015 4:53 PM *To:* firedrake@imperial.ac.uk *Subject:* [firedrake] 2D to 3D function
Dear all,
First of all, thanks a lot for your time last Friday, and your help both for the implementation and for the installation of Firedrake.
I am now trying to implement the equations we discussed on Friday, for the 3D potential flow equations. As a reminder, I solve the equations for phi, h, but also phi_s which is a 3D function, but is only updated at the free surface. However, I would like to update the interior nodes of phi_s as well, by copying the value of its surface nodes, as soon as they are updated (that is, simultaneously with solving the coupled equations). Is there a way to do this?
I attach a short pdf summarising the equations, the current implementation and the issue I get.
Thank you very much,
Floriane
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
No Onno, at the moment phis is a 3D function, phis(x,y,z), which is defined in the whole 3D domain but updated from the equations only at the surface z=H0. I would like to copy this update in the interior nodes. To include a 2D function phis(x,y) in the equations is a different problem (which might work as well, but it's not what we consider at the moment). Floriane ________________________________ De : firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> de la part de Onno Bokhove <O.Bokhove@leeds.ac.uk> Envoyé : jeudi 10 décembre 2015 17:16 À : firedrake@imperial.ac.uk Objet : Re: [firedrake] 2D to 3D function To rephrase that: The 2D function: phis(x,y) should become a 3D function: phis_extended(x,y,z) independent of z, i.e., its value does not vary in the z-direction but can vary in the horizontal and time. How does one do that in FD? ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Floriane Gidel [RPG] <mmfg@leeds.ac.uk> Sent: Thursday, December 10, 2015 4:53 PM To: firedrake@imperial.ac.uk Subject: [firedrake] 2D to 3D function Dear all, First of all, thanks a lot for your time last Friday, and your help both for the implementation and for the installation of Firedrake. I am now trying to implement the equations we discussed on Friday, for the 3D potential flow equations. As a reminder, I solve the equations for phi, h, but also phi_s which is a 3D function, but is only updated at the free surface. However, I would like to update the interior nodes of phi_s as well, by copying the value of its surface nodes, as soon as they are updated (that is, simultaneously with solving the coupled equations). Is there a way to do this? I attach a short pdf summarising the equations, the current implementation and the issue I get. Thank you very much, Floriane
Ah, in that case the example I sent is not directly applicable. But I think you still need a pyop2 kernel to copy the nodal values -- you might be able to adapt the example: just remove the 2d function and do something like "func[d+e][c] = func[d][c];" in the kernel loop (depending on which surface you are copying from). The 3d function should have access op2.RW instead of op2.READ. - Tuomas On 12/10/2015 09:44 AM, Floriane Gidel [RPG] wrote:
No Onno, at the moment phis is a *3D function, phis(x,y,z)*, which is defined in the whole 3D domain but updated from the equations *only at the surface* z=H0. I would like to copy this update in the interior nodes.
To include a 2D function phis(x,y) in the equations is a different problem (which might work as well, but it's not what we consider at the moment).
Floriane
------------------------------------------------------------------------ *De :* firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> de la part de Onno Bokhove <O.Bokhove@leeds.ac.uk> *Envoyé :* jeudi 10 décembre 2015 17:16 *À :* firedrake@imperial.ac.uk *Objet :* Re: [firedrake] 2D to 3D function
To rephrase that:
The 2D function: phis(x,y) should become
a 3D function: phis_extended(x,y,z) independent of z, i.e.,
its value does not vary in the z-direction but can vary in the horizontal and time.
How does one do that in FD?
------------------------------------------------------------------------ *From:* firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Floriane Gidel [RPG] <mmfg@leeds.ac.uk> *Sent:* Thursday, December 10, 2015 4:53 PM *To:* firedrake@imperial.ac.uk *Subject:* [firedrake] 2D to 3D function
Dear all,
First of all, thanks a lot for your time last Friday, and your help both for the implementation and for the installation of Firedrake.
I am now trying to implement the equations we discussed on Friday, for the 3D potential flow equations. As a reminder, I solve the equations for phi, h, but also phi_s which is a 3D function, but is only updated at the free surface. However, I would like to update the interior nodes of phi_s as well, by copying the value of its surface nodes, as soon as they are updated (that is, simultaneously with solving the coupled equations). Is there a way to do this?
I attach a short pdf summarising the equations, the current implementation and the issue I get.
Thank you very much,
Floriane
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
Ok thanks, I'll have a look at this! Floriane ________________________________ De : firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> de la part de Tuomas Karna <tuomas.karna@gmail.com> Envoyé : jeudi 10 décembre 2015 18:01 À : firedrake@imperial.ac.uk Objet : Re: [firedrake] 2D to 3D function Ah, in that case the example I sent is not directly applicable. But I think you still need a pyop2 kernel to copy the nodal values -- you might be able to adapt the example: just remove the 2d function and do something like "func[d+e][c] = func[d][c];" in the kernel loop (depending on which surface you are copying from). The 3d function should have access op2.RW instead of op2.READ. - Tuomas On 12/10/2015 09:44 AM, Floriane Gidel [RPG] wrote: No Onno, at the moment phis is a 3D function, phis(x,y,z), which is defined in the whole 3D domain but updated from the equations only at the surface z=H0. I would like to copy this update in the interior nodes. To include a 2D function phis(x,y) in the equations is a different problem (which might work as well, but it's not what we consider at the moment). Floriane ________________________________ De : firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk> <firedrake-bounces@imperial.ac.uk><mailto:firedrake-bounces@imperial.ac.uk> de la part de Onno Bokhove <O.Bokhove@leeds.ac.uk><mailto:O.Bokhove@leeds.ac.uk> Envoyé : jeudi 10 décembre 2015 17:16 À : firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> Objet : Re: [firedrake] 2D to 3D function To rephrase that: The 2D function: phis(x,y) should become a 3D function: phis_extended(x,y,z) independent of z, i.e., its value does not vary in the z-direction but can vary in the horizontal and time. How does one do that in FD? ________________________________ From: firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk> <firedrake-bounces@imperial.ac.uk><mailto:firedrake-bounces@imperial.ac.uk> on behalf of Floriane Gidel [RPG] <mmfg@leeds.ac.uk><mailto:mmfg@leeds.ac.uk> Sent: Thursday, December 10, 2015 4:53 PM To: firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> Subject: [firedrake] 2D to 3D function Dear all, First of all, thanks a lot for your time last Friday, and your help both for the implementation and for the installation of Firedrake. I am now trying to implement the equations we discussed on Friday, for the 3D potential flow equations. As a reminder, I solve the equations for phi, h, but also phi_s which is a 3D function, but is only updated at the free surface. However, I would like to update the interior nodes of phi_s as well, by copying the value of its surface nodes, as soon as they are updated (that is, simultaneously with solving the coupled equations). Is there a way to do this? I attach a short pdf summarising the equations, the current implementation and the issue I get. Thank you very much, Floriane _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
On 10/12/15 16:53, Floriane Gidel [RPG] wrote:
Dear all,
First of all, thanks a lot for your time last Friday, and your help both for the implementation and for the installation of Firedrake.
I am now trying to implement the equations we discussed on Friday, for the 3D potential flow equations. As a reminder, I solve the equations for phi, h, but also phi_s which is a 3D function, but is only updated at the free surface. However, I would like to update the interior nodes of phi_s as well, by copying the value of its surface nodes, as soon as they are updated (that is, simultaneously with solving the coupled equations). Is there a way to do this?
I attach a short pdf summarising the equations, the current implementation and the issue I get.
Thank you very much,
Floriane
I'm a little confused by your equations: phi_s only occurs in the top surface integral in R_phi_s, so why do you need it in 3D? Also R_phi_s only has one surface integral, so you cannot use a 3D test function q there, since you would get spurious equations for all q that are zero at the top. Finally you say you have a boundary condition that implies phi_s=phi^* at the top, but you don't indicate the time-level for phi^* in (1) - also you have to indicate what time level R_phi_star is at if you want to solve it in conjuction with R_phi_s. Is what you want to do solve for \phi^* using R_phi_star (which is independent of phi_s?) and then solve for phi_s via R_phi_s? Cheers Stephan
The actual numerics works, see Gagarina et al JCP 2014 expression (35), in terms of explicit matrices, and is as follows: 1) Step 1 solve two coupled equations for unknowns phis and phi* - use a surface equation for the unknown 2DH function phis(x,y) (taken at n+1/2) but it contains the vertical gradient of the 3D function phi*, which vertical gradient is evaluated at the top surface - this is coupled to a interior 3D equation for phi*(x,y,z), which value is phis(x,y) at the top surface. The time discretisation is stormer-verlet for the hyperbolic surface equations, because one can eliminate the interior degrees of freedom for phi by symbolically taking the inverse of the linear Laplace problem, but alas that leads to the following: - phis(x,y) is evaluated at n+1/2 but - phi*(x,y,z) in the interior is evaluated at another time level and emerges when one avoids taking explicit inverses; it is in essence just an aid variable. In terms of unknown coefficients this is easy to split, but in FD that seems to require the following split (before time is discretized): varphi(x,y,z) = phi-phis such that varphi =0 at the top at all times! Now varphi can be safely evaluated at varphi^n,+=varphi* in the interior and phis can be evaluated at n+1/2. Let us assume phis(x,y) is a genuinely 2D function with a 2D test function, but when it is used in the 3D volume it needs to be extended downward in a uniform fashion to say phis3D(x,y,z)=phis(x,y). 2) Unknown h^n+1 as 2D function of x and y and varphi** in the interior (by definition) Now we updated h to h^n+1 in a surface equation part coupled to an unknown varphi**(x,y,z)=varphi^n+1,- (DG o the minus n+1 side in time). Here we need to extend h^n+1 at the top to the interior in the volume equation for h, say h_interior=h^n+1(x,y). 3) Step 3 is explicit. Onno ________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Stephan Kramer <s.kramer@imperial.ac.uk> Sent: Thursday, December 10, 2015 7:21 PM To: firedrake@imperial.ac.uk Subject: Re: [firedrake] 2D to 3D function On 10/12/15 16:53, Floriane Gidel [RPG] wrote:
Dear all,
First of all, thanks a lot for your time last Friday, and your help both for the implementation and for the installation of Firedrake.
I am now trying to implement the equations we discussed on Friday, for the 3D potential flow equations. As a reminder, I solve the equations for phi, h, but also phi_s which is a 3D function, but is only updated at the free surface. However, I would like to update the interior nodes of phi_s as well, by copying the value of its surface nodes, as soon as they are updated (that is, simultaneously with solving the coupled equations). Is there a way to do this?
I attach a short pdf summarising the equations, the current implementation and the issue I get.
Thank you very much,
Floriane
I'm a little confused by your equations: phi_s only occurs in the top surface integral in R_phi_s, so why do you need it in 3D? Also R_phi_s only has one surface integral, so you cannot use a 3D test function q there, since you would get spurious equations for all q that are zero at the top. Finally you say you have a boundary condition that implies phi_s=phi^* at the top, but you don't indicate the time-level for phi^* in (1) - also you have to indicate what time level R_phi_star is at if you want to solve it in conjuction with R_phi_s. Is what you want to do solve for \phi^* using R_phi_star (which is independent of phi_s?) and then solve for phi_s via R_phi_s? Cheers Stephan _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
participants (4)
- 
                
                Floriane Gidel [RPG]
- 
                
                Onno Bokhove
- 
                
                Stephan Kramer
- 
                
                Tuomas Karna