Hello,
The nonlinear variational problem that I am dealing with is the 1D model of a liquid jet stretched by gravity, developed by Eggers & Dupont (1994) and García & Castellanos (1994), and which reads,
$\frac{\partial h^2}{\partial t} + \frac{\partial (h^2 u)}{\partial z} = 0$,
$\frac{\partial u}{\partial t} + u \frac{\partial u}{\partial z} = 1 - \frac{\partial }{\partial z} \left( \nabla \cdot \mathbf{n}\right) + \frac{\Gamma}{h^2} \frac{\partial}{\partial z} \left(h^2 \frac{\partial u}{\partial z} \right)$,
where $h(z,t)$ is the radius of the jet, $u(z,t)$ its axial velocity and $\nabla \cdot \mathbf{n} = h^{-1} \, \left[ 1 + \left( \frac{\partial h}{\partial z} \right)^2 \right]^{-1/2} - \frac{\partial^2 h}{\partial z^2} \, \left[ 1 + \left( \frac{\partial h}{\partial z} \right)^2 \right]^{-3/2}$, is the full curvature of the liquid-air interface. The boundary conditions that need to be imposed are: $h(0,t) = \sqrt{Bo}$, and $u(0,t) = We^{1/2} Bo^{-1/4}$, where $We$ and $Bo$ are the Weber and the Bond number respectively.
In particular I am trying to solve the stationary state of the latter system of equations, which is a third order nonlinear ODE. From the first equation (continuity) we can obtain the relation between the radius and the axial velocity, $h^2 u = q = Bo^{3/4} We^{1/2}$, where $q$ is the dimensionless flow rate, being its value a function of the Weber and the Bond number. If we introduce this expression into the stationary axial momentum equation we obtain a third order nonlinear ODE,
$-\frac{2 q^2}{h^5} h' + (\nabla \cdot \mathbf{n})' - \frac{\Gamma}{h^2} \left( \frac{-2 q}{h} h' \right)' -1 = 0$, $h(0) = \sqrt{Bo}$ (the Bond number is fixed, e.g. $Bo =1$).
I have tried to implement this problem in FEniCS through a nonlinear variational problem, but I always obtain NaNs just in the first iteration. I attach the code,
from fenics import *
# Dimensionless parameters
Bo = Constant(1.0)
We = Constant(8E-3)
Gamma = Constant(16.67)
q = (Bo**(3/4))*sqrt(We)
# Create mesh and define function space
mesh = IntervalMesh(60,0, 20)
V = FunctionSpace(mesh, 'P', 2)
# Define boundary condition
inflow = 'near(x[0],0)'
bc = DirichletBC(V,sqrt(Bo),inflow)
# Define variational problem
h = Function(V)
v = TestFunction(V)
F = 2*(q**2)*(h**(-4))*grad(v)[0]*dx -10*(q**2)*h**(-5)*grad(h)[0]*v*dx-((h**(-1))*(1+grad(h)[0]**2)**(-1/2)-grad(grad(h)[0])[0]*(1+grad(h)[0]**2)**(-3/2))*grad(v)[0]*dx - Gamma*2*q*grad(h)[0]*(h**(-3))*grad(v)[0]*dx + Gamma*4*q*(grad(h)[0]**2)*(h**(-4))*v*dx + ((q**2)*h**(-4))*v*ds +((h**(-1))*(1+grad(h)[0]**2)**(-1/2)-grad(grad(h)[0])[0]*(1+grad(h)[0]**2)**(-3/2))*v*ds + Gamma*2*q*grad(h)[0]*(h**(-3))*v*ds - v*dx
J = derivative(F,h)
problem = NonlinearVariationalProblem(F, h, bc, J=J)
solver = NonlinearVariationalSolver(problem)
prm = solver.parameters
prm["newton_solver"]["absolute_tolerance"] = 1E-6
prm["newton_solver"]["relative_tolerance"] = 1E-6
prm["newton_solver"]["maximum_iterations"] = 50
prm["newton_solver"]["relaxation_parameter"] = 0.1
solver.solve()
#solve(F == 0, h, bc, J=J)
# Plot solution and mesh
plot(h)
# Hold plot
interactive()
Thanks in advance,
Alejandro