Re: [firedrake] Issues with Firedrake
Dear William, Thanks for your email, I'm shifting this conversation onto the Firedrake mailing list, which is the appropriate place for Firedrake help requests. Please also see my responses below. On Thu, 15 Oct 2015 at 10:10 William Booker <scwb@leeds.ac.uk> wrote:
Dear David,
I've been trying to get to grips with Firedrake by modifying the advection demo.
I'm trying to implement it as unsteady with a backwards euler timestep but I've run into a few problems.
First is that my initial condition does not appear to be implemented correctly, as shown in the graph. It seems that instead of a shock, the IC is smoothed out throughout the domain.
I've run your code, and the first thing to realise is that your first output is after the first timestep. The image you show is therefore after the tracer has begun to advect. This accounts for the "smearing out" and as far as I can see, the solution is entirely consistent with what you have specified.
Second is that I'm not sure that my boundary conditions are actually being set correctly, that is if I try to set the IC to be zero everywhere, I'm not getting a value of 1 rising on the right side as I would expect.
I'm not sure why you expect this because the velocity field you have specified flows in the z direction, and the boundary condition is non-zero over the right half of the x-y (z=0) boundary. The advection equation therefore causes tracer to flux vertically through the right half of the domain until it is uniformly 1 and the left side is uniformly 0. This is what happens in the simulation, as far as I can see it's all correct. There is one small issue you may not have noticed, which is that the tracer is taking the value 0.5 when you might have expected 1.0. This is due to a subtle rounding error. When you project your tracer field, it is first being interpolated into DG1. In DG1, the top nodes of the bottom cell are (for rounding reasons) taking the value 0, which means the cell average value is 0.5. In this case, the simplest way around this is to interpolate the BC value straight into DG0. That is, replace: ic = project(inflow, V) with: ic = interpolate(inflow, V)
Finally I've tried to use a mesh made in gmsh but I've found if I don't name the boundaries, I can't assign values using the 1,2,3,4 system. This may be related to the previous point but if I try to assign names in gmsh, Firedrake won't load the file with an error that it is not a valid gmsh file.
Firedrake is complaining that it's not a valid gmsh file because it isn't a valid gmsh file. If you check lines 8 and 9 of trapezium.msh you will see some junk which is directly quoted from the .geo file. There is clearly some issue with your .geo file. If I had to take a guess, I would say that there is a missing double quote character after Right.
Regards, David
Any help would be greatly appreciated,
Will
Dear Firedrakers, I fixed the physical name issue from last time but I'm still getting that the msh file isn't valid. What can I do to correct this? Thanks in advance, Will ________________________________ From: David Ham <David.Ham@imperial.ac.uk> Sent: 15 October 2015 12:07 To: William Booker; firedrake Subject: Re: Issues with Firedrake Dear William, Thanks for your email, I'm shifting this conversation onto the Firedrake mailing list, which is the appropriate place for Firedrake help requests. Please also see my responses below. On Thu, 15 Oct 2015 at 10:10 William Booker <scwb@leeds.ac.uk<mailto:scwb@leeds.ac.uk>> wrote: Dear David, I've been trying to get to grips with Firedrake by modifying the advection demo. I'm trying to implement it as unsteady with a backwards euler timestep but I've run into a few problems. First is that my initial condition does not appear to be implemented correctly, as shown in the graph. It seems that instead of a shock, the IC is smoothed out throughout the domain. I've run your code, and the first thing to realise is that your first output is after the first timestep. The image you show is therefore after the tracer has begun to advect. This accounts for the "smearing out" and as far as I can see, the solution is entirely consistent with what you have specified. Second is that I'm not sure that my boundary conditions are actually being set correctly, that is if I try to set the IC to be zero everywhere, I'm not getting a value of 1 rising on the right side as I would expect. I'm not sure why you expect this because the velocity field you have specified flows in the z direction, and the boundary condition is non-zero over the right half of the x-y (z=0) boundary. The advection equation therefore causes tracer to flux vertically through the right half of the domain until it is uniformly 1 and the left side is uniformly 0. This is what happens in the simulation, as far as I can see it's all correct. There is one small issue you may not have noticed, which is that the tracer is taking the value 0.5 when you might have expected 1.0. This is due to a subtle rounding error. When you project your tracer field, it is first being interpolated into DG1. In DG1, the top nodes of the bottom cell are (for rounding reasons) taking the value 0, which means the cell average value is 0.5. In this case, the simplest way around this is to interpolate the BC value straight into DG0. That is, replace: ic = project(inflow, V) with: ic = interpolate(inflow, V) Finally I've tried to use a mesh made in gmsh but I've found if I don't name the boundaries, I can't assign values using the 1,2,3,4 system. This may be related to the previous point but if I try to assign names in gmsh, Firedrake won't load the file with an error that it is not a valid gmsh file. Firedrake is complaining that it's not a valid gmsh file because it isn't a valid gmsh file. If you check lines 8 and 9 of trapezium.msh you will see some junk which is directly quoted from the .geo file. There is clearly some issue with your .geo file. If I had to take a guess, I would say that there is a missing double quote character after Right. Regards, David Any help would be greatly appreciated, Will
participants (2)
- 
                
                David Ham
- 
                
                William Booker