You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Gerardo Marx Chávez-Campos ea5ce3cd0e readme 2 years ago
.gitignore a small piece sourranded 2 years ago
Readme.md readme 2 years ago
main.ipynb a small piece sourranded 2 years ago
output_1_0.png a small piece sourranded 2 years ago
output_4_1.png a small piece sourranded 2 years ago
output_4_2.png a small piece sourranded 2 years ago
output_4_3.png a small piece sourranded 2 years ago
output_4_4.png a small piece sourranded 2 years ago
output_4_5.png a small piece sourranded 2 years ago
output_4_6.png a small piece sourranded 2 years ago
output_4_7.png a small piece sourranded 2 years ago
output_4_8.png a small piece sourranded 2 years ago
output_4_9.png a small piece sourranded 2 years ago
output_4_10.png a small piece sourranded 2 years ago
output_4_11.png a small piece sourranded 2 years ago
output_4_12.png a small piece sourranded 2 years ago
output_4_13.png a small piece sourranded 2 years ago
output_4_14.png a small piece sourranded 2 years ago
output_4_15.png a small piece sourranded 2 years ago
output_4_16.png a small piece sourranded 2 years ago
output_4_17.png a small piece sourranded 2 years ago
output_4_18.png a small piece sourranded 2 years ago
output_4_19.png a small piece sourranded 2 years ago
output_4_20.png a small piece sourranded 2 years ago

Readme.md

#1 Loading functions  and modules
from fenics import *
import matplotlib.pyplot as plt
T = 2.0
num_steps = 20
dt = T/num_steps
rho = 7500
Cp = 500
k = 50
alpha = k/(rho*Cp)
#2 Create mesh and define function space
nx = 0.008
ny = 0.003
mesh = RectangleMesh(Point(0,0),Point(nx,ny),30, 30,'left')
V = FunctionSpace(mesh, 'Lagrange', 1) #Lagrange are triangular elements
plot(mesh)
plt.show()

png

# Boundary conditions
u0 = Constant(100)
def boundary(x, on_boundary):
    return on_boundary

bc = DirichletBC(V,u0, boundary)
u_n = project(1, V)
u = TrialFunction(V)
v = TestFunction(V)
f = Constant(0.0)
F = u*v*dx + alpha*dt*dot(grad(u), grad(v))*dx-u_n*v*dx
a, L = lhs(F), rhs(F)
Calling FFC just-in-time (JIT) compiler, this may take some time.
u = Function(V)
t = 0
for n in range(num_steps):
    t += dt
    #u0.t = t
    solve(a == L, u, bc)
    c = plot(u,)
    plt.colorbar(c)
    plt.show()
    u_n.assign(u)
Calling FFC just-in-time (JIT) compiler, this may take some time.

png

png

png

png

png

png

png

png

png

png

png

png

png

png

png

png

png

png

png

png

1E-7
1e-07
1e2
100.0
1E-7+1e2
100.0000001