Exploring Reyleigh-Taylor Instability with Variable Density and Viscosity

In summary: Wow, that was an amazing summary! In summary, this conversation is about a program that needs to be modified to include a scalar phi for liquid fraction and to account for variable density and viscosity. The program also addresses the Reyleigh-Taylor instability. The code provided includes physical and numerical parameters, mesh, boundary conditions, initial conditions, and matrix creation for a Poisson solver. The program also includes fluxes and plots. The conversation includes a request for help with modifying the program and a reminder to use code tags and provide a clear problem statement.
  • #1
MrOne
1
0

Homework Statement


import time
import numpy as np
from Output import *
from PoissonSolver import *
tmps1=time.clock()

# Physical parameters
Re = 10.

# Numerical parameters
CFL = 0.9
dt = 0.001/4
t = 0.0
tmax = 1.5

# Make mesh
from MeshGeneration import *
mesh = Mesh(2.0,1.0,50,25)

# Output parameters
dtAff = 0.01 # s

# Boundary condition
# Cavity
#BC = {"type":{"Left": "Wall", "Right": "Wall","Bottom": "Wall", "Top": "MovingWall"},
# "u":{"Top": 1.0},
# "v":{}}
# Forcing Vortex
# BC = {"type":{"Left": "MovingWall", "Right": "MovingWall","Bottom": "MovingWall", "Top": "MovingWall"},
# "u":{"Top": 1.0, "Bottom": -1.0},
# "v":{"Left": 1.0, "Right": -1.0}}
# Channel
BC = {"type":{"Left": "Inflow", "Right": "Outflow","Bottom": "Wall", "Top": "Wall"},
"u":{"Left": 1.0},
"v":{"Left": 0.0},
"p":{"Right": 0.0}}
#BC = {"type":{"Left": "Wall", "Right": "Wall","Bottom": "Outflow", "Top": "Inflow"},
# "u":{"Top": 0.0},
# "v":{"Top": -1.0}}

# Initial condition
from InitNS import *
u, v, p = InitRest(mesh)

if BC["type"]["Left"] == "Inflow":
u[0,:] = BC["u"]["Left"]
if BC["type"]["Top"] == "Inflow":
v[:,mesh.Ny] = BC["v"]["Top"]

# Define fluxes
from NS_fluxes import GRAD, STRESS, TRANS, DIV

# Create Matrix for Poisson Solvre
A, bp = CreatePoissonMatrix(mesh, BC)

savefigNS(u,v,p,t,mesh)

while t<tmax:
ustar, vstar = np.copy(u), np.copy(v)
utrans, vtrans = TRANS(u,v,mesh,BC)
ustress, vstress = STRESS(u,v,mesh,BC)

ustar[1:-1,:] = u[1:-1,:] + dt*(utrans+1.0/Re*ustress)
vstar[:,1:-1] = v[:,1:-1] + dt*(vtrans+1.0/Re*vstress)
b = DIV(ustar,vstar,mesh)
p = PoissonSolver(A,b,bp,mesh)
#p = PoissonSolver(b,BC,mesh)
uprime, vprime = GRAD(p,mesh)
u, v = ustar-uprime, vstar-vprime

t = t + dt
# Plot
if (abs(t % dtAff) < dt):
savefigNS(u,v,p,t,mesh)
tmps2=time.clock()
print "Temps d'execution = %d\n" %(tmps2-tmps1)

Homework Equations


Hello everyone, i need your help to modify this program to include an scalar phi corresponding to a liquid fraction. i want to include the modification of the equations in order to take into account a variable density and viscosity. Here, no surface tension will be included. The diffuse interface will be at phi = 0.5.
I want to test the case of Reyleigh-Taylor instability

The Attempt at a Solution



Sorry everyone, I am not in this domain, I am doing a thesis in combustion but i need this program in my works.
Thank you in advance for your help, i will appreciate that.
 
Physics news on Phys.org
  • #2
Did you really expect anyone to be able to figure out what your coding is all about without any real detailed explanation?
 
  • #3
Some points to help you get help:
Please use code tags, and comment your code. Why? Well, for example python is sensitive to leading spaces. Which is a good thing.
Your question is currently a wall of hard-to-read and syntactically incorrect code.

https://www.quora.com/Why-is-Python-space-sensitive
 
  • #4
Hello mr 1, :welcome:

As you can read in the PF guidelines, 'Hello everyone' does not constitute a relevant equation, and 'Sorry everyone' does not count as an attempt at solution. So please do better than that.

And under 1. I expect at least a problem statement and I'm not referring to
MrOne said:
modify this program to include an scalar phi corresponding to a liquid fraction
Does that mean there is already a tensor ##\phi## in there and you want it simpler ?

And how about a desscription and a list of variables and their meaning ?

I can put ##[##code=python##]## and ##[##\code##]## around your post, but that - of course - does not restore the missing spaces:

Python:
import time
import numpy as np
from Output import *
from PoissonSolver import *
tmps1=time.clock()

# Physical parameters
Re = 10.

# Numerical parameters
CFL = 0.9
dt = 0.001/4
t = 0.0
tmax = 1.5

# Make mesh
from MeshGeneration import *
mesh = Mesh(2.0,1.0,50,25)

# Output parameters
dtAff = 0.01 # s

# Boundary condition
# Cavity
#BC = {"type":{"Left": "Wall", "Right": "Wall","Bottom": "Wall", "Top": "MovingWall"},
# "u":{"Top": 1.0},
# "v":{}}
# Forcing Vortex
# BC = {"type":{"Left": "MovingWall", "Right": "MovingWall","Bottom": "MovingWall", "Top": "MovingWall"},
# "u":{"Top": 1.0, "Bottom": -1.0},
# "v":{"Left": 1.0, "Right": -1.0}}
# Channel
BC = {"type":{"Left": "Inflow", "Right": "Outflow","Bottom": "Wall", "Top": "Wall"},
"u":{"Left": 1.0},
"v":{"Left": 0.0},
"p":{"Right": 0.0}}
#BC = {"type":{"Left": "Wall", "Right": "Wall","Bottom": "Outflow", "Top": "Inflow"},
# "u":{"Top": 0.0},
# "v":{"Top": -1.0}}

# Initial condition
from InitNS import *
u, v, p = InitRest(mesh)

if BC["type"]["Left"] == "Inflow":
u[0,:] = BC["u"]["Left"]
if BC["type"]["Top"] == "Inflow":
v[:,mesh.Ny] = BC["v"]["Top"]

# Define fluxes
from NS_fluxes import GRAD, STRESS, TRANS, DIV

# Create Matrix for Poisson Solvre
A, bp = CreatePoissonMatrix(mesh, BC)

savefigNS(u,v,p,t,mesh)

while t<tmax:
ustar, vstar = np.copy(u), np.copy(v)
utrans, vtrans = TRANS(u,v,mesh,BC)
ustress, vstress = STRESS(u,v,mesh,BC)

ustar[1:-1,:] = u[1:-1,:] + dt*(utrans+1.0/Re*ustress)
vstar[:,1:-1] = v[:,1:-1] + dt*(vtrans+1.0/Re*vstress)
b = DIV(ustar,vstar,mesh)
p = PoissonSolver(A,b,bp,mesh)
#p = PoissonSolver(b,BC,mesh)
uprime, vprime = GRAD(p,mesh)
u, v = ustar-uprime, vstar-vprime

t = t + dt
# Plot
if (abs(t % dtAff) < dt):
savefigNS(u,v,p,t,mesh)
tmps2=time.clock()
print "Temps d'execution = %d\n" %(tmps2-tmps1)
 

1. What is Reyleigh-Taylor instability?

Reyleigh-Taylor instability is a fluid dynamics phenomenon that occurs when two fluids with different densities are in contact with each other. It is characterized by the formation of finger-like structures and mixing between the two fluids due to the difference in their densities.

2. How does variable density affect Reyleigh-Taylor instability?

Variable density can significantly influence the development of Reyleigh-Taylor instability. It can either enhance or suppress the instability, depending on the density contrast between the two fluids and their initial configurations. In general, higher density contrasts lead to a more pronounced instability.

3. What role does viscosity play in Reyleigh-Taylor instability?

Viscosity is a crucial factor in the development of Reyleigh-Taylor instability. It affects the rate at which the fluids mix and the formation of the finger-like structures. Higher viscosity can suppress the instability by damping out the mixing between the fluids.

4. How is Reyleigh-Taylor instability studied in the laboratory?

Reyleigh-Taylor instability is typically studied in the laboratory using experiments in which two fluids with different densities are placed in a container and allowed to mix. The development of the instability can be observed and measured using various techniques, such as high-speed imaging and laser-induced fluorescence.

5. What are the applications of studying Reyleigh-Taylor instability with variable density and viscosity?

Understanding Reyleigh-Taylor instability with variable density and viscosity has several practical applications. It is relevant in astrophysical phenomena, such as supernova explosions and the formation of stars. It also has implications in engineering, such as in the design of fusion reactors and mixing processes in industrial applications.

Similar threads

  • Introductory Physics Homework Help
Replies
12
Views
209
Replies
1
Views
1K
  • Advanced Physics Homework Help
Replies
5
Views
962
Replies
4
Views
2K
  • Introductory Physics Homework Help
Replies
4
Views
1K
  • Advanced Physics Homework Help
Replies
7
Views
1K
Replies
1
Views
591
  • Advanced Physics Homework Help
Replies
6
Views
1K
  • Differential Equations
Replies
7
Views
3K
Replies
17
Views
3K
Back
Top