← Back to team overview

dolfin team mailing list archive

[Question #156790]: eikonal equation

 

New question #156790 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/156790

Hi,

I'd like to solve the pde  |grad(u)|**2 = n**2. To start , I tried the following example but it does not work. What would be the correct variational form for this?

Thanks. Chaffra

 
mesh = UnitInterval(51, )

class RefractiveIndex(Expression):
    def eval(self, values,x):
        if x[0]<0.5:
            values[0] = 2.0
        else:
            values[0] = 3.0

Q = FunctionSpace(mesh,'CG',1)
u = TrialFunction(Q)
v = TestFunction(Q)
            
n = RefractiveIndex()
a = inner(grad(u), grad(u))*v*dx
L = n**2*v*dx 

problem = VariationalProblem(a, L, bcs=[])
problem.solve()

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.