[petsc-users] DMPlex : Assemble global stiffness matrix problem

Morten Nobel-Jørgensen mono at mek.dtu.dk
Tue Apr 5 07:11:27 CDT 2016


Hi Matthew

We are now facing a related problem. When running on a single process everything works as intended, where the values of global stiffness matrix are between 0.0 and 2.0 (the number corresponds to the number of elements/cells which affects the relation between two dofs).

However if the program is using 2 (or more) processes, then the global stiffness matrix changes, such that the values is now between 0.0 and 1.0 (even though we are using ADD_VALUES in the MatSetValuesLocal).

Any idea what could be wrong? I have attached a modified version of the code, where the program outputs the matrix to a file called ‘Kmat.m'.

Kind regards,
Morten


Fra: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Dato: Tuesday 8 March 2016 at 19:47
Til: Morten Nobel-Jørgensen <mono at mek.dtu.dk<mailto:mono at mek.dtu.dk>>
Cc: "petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>" <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Emne: Re: [petsc-users] DMPlex : Assemble global stiffness matrix problem

On Tue, Mar 8, 2016 at 7:10 AM, Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>> wrote:
On Mon, Mar 7, 2016 at 1:28 PM, Morten Nobel-Jørgensen <mono at mek.dtu.dk<mailto:mono at mek.dtu.dk>> wrote:
I have some problems using DMPlex on unstructured grids in 3D.

After I have created the DMPlex and assigned dofs (3 dofs on each node), I run into some problems when assembling the global stiffness matrix. I have created a small example in the attached cc file. My problems are:

  *   It seems like the matrix (created using DMCreateMatrix) contains no non-zero elements. I was under the impression that the sparsity pattern of the matrix would be created automatically when the dofs has been assigned to the default section.
  *   (Probably as a consequence of this) when assigning values to the matrix I get an: "Argument of of range. New nonzero at (0,0) caused a malloc. Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check"
  *   Finally, I'm reading the nodes of each element using the get-transitive-clojure (where I test if each point is inside the node range), but I have a hard time understanding if the returned values are sorted. And if not, how to sort the values (e.g. using orientation which the get-transitive-clojure function also returns).

I hope someone can guide me in the right direction :)

I will take a look today or tomorrow. The first thing to do is to look at the nonzero pattern of the Jacobian. I use -mat_view draw -draw_pause -1

I admit that this problem is counter-intuitive, and I will think about a good error check. The problem is that I allow "inconsistent"
sections, meaning that the dof for each field do not add up to the total dof. In your code, when you call

      ierr = PetscSectionSetDof(s, v, 3);CHKERRQ(ierr);

you should also call

      ierr = PetscSectionSetFieldDof(s, v, 0, 3);CHKERRQ(ierr);

Then everything works. I am attaching my slight rewrite of your code.

  Thanks,

    Matt

  Thanks,

    Matt

Kind regards,
Morten



--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener



--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160405/6ee186eb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex18.cc
Type: application/octet-stream
Size: 4781 bytes
Desc: ex18.cc
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160405/6ee186eb/attachment.obj>


More information about the petsc-users mailing list