# solving Eikonal equation

I am a new Fenics user, and I want to solve eikonal equation, but I don't know what is is the problem with my code.

Thanks,

Pary

from dolfin import *

import numpy

import sys

mesh = UnitInterval(51, )

class RefractiveIndex

def eval(self, values,x):

if x[0]<0.5:

else:

def light_exposed_

return near(x[0],0.0) and on_boundary

light_boundary = AutoSubDomain(

V = FunctionSpace(

u = Function(V)

du = TrialFunction(V)

v = TestFunction(V)

eps = Constant(0.01)

n = RefractiveIndex()

F1 = inner(grad(u), grad(v))*dx - n**2*v*dx

a1, L1 = lhs(F1), rhs(F1)

A1, b1 = assemble_system(a1, L1)

for bc in bcs: bc.apply(A1, b1)

solve(A1, u.vector(), b1)

F = inner(grad(u), grad(u))*v*dx - n**2*v*dx + eps*inner(

J = derivative(F,u,du)

bc = DirichletBC(

problem = NonlinearVariat

solver = NonlinearVariat

solver.solve()

plot(u)

## Question information

- Language:
- English Edit question

- Status:
- Solved

- For:
- DOLFIN Edit question

- Assignee:
- No assignee Edit question

- Solved by:
- Johan Hake

- Solved:

- Last query:

- Last reply: