hi, I have a Jacobian matrix created using DMCreateMatrix(). What would be the best way to add extra nonzero entries into it? I'm guessing that DMCreateMatrix() allocates the storage so the nonzero structure can't really be easily modified. 
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
 
ZjQcmQRYFpfptBannerEnd
hi,

I have a Jacobian matrix created using DMCreateMatrix(). What would be 
the best way to add extra nonzero entries into it?

I'm guessing that DMCreateMatrix() allocates the storage so the nonzero 
structure can't really be easily modified. Would it be a case of 
creating a new matrix, copying the nonzero entries from the original one 
and then adding the extra ones, before calling MatSetUp() or similar? If 
so, how exactly would you copy the nonzero structure from the original 
matrix?

Background: the flow problem I'm solving (on a DMPlex with finite volume 
method) has complex source terms that depend on the solution (e.g. 
pressure), and can also depend on other source terms. A simple example 
is when fluid is extracted from one location, with a pressure-dependent 
flow rate, and some of it is then reinjected in another location. This 
can result in poor nonlinear solver convergence. I think the reason is 
that there are effectively missing Jacobian entries in the row for the 
reinjection cell, which should have an additional dependence on the 
solution in the cell where fluid is extracted.

- Adrian

-- 
Dr Adrian Croucher
Senior Research Fellow
Department of Engineering Science
Waipapa Taumata Rau / University of Auckland, New Zealand
email: [email protected]
tel: +64 (0)9 923 4611

Reply via email to