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
Implement interior penalty discontinuous Galerkin method for temperature field. #661
Conversation
Hi Sam,
|
Hi Rene, thanks for your feedback! I've corrected the formatting above. On the question of DG for composition fields, are you suggesting all advection fields should use the same discretization, or that we should allow the user to pick and choose which fields are (dis)continuous? |
How do you handle assembly of face terms for faces on interfaces between processors (especially in combination with hanging nodes)? |
The layer of ghost cells provides the information on neighbouring cells owned by other processors. The issues that arise from the face-selection logic used in step-30 regarding faces on interfaces between processors are handled by modifying the face-selection logic for the case of equally-refined cells to rely on cell->id() rather than cell->level() and cell->index(). Have I missed another issue? |
On 11/04/2015 03:47 AM, Sam Cox wrote:
You can do it that way; or you could say that on faces between a locally owned |
@bangerth : the documentation stated id() takes O(level) time to compute - I guess subdomain_id() is known anyway - would it be worth changing to subdomain_id() then? |
Yes, that's likely more efficient. In the end you just need some kind of tie breaker; what exactly it is you do is not important as long as both processors agree on the procedure, so doing something cheap is better I suppose. |
I am asking because the logic is slightly more complicated with adaptive refinement, where you typically have to assemble coming from the finer cells. Using |
I think the current algorithm works, under a couple of assumptions:
A rough proof:
Essentially, in any case where the From what I can see, all the nasty cases being caught in LoopControl don't exist under the above assumptions, as it's been written for more general iterators and with more control over which faces are of interest. |
On 11/04/2015 10:56 AM, Timo Heister wrote:
The tie breaker is only necessary between cells of the same level. |
So, my thoughts on what might need cleaning up in this code: (1) Near-identical code in the equal-face and subface cases: Should this be cleaned up by a call to a function
(2) Removal of (3) On the issue of composition fields - there shouldn’t be too much of an issue, although the only terms needed from the faces in the composition field (due to lack of diffusion) are the convection-dependent terms, so there will be a good number of I am happy to implement the composition fields and will work on that in the next day or so when I get a chance. |
Hi Sam, |
My initial inclination would have been to either make all fields continuous or all discontinuous. But @gassmoeller is right -- people have (ab)used the flexibility of compositional fields in ways we could never have imagined, and keeping things flexible would allow to continue this tradition. If it isn't too much work, it might be interesting to leave it up to the user whether a field is cG or dG. |
Hi guys, sorry for leaving this hanging for such a long time - I had to go get my teeth into some theory for a couple of months! I've fixed a couple of bugs in the original implementation, so that compositions can now be treated as continuous or discontinuous. However, I've hit an issue in the implementation of the flexible approach (allowing different fields to have cG or dG). The issue I have is that if we allow two composition fields, one cG and one dG, then this starts to break a number of assumptions in the code. For example, Similarly, in I'm asking for advice - is this the right way to go, or is there a better way? |
Thanks for coming back to this. You are right, the individual selection seems to cause more problems than I expected. Since the individual selection is a feature that is not needed right away, would it be much work to implement your new additions in a way that allows for flexible selection of discontinuous fields, but enforce either all fields being selected as discontinuous or none, for now? |
If that is also causing much trouble, then I would say let us just go
with the all continuous / discontinuous fields for now and lets worry
about the mixed case when somebody actually needs it.
I think that makes sense.
|
Ok, I think I have a (nearly) finished product! I haven't yet added any test cases. To do. Any pointers on that front would be welcomed. Let me know what needs tidying up - otherwise, I think this is about ready to go, from my POV. I also haven't added anything to the manual yet - from a quick run through, I think it might be worth mentioning this in §2.9 Numerical methods: Accurate discretizations, as well as §5.1.2: Parameters for certain aspects of the numerical algorithm. The two parameters |
/run-tests |
The overall structure looks good, it should also be compatible to the new structure of the advection assembly (as a follow-up to #718 for the Stokes system. @bangerth: This patch needs face terms similar to #722 but for the Advection equation). I do not feel competent enough to review the math of the patch, but I guess we need a benchmark and tests for that anyway. I will leave a few minor comments in the code, but I think it might be worth merging this soon (when it compiles) to not block the restructuring of the assembly by @bangerth. Essentially so far nothing old has been changed, only the new functions are missing tests and documentation, so nobody will use it yet 😄 |
@@ -1043,7 +1062,7 @@ namespace aspect | |||
*/ | |||
void | |||
compute_material_model_input_values (const LinearAlgebra::BlockVector &input_solution, | |||
const FEValues<dim,dim> &input_finite_element_values, | |||
const FEValuesBase<dim,dim> &input_finite_element_values, |
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 think this change will be merged into the developer version with #723 soon anyway, will be removed during the rebase before merging.
The issue with the quadrature is in fact not that it's not possible to create a quadrature rule with no points, but that it's not possible to create a FEValuesBase object with such a quadrature formula:
I think that's actually quite reasonable. What do you think of the following proposal: While the scratch objects have member variables for the This should avoid the error above. |
I would be happy to require 8.4.0 after the next ASPECT release but I would prefer the next ASPECT release (soon!?) to be at 8.3 or 8.2.1. I think using a |
I've implemented the shared_ptr method. Let me know what you think! It all seems to work locally - just waiting for the tests to run here. Re the errors for 8.2.0: It also didn't work in 8.4.0 either, I just hadn't tested it enough locally :) |
OK, great. Let me look through it one more time. In the meantime, would you mind squashing the 27 commits into one? |
|
||
local_dof_indices (finite_element.dofs_per_cell), | ||
neighbor_dof_indices ((field_is_discontinuous ? GeometryInfo<dim>::max_children_per_face | ||
* GeometryInfo<dim>::faces_per_cell : 0), |
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.
Please break these lines (starting at line 368) differently so that an expression in either of the branches does not unnecessarily crosses lines. Maybe like
field_is_discontinuous
?
...
:
0
?
I had only two really minor issues left. Please address them, squash everything, and then this is ready to merge! I really appreciate all of the work you've put into this, and your patience with both my slowness in getting this reviewed and with addressing all of the comments I've had. Many thanks, @spco ! |
@@ -240,8 +265,18 @@ namespace aspect | |||
* that correspond only to the variables listed in local_dof_indices | |||
*/ | |||
FullMatrix<double> local_matrix; | |||
std::vector<FullMatrix<double> > local_matrices_int_ext; |
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.
can you add a comment what these matrices are? What is the length of the vector?
Sorry for only looking at it now. Looks good except my minor comments above. |
Thanks for your comments @bangerth and @tjhei . I've addressed all the issues apart from that of averaged material_model_outputs. On that front, there are |
Yes, taking the maximum makes sense. 👍 |
c0901e2
to
2d1e9b3
Compare
…ure and composition fields. Includes 2 tests.
2d1e9b3
to
74289d9
Compare
Right, all tests have finally passed! |
Implement interior penalty discontinuous Galerkin method for temperature field.
I've hit the "merge" button so we can get on with the other patches that were queued up after this. @spco -- would you mind adding an entry to @tjhei -- what was your take on averaging? We can do this in a follow-up patch without having to hold this further up. @jdannberg and @gassmoeller -- if you want, go ahead and also put the advection assemblers into the signals format. |
The correct thing to do would be to average, even if the assembly here takes the maximum of the values in a single quadrature point.
Can you take a look at #751 before we continue with modifying the other assemblers? |
Some related discussion is in #808. |
Hi guys,
This is my implementation of IPDG for the temperature field, as discussed a couple of months ago. There are several TODOs around, which may need some tweaking, but I'd rather show you what I have for now so you can feedback.
A brief overview:
parameters.use_discontinuous_temperature_discretization
is the control variable (defaults to false).When
parameters.use_discontinuous_temperature_discretization==true
:(1) Set temperature to use
FE_DGQ
instead ofFE_Q
insetup_fes()
.(2)
DoFTools::make_flux_sparsity_pattern
is called insetup_system_preconditioner()
andsetup_system_matrix()
.(3) Dirichlet-type boundary constraints are skipped in
compute_current_constraints()
- we impose boundary conditions weakly(4) Face terms are calculated via
local_assemble_advection_face_terms()
at the end oflocal_assemble_advection_terms()
.(5) Face-term local matrices are added into
system_matrix
.(6)
compute_viscosity()
returns zero (no stabilisation desired)Changes I’ve had to make:
compute_material_model_input_values()
now takes anFEValuesBase
object as argument to allow passing ofFEFaceValues
andFESubfaceValues
Scratch::AdvectionSystem
now has a number of members to hold data from the faces, and its constructor requires a quadrature object for the faces.CopyData::AdvectionSystem
has vectors of local matrices to hold the internal-external, ext-int and ext-ext pairings (each element of the vector holds a matrix associated with each face or subface). A new memberlocal_neighbor_dof_indices
holds vectors of dof indices for each face (or subface) of the cell.Any feedback gratefully received, particularly re whether these changes to
AdvectionSystem
are acceptable. I've tried to keep to the current style as far as I can - there's probably a lot of indenting tweaks needed, but I can do that later. I haven't done anything to attempt to optimize behaviour, e.g. minimising the number of local int_ext etc matrices by pre-calculating face/subface counts or various other parts as I don't know what returns we'd get.I haven't included any DG parameter files - should these be included, eg convection-box-dg.prm?
Sam Cox