I tried to solve the NSCH equation with a completely implicit method. and when I used the solution method in the cahn hilliard example, I got an error. I think this is because the memory required for the operation is too large. I wonder how to select a suitable nonlinear solver?
error:
interrupted by signal 9: SIGKILL
function:
Unknown variables:
c, mu, u, p
The solver I chosed:
class CahnHilliardEquation(NonlinearProblem):
def __init__(self, a, L):
NonlinearProblem.__init__(self)
self.L = L
self.a = a
def F(self, b, x):
assemble(self.L, tensor=b)
def J(self, A, x):
assemble(self.a, tensor=A)
...
L0 = c * fai * dx - c0 * fai * dx + dt * inner(inner(u, grad(c)), fai) * dx + dt * M * inner(grad(mu), grad(fai)) * dx
L1 = mu * pot * dx - df_dc * pot * dx - coef * inner(grad(c), grad(pot)) * dx
L2 = inner(u, v) * dx - \
inner(u0, v) * dx + \
dt * inner(grad(u) * u, v) * dx + \
dt / rho_int_ox * inner(grad(p), v) * dx + \
yita * dt / rho_int_ox * inner(grad(u), grad(v)) * dx + \
dt / rho_int_ox * inner(c * grad(mu), v) * dx + \
dt / rho_int_ox * inner(rho(c) * g, v) * dx
L3 = div(u) * q * dx
L = L0 + L1 + L2 + L3
a = derivative(L, c_mu_u_p, d_c_mu_u_p)
problem = CahnHilliardEquation(a, L)
solver = NewtonSolver()
solver.parameters["linear_solver"] = "lu"
solver.parameters["convergence_criterion"] = "incremental"
solver.parameters["relative_tolerance"] = 1e-6
mesh:
192×768 rectangles
In order to simplify the problem, only part of the code is given, and if necessary I will provide