Dear Thibault, I have studied the example you sent me, and I noticed you inserted 0.5-0.5tan(Dx) for PHI.
I was not sure on how FiPY worked in the first place, and wondered if your example basically tests whether 0.5-0.5tan(Dx) fits in and solves the given PDE, which I wrote in the beginning? This eqn was u_t + u_xx +u² = 0 As 0.5-0.5tan(Dx) does not give zero here, when inserted, does this mean that FiPY tests the fitness of a function (phi) in a PDE, and if it fits, it ends up with a zero-line for homogenous cases as this PDE? Thanks In advance! Sergio Manzetti [ http://www.fjordforsk.no/logo_hr2.jpg ] [ http://www.fjordforsk.no/ | Fjordforsk AS ] [ http://www.fjordforsk.no/ | ] Midtun 6894 Vangsnes Norge Org.nr. 911 659 654 Tlf: +47 57695621 [ http://www.oekolab.com/ | Økolab ] | [ http://www.nanofact.no/ | Nanofactory ] | [ http://www.aq-lab.no/ | AQ-Lab ] | [ http://www.phap.no/ | FAP ] From: "Thibault Bridel-Bertomeu" <thibault.bridellel...@gmail.com> To: "fipy" <fipy@nist.gov> Sent: Thursday, May 18, 2017 8:16:47 PM Subject: Re: Compressible euler equations Hi Daniel, Thank you for your answer, I feel I am getting close thanks to you but it still does not work .. can you please shed some light on the following points : 1/ for the pressure equation, when you meant implicitTerm were you thinking about this : eqnP = fipy.ImplicitSourceTerm(coeff=1.0, var=p) == gm1*roE - 0.5*gm1*(roU**2 + roV**2)/ro 2/ Okay, for the dp/dx and dp/dy, I agree now I see that we can use a centralconvectionterm indeed. Can you confirm they are to be written as : coeffForX = fipy.CellVariable(mesh=mesh, rank=1) coeffForX[0] = 1.0 coeffForX[1] = 0.0 fipy.CentralDifferenceConvectionTerm(coeff=coeffForX, var=p) for dp/dx, and as : coeffForY = fipy.CellVariable(mesh=mesh, rank=1) coeffForY[0] = 0.0 coeffForY[1] = 1.0 fipy.CentralDifferenceConvectionTerm(coeff=coeffForY, var=p) for dp/dy ? As for the roE equation, I combined the gradient components into this : coeffConv = fipy.CellVariable(mesh=mesh, rank=1) coeffConv[0] = roU/ro coeffConv[1] = roV/ro fipy.CentralDifferenceConvectionTerm(coeff=coeffConv.faceValue, var=p) Does it seem reasonable to you ? 3/ By non-linear, I get that you mean sweeping the equations several times before actually updating the solution in time. But I don’t know what equations i am supposed to be sweeping here, I think I lack the experience. The whole system should be swept, like so : for step in range(steps): ro.updateOld() roU.updateOld() roV.updateOld() roE.updateOld() p.updateOld() # # eqn.solve(dt=dt) for sweep in range(sweeps): print "ITER %d, SWEEP %d"%(step+1, sweep+1) vi2D.plot() eqnP.sweep(dt=dt) eqnC.sweep(dt=dt) eqnMx.sweep(dt=dt) eqnMy.sweep(dt=dt) eqnE.sweep(dt=dt) or is it only a few equations, in a certain order ? I need your help on that please. Thank you so much again, Cordialement, -- T. BRIDEL-BERTOMEU 2017-05-18 16:28 GMT+02:00 Daniel Wheeler < [ mailto:daniel.wheel...@gmail.com | daniel.wheel...@gmail.com ] > : Hi Thibault, I think that you are almost there with your implementation. There are a few more things to do to get it working. - First, use an ImplciitSourceTerm rather than a TransientTerm to represent "p" in the pressure equation. - Secondly, use a CentralDifferenceConvectionTerm in the momentum equations to represent dp/dx etc. This will give you the implicit coupling. Also, maybe, in the roE equation, though that is more complicated. - Thirdly, as this is non-linear, you also need an extra non-linear loop at each time step. - Fourthly, if you can't get this working in a coupled manner. Maybe try uncoupling and solving each equation separately, but use the non-linear loop mentioned above. Only when that is working you should start coupling terms one by one. Cheers, Daniel On Thu, May 18, 2017 at 5:55 AM, Thibault Bridel-Bertomeu < [ mailto:thibault.bridellel...@gmail.com | thibault.bridellel...@gmail.com ] > wrote: > Hello Daniel, > > Thank you for the paper and the script - I am afraid it will take me some > time though, its impressive and long work !! > > Regarding the equations, I think I was not clear enough in my previous > explanations, I apologize. > In substance, I have 4 variables : ro, roU, roV and roE. They are density, > velocity along X, velocity along Y and energy. > I also have 4 differential equations : > > dro/dt + nabla.(ro*[U,V]) = 0 > droU/dt + nabla.(roU*[U,V]) = -dp / dx > droV/dt + nabla.(roV*[U,V]) = -dp / dy > droE/dt + nabla.(roE*[U,V]) = - d(p*(roU/ro))/dx - d(p*(roV/ro))/dy > > As you can see, they are written with a fifth variable, p, for pressure, > that is related to the others by : > > p = (gamma-1.0)*roE - 0.5*(gamma-1.0)*(roU**2 + roV**2)/ro > > this is what I call the equation of state, it is not differential it is just > algebraic. > > I wager the differential equations above are not the most complex you have > seen or implemented in FiPy, and I think I succeeded, although of course, > since the whole thing does not work, I cannot be sure. But then I am stuck > with that non-differential equation that I would have to solve with the four > differential (?) to close the system … > > Can you see what I am stuck with ? > Also, could you please elaborate on the last paragraph of your previous > e-mail ? « If you do include … » I am not sure I get why you speak of > linearization and relaxation ? > > I attach the latest version of my non-working script .. > > Thanks for the help > > Best, > > Thibault -- Daniel Wheeler _______________________________________________ fipy mailing list [ mailto:fipy@nist.gov | fipy@nist.gov ] [ http://www.ctcms.nist.gov/fipy | http://www.ctcms.nist.gov/fipy ] [ NIST internal ONLY: [ https://email.nist.gov/mailman/listinfo/fipy | https://email.nist.gov/mailman/listinfo/fipy ] ] _______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
_______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]