underworldcode / underworld2

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

Shortening and particle escape. #192

Closed rvachon closed 7 years ago

rvachon commented 7 years ago

Hello everyone,

I am actually trying to run a kind of sandbox shortening experiment with UW2 as follow: -Geometry: 4 x 1 [metric unit] box, composed of three different layers (+ a sticky air layer on the top). -Rheology : composite visco-plastic rheology (as describe in the 2_09 exemple). -BC: bottom and right walls are fixed, the left wall has an inflow velocity in x toward the right (vx = 1[metric unit/s]) and the top edge is supposed to be a free surface.

The model quickly stop (after 1 converged iteration) for the following reason :

FeVariable derivative interpolation at location (0.23617, 1.00151) does not appear to be valid. Location is probably outside local domain.

I think it´s due to the fact that some particles are outside the mesh above the top wall, which of course make sense as i am shortening the model. I than tried to allow particleEscape as i think it is supposed to removed the particles outside the local domain. Unfortunately it doesn´t seems to change anything and i get the same error message. I was wondering if i set up this particleEscape properly (swarm = uw.swarm.Swarm( mesh=mesh, particleEscape=True )) or if i should add something else to make it work ?

Thank you very much.

Rémi

PS: One other solution would be to deform the mesh (so particles stay inside the local domain) but i thought that allowing particleEscape would be easier to set up for an underworld beginner.

jmansour commented 7 years ago

Hi Rémi

Are you moving the mesh or have you just set an inflow velocity on the left wall? Likewise, is the top of the mesh moving, or have you simply set it to an open type condition? I gather from you've said that it's just open.

Can you post the entire context and message that you encounter? I'm guessing this happens during swarm advection? I think setting particleEscape to True should fix this, but there can be some subtle details around this.

rvachon commented 7 years ago

Hi,

Indeed my sentence wasn´t clear. I set an inflow velocity on the left wall. The mesh is not set to deform at any moment. I actually fix my problem this morning. The problem as you mentioned was during swarm advection, so i did the following changes and it seems to work fine now:

def update():
# Retrieve the maximum possible timestep for the advection system.
dt = advector.get_max_dt()
print 'dt = {0:.3e}'.format(dt)
# Advect using this timestep size.
advector.integrate(dt, update_owners=True) <== set update_owners to True

# particle population control
pop_control.repopulate() <=== add particle repopulation

return time+dt, step+1

Thank you for your time. I guess i just made a beginner mistake. I will play with the model a bit and then try to use mesh_deform instead of having outflow on my top wall. Thank you again.

Rémi

jmansour commented 7 years ago

Ok, great!

Just a few things:

  1. The update_owners=True parameter is the default, so I don't think adding this has changed anything.
  2. Certainly if you are not moving the left wall, you will need to add the population control mechanisms to repopulate particles at the left wall.
  3. In your original post, the particle appeared to have left the box at the top of the domain. I guess possibly this message was from before you enabled particle escape.

There is also the fn_particle_found underworld function, accessible as a method on the swarm object. You could potentially use this instead of repopulating particles. Basically, this function allows you to switch out from using a swarm variable where particles exists, to another function in case there are no swarm particles in that part of the domain (you would do this via the fn.branching.conditional switch). But this is more experimental, and I believe it's not available on the stable branch yet.