Kelvin Helmholtz instability simulation

369 views
Skip to first unread message

Kesava Prasad

unread,
Feb 2, 2021, 5:04:38 AM2/2/21
to Dedalus Users
Hello all,

i am trying to simulate kelvin helmholtz instability in a fully compressible medium.
The equations I model are from the papers Lecoanet.et.el (appendix D.1)

When I try to define the equation D1 of the paper,

problem.add_equation("dt(w)+dz(T)+T_mean*dz(Y)+T*dz(lnρ)-ν*(D1w1)= -T*dz(Y)-u*dx(w)-w*wz+ν*(D1w2)")

I get this error: name 'n' is not defined even though there isn't any variable named n.

I followed an earlier thread
(https://groups.google.com/g/dedalus-users/c/TrBYJqfhUeg/m/jedAOZAjBQAJ ) which discussed the issue but that got me nowhere.
I have attached the code (it is not complete).

Any help is appreciated.

Thanks,
Kesava



KHi_benchmark.py

Daniel

unread,
Feb 2, 2021, 8:18:14 AM2/2/21
to 'Long Zhao' via Dedalus Users
Hi Kesava,

You use a variable n on lines 58 and 59. Also, I should mention that the KH problem is doubly periodic, so I used Fourier bases in both directions. I used constant background density and temperature profiles. There is also no gravity in the KH problem.

Daniel

--
You received this message because you are subscribed to the Google Groups "Dedalus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dedalus-users/5f9c59ce-1cd3-4b9d-b0cb-8d64dd17136fn%40googlegroups.com.
<KHi_benchmark.py>

Kesava Prasad

unread,
Feb 2, 2021, 8:50:27 AM2/2/21
to Dedalus Users
Thanks Daniel, I overlooked that. I forgot to add n in the parameter list thereby resulting in the said error.

If I understand it correctly, the T_mean and rho_mean profiles are constant?

Kesava

Daniel

unread,
Feb 2, 2021, 8:52:38 AM2/2/21
to 'Long Zhao' via Dedalus Users
Yes. If I remember correct, I set rho_mean=1, and T_mean = P0 = 10.

Daniel

Kesava Prasad

unread,
Feb 4, 2021, 9:28:49 AM2/4/21
to Dedalus Users
Thanks Daniel.

Kesava Prasad

unread,
Feb 17, 2021, 5:38:03 AM2/17/21
to Dedalus Users
Hello all,
sorry for the late update.

So i am able to model the equations and build the pencil matrix with the below specified initial conditions based on the paper Lecoanet et.el (https://arxiv.org/pdf/1509.03630.pdf). I am using chebyshev grid in the z-axis in contrast to the paper.
I was able to run with what I think are the correct BC and IC. However, the simulation keeps blowing up after about 10 iterations. 
I believe that the simulation becomes unstable after 10 iterations and I tried changing the CFL condition by changing the timestep but it doesn't seem to work  I am pasting the IC and BC below:

BC:
problem.add_bc("left(dz(T)) = 0")
problem.add_bc("right(dz(T)) = 0")
problem.add_bc("left(u) = 0.5")
problem.add_bc("right(u) = 0.5")
problem.add_bc("left(w) = 0")
problem.add_bc("right(w) = 0")
problem.add_bc("left(c) = 0")
problem.add_bc("right(c) = 1")

IC: from the paper
z1=0.5
z2=1.5
uflow=1
a=0.05
sigma=0.2
A=0.01
den=0
u['g'] = uflow*(np.tanh((z-z1)/a)-np.tanh((z-z2)/a) -1)
w['g'] = A*np.sin(2*np.pi*x)*(np.exp(-(z-z1)**2/sigma**2) + np.exp(-(z-z2)**2/sigma**2))
Y['g'] = 1+den*0.5*(np.tanh((z-z1)/a) - np.tanh((z-z2)/a))
c['g']=0.5*(np.tanh((z-z2)/a) - np.tanh((z-z1)/a) + 2)

I am attaching the code as well for the reference.

Thanks,
Kesava
nonlinear_KHI.py
Figure.png

Adrian Fraser

unread,
Feb 17, 2021, 9:41:46 PM2/17/21
to Dedalus Users
Hi Kesava,

Does it help to either decrease the "safety" argument in your CFL condition to, say, 0.8, or increase the viscosity? I wonder if you might be under-resolving the flow in either the spatial or time domains.

Adrian

Kesava Prasad

unread,
Feb 18, 2021, 4:05:07 AM2/18/21
to Dedalus Users
Hi Adrian,

You were right. I had increased the viscosity by a magnitude of 10 and forgot to do the same with the diffusivity. That was the problem and now at least the simulation is running till the prescribed number of iterations. I'll have to check whether the results make sense.

Thanks

Kesava
Reply all
Reply to author
Forward
0 new messages