Hello everyone, I am doing the diffusion problem of stress and concentration displacement, the general governing equation is as follows:
My minimum working code is as follows:
from fenics import *
L = 1
D = 1T = 1
num_steps = 100
dt = T/num_stepsmesh = IntervalMesh(100, 0, L)
V = FunctionSpace(mesh, “P”, 1)v = TestFunction(V)
u = TrialFunction(V)
u_n = Function(V)sigma = Expression(‘10*exp(pow(x[0]-c,2))’, c=0.5, degree=2)
F = v*((u - u_n)/dt)dx - Ddot(grad(v), grad(u))dx - udot(grad(v), grad(sigma))*dx
u = Function(V)
solve(lhs(F) == rhs(F), u)for n in range(num_steps):
solve(lhs(F) == rhs(F), u) u_n.assign(u) plot(u)
But running the calculation is wrong: it Cannot determine geometric dimension from expression.