CFD Online Logo CFD Online URL
Home > Forums > General Forums > Main CFD Forum

Matrix Updation in PETSc

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   March 10, 2023, 01:25
Post Matrix Updation in PETSc
New Member
Ajeesh Mohan T
Join Date: Mar 2023
Posts: 3
Rep Power: 3
ajeesh is on a distinguished road

I'm trying to develop a model for battery simulation using PETSc. I am using KSP solver to solve concentration diffusion with electrochemical reaction as interface condition at the electrode-electrolyte interface.

I need to update the coefficient matrix in the time loop each time when a layer of discharge products is formed. It works fine when the first layer is updated but fails during the second layer formation.

It shows a kind of 'hang' (not actually hang anyway since I'm using HPC for running the code ), means the code still runs but stops updating the timesteps. It looks like being stuck between MatAssemblyBegin and MatAssemblyEnd functions.

I am using MatResetPreallocation function before updating the matrix to reuse the collapsed unused elements of matrix due to the previous MAT_FINAL_ASSEMBLY. Also the MAT_NEW_NONZERO_LOCATIONS has been declared to be PETSC_TRUE with the MatSetOption function.

The issue persists and I can't see any possible solution anywhere in the internet.

It will be helpful if anybody can suggest some possible solutions .

Thanks in advance.
ajeesh is offline   Reply With Quote

Old   March 21, 2023, 14:59
New Member
Join Date: Jul 2011
Posts: 14
Rep Power: 14
nasa55 is on a distinguished road
It sounds like you are experiencing some issues with your PETSc-based battery simulation code. Without access to your code, it's difficult to provide a specific solution, but here are a few suggestions that may help:

Check for errors: Make sure that your code is not generating any error messages or warnings during the simulation. Sometimes, these can be hidden and not immediately visible in the output. Use the -log_view and -options_left options when running the code to see if there are any error messages or warnings.

Check for memory leaks: PETSc has a built-in memory leak detector called PetscMallocDump. Run your code with this enabled (using the -malloc_dump command-line option) to see if there are any memory leaks. If there are, this could be causing your code to hang.

Use a debugger: Try using a debugger (such as gdb) to step through your code and see where it's hanging. This can help you identify the exact point at which the code is getting stuck.

Try a different solver: If you're still having trouble, try using a different KSP solver or a different type of solver altogether. This may help you identify whether the issue is with the solver or with some other part of your code.

Ask for help: If you're still having trouble, consider asking for help on the PETSc mailing list or forum. The PETSc community is very helpful and may be able to provide more specific advice based on your code and simulation setup.

I hope these suggestions are helpful, and I wish you the best of luck with your simulation!
nasa55 is offline   Reply With Quote

Old   August 28, 2023, 03:07
New Member
Ajeesh Mohan T
Join Date: Mar 2023
Posts: 3
Rep Power: 3
ajeesh is on a distinguished road

I have contacted the PETSc developers and the issue has been rectified.

Thank you for your time and effort for addressing my issue.
ajeesh is offline   Reply With Quote


ksp, matrix, mat_final_assembly, petsc

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unknown asymemetric matrix solver type smothSolver FluidKo OpenFOAM Running, Solving & CFD 1 August 5, 2022 03:10
Regarding PETSc4FOAM by dlahaye OpenFOAM Programming & Development 0 July 22, 2022 05:40
Problem simulating the temperature rise in a composite material (chtMultiRegionFoam) Adam_K OpenFOAM Running, Solving & CFD 2 March 27, 2019 06:51
Force can not converge colopolo CFX 13 October 4, 2011 22:03
OpenFOAM version 1.6 details lakeat OpenFOAM Running, Solving & CFD 42 August 26, 2009 21:47

All times are GMT -4. The time now is 22:43.