Hello, I’m fairly new to Fenics and am trying to simulate the following (modified) reaction-diffusion
I’ve written both equations in weak form, but am having trouble implementing on Fenics. The nonlinear terms, specifically, have given me a lot of trouble since division and exponentiation is not allowed for function types. Are there any specific ways to go about this? I couldn’t seem to find anything in the tutorials.
For reference, here’s my attempt at writing up the weak form as a function.
# Create the Mesh
mesh = dolfin.IntervalMesh(n, xgrid[0], xgrid[-1])
T = dolfin.FunctionSpace(mesh, 'CG', 2)
S = dolfin.FunctionSpace(mesh, 'CG', 2)
# FEM Discretization
v = dolfin.TestFunction(T)
phi = dolfin.TrialFunction(T)
w = dolfin.TestFunction(S)
theta = dolfin.TrialFunction(S)
clsdform_T = alpha * dolfin.inner(S * **expterm**, v)*dolfin.dx
clsdform_S = -gamma_s * dolfin.inner(S * **expterm**, w)*dolfin.dx
where the expTerm is
and T
and S
are the unknowns I’m attempting to solve for, while \alpha, \gamma_s, \beta are constants, and v and w are my test functions.
Thanks for the help!
EDIT Included only relevant parts of code relating to original question and added the relevant PDE.