[petsc-users] Mass matrix with PetscFE

Julian Andrej juan at tf.uni-kiel.de
Wed Feb 24 06:47:59 CST 2016


i'm trying to assemble a mass matrix with the PetscFE/DMPlex interface. 
I found something in the examples of TAO


but using the lines

DMClone(dm, &dm_mass);
DMSetNumFields(dm_mass, 1);
DMPlexCopyCoordinates(dm, dm_mass);
DMGetDS(dm_mass, &prob_mass);
PetscDSSetJacobian(prob_mass, 0, 0, mass_kernel, NULL, NULL, NULL);
PetscDSSetDiscretization(prob_mass, 0, (PetscObject) fe);
DMPlexSNESComputeJacobianFEM(dm_mass, u, M, M, NULL);
DMCreateMatrix(dm_mass, &M);

leads to errors in DMPlexSNESComputeJacobianFEM (u is a global vector).

I don't can understand the necessary commands until 
DMPlexSNESComputeJacobianFEM. What does it do and why is it necessary? 
(especially why does the naming involve SNES?)

Is there another/easier/better way to create a mass matrix (the inner 
product of the function space and the test space)?

Julian Andrej

More information about the petsc-users mailing list