Poor Convergence When Solving Shear-Thinning Poiseuille Flow Using NLBVP

83 views
Skip to first unread message

张斌

unread,
Sep 16, 2024, 10:54:46 PM9/16/24
to Dedalus Users

Hello everyone,

I am currently using NLBVP to solve for the steady-state solution of shear-thinning Poiseuille flow, but I am facing poor convergence with the solver. Interestingly, when I use the same parameters in a MATLAB solver (based on the spectral collocation method), the convergence is much better.

Could this be an issue with my code, or is it related to the solver setup or something else?

Any suggestions or advice would be greatly appreciated!

PS:

n = 0.6 lam = 10

I believe these parameters shouldn't cause difficulties in convergence.  

import numpy as np
import dedalus.public as d3
import logging
import matplotlib.pyplot as plt

logger = logging.getLogger(__name__)

Ny = 200
dealias=3/2
dtype = np.float64

# Bases
ycoord = d3.Coordinate('y')
dist = d3.Distributor(ycoord, dtype=dtype)
ybasis = d3.Chebyshev(ycoord, size=Ny, bounds=(-1, 1), dealias=dealias)

# Fields
U = dist.Field(name='U', bases=ybasis)
C = dist.Field(name='C')
tau_u1 = dist.Field(name='tau_u1')
tau_u2 = dist.Field(name='tau_u2')

# Substitutions
y = dist.local_grid(ybasis)
lift_basis = ybasis.derivative_basis(2)
lift = lambda A, n: d3.Lift(A, lift_basis,n)
dy = lambda A: d3.Differentiate(A,ycoord)


# Initial conditions
U['g'] = 1-y*y
C['g'] = -2

# Parameters
n = 0.6
lam = 10

mu = (1.0+(lam*(dy(U)))**2)**((n-1)/2)
problem = d3.NLBVP([U,C, tau_u1,tau_u2], namespace=locals())
problem.add_equation("-C + dy(mu*dy(U)) + lift(tau_u1,-1) + lift(tau_u2,-2) = 0")
problem.add_equation("U(y= 0) = 1")
problem.add_equation("U(y=-1) = 0")
problem.add_equation("U(y= 1) = 0")
solver = problem.build_solver()

tolerance = 1e-10
pert_norm = np.inf
while pert_norm > tolerance:
    solver.newton_iteration(damping=1)
    solver.print_subproblem_ranks()
    pert_norm = sum(pert.allreduce_data_norm('c', 2) for pert in solver.perturbations)
    logger.info(f'Perturbation norm: {pert_norm:.3e}')




Daniel Lecoanet

unread,
Sep 17, 2024, 9:48:38 AM9/17/24
to Dedalus Users
Hi,

The convergence of the NLBVP depends sensitively on the initial guess. One strategy is to solve the problem with “easier” parameters and then use those solutions as guesses for more difficult parameters. This may allow you to bootstrap to the parameters of interest.

Daniel

--
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 on the web visit https://groups.google.com/d/msgid/dedalus-users/2d780914-8d7a-43dd-9e37-54db59538385n%40googlegroups.com.

张斌

unread,
Sep 18, 2024, 2:28:30 AM9/18/24
to Dedalus Users

Hi Daniel,

Thank you for your suggestion. I understand the approach of using solutions from "easier" parameters as initial guesses for more challenging cases. However, even when I use an initial guess that is very close to the solution (calculated from MATLAB code), the solver still fails to converge. During the iterations, the perturbation norm starts at  6.555e-09  but continues to increase, eventually causing the solver to crash. I am unsure why this is happening.

Again, thank you for your advice. I am starting to think that there might not be a good solution to this problem.  

PS:

plt.plot(y,(-C + dy(mu*dy(U)))['g']) # Initial guess satisfying the equation

output.png

2024-09-18 14:25:05,633 subsystems 0/1 INFO :: Building subproblem matrices 1/1 (~100%) Elapsed: 1s, Remaining: 0s, Rate: 1.0e+00/s
2024-09-18 14:25:05,634 __main__ 0/1 INFO :: Perturbation norm: 6.555e-09
2024-09-18 14:25:05,673 subsystems 0/1 INFO :: Building subproblem matrices 1/1 (~100%) Elapsed: 0s, Remaining: 0s, Rate: 2.7e+01/s
2024-09-18 14:25:05,674 __main__ 0/1 INFO :: Perturbation norm: 7.092e-09
2024-09-18 14:25:05,712 subsystems 0/1 INFO :: Building subproblem matrices 1/1 (~100%) Elapsed: 0s, Remaining: 0s, Rate: 2.8e+01/s
2024-09-18 14:25:05,713 __main__ 0/1 INFO :: Perturbation norm: 5.161e-08
2024-09-18 14:25:05,751 subsystems 0/1 INFO :: Building subproblem matrices 1/1 (~100%) Elapsed: 0s, Remaining: 0s, Rate: 2.7e+01/s
2024-09-18 14:25:05,752 __main__ 0/1 INFO :: Perturbation norm: 6.380e-07
2024-09-18 14:25:05,835 subsystems 0/1 INFO :: Building subproblem matrices 1/1 (~100%) Elapsed: 0s, Remaining: 0s, Rate: 1.2e+01/s
2024-09-18 14:25:05,836 __main__ 0/1 INFO :: Perturbation norm: 8.127e-06
2024-09-18 14:25:06,381 subsystems 0/1 INFO :: Building subproblem matrices 1/1 (~100%) Elapsed: 1s, Remaining: 0s, Rate: 1.8e+00/s
2024-09-18 14:25:06,382 __main__ 0/1 INFO :: Perturbation norm: 9.623e-05
2024-09-18 14:25:06,927 subsystems 0/1 INFO :: Building subproblem matrices 1/1 (~100%) Elapsed: 1s, Remaining: 0s, Rate: 1.8e+00/s
2024-09-18 14:25:06,928 __main__ 0/1 INFO :: Perturbation norm: 1.858e-03
2024-09-18 14:25:07,051 subsystems 0/1 INFO :: Building subproblem matrices 1/1 (~100%) Elapsed: 0s, Remaining: 0s, Rate: 8.2e+00/s

Best regards,
Bin Zhang

Reply all
Reply to author
Forward
0 new messages