<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hi,</div>
<div> </div>
<div>I found the problem. PetscViewerVTKOpen will only work for DMVectors not for natural Vectors.</div>
<div> </div>
<div><strong>This doesn't work:</strong><br/>
<span class="s1" style="line-height: 1.6em;">ierr</span><span style="line-height: 1.6em;"> = DMDACreate3d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_BOX, 10, 10, 10, PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE, 1, 1,NULL,NULL,NULL,&test);CHKERRQ(</span><span class="s1" style="line-height: 1.6em;">ierr</span><span style="line-height: 1.6em;">);</span></div>
<div>
<p class="p1"><span class="s1">Vec</span> a;<br/>
DMDACreateNaturalVector(test,&a);CHKERRQ(<span class="s1">ierr</span>);<br/>
<span class="s1">ierr</span> = PetscViewerVTKOpen(PETSC_COMM_WORLD,"yourfile_natural.vts",FILE_MODE_WRITE, &viewer1);CHKERRQ(<span class="s1">ierr</span>);<br/>
ierr = VecView(a, viewer1);CHKERRQ(ierr);<br/>
ierr = PetscViewerDestroy(&viewer1);CHKERRQ(ierr);</p>
<p class="p1"> </p>
<p class="p1"><strong>This does work:</strong><br/>
<span class="s1" style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;">ierr</span><span style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;"> = DMDACreate3d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_BOX, 10, 10, 10, PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE, 1, 1,NULL,NULL,NULL,&test);CHKERRQ(</span><span class="s1" style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;">ierr</span><span style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;">);</span><br style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;"/>
<span class="s1" style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;">Vec</span><span style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;"> a;</span><br style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;"/>
DMCreateGlobalVector(test,<span class="s1">&a</span>);<br style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;"/>
<span class="s1" style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;">ierr</span><span style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;"> = PetscViewerVTKOpen(PETSC_COMM_WORLD,"yourfile_dm.vts",FILE_MODE_WRITE, &viewer1);CHKERRQ(</span><span class="s1" style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;">ierr</span><span style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;">);</span><br style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;"/>
<span style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;">ierr = VecView(a, viewer1);CHKERRQ(ierr);</span><br style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;"/>
<span style="font-family: Verdana; font-size: 12px; line-height: 19.2000007629395px;">ierr = PetscViewerDestroy(&viewer1);CHKERRQ(ierr);</span></p>
<p class="p1">Can anyone confirm this?</p>
<p class="p1">king regards,<br/>
<span style="line-height: 1.6em;">Grischa</span></p>
<p class="p1">Graduate School CE, TU Darmstadt</p>
</div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Dienstag, 03. März 2015 um 23:49 Uhr<br/>
<b>Von:</b> "Jed Brown" <jed@jedbrown.org><br/>
<b>An:</b> "Grischa Jacobs" <grischa.jacobs@email.de>, petsc-users@mcs.anl.gov<br/>
<b>Betreff:</b> Re: [petsc-users] VTK Output / no file</div>
<div name="quoted-content">Grischa Jacobs <grischa.jacobs@email.de> writes:<br/>
<br/>
> Dear,<br/>
><br/>
> I used to save my Vec results to vts files. Unfortunately this is not working<br/>
> anymore. My Code:<br/>
><br/>
> // Creating 3DDM before<br/>
> ierr = DMDACreateNaturalVector(dynamic_Maxwell, &dynamic_fields_global);CHKERRQ<br/>
> (ierr);<br/>
> ierr = VecSet(dynamic_fields_global,some_number);CHKERRQ(ierr);<br/>
><br/>
> PetscViewer viewer;<br/>
> ierr = PetscViewerVTKOpen(PETSC_COMM_WORLD, "test.vts", FILE_MODE_WRITE, &<br/>
> viewer);CHKERRQ(ierr);<br/>
> ierr = VecView(dynamic_fields_global, viewer);CHKERRQ(ierr);<br/>
> ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);<br/>
<br/>
What version of PETSc are you using and what error do you get?<br/>
<br/>
> Saving to ASCII still works:<br/>
> ierr = PetscViewerASCIIOpen(PETSC_COMM_WORLD,"test.vts",&viewer);CHKERRQ(ierr);<br/>
><br/>
> I don't get any errors.<br/>
><br/>
><br/>
><br/>
> king regrads,<br/>
> Grischa</div>
</div>
</div></div></body></html>