Question #156790 on DOLFIN changed: https://answers.launchpad.net/dolfin/+question/156790
Status: Open => Answered Mikael Mortensen proposed the following answer: Hi, There is an Eikonal solver in the CBC.RANS project on https://launchpad.net/cbc.rans. Basically, you need to declare a nonlinear problem. Try something like y = Function(Q) eps = Constant(0.01) F = inner(grad(y), grad(y))*v*dx - n**2*v*dx + eps*inner(grad(u), grad(v))*dx J = derivative(F, y, u) bc = DirichletBC(Q, Constant(0), DomainBoundary()) problem = VariationalProblem(J, -F, bcs) y = problem.solve() where the last term in F is for stabilization. There are other possibilities for stabilizing as well, but this is the one that works for me. Hope it works. Look up the nonlinear demos if it doesn't. (Never tried it in 1D before) Best regards Mikael On 9 May 2011 21:56, Chaffra <question156...@answers.launchpad.net> wrote: > 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. > > _______________________________________________ > Mailing list: https://launchpad.net/~dolfin > Post to : dolfin@lists.launchpad.net > Unsubscribe : https://launchpad.net/~dolfin > More help : https://help.launchpad.net/ListHelp > -- You received this question notification because you are a member of DOLFIN Team, which is an answer contact for DOLFIN. _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp