Re: [deal.II] Mesh refinement and the ability to transfer the data to the quadrature points of the new mesh on parallel::shared::triangulation.

2020-04-22 Thread Marc Fehling
Hi Alberto!

If I understood you correctly, you transfer quadrature point data, with the 
`SolutionTransfer` class which is meant to transfer finite element 
approximations.

A different class dedicated to the transfer of quadrature point data 
already exists: It is called `TransferableQuadraturePointData`. Examples on 
how to use that feature can be found in 
`tests/base/quadrature_point_data_{02|03|04}`.

You could also use the `CellDataTransfer` class to transfer cell related 
data, i.e. stored as `Vector>` in your case if I interpreted 
your code correctly. However, this particular feature is only available in 
the current `master` branch of the library and has not been released yet.

Hope this gives you some more options to find a solution!

Best,
Marc

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/71caa803-60fa-42cc-b609-3c2e1dd57674%40googlegroups.com.


Re: [deal.II] Mesh refinement and the ability to transfer the data to the quadrature points of the new mesh on parallel::shared::triangulation.

2020-04-21 Thread Wolfgang Bangerth



Hi Alberto,
that's too much code for anyone to look through -- do you think you could come 
up with a minimal, self-contained testcase that shows the problem? It's 
entirely possible that there is a bug, but it would be very useful to have a 
self-contained program that demonstrates it and that others can use for debugging.


Best
 W.

On 4/21/20 10:03 AM, Alberto Salvadori wrote:


Dear community

I have been struggling in these days on the mesh refinement. I am encountering 
a problem that, so far, I just was unable to sort out.

Therefore, I wonder i f I can get some help.

Shortly: I want to refine my mesh for a vector problem in mechanics. After 
solving the problem on an initial grid, the solution is stored in the 
std::vector< double > *this*->accumulated_displacement
Moreover, I collected some further data in a constitutive class, 
MechanicalModels_FiniteDifference_Integrator* pmech;
associated to the cell->user_pointer()) pointer . On refinement, I aim at 
interpolating the solution and the data at the Gauss points, too.


This problem has been the subject of a few discussions and suggestions have 
been provided for parallel::distributed::triangulations. At present I am still 
using parallel::shared , though.


The step-26 shows very clearly how to deal with refinement and solution 
update. In fact, I copied the approach and it works very well.
The code gallery example 'Goal-oriented mesh adaptivity in elastoplasticity 
problems' seems to address the problem of how to propagate GP data. Being 
inspired by it, I wrote some code, that I am attaching below.


It turns out that it works well on 1 processor, but it fails in parallel. To 
test the code, I run a trivial test in which a uniform tensor


Fatq [ q_point ] = 1,0.15, 0, 0, 1.05, 0,0, 0.1,1


is stored at all GPs. After refinement on 1 processor, all GPs of the new 
triangulation have the same tensor Fatq. Once running on 4 processor, though, 
a print of Fatqs at processor 0 shows the following:


Problem LargeStrainMechanicsSolver_OneField_WithRemeshing defined


    Reading material parameters from file ../input/mech_test_hex.materials ...

    Reading refinement parameters from file 
../input/mech_test_hex.msh_refinement ...  done


    Reading time discretization parameters from file 
../input/mech_test_hex.time_discretization ...  done



   Time = 0., step =        0

    Initialization

    Reading discretization from file ../input/mech_test_hex.msh ...  done

    Number of active cells:       8 (by partition: 2+2+2+2)

    Number of degrees of freedom: 81 (by partition: 36+18+18+9)

    Dirichlet faces: 24, Neumann faces (with non-zero tractions): 0, contact 
faces: 0


     NR it. 0, Assembling..., convergence achieved.

     Writing output...,     0.00 s. Elapsed time     0.02 s.


   Time = 0.0500, step =        1

   Refinement level: 0:

    Number of active cells:       8 (by partition: 2+2+2+2)

    Number of degrees of freedom: 81 (by partition: 36+18+18+9)

    Dirichlet faces: 24, symmetry faces: 0

    Dirichlet faces: 24, Neumann faces (with non-zero tractions): 0, contact 
faces: 0


     NR it. 0, Assembling...,     0.00 s, norm of residual is 
6034.853338302001248 Bicgstab , solver converged in 0 iterations,     0.01 s, 
updating q. p. data,     0.00 s.


     NR it. 1, Assembling...,     0.00 s, norm of residual is
0.102 residual / initial_residual    0.000, 
convergence achieved.


   Refinement level: 1:

    Refining the grid, refined and coarsened fixed number, limited the 
refinement levels, executed coarsening and refinement, displacements 
transferred, quadrature_point_fields_trans interpolated,


Fatq [ q_point ] =                    0,                    0,
     0,                    0,                    0,                    0,  
               0,                    0,                    0


Fatq [ q_point ] =                    0,                    0,
     0,                    0,                    0,                    0,  
               0,                    0,                    0


Fatq [ q_point ] =                    0,                    0,
     0,                    0,                    0,                    0,  
               0,                    0,                    0


Fatq [ q_point ] =                    0,                    0,
     0,                    0,                    0,                    0,  
               0,                    0,                    0


Fatq [ q_point ] =                    0,                    0,
     0,                    0,                    0,                    0,  
               0,                    0,                    0


Fatq [ q_point ] =                    0,                    0,
     0,                    0,                    0,                    0,  
               0,