I would like to solve the NSK equations in the domain [0,1]×[0,1] , with periodic boundary conditions applied in both x and y directions. The equations are as follows:
I will employ a segregated approach to solve for the variables of this system, and a simple discretization scheme is shown below:
In Problem 4, the second equation employs the following assumption:
I encountered a singular matrix issue while writing the code, which occurs in Problem 4. The hint for this issue is as follows:
******************************************************************************
Traceback (most recent call last):
File "/home/weiguangyuan/dedalus/mydedalus/fenbuqiujie1/biannianduzuizhong.py", line 111, in <module>
solverMom1.step(timestep)
File "/home/weiguangyuan/anaconda3/envs/dedalus3/lib/python3.12/site-packages/dedalus/core/solvers.py", line 654, in step
self.timestepper.step(dt, wall_time)
File "/home/weiguangyuan/anaconda3/envs/dedalus3/lib/python3.12/site-packages/dedalus/core/timesteppers.py", line 627, in step
sp.LHS_solvers[i] = solver.matsolver(sp.LHS, solver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/weiguangyuan/anaconda3/envs/dedalus3/lib/python3.12/site-packages/dedalus/libraries/matsolvers.py", line 141, in __init__
self.LU = spla.splu(matrix.tocsc(),
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/weiguangyuan/anaconda3/envs/dedalus3/lib/python3.12/site-packages/scipy/sparse/linalg/_dsolve/linsolve.py", line 438, in splu
return _superlu.gstrf(N, A.nnz, A.data, indices, indptr,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Factor is exactly singular
******************************************************************************
The problematic code is as follows:
******************************************************************************
#Problem
problemMas = d3.IVP([rho], namespace=locals())
problemMas.add_equation("dt(rho) -alpha1*lap(rho) = -div(rho*u) -alpha1*lap(rho)")
problemMasc = d3.IVP([c], namespace=locals())
problemMasc.add_equation("dt(c) - B*lap(c) +C*c = -div(c*u) +C*rho")
problemP = d3.IVP([p], namespace=locals())
problemP.add_equation("p = (8/27)*(rho*T/(1-rho))-rho**2")
problemMom1 = d3.IVP([u,p], namespace=locals())
problemMom1.add_equation("dt(u) +(1/rho0)*grad(p) =(1/rho0 - 1/rho)*grad(p) + (1/(Re*rho))*grad(miu)@tau + (4*miu/(3*Re*rho))*grad(div(u)) -(miu/(Re*rho))*(-skew(grad(w))) -u@grad(u) + A*(grad(c)-grad(rho))")
problemMom1.add_equation("div(u) = (1/rho)*(rhoold*div(u)+u@grad(rhoold)-u@grad(rho))")
problemMom2 = d3.IVP([u], namespace=locals())
problemMom2.add_equation("dt(u) - alpha2*lap(u) = -alpha2*grad(div(u))+alpha2*(-skew(grad(w)))")
******************************************************************************
I have attached the complete code in the attachment. I would greatly appreciate it if you could help me resolve this issue.
Best wishes,
Guangyuan
--
You received this message because you are subscribed to the Google Groups "Dedalus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dedalus-users/7f048403-1f52-4fd4-88c9-8ef70ce3ffdan%40googlegroups.com.