Inhomogeneous periodic boundary constraints

128 views
Skip to first unread message

Alex Cumberworth

unread,
Feb 25, 2021, 10:45:25 AM2/25/21
to deal.II User Group
I need to implement periodic boundary constraints with inhomogeneities. From reading through the documentation and source code of the library, it seems that to do this I will need to modify the set_periodicity_constraints function in the dof_tools_constraints.cc file to also add an inhomogeneity. Is there a simpler way to do this that I missed that allows me to use the make_periodicity_constraints() function and then add the inhomogeneity after calling it?

To give some context, I am solving an elasticity problem that involves taking a beam, deforming it, and "glueing" together some of the faces (e.g. to form a ring -- I included an image of this in a previous post).

Any thoughts would be greatly appreciated.

Best,
Alex

Jean-Paul Pelteret

unread,
Feb 26, 2021, 3:09:22 AM2/26/21
to dea...@googlegroups.com
Hi Alex,

I can only give you a very brief answer right now: Using the AffineConstraints::set_inhomgeneity() method, you can add the inhomogeneity after constructing the homogeneous periodic constraints. If you're stuck trying to figure out which global DoF index you're wanting to set the inhomogeneity for, then there are some other posts on the group and information in the Wiki that describe some ways that you can
get that information. If you're still stuck, then let us know and I (or someone else) can try to give you some more details.

Best,
Jean-Paul
--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/777d38f4-bc4d-459d-aef6-63c35143997dn%40googlegroups.com.

Alex Cumberworth

unread,
Mar 3, 2021, 1:44:40 PM3/3/21
to deal.II User Group

Hi Jean-Paul,

Thanks for the response. I realize I should have specified that the values of the inhomogeneities that I would like to use are the differences in the two points that are being glued together. This means that when I set the inhomogeneity for a degree of freedom, I actually need access to all the degrees of freedom with non-zero weights in the line of the constraint involved. In the end, it seemed that the set_periodicity_constraints and make_periodicity_constraints functions are mostly about going through and figuring out which DOFs are being linked, so it seemed easier to modify those functions than to add the inhomogeneities after calling them.

I implemented the modifications for when the faces are at the same level of refinement, but am now having trouble with the solver not converging. My problem of bending a bar around to glue the faces together to form a ring does not satisfy the assumption of infinitesimal strain, so I have included the nonlinear strain term to use the Saint Venant–Kirchhoff model of elasticity, and am using Newton's method to solve the problem. I was able to solve the same problem by setting the boundary conditions directly, although I had to solve the problem in stages in which I updated the boundary to move along a spiral path to achieve convergence. With the inhomogeneous periodic constraints, I also try solving the problem in stages in which I slowly move from a homogeneous problem (the solution of which is no deformation) to the final inhomogeneous problem, although with a more direct path. However, with even the smallest inhomogeneity, after a few Newton iterations, the residual from the CG solver suddenly becomes nan.

I am wondering whether I have setup the constraints properly, particularly whether I have called the functions to condense and distribute the problem correctly. In the "Constraints on degrees of freedom" module, step 1 of the second approach under "Treatment of inhomogeneous constraints" involves calling distribute_local_to_global() during assembly. In my case, because I will calculate the right hand side again with the updated solution to calculate the residual, I have to call this on two occaions. However, in calculating the residual, I only need to assemble the right hand side, so I first tried using the second variant of distribute_local_to_global(), which takes only the local matrix (in addition of course to the local and global RHS vector) as an argument. In the description of the function, it says it is used for situations involving inhomogeneous constraints where the global matrix does not need to be assembled again, which seems to apply here. However, the assembly in the next Newton iteration, which uses the same solution vector (with the step size alpha=1), produces a different result (where it calls variant 9 of the function). Have I misunderstood the difference between these two functions?

In step two of the second approach under "Constraints on degrees of freedom", it states "Set the concerning components of the solution to the inhomogeneous constrained values (for example using AffineConstraints::distribute())". However, in the step-22 example cited for use of inhomogeneous constraints, the distribute method on the constraints object is only called after running the linear solver (which I understand needs to be done as well), not before. In my own tests, it seemed to make no difference whether I called before solving or not. Are the solution components being set in some other function then?

I also wonder if I am using the wrong solver, preconditioner, and/or sparsity pattern for my problem. However before I can address that it seems I need to check I have set the constraints up properly. I have for now stuck with the choices made in the early tutorial steps of SolverCG, PreconditionSSOR, and copying from a DynamicSparsityPattern object to SparsityPattern.

I have attached an example program for solving my problem, as well as the file with the modifications to the periodic boundary conditions functions. The main modifications to the periodic boundary conditions functions are on lines 310-314, where I calculate the difference between the position of the support points the DOFs are associated with and set the inhomogeneity for the current DOF. I did print out the values of the component being used, and this part at least appears to be correct.

Any further thoughts would be much appreciated.

Best,
Alex

solve-ring_nonlinear.cpp
modded_periodic_functions.h

Alex Cumberworth

unread,
May 4, 2021, 5:52:13 AM5/4/21
to deal.II User Group
I ended up getting it working, so in case anyone else is interested in doing something similar, I have attached updated versions of the previous scripts. I further modified set_periodicity_constraints so that it can take a function to set the inhomogeneity based on the values of the two support points associated with the two degrees of freedom that are being tied together, although it would need to be modified for more general use (the functions works on the difference of the two points, and further it uses only the absolute value of the difference in the x-component). I have also not made changes to allow for adaptive mesh refinement. I think this is a pretty ugly solution to the general problem of inhomogeneous periodic boundary constraints, but I couldn't see how to do it without modifying these functions without largely replicating them.

The issues mentioned in the previous post regarding distribute_local_to_global() and AffineConstraints::distribute() stemmed from a misunderstanding of exactly what these functions were doing, and have been fixed. It does seem that with these constraints, SolverCG does not work as a solver (I suppose the matrix is not symmetric anymore?), but either SolverGMRES or the direct solver SparseDirectUMFPACK work.

The script has also been improved based on other tutorials, and now includes parsing for a parameter file. I tried to include an example parameter file but I guess the mailing list has a restriction on allowable file types.

Best,
Alex

modded_periodic_functions.h
solve-ring_nonlinear.cpp

Jean-Paul Pelteret

unread,
May 5, 2021, 4:44:31 PM5/5/21
to dea...@googlegroups.com
Hi Alex,

I’m sorry that I didn’t find the time to contribute any further to our discussion. But I’m really glad to hear that you carried on experimenting and ultimately found a solution to the problem that you were facing. Thank you for sharing the solution with us. When I next have some time, I’ll try to look through the final code that you attached, and perhaps we can find a way to incorporate the modified function (in some form) into the library.

Best,
Jean-Paul

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/0c692129-a363-4d67-98a7-8c7e04ba3892n%40googlegroups.com.
<modded_periodic_functions.h><solve-ring_nonlinear.cpp>

Reply all
Reply to author
Forward
0 new messages