https://linen.dev logo
I'm looking into using a new preconditioner to com...
# programming
k
I'm looking into using a new preconditioner to compare against the typical openfoam preconditioners, however I'm getting having problems trying to replicate openfoam's residual solver process in isolation. Each timestep, I extract the A,b,x^{n},x^{n+1} matrix/vectors of the Ax=b system for iteratively solving and reducing the residual, where x^{n} is the solution vector at the start and x^{n+1} is the converged solution vector after x iterations. I do this for a few nominal tutorial cases with PCG solver and DIC preconditioner and then in python have a fool-proof implementation of the DIC preconditioner, however for the same number of iterations the representative residual is about 3 orders of magnitude higher than the equivalent for the residual reported by openfoam (1e-9 for python DIC vs 1e-12 for openfoam). The trajectories of the C++ implementation of the DIC-preconditioned solver pipeline is the same as the python implementation and several other separate preconditioner pipelines are also about 3 orders of magnitude off from the openfoam residual after the same number of residuals. All of the openfoam cases I looked at intentionally were set to low residual tolerances to get a high number of iterations (~1e2 - 1e3 iterations) for testing. Could the lduMatrix setup in openfoam be causing this discrepancy and if so how could I replicate what openfoam does in isolation for external preconditioner testing?