usnistgov / fipy

FiPy is a Finite Volume PDE solver written in Python
http://pages.nist.gov/fipy/en/latest
Other
504 stars 148 forks source link

How can I write the Navier-Stokes equations for the code below? #937

Closed ghost closed 1 year ago

ghost commented 1 year ago

` #Import fipy from fipy import CellVariable, FaceVariable, Grid2D, DiffusionTerm, Viewer, TransientTerm, ImplicitSourceTerm ############################################################################################################################

# Define the initial & physical parameters
viscosity = 0.1
diffusivity = 1.0
interfacialAreaCoeff = 0.1
u = 1.0
v = 0.0
k = 1.0
############################################################################################################################

# Set up the domain
L1 = 5.0    #cm
L2 = 20    #cm
x = 10.0
y = 2.0
dy = L1 / y
dx = L2 / x
mesh = Grid2D(nx=x, ny=y, dx=dx, dy=dy)
x, y = mesh.cellCenters
############################################################################################################################

# Define the fluid velocity
velocity = FaceVariable(name="Velocity", mesh=mesh, value=(u,v))

#Define the pressure
pressure = CellVariable(name="Pressure", mesh=mesh)

# Define the species concentration
C = CellVariable(name="Concentration", mesh=mesh, hasOld=True)

# Define the volume fraction
phi = CellVariable(name="Volume Fraction", mesh=mesh, hasOld=True)

# Define the interfacial area
A = CellVariable(name="Interfacial Area", mesh=mesh, hasOld=True)`