<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">That fixed it, thanks. Given that I the nonzero pattern will not change throughout the solve, would it still be unreasonable to use this for larger problems?<div class=""><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">-gideon</span>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Jul 29, 2015, at 1:52 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class=""> To start, immediately after you have created the matrix do what it says call<br class=""><br class=""><blockquote type="cite" class="">MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) <br class=""></blockquote><br class=""> this will allow you to build your matrix and work fine for modest size problems. For larger problems (only when you have your code running and solving the problem you want) you need to add in more preallocation information. But to do it now would be premature optimization.<br class=""><br class=""> Barry<br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jul 29, 2015, at 11:51 AM, Gideon Simpson <<a href="mailto:gideon.simpson@gmail.com" class="">gideon.simpson@gmail.com</a>> wrote:<br class=""><br class="">That’s generating malloc errors:<br class=""><br class="">[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br class="">[0]PETSC ERROR: Argument out of range<br class="">[0]PETSC ERROR: New nonzero at (10,0) caused a malloc<br class="">Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check<br class=""><br class="">I suspect this is because DMCreateMatrix is picking a sparsity pattern which is not consistent with what I need.<br class=""><br class="">-gideon<br class=""><br class=""><blockquote type="cite" class="">On Jul 28, 2015, at 10:10 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>> wrote:<br class=""><br class=""><br class=""> DMCreateMatrix() ? <br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jul 28, 2015, at 9:02 PM, Gideon Simpson <<a href="mailto:gideon.simpson@gmail.com" class="">gideon.simpson@gmail.com</a>> wrote:<br class=""><br class="">I’m working with a DMComposite where I have a DMRedundant with 2 parameters, and then a standard DMDACreate with some number of entires that I would like to have distributed. For concreteness, suppose it is <br class=""><br class="">DMCompositeCreate(PETSC_COMM_WORLD, &packer);<br class="">DMRedundantCreate(PETSC_COMM_WORLD, 0, 2, &p_dm);<br class="">DMCompositeAddDM(packer,p_dm);<br class="">DMDACreate1d(PETSC_COMM_WORLD,DM_BOUNDARY_NONE, nx, 1, 1, NULL,&u_dm);<br class="">DMCompositeAddDM(packer,u_dm);<br class="">DMCreateGlobalVector(packer,&U);<br class=""><br class="">Now, I would like to construct a matrix for this problem that can be used for computing Jacobians in a nonlinear solve. Is there a way to get the matrix size to layout in a “useful” way, in the sense that the first process, which owns the two degrees of freedom of p_dm and the first N0 number of the rows of u_dm, controls the corresponding N0+2 rows of the matrix, and analgously for the second process has the next N1 rows of the u_dm vector, and has the next N1 rows of the matrix?<br class=""><br class="">-gideon<br class=""><br class=""></blockquote><br class=""></blockquote><br class=""></blockquote><br class=""></div></blockquote></div><br class=""></div></body></html>