-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable hanging nodes for continuous Galerkin discretizations #506
Enable hanging nodes for continuous Galerkin discretizations #506
Conversation
@kronbichler the lengthy comment in commit f02f2c1 is kind of a summary of our discussion from #386 (... or what I took home from this discussion). Could you have a look at this commit? |
I think I have to resolve #507 first, because we need the separate dof-index and integrator also in |
069793a
to
2a4ea23
Compare
…ction evaluate_add()
…ity problems (used by rhs_add() function for example)
…ta. OperatorBase::rhs() does.
The code seems to crash in An error occurred in line <7847> of file </home/code/dealii/include/deal.II/matrix_free/fe_evaluation.h> in function
void dealii::FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number, VectorizedArrayType>::evaluate(dealii::EvaluationFlags::EvaluationFlags) [with int dim = 3; int fe_degree = -1; int n_q_points_1d = 0; int n_components_ = 1; Number = float; VectorizedArrayType = dealii::VectorizedArray<float, 8>]
The violated condition was:
this->dof_values_initialized == true
Additional information:
(none) What about the TODO here: exadg/include/exadg/operators/operator_base.cpp Lines 432 to 448 in 980cc10
The line with |
The code inside deal.II is complicated, because it tracks down the constraints and computes their influence on the local degrees of freedom, doing a long preparation https://github.com/dealii/dealii/blob/3bba74760bff6724e1766bf22e4ee06eaf98bfc1/include/deal.II/matrix_free/tools.h#L422-L854 and then https://github.com/dealii/dealii/blob/3bba74760bff6724e1766bf22e4ee06eaf98bfc1/include/deal.II/matrix_free/tools.h#L872-L908 to extract the entries. I recently rewrote around 300 of the 500 lines of that code in dealii/dealii#15135 and dealii/dealii#15147 because the initial implementation was performing poorly - the details are not so important, but it shows that re-writing this in ExaDG is probably not a good idea. I see two options here:
unsigned int last_cell = numbers::invalid_unsigned_int;
dealii::MatrixFreeTools::
compute_diagonal<dim, -1, 0, n_components, Number, dealii::VectorizedArray<Number>>(
*matrix_free,
diagonal,
[&](auto & integrator) -> void {
if (last_cell != integrator.get_current_cell_index())
this->reinit_cell(integrator, integrator.get_current_cell_index());
... and this way only call it once per cell, not once per column. We still use another evaluator here, but that one is hidden inside I usually do not like lambda functions, because they are also complicated for a user to understand. But here it might make sense to go down that way because it is a bit cleaner for ExaDG nonetheless in my opinion. |
We should only do it once per cell and not once per column. So the lambda function I was thinking of would be called by the deal.II code only once per cell, just as Overall this is in line with my general design ideas/wishes regarding generic marix-free operators: The user wants to specify (i) |
Yes indeed, this is what one would like to have, fully agree. |
I would like to avoid the above variant with |
…us Dirichlet boundary data (initial acceleration data)
…:MassOperator and shift functions for initial acceleration from FieldFunctions to BoundaryDescriptor
@kronbichler I wonder why the tests have passed in PR #508 given that the line with |
…earOperator::integrator_lin with correct dof_index (the one for the linearization vector with inhomogeneous Dirichlet data)
@kronbichler I think I resolved the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mostly agree with this PR. Below, I list some cosmetic changes, plus some code design issues regarding the setup of constraints, plus one discussion as a point of documentation.
Note that the utility functions introduced in c3dc80b could also be used to avoid code duplications in the multigrid implementation. However, I suggest to do this as a follow-up PR (since this might touch many files). |
*this->grid, | ||
dof_handler); | ||
|
||
affine_constraints_periodicity_and_hanging_nodes.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line seems to have introduced a bug in debug mode, see PR #535, since we later call copy_from
and then add additional constraints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution is to call close()
in the end once all the constraints have been added (which somewhat hinders writing modular code ...)
This PR aims to realize local refinements / hanging-nodes for continuous Galerkin discretizations for nonlinear problems (e.g. nonlinear structural mechanisms) with special requirements in terms of constraints / inhomogeneous BC as discussed in issue #386.
closes #386
closes #446 (@bugrahantemur please take a look at the changes and let me know if you do not agree)
TODOs:
introduce secondAffineConstraints
object forPoisson
spatial discretization (which is the second case of continuous Galerkin discretizations in ExaDG apart from theStructure
module; other modules use continuous Galerkin only inside MG, which is unproblematic since the operators used in MG preconditioning are always homogeneous)set_inhomogeneous_boundary_values()
will be removed fromOperatorBase::evaluate()
functions. Make sure that all modules currently calling these functions are adapted accordingly.initializedof_index_inhomogeneous
with an invalid number and make sure that a correct value has been set whenever usingdof_index_inhomogeneous