Avram equation on source term

I d like to use a fuction like Avrami equation on source in diffusion process, but it came with error:
“Unable to compile C++ code with dijitso”

Can anyone help?

n=const.
g2=const.

def fi( c ):

return pow(e,g2*pow(c,n))

return e**(g2*c**n)

du = TrialFunction(V)

def f4(ut):
return exp(g2*np.power(ut,n))

#f1=Ntkexp(g2pow(ut,n))u-put
f1=Nt
k*(Expression(“fi(ut)”,ut=ut, degree = 2))u-put

def Ftheta(u,v):
return SDinner(grad(u), grad(v))dx-J0vdsN + f1vdx
F = S
(1./dt)(u-u0)vdx + thetaFtheta(u,v)
+(1.-theta)*Ftheta(u0,v)
J = derivative(F,u,du)

problem = NonlinearVariationalProblem(F, u, bcs, J)
solver = NonlinearVariationalSolver(problem)

while t <= Tf+ DOLFIN_EPS:
solver.solve()
ut.vector()[:] = (dtNtku.vector()-dtku.vector()ut.vector()-dtput.vector()+ut.vector())
u0.assign(u)

Is this what you would like:
Expression("exp(a*pow(c,n))", degree=2, a=2, c=3, n=5)

I did it:
f0=Expression(“exp(g2 * pow(ut,n))”,ut=ut, n=n, g2=g2, degree=2)
f1=Nt * k * f0 * u- p * ut

, but I cant recalculate ut for next step like it

ut.vector()[:]= dt * Nt * k * f1 * u.vector() - dt * p * ut.vector()+ut.vector()

Error:
rmul(): incompatible function arguments. The following argument types are supported

You Need to either project or interpolate the expression to the function space you are setting the vector for.

I have done it, but source function cant be recalculate each time step. How can i do it?

from dolfin import*
import numpy as np

Nt=1.0E+20
k=5.0E-22
p=1.E-7

dt = 1.8E+2

Tf = dt*20
t = float(dt)

arq_saida=“flux-Monophase”
o1 = open(arq_saida,‘w’)

Lcx=10.E+3
Lc=0.55E+3

mesh=RectangleMesh(Point(0., 0.), Point(Lc, Lcx), 50, 50, “left”)
boundaries = MeshFunction(“size_t”, mesh, mesh.topology().dim()-1)

V = FunctionSpace(mesh, “CG”, 1)

coordinates = V.tabulate_dof_coordinates()
dof_x = coordinates[:, 0]

X_max=np.amax(dof_x)

X_min=np.amin(dof_x)

Lc=X_max - X_min

class Rigth(SubDomain):
def inside(self, x, on_boundary):
tol = 1E-14 # tolerance for coordinate comparisons
return on_boundary and abs(x[0] - X_max) < tol
class Left(SubDomain):
def inside(self, x, on_boundary):
tol = 1E-14 # tolerance for coordinate comparisons
return on_boundary and abs(x[0]- X_min) < tol

saida=Rigth()
saida.mark(boundaries,1)
Entrada=Left()
Entrada.mark(boundaries,2)

dS = dS(subdomain_data=boundaries)
ds = ds(subdomain_data=boundaries)

D=3.9E-0

u0 = Constant(0.0)

bc1 = DirichletBC(V, u0, boundaries,1)
bcs = [bc1]

#Variational problem at each time
u0= Function(V)
u= Function(V)
f1 = Function(V)
f2 = Function(V)
v= TestFunction(V)
ut=Function(V)

n0=2.0
g2=-1.0E-9

du = TrialFunction(V)

f2=interpolate(Expression(“exp(g2 * pow(ut,n0))”,ut=ut, n0=n0, g2=g2, degree=2),V)
f0=exp(g2 * pow(ut,n0))
f1=Nt * k * exp(g2 * pow(ut,n0)) *u-p * ut

J0=3.0E+6
theta=0.5

dsN = Measure(“ds”, subdomain_id=2, subdomain_data=boundaries)
ds_out = Measure(“ds”, subdomain_id=1, subdomain_data=boundaries)

def Ftheta(u,v):
return D * inner(grad(u), grad(v)) * dx-J0 * v * dsN + f1 * v * dx\

F = (1./dt)(u-u0)vdx + thetaFtheta(u,v)
+(1.-theta)*Ftheta(u0,v)

J = derivative(F,u,du)
problem = NonlinearVariationalProblem(F, u, bcs, J)
solver = NonlinearVariationalSolver(problem)

fileu = File(“Monophase/u.pvd”)
fileut = File(“Monophase/ut.pvd”)
fileuf = File(“Monophase/f2.pvd”)
flu1=
tempo=

n1 = FacetNormal(mesh)

contador=0
while t <= Tf+ DOLFIN_EPS:
solver.solve()
f2=interpolate(Expression(“exp(g2pow(ut,n0))",ut=ut, n0=n0, g2=g2, degree=2),V)
ut.vector()[:] = dt
Ntkf2.vector()u.vector()-dtput.vector()+ut.vector()
u0.assign(u)
contador+=1
if contador%1==0:
fileu << (u,t)
fileut << (ut,t)
fileuf << (f2,t)
flux = -dot(grad(D
u), n1)*ds_out
flux = assemble(flux)
if contador%1==0:
o1.write(”%s"%t)
o1.write(" %s \n" %flux)
t += float(dt)
print (“tempo = %s , contador = %s , fluxo = %s” %(t, contador, flux))
o1.close()