[petsc-users] Writing VTK output for vectors derived from DM Global vector

Garnet Vaz garnet.vaz at gmail.com
Fri Sep 27 12:20:04 CDT 2013


Hi Matt,

I did run into some documentation that said that complex output
should use complex instead of scalars and have
Real[0]
Imag[0]
...
Real[N]
Imag[N].


I will try to find the documentation.

-
Garnet


On Fri, Sep 27, 2013 at 10:14 AM, Matthew Knepley <knepley at gmail.com> wrote:

> On Fri, Sep 27, 2013 at 10:12 AM, Garnet Vaz <garnet.vaz at gmail.com> wrote:
>
>> Hi,
>>
>> Does the vtk output write complex vectors? I wrote an example
>> to test the usage but only the real part of the vector is written
>> to the file. Is complex output supported?
>>
>
> I had never considered that since I did not know how VTK would plot it.
> Does VTK support it?
> If so, I can change the code to output what you want.
>
>   Thanks,
>
>      Matt
>
>
>> Thanks.
>> -
>> Garnet
>>
>>
>> On Tue, Sep 24, 2013 at 6:44 AM, Garnet Vaz <garnet.vaz at gmail.com> wrote:
>>
>>> Hi Matt,
>>>
>>> Yes. Thanks. I got it to work. The shell on emacs had not
>>> updated $PETSC_DIR and was using 3.4.2.
>>>
>>> -
>>> Garnet
>>>
>>>
>>> On Tue, Sep 24, 2013 at 6:26 AM, Matthew Knepley <knepley at gmail.com>wrote:
>>>
>>>> On Tue, Sep 24, 2013 at 6:16 AM, Garnet Vaz <garnet.vaz at gmail.com>wrote:
>>>>
>>>>> Hi Matt,
>>>>>
>>>>> I did pull yesterday. My configure.log file has
>>>>>           Defined "VERSION_GIT" to
>>>>> ""b4e904d1358c92c43842a940440f995d2117e40b""
>>>>>           Defined "VERSION_DATE_GIT" to ""2013-09-23 12:36:08 +0100""
>>>>>
>>>>> Is the change added after this?
>>>>>
>>>>
>>>> I see it here:
>>>>
>>>>
>>>> https://bitbucket.org/petsc/petsc/src/33dd83b134909f5b4acb842818b1e0de2db2f4eb/include/petscdm.h?at=master#cl-35
>>>>
>>>> and it has been there since this commit in July:
>>>>
>>>>
>>>> https://bitbucket.org/petsc/petsc/commits/38221697d93bc7c9a6149445938a5de22e85bc83
>>>>
>>>>       Matt
>>>>
>>>>
>>>>>  -
>>>>> Garnet
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Sep 24, 2013 at 6:08 AM, Matthew Knepley <knepley at gmail.com>wrote:
>>>>>
>>>>>> On Tue, Sep 24, 2013 at 5:54 AM, Garnet Vaz <garnet.vaz at gmail.com>wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Thanks Jed. I will set the field names before I write them.
>>>>>>> I need to create a clone and then change the default section
>>>>>>> to have dof to 1 before I write them. I am not able to use clone with
>>>>>>>
>>>>>>> DMClone(originaldm,&newdm);
>>>>>>>
>>>>>>> The error I get when compiling is
>>>>>>> "'DMClone' was not declared in this scope".
>>>>>>>
>>>>>>> I do have #include<petscdmplex.h> which includes the
>>>>>>> petscdm.h header. Other than clone I am able to use the
>>>>>>> other functions.
>>>>>>>
>>>>>>
>>>>>> Have you updated? I think I forgot the declaration initially.
>>>>>>
>>>>>>   Matt
>>>>>>
>>>>>>
>>>>>>> Thanks.
>>>>>>> -
>>>>>>> Garnet
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Sep 23, 2013 at 3:30 PM, Jed Brown <jedbrown at mcs.anl.gov>wrote:
>>>>>>>
>>>>>>>> Garnet Vaz <garnet.vaz at gmail.com> writes:
>>>>>>>>
>>>>>>>> > Hi,
>>>>>>>> >
>>>>>>>> > I would like to write out my solution to a VTK file where I use
>>>>>>>> unstructured
>>>>>>>> > grids in DMPlex.
>>>>>>>> >
>>>>>>>> > The solution corresponds to  harmonic frequencies (~ 5-10
>>>>>>>> distinct) which
>>>>>>>> > are
>>>>>>>> > currently saved into a Vec* object. These vectors were created by
>>>>>>>> > duplicating the
>>>>>>>> > global vector for the DM object. (I know that they correspond to
>>>>>>>> the right
>>>>>>>> > cell.)
>>>>>>>> >
>>>>>>>> > Is it possible to have one file which would contain the mesh from
>>>>>>>> the DM
>>>>>>>> > object and all the Vec* objects?
>>>>>>>> > Would I have to clone the original DM and use
>>>>>>>> >
>>>>>>>> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerVTKAddField.html
>>>>>>>> > to include all the vectors?
>>>>>>>>
>>>>>>>> This is a private function.
>>>>>>>>
>>>>>>>> > In the above function does
>>>>>>>> > PetscViewerVTKWriteFunction
>>>>>>>> > just need to be
>>>>>>>> >
>>>>>>>> > myWriteFunc(vec,viewer)
>>>>>>>> > {
>>>>>>>> > VecView(vec,viewer)
>>>>>>>> > }
>>>>>>>> > if I do not need to make any changes to the vector?
>>>>>>>>
>>>>>>>> This should work, but you may want to use PetscObjectSetName() so
>>>>>>>> that
>>>>>>>> the names of the different fields are sensible.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Regards,
>>>>>>> Garnet
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Garnet
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 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
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Garnet
>>>
>>
>>
>>
>> --
>> Regards,
>> Garnet
>>
>
>
>
> --
> 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
>



-- 
Regards,
Garnet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130927/ce78e065/attachment-0001.html>


More information about the petsc-users mailing list