Changing mesh name from Th to Th3 appears to generate problems

I’m trying to convert some code to use PETSc. I tried to copy an example but got
various compile errors and then seg faults at run time. I isolated a problem upstream
but have not verified to is a problem later. At issue seems tobe the name of the mesh and
requirement for macro defs that are suspcious later on. For example, the two attached files
differ only in Th vs Th3 for the mesh name but Th3 fails at compile without the defs for def and
init lol. What is the deal here? Am I missing something simple? Thanks.
mwe_defs3.edp (1.6 KB)
mwe_defs.edp (1.5 KB)

 diff mwe*
<  mesh3  Th3 = cube(Xpts,Ypts,Tpts);
>  mesh3  Th = cube(Xpts,Ypts,Tpts);
< Th3=change(Th3,refface=chlab);
> Th=change(Th,refface=chlab);
< buildDmesh(Th3)
> buildDmesh(Th)
< // need to uncomment naming mesh Th3 and then it bombs during run ???
<     createMat(Th3, AP, Pk)
>     createMat(Th, AP, Pk)

 4967  ff-mpirun -np 1  mwe_defs.edp  -wg 
 4968  vi mwe_defs.edp 
 4969  cp mwe_defs.edp mwe_defs3.edp 
 4970  vi mwe_defs3.edp 
 4971  ff-mpirun -np 1  mwe_defs3.edp  -wg 

I went back and changed the full code and it now appears to run although the solution
is not correct it no longer seg faults and I dont need the macro defs for def and init :slight_smile:

I have a bunch of little issues like this that take forever to track down but now I want
to get the results and see if the math/analysis makes any sense. I had to scale down to
a 2+1D electrmagnetics problem with the z dimension as time. I’m using the last result
for the initial conditions of a new solve so I have some more detais
to check.

You neglected to update the name of the mesh in the macro definitions. Change ThN2O to Th3N2O and ThPkPart to Th3PkPart.

Thanks. I’m kind of curious what kind of code it generated now :slight_smile: I guess it was easy to
overlook as I would expect a compile time error. The scoped macro idea, kind of
like c++ templates, is powerful but apparently takes dome getitng used to.