fppimenta / rheoTool

Toolbox to simulate GNF and viscoelastic fluid flows in OpenFOAM®
GNU General Public License v3.0
159 stars 66 forks source link

Segregated solvers with petsc solver ERROR #93

Closed zwthwj closed 1 year ago

zwthwj commented 1 year ago

when use Segregated solvers with petsc solver, ERROR: PETSC ERROR: Cannot mix add values and insert values. Any help would be appreciated. Thanks.

fppimenta commented 1 year ago

As you can imagine, the info you provide is not enough for debugging. Need info about versions being used and minimum working example showing the error.

zwthwj commented 1 year ago

[Uploading TEST1.zip…]() Thanks for reply. I use the rheolTool-master for of 70 in Ubuntu 18.04. I copy the buoyantCavity in rheoHeatFoam, and change the solver of p_rgh to petscSolver in fvSolution. And change the petscDict:

--> KSP

-p_rgh_ksp_type cg

--> PC

-p_rgh_pc_type bjacobi -p_rgh_pc_factor_mat_solver_type petsc.

Error: [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: Object is in wrong state [0]PETSC ERROR: Cannot mix add values and insert values [0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.15.0, Mar 30, 2021

zwthwj commented 1 year ago

As you can imagine, the info you provide is not enough for debugging. Need info about versions being used and minimum working example showing the error.

Thanks for reply. I use the rheolTool-master for of 70 in Ubuntu 18.04. I copy the buoyantCavity in rheoHeatFoam, and change the solver of p_rgh to petscSolver in fvSolution. And change the petscDict:

--> KSP

-p_rgh_ksp_type cg

--> PC

-p_rgh_pc_type bjacobi -p_rgh_pc_factor_mat_solver_type petsc.

Error: [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: Object is in wrong state [0]PETSC ERROR: Cannot mix add values and insert values [0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.15.0, Mar 30, 2021

I also try other tutorials and change the solver of * to petscSolver, the same error is reported.

fppimenta commented 1 year ago

Somewhere after v 3.10, Petsc forbids mixing add and insert values (before that it was not recommended but still allowed as long as they were not conflicting). A list of possible options to fix the issue:

zwthwj commented 1 year ago

Thank you very much for your help. Another question I want to ask is if I choose petscSolver, where can I set the tolerance, relTol and caching? I have searched the Guide but didn't find it. Thanks.

fppimenta commented 1 year ago

This is loosely explained at the end of section 4.5.2 of the user guide. Shortly, those settings belong to petsc itself, so that they should be specified in petscDict. You have an example here. If you want to get all options available uncoment the -help. To know the meaning of each option you need to look at petsc user-guide.

Note: the relTol and absTol definitions that openfoam uses are different from those used by petsc. However, the residuals displayed to the terminal are always according to openfoam´s definition (section 4.5.2 of the user guide). Thus, don't expect to see the residuals dropping til the p_ksp_atol that you define under petscDict.