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,