________________________________________ The "New nonzero at <fill in the blank> caused a malloc" error looks like what happens if the preallocation is not exact. What happens if you add
call MatSetOption(Kglobal, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE, ierr) after your call to your preallocation subroutine? ________________________________________ Oh, of course Kglobal should be replaced by whatever matrix you are trying to set the values of.
