Hi
I’m just getting started with Fenics and I’m trying to apply fenics to the following formula: beta(x) dy/dx = f(x), and after applying Galerkin method, I have the following:
let u(x) be the test function and v(x) be the trail function, then I have
beta(x) * u(x) *( dv / dx) dx = u(x) f(x) dx
But I just can’t find a way to put u(x) and dv/dx together, can anyone help me with it please?
Here’s my code:
a = 0
b = 2
N = 10
mesh = IntervalMesh(N,a,b)
V = FunctionSpace(mesh, "Lagrange",1)
exact = Expression("2/3 * x[0] ", degree = 1)
def bounds(x,on_bound):
return on_bound
bc = DirichletBC(V, exact, bounds)
u = TestFunction(V)
v = TrialFunction(V)
beta = Expression("3.0 * x[0]", degree =1)
A = beta_f * u *nabla_grad(v) *dx
I tried a few other ways to get A ( interpolate, project beta on V, evaluate testfunction and trailfunction) but none of them works, I’m not sure what I can do to testfunction and trialfunction.