[petsc-users] Custom matrix coloring for finite difference Jacobian
Eirik Jaccheri Høydalsvik
eirik.hoydalsvik at sintef.no
Thu Sep 11 18:25:20 CDT 2025
Hi,
I have made a two-phase flow code which computes motion of two phases in one dimension, where the phases are allowed to intermix. This code relies on a finite difference Jacobian computed using the standard coloring I get from the DMDA object:
da = PETSc.DMDA().create(
dim=(N_vertical,),
dof=3,
stencil_width=1,
)
I now want to add a variable for the interphase height L_z in addition to a velocity u_v, giving the velocity of the vapor flowing in to the interface. The interface will move throughout the grid, meaning that these two variables will not be coupled to a fixed set of grid cells, but will be coupled to different sets of three grid cells throughout the simulation.
Questions:
1. Is it possible to create a custom coloring to efficiently compute the finite difference Jacobian including the interphase height and vapor velocity?
2. How do I revert to computing the full finite difference Jacobian with the purpose of testing if the interphase model works?
Best regards,
Eirik Jaccheri Høydalsvik
Sintef ER and NTNU EPT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20250911/4ee460fd/attachment.html>
More information about the petsc-users
mailing list