How to get adapted mesh from Adaptive solver

Asked by Praveen C

Hello

I am using AdaptiveNonlinearVariationalSolver for some problem.

Is it possible to get the final mesh (and those in between also). I would like to use the final mesh for further computations. I set

solver.parameters["save_data"] = True

and it seems to be saving every mesh in directory "default". But this in some *.bin format. How can I view this mesh and use it in a different program ?

Thanks
praveen

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Marie Rognes
Solved:
Last query:
Last reply:
Revision history for this message
Marie Rognes (meg-simula) said :
#1

On 10/05/11 12:20, Praveen C wrote:
> New question #173284 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/173284
>
> Hello
>
> I am using AdaptiveNonlinearVariationalSolver for some problem.
>
> Is it possible to get the final mesh (and those in between also). I would like to use the final mesh for further computations. I set
>
> solver.parameters["save_data"] = True
>
> and it seems to be saving every mesh in directory "default". But this in some *.bin format. How can I view this mesh and use it in a different program ?
>

Yes, it is definitely possible, but the answer depends on which version
of dolfin you are using. Which would that be?

The binary format (*.bin) is the one output by the TimeSeries class. See:

http://fenicsproject.org/doc/dolfin/dev/python/programmers-reference/cpp/TimeSeries.html#dolfin.cpp.TimeSeries

for how to retrieve the data.

--
Marie

Revision history for this message
Praveen C (cpraveen) said :
#2

I am using 1.0-beta.

Revision history for this message
Best Marie Rognes (meg-simula) said :
#3

Meshes (and Functions, DirichletBC, Forms etc) inherit from the Hierarchical class:

http://fenicsproject.org/doc/dolfin/1.0.beta/cpp/programmers-reference/common/Hierarchical.html#Hierarchical

During the adaptive solve, a hierarchy of meshes etc. is created. This hierarchy can be traversed through the child() and parent() functions, for instance post-solve try:

while (True):
    if mesh.has_child():
        plot(mesh)
        mesh = mesh.child()

The first mesh and the final mesh can be extracted using fine() and coarse() in dolfin-1.0beta (and root_node() and leaf_node() in dolfin-dev and onward)

Revision history for this message
Praveen C (cpraveen) said :
#4

Thanks Marie Rognes, that solved my question.