[MOAB-dev] A PDE example with MOAB.

Tim Tautges tautges at mcs.anl.gov
Wed Apr 13 16:48:26 CDT 2011


Sounds good, and let me know if/when you run into problems.  I'd also ask you to keep a list of things you'd most like 
to be documented better; that would help me know how to focus my documentation efforts.

- tim

On 04/13/2011 04:43 PM, Vijay S. Mahadevan wrote:
>> - I'd love to have more simple examples, so if/when you have one ready, I'll
>> gladly take it and put it in the repo (or let me know if you want/need write
>> access).
>
> As with any library, there is a steep learning curve here. But in the
> coming weeks, I should have something concrete working. It could be
> un-optimized but I hope that you can help me refine it better when it
> is completed. And regarding the repo, I do not need write access
> immediately but if I need one, I will definitely let you know.
>
> Thanks,
> Vijay
>
> On Wed, Apr 13, 2011 at 4:29 PM, Tim Tautges<tautges at mcs.anl.gov>  wrote:
>> Aha, now I understand better.  Some additional notes:
>>
>> - MOAB is tuned first for minimizing memory; therefore, internal faces and
>> edges in a 3d mesh won't necessarily be explicitly represented (i.e. you
>> won't get a handle to them); if you do want them, and can afford the cost in
>> terms of memory, call get_adjacencies with "true" for the create_if_missing
>> parameter
>>
>> - both up and down adjacencies use the get_adjacencies function, from any
>> dimension to any other dimension; you don't need to go in steps from d to
>> d-1 or d+1.  For getting vertices, you can also use get_connectivity; for
>> the latter, if you're doing local traversal, I often use the version of that
>> function that returns a const EntityHandle*, int num_entities; that just
>> saves you a bit of memory and list handling.
>>
>> - local ordering is available through the CN class (Canonical Numbering), or
>> for specific entities through the side_number and side_element functions.
>>   CN also supports permutations if you want to use a different ordering for a
>> given entity type.
>>
>> - I'd love to have more simple examples, so if/when you have one ready, I'll
>> gladly take it and put it in the repo (or let me know if you want/need write
>> access).
>>
>> - tim
>>
>> On 04/13/2011 04:10 PM, Vijay S. Mahadevan wrote:
>>>>
>>>> Are you implementing in Fortran or C++ or something else?  In what way
>>>> does
>>>> it seem complicated?
>>>
>>> C++. I tried to traverse the hierarchy by recursively querying the
>>> entities to get the data I needed. During the assembly, once I needed
>>> to get the information for a particular node, I could not figure out
>>> the reverse lookup to get a list of elements that the node belongs.
>>>
>>> Tim, I will look at the test program you suggested and the routines
>>> (query_elem_to_vert,..) to understand this. Being used to the elem,
>>> face, node hierarchy, I am still getting used to the idea of
>>> traversing through the mesh differently. I have been reading the
>>> source and am slowly learning the "right" way to do things. So forgive
>>> me for any other trivial questions that I might ask.
>>>
>>> I do plan to write a simple 1-d program that probably Jed's library
>>> already does. But hopefully it will be self contained so that it could
>>> serve as a good example for anyone looking for something like this in
>>> the future.
>>>
>>> Vijay
>>>
>>> On Wed, Apr 13, 2011 at 3:52 PM, Tim Tautges<tautges at mcs.anl.gov>    wrote:
>>>>
>>>>
>>>> On 04/13/2011 03:15 PM, Vijay S. Mahadevan wrote:
>>>>>
>>>>> Tim,
>>>>>
>>>>> I have used the example MOAB programs to read mesh files (gmsh mostly)
>>>>> and load the entities and tags. But the usage for traversing through
>>>>> the mesh and querying each node to obtain its neighbors and elements
>>>>> that they belong seems a little complicated. Since these operations
>>>>> are fundamental building blocks in writing a residual function for a
>>>>> PDE, I just wanted to look at how it could be done for a simple
>>>>> example.
>>>>>
>>>>
>>>> Are you implementing in Fortran or C++ or something else?  In what way
>>>> does
>>>> it seem complicated?
>>>>
>>>> I just remembered one of the tests that shows basic mesh traversal, it's
>>>> the
>>>> test/perf/perf.cpp (the equivalent code that uses the iMesh interface is
>>>> in
>>>> tstt_perf.cpp in the same directory).  There are two functions in those
>>>> tests you'll want to look at:
>>>>
>>>> - query_elem_to_vert: gets all the elements in the mesh, then for each
>>>> element, gets the connectivity, the coordinates of those vertices, and
>>>> averages those coordinates.  That function is about 20 lines long,
>>>> including
>>>> the averaging.
>>>>
>>>> - query_vert_to_elem: gets all the vertices, then for each queries the
>>>> adjacent hexes.  That function is about 12 lines long.
>>>>
>>>>> I will definitely look at NEK as per your suggestion but if they only
>>>>> use MOAB to read the mesh and convert it to their own mesh data
>>>>> structures, it beats the purpose of my question. Thanks for the
>>>>> pointer though.
>>>>
>>>> That's essentially what it does, so maybe not that helpful.
>>>>
>>>> - tim
>>>>
>>>>>
>>>>> Vijay
>>>>>
>>>>> On Wed, Apr 13, 2011 at 3:02 PM, Tim Tautges<tautges at mcs.anl.gov>
>>>>>   wrote:
>>>>>>
>>>>>> Hi Vijay,
>>>>>>   Yes, this is the right forum, but no, I don't know of a good example
>>>>>> that's
>>>>>> self-contained.  An alternative would be to look at the Nek code, which
>>>>>> has
>>>>>> a working MOAB reader.  That'll show how to pick up the mesh and bc's,
>>>>>> though I don't think it writes anything down to the mesh.  Other than
>>>>>> that,
>>>>>> the tutorial slides on the MOAB wiki have some coding examples, but
>>>>>> they're
>>>>>> pretty short.
>>>>>>
>>>>>> - tim
>>>>>>
>>>>>> On 04/13/2011 02:40 PM, Vijay S. Mahadevan wrote:
>>>>>>>
>>>>>>> All,
>>>>>>>
>>>>>>> I was wondering whether there is a simple example on the usage of MOAB
>>>>>>> or iMesh for solving a PDE. This could be as trivial as a finite
>>>>>>> differenced, 1-d poisson equation but I just wanted to have a look at
>>>>>>> a working example in action in order to extend the ideas to more
>>>>>>> practical problems. I could not find any such tutorial in the MOAB
>>>>>>> repository and so thought that maybe someone in the list can point me
>>>>>>> to one.
>>>>>>>
>>>>>>> Also, if there is a different forum for such questions, I would
>>>>>>> appreciate it if you can redirect me to it.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Vijay
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> ================================================================
>>>>>> "You will keep in perfect peace him whose mind is
>>>>>>   steadfast, because he trusts in you."               Isaiah 26:3
>>>>>>
>>>>>>              Tim Tautges            Argonne National Laboratory
>>>>>>          (tautges at mcs.anl.gov)      (telecommuting from UW-Madison)
>>>>>>          phone: (608) 263-8485      1500 Engineering Dr.
>>>>>>            fax: (608) 263-4499      Madison, WI 53706
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> --
>>>> ================================================================
>>>> "You will keep in perfect peace him whose mind is
>>>>   steadfast, because he trusts in you."               Isaiah 26:3
>>>>
>>>>              Tim Tautges            Argonne National Laboratory
>>>>          (tautges at mcs.anl.gov)      (telecommuting from UW-Madison)
>>>>          phone: (608) 263-8485      1500 Engineering Dr.
>>>>            fax: (608) 263-4499      Madison, WI 53706
>>>>
>>>>
>>>
>>
>> --
>> ================================================================
>> "You will keep in perfect peace him whose mind is
>>   steadfast, because he trusts in you."               Isaiah 26:3
>>
>>              Tim Tautges            Argonne National Laboratory
>>          (tautges at mcs.anl.gov)      (telecommuting from UW-Madison)
>>          phone: (608) 263-8485      1500 Engineering Dr.
>>            fax: (608) 263-4499      Madison, WI 53706
>>
>>
>

-- 
================================================================
"You will keep in perfect peace him whose mind is
   steadfast, because he trusts in you."               Isaiah 26:3

              Tim Tautges            Argonne National Laboratory
          (tautges at mcs.anl.gov)      (telecommuting from UW-Madison)
          phone: (608) 263-8485      1500 Engineering Dr.
            fax: (608) 263-4499      Madison, WI 53706



More information about the moab-dev mailing list