underworldcode / underworld2

underworld2: A parallel, particle-in-cell, finite element code for Geodynamics.
http://www.underworldcode.org/
Other
177 stars 59 forks source link

Stokes solver Convergence issue with prescribed velocity BCs #378

Closed tingyang2004 closed 5 years ago

tingyang2004 commented 5 years ago

Hi all,

I am having a stokes solver convergence issue when trying to investigate the influence of the prescribed upwelling and downwellings on mantle convection. Periodic BC are used for side boundaries. The horizontal velocity of the bottom boundary is fixed to zero while the vertical velocity is as below: image The stokes solver does not converge after the maximum pressure iteration of 10000: image

But it converges very fast when the bottom vertical velocity is set as zero: image

Any suggestions? The input parameter and log files are attached below.

Best regards, Ting

input5A.log input5A.py.txt

jmansour commented 5 years ago

My guess is you are violating volume conservation. What is your top BC? From your graph, it looks like are trying to have equal volume in and out, which is good, except that this BC will only be represented approximately so it probably won't work this way.

You have a few options:

  1. Add a compressible layer somewhere to take up the slack.
  2. Use an identical BC at the top.
  3. Be very careful to ensure flux in = flux out at the bottom.
  4. Set an open BC at the top which will allow outflow as necessary.

You can create a surface integral across the bottom to calculate your total flux through the boundary.

tingyang2004 commented 5 years ago

Thanks, John. Top BC is free slip. You mean approximation due to mesh discretization? Do you have any suggestions on how to make in- and out- flows equal to each other exactly. Right now, the relative error of the bottom velocity BC is: int(x,vz)/int(x,abs(vz))=-0.00475 where int(x,vz) is the integration of vertical velocity along the bottom boundary.

jmansour commented 5 years ago

Yep approximate due to discretisation. To ensure an exact in/out flow, you could create a symmetric BC along the bottom so any discretisation errors are reflected exactly in the opposite sense. I guess it depends on how critical the form of your inflow/outflow are to your modelling. There are other things you could try to tune the condition, but don't really feel it's the way forward as they probably will not prove sufficiently robust. Perhaps you could even have part of your lower BC fixed and another part open. Say, Dirichlet for the inflow, and then for a subsection Neumann to allow it to automatically find the required outflow.

I'd suggest the first thing to try is to add the compressible layer to see if this immediately remedies your solve issues.

tingyang2004 commented 5 years ago

That's true. I have just tested a model with cosine bottom boundary vertical velocity values and the stokes solver converged rapidly. So the discretization error was the key. I guess the Neumann boundary condition may also cause problems? since the exact vertical integration of the density also have numerical errors? image When the bottom vertical velocity was set as the blue line, the stokes solver did not converge, while when it was set as the red line (cosine perturbations), it converged rapidly.

jmansour commented 5 years ago

They Neumann condition shouldn't cause issues on account of volume conservation, but it may create other difficulties (if you have gravity, you'll need to set it to provide the required support). Perhaps you could even set a single node to Neumann to provide some breathing room, and constrain the rest.

tingyang2004 commented 5 years ago

I am still using the Direchlet BC but have removed the average of the velocity field, the stokes solver now converges. As you can see, the original vertical velocity and the corrected velocity at the bottom boundary are quite close, but this difference has made the convergence issue. image

jmansour commented 5 years ago

Actually that's a great idea Ting. I didn't think of that. You could easily automate this too. After you set your initial velocity, do the surface integral, then add correction.

On Fri, 10 May 2019, 4:57 pm tingyang2004 <notifications@github.com wrote:

I am still using the Direchlet BC but have removed the average of the velocity field, the stokes solver now converges. As you can see, the original vertical velocity and the corrected velocity at the bottom boundary are quite close, but this difference has made the convergence issue. [image: image] https://user-images.githubusercontent.com/26615840/57508238-8f869900-7333-11e9-995e-c7aeab5bda69.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/underworldcode/underworld2/issues/378#issuecomment-491178943, or mute the thread https://github.com/notifications/unsubscribe-auth/AAK7NHOAIODTICVVRF57LETPUUMFFANCNFSM4HL7SDSQ .

tingyang2004 commented 5 years ago

OK, I will close this ticket since John has kindly helped me solved it out.