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
[WIP] Modularize assembly #718
Conversation
{ | ||
template <int dim> | ||
void | ||
local_assemble_stokes_preconditioner (const Introspection<dim> &introspection, |
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.
is there a reason you go for SimulatorAccess for the Stokes system but Introspection for the preconditioner? I would prefer an identical interface.
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.
Fair enough. My guiding line was to ask for as little as I could get away with, but a SimulatorAccess
object makes things uniform. Will come up in the next patch iteration.
This looks really nice!
I see a point in the future where the simulator might be interested in querying certain information from each assembler, for example if they need certain information precomputed. I am thinking of asking each assembler which AdditionalOutputs object they need (this needs to happen before the material model is evaluated). Then it makes more sense to have instances of classes. Maybe we should go there immediately?
I would prefer similar interfaces. In fact, if we get rid of the separate scratch object for the preconditioner (is that really necessary?), preconditioner assembly and system assembly can be identical.
I am happy to leave that for a separate PR. There is assembly for the advection residual for entropy viscosity and we could also introduce a function for the non-linear residual (or are they identical?). I think it would be great to have this merged soon. We can always rearrange things into different files later. @jdannberg have you started playing with this for the melt transport? Let us know how that goes. |
I've given this a bit of thought over the past two days. Putting everything On the other hand, I think that the design will not allow the assemblers For similar reasons, I'm doubtful that we will gain much by inheriting one Finally, if I put everything into classes, I find it difficult to mix and Let me try something here.
I don't see that working. The assemblers just do things differently enough
|
Introduce a structure that contains signals that point to functions that do the actual assembly loop. The setup of scratch objects etc continues to happen at an outer level, but on every cell we then simply call each slot in the signal, and thereby add up terms as appropriate for an equation or approximation.
9fce192
to
816b823
Compare
This requires us to store a list of such objects somewhere. But it also allows us to remove the SimulatorAccess object from the argument list of these functions.
@tjhei -- I've updates the first commit with your smaller comments. The second commit restructures things so that for the complete equation, the assemblers are now wrapped in a class. This design does not require functions to be part of classes, but they are allowed to if it makes their design simpler. Do you like this better? |
431cb99
to
d6041df
Compare
I've pushed two more commits that now also convert assembly of the traction boundary condition and free surface terms. |
This requires making the FreeSurfaceHandler public in the Simulator class. If merged, I will move this class into its own header file at a later time.
@tjhei @bangerth I put everything I have so far here: https://github.com/jdannberg/aspect/tree/melt_assembly |
It is probably okay to put something like |
Yes, I like having a separate function for the face assembly. It would also make the melt assembler much shorter. And we need the |
On 01/17/2016 11:46 PM, Juliane Dannberg wrote:
I think you should put the melt terms into their own class, rather than put |
What's people's opinion on the current state of the patch? |
*/ | ||
struct Assemblers | ||
{ | ||
boost::signals2::signal<void (const double, |
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.
would it make sense to include the current cell also for the stokes preconditioner?
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 chose the minimal interface that works. All of these are internal interfaces and I suspect that we will adjust them as we use them more.
I have some smaller nitpicks, but I think we can move forward and merge it and then evolve the interface as we go. |
On 01/19/2016 07:46 AM, Timo Heister wrote:
Well, let me know what you want me to change. |
I just hit "merge".
|
Yes, @jdannberg and @gassmoeller and I just talked about the face assembly. I have a plan. Will do temperature/composition after that. |
In reference to #733. |
This is my second try, following #695.
The idea here is to introduce a structure that contains signals that point to functions that do the actual assembly loop. The setup of scratch objects etc continues to happen at an outer level, but on every cell we then simply call each slot in the signal, and thereby add up terms as appropriate for an equation or approximation.
The current patch is simply a strawman that just does this for the Stokes preconditioner and assembly. It seems to pass the first few tests on my machine, but that's not the point right now.
Points to discuss:
SimulatorAccess
object to them. I worry that if we create more complex assemblers, that they need more than what they get right now. On the other hand, this probably encourages a clean design where we use as little information as we can. What are people's opinions on free functions? I could as well declare a classCompleteEquations
(rather than a namespace) which we could then derive fromSimulatorAccess
. I'm not really sure we'd save very much this way, though.SimulatorAccess
orIntrospection
argument. I simplystd::bind
them inset_assemblers()
. This style allows me to define these functions with interfaces that differ by additionalconst
arguments that are known at the timeset_assemblers()
is run.