Hello everyone,
I have been trying to add Fischer-Burmeister functions (Nonlinear Complementary functions) to the existing Cahn-Hilliard tutorial problem to impose a constrain on the concentration value p to be within range of 0 to 1. It is needed to be solved along with the set of equation but the constrain functions were not in any integral. Hence directly adding these along with the tutorial equation is making error as
Traceback (most recent call last):
File "/mnt/e/PPP/Project/Chapter 1-29-11/Phase_field solver/code/Cahn_hilliard_h.py", line 57, in <module>
F = F0 + F1 + F2 + F3
TypeError: unsupported operand type(s) for +: 'Form' and 'Sum'
The set of equations to be solved were look like
F0 = inner(p, q) * dx - inner(p0, q) * dx + dt * k * inner(grad(mu_mid), grad(q)) * dx
F1 = inner(mu, v) * dx - inner(dfdc, v) * dx - 3*epsilon*areainteng*inner(grad(p), grad(v)) * dx + inner(lam1,v)*dx - inner(lam2,v)*dx
F2 = (ufl.sqrt((p-1)**2+lam1**2) + (p-1) - lam1)
F3 = (ufl.sqrt((-p)**2+lam2**2) - p - lam2)
Additionally i also did changes to the functions as i needed to find the value of lamda (lam) for all the node including with the chemical potential and concentration. The modification is as follows
#Mesh creation
msh = create_unit_square(MPI.COMM_WORLD,24,24, CellType.quadrilateral)
P1 = element("Lagrange", msh.basix_cell(), 1)
ME = functionspace(msh, mixed_element([P1, P1, P1, P1]))
#Test functions
q, v, l1, l2 = ufl.TestFunctions(ME) #q-chemical potential,v-order parameter
u = Function(ME) # current solution
u0 = Function(ME) # solution from previous converged step
# Split mixed functions
p, mu,lam1,lam2= ufl.split(u)
p0, mu0,lam01,lam02= ufl.split(u0)
Is there any way to solve these set of equation. Also i have tried multiplying dx to these but the solver is making error. Please suggest me some approaches for handling the same. Any advice would be truly appreciated. Thanks for your time and consideration.