[petsc-dev] Problem mixing sieve and TS

Paul Sicsic paul.sicsic at polytechnique.edu
Thu Oct 27 09:54:04 CDT 2011


Hi,

I have looked into this "The X you passed in is not a valid Mat (we could
see that from the earlier call"
I have added the following lines to my code:

Call MatView(AppCtx%M, PETSC_VIEWER_STDOUT_WORLD,iErr);CHKERRQ(iErr)


Call MatView(AppCtx%K, PETSC_VIEWER_STDOUT_WORLD,iErr);CHKERRQ(iErr)
Call MatView(AppCtx%Jac, PETSC_VIEWER_STDOUT_WORLD,iErr);CHKERRQ(iErr)

Before calling TSSolve and in the functions called by TSSetRHSFunction,
TSSetIFunction, TSSetIJacobian

Although these matrices are correctly defined before calling TSSolve,
in functions called by TSSetRHSFunction, TSSetIFunction. I get

[0]PETSC ERROR: MatView() line 727 in
/opt/HPC/petsc-dev/src/mat/interface/matrix.c Invalid Pointer to Object:
Parameter # 1

or

Program received signal SIGSEGV, Segmentation fault.

when trying to view AppCtx%M or AppCtx%K

Actually my entire context user AppCtx is corrupted in IJacobian


   - IJacobain

(gdb) set language c
Warning: the current language does not match this frame.
(gdb) p appctx
$1 = {meshtopology = {num_dim = 0, num_verts = 17361392, num_elems = 0,
num_elem_blks_global = 1, num_elem_blks = 0, elem_blk = 0x7fff342fed44,
num_node_sets_global = 32767,
    num_node_sets = 0, node_set = 0x7fff342fed44, num_side_sets_global = 0,
num_side_sets = 875560448, mesh = {v = 32767}}, exo = {comm = 0, exoid = 0,
filename = <error reading variable>,
    title = <error reading variable>, num_qa = 0, qa_rec = 0x7fff342fed44,
num_ebproperties = 0, ebproperty = 0x7fff342fed44, num_ssproperties = 0,
ssproperty = 0x7fff342fed44,
    num_nsproperties = 32603, nsproperty = 0x7fff342fed44, num_globvariables
= 10, globvariable = 0x7fff342fed44, num_cellvariables = 32603, cellvariable
= 0x7fff342fed44,
    num_vertvariables = 32767, vertvariable = 0x7fff342fed44}, myexo = {comm
= 32603, exoid = 875557088, filename = <error reading variable>, title =
<error reading variable>, num_qa = 0,
    qa_rec = 0x7fff342fed44, num_ebproperties = 32603, ebproperty =
0x7fff342fed44, num_ssproperties = 0, ssproperty = 0x7fff342fed44,
num_nsproperties = 32767, nsproperty = 0x7fff342fed44,
    num_globvariables = 0, globvariable = 0x7fff342fed44, num_cellvariables
= 0, cellvariable = 0x7fff342fed44, num_vertvariables = 0, vertvariable =
0x7fff342fed44}, elem = 0x7fff342fed44,
  gradu = {v = 335007449088}, elasticenergy = 4.1421357839642116e-311, u =
{sec = {v = 335007449088}, component_sec = 0x7fff342fed44, vec = {v =
3760492082398003035}, localvec = {
      v = 167881681698815}, scatter = {v = 159704063934464}, num_components
= 0, component_size = 0x7fff342fed44}, f = {sec = {v = 0}, component_sec =
0x7fff342fed44, vec = {
      v = 87979072163971071}, localvec = {v = 8126078124032}, scatter = {v =
8126078124032}, num_components = 0, component_size = 0x7fff342fed44},
extforceswork = 8.6701337941472592e-303,
  totalenergy = 9.3259520631612332e-304, bcflag = {sec = {v =
-5667103038041489408}, component_sec = 0x7fff342fed44, num_components =
32603, component_size = 0x7fff342fed44}, k = {
    v = -5730207330369273856}, m = {v = 87758826241032027}, jac = {v =
-5730213910259171328}, rhs = {sec = {v = -5666668292861853696},
component_sec = 0x7fff342fed44, vec = {
      v = -5666668292861820929}, localvec = {v = 3760511323851489115},
scatter = {v = 87766866419810303}, num_components = 0, component_size =
0x7fff342fed44}, ksp = {
    v = 6013542811304225138}, pc = {v = 18963712520581748}, loginfo =
{io_stage = 0, setup_stage = 875562344, meshcreateexodus_stage = 32767,
meshdistribute_stage = 875562352,
    matassembly_stage = 32767, rhsassembly_stage = -1319374026,
kspsolve_stage = 32603, postproc_stage = 0, matassemblyblock_event = 0,
rhsassemblyblock_event = 0, postproc_event = 0},
  appparam = {restart = false, verbose = 0, testcase = 0, prefix = <error
reading variable>, logviewer = {v = -5819891440125214720}, mylogviewer = {v
= 32603}}, ts = {v = 88033721327812608},
  maxsteps = 0, maxtime = 9.0477955801092479e-303, u_0 = {sec = {v = 0},
component_sec = 0x7fff342fed44, vec = {v = -5930345144141217792}, localvec =
{v = 3760497545596403547}, scatter = {
      v = 94489313279}, num_components = 0, component_size =
0x7fff342fed44}}


   - dans RHSPoisson

(gdb) set language c
Warning: the current language does not match this frame.
(gdb) p appctx
$2 = {meshtopology = {num_dim = 2, num_verts = 137, num_elems = 232,
num_elem_blks_global = 1, num_elem_blks = 1, elem_blk = 0x7fffa5ff9b50,
num_node_sets_global = 2, num_node_sets = 2,
    node_set = 0x7fffa5ff9b50, num_side_sets_global = 0, num_side_sets = 0,
mesh = {v = 38875504}}, exo = {comm = 1140850688, exoid = 0, filename =
<error reading variable>,
    title = <error reading variable>, num_qa = 0, qa_rec = 0x7fffa5ff9b50,
num_ebproperties = 0, ebproperty = 0x7fffa5ff9b50, num_ssproperties = 0,
ssproperty = 0x7fffa5ff9b50,
    num_nsproperties = 0, nsproperty = 0x7fffa5ff9b50, num_globvariables =
0, globvariable = 0x7fffa5ff9b50, num_cellvariables = 0, cellvariable =
0x7fffa5ff9b50, num_vertvariables = 0,
    vertvariable = 0x7fffa5ff9b50}, myexo = {comm = 1140850689, exoid = 0,
filename = <error reading variable>, title = <error reading variable>,
num_qa = 0, qa_rec = 0x7fffa5ff9b50,
    num_ebproperties = 2, ebproperty = 0x7fffa5ff9b50, num_ssproperties = 2,
ssproperty = 0x7fffa5ff9b50, num_nsproperties = 1, nsproperty =
0x7fffa5ff9b50, num_globvariables = 0,
    globvariable = 0x7fffa5ff9b50, num_cellvariables = 0, cellvariable =
0x7fffa5ff9b50, num_vertvariables = 0, vertvariable = 0x7fffa5ff9b50}, elem
= 0x7fffa5ff9b50, gradu = {v = 0},
  elasticenergy = 0, u = {sec = {v = 38942496}, component_sec =
0x7fffa5ff9b50, vec = {v = 39336784}, localvec = {v = 39310784}, scatter =
{v = 39385408}, num_components = 1,
    component_size = 0x7fffa5ff9b50}, f = {sec = {v = 39353184},
component_sec = 0x7fffa5ff9b50, vec = {v = 39456784}, localvec = {v =
39476448}, scatter = {v = 39526144},
    num_components = 1, component_size = 0x7fffa5ff9b50}, extforceswork = 0,
totalenergy = 0, bcflag = {sec = {v = 39632224}, component_sec =
0x7fffa5ff9b50, num_components = 1,
    component_size = 0x7fffa5ff9b50}, k = {v = 40465120}, m = {v =
40559808}, jac = {v = 40613120}, rhs = {sec = {v = 39491184}, component_sec
= 0x7fffa5ff9b50, vec = {v = 39597824},
    localvec = {v = 39617488}, scatter = {v = 39667184}, num_components = 1,
component_size = 0x7fffa5ff9b50}, ksp = {v = 4294967955}, pc = {v = 0},
loginfo = {io_stage = 3, setup_stage = 4,
    meshcreateexodus_stage = 1, meshdistribute_stage = 2, matassembly_stage
= 5, rhsassembly_stage = 6, kspsolve_stage = 7, postproc_stage = 8,
matassemblyblock_event = 1,
    rhsassemblyblock_event = 2, postproc_event = 3}, appparam = {restart =
2992725822, verbose = 0, testcase = 2, prefix = <error reading variable>,
logviewer = {v = 6890688}, mylogviewer = {
      v = 0}}, ts = {v = 42310832}, maxsteps = 1000, maxtime = 10, u_0 =
{sec = {v = 39843104}, component_sec = 0x7fffa5ff9b50, vec = {v = 39789632},
localvec = {v = 39809296}, scatter = {
      v = 39858992}, num_components = 1, component_size = 0x7fffa5ff9b50}}


I use :

    Call TSSetIJacobian(AppCtx%TS, AppCtx%Jac, AppCtx%Jac, IJacobianPoisson,
AppCtx, ierr); CHKERRQ(iErr)

and

#undef __FUNCT__
#define __FUNCT__ "IJacobianPoisson"
   SubRoutine IJacobianPoisson(dummyTS, t, U, Udot, a, Jac, PreJac, AppCtx,
iErr)
      Type(TS)                                     :: dummyTS
      PetscReal                                    :: t, a
      Type(Vec)                                    :: U, Udot
      Type(Mat)                                    :: Jac, PreJac
       Type(AppCtx_Type)                            :: AppCtx
      PetscInt                                     :: iErr
      Character(len=MEF90_MXSTRLEN)                :: IOBuffer
! a*AppCtx%M + AppCtx%K
      Write(IOBuffer, *) 'Begin IJacobianPoisson \n'
      Call PetscPrintf(PETSC_COMM_WORLD, IOBuffer, iErr); CHKERRQ(iErr)
      Call MatView(AppCtx%M, PETSC_VIEWER_STDOUT_WORLD,iErr);CHKERRQ(iErr)
      Call MatView(AppCtx%K, PETSC_VIEWER_STDOUT_WORLD,iErr);CHKERRQ(iErr)
      Call MatView(AppCtx%Jac, PETSC_VIEWER_STDOUT_WORLD,iErr);CHKERRQ(iErr)
!Initialisation de la matrice Jac ?
!! Condition aux limites ??
      call MatAXPY(Jac, a, AppCtx%M, AppCtx%K, iErr); CHKERRQ(iErr)

   End Subroutine IJacobianPoisson

Could the Fortran binding be incorrect for this specific function or am I
really really missing something  here?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111027/3025e17a/attachment.html>


More information about the petsc-dev mailing list