Conversation
Adds diagnostics to print where a value is being used, if it is modified after use. Amjuel reactions and CX don't need velocity boundary conditions, so GET_NOBOUNDARY can be used. This allows the velocity boundary condition to be set after the reactions.
Loops over both lower and upper boundaries while calling a user-supplied lambda function. This removes duplication since a boundary condition only needs to be implemented once rather than twice.
Work in progress. Runs but not properly tested. Sets the parallel flow at the wall so that the combined flow into the target is zero, using a constant neutral pressure gradient. This allows a net flow along the target. An alternative would be to set e.g. a Neumann condition on the parallel flow, and use that to set the neutral pressure gradient at the wall.
IS_SET marks the boundary as used, but density boundary is not needed. Use IS_SET_NOBOUNDARY instead.
If toroidal_slip is true (the default), set the parallel flow to a Neumann boundary condition. Use the flow velocity to calculate the pressure gradient needed to create a perpendicular flow that cancels the net flow into the target.
There was a problem hiding this comment.
I'd like to make sure I fully understand this. How come using get prevents setting a velocity BC after the reactions? And what is the difference between get and GET_VALUE in general?
There was a problem hiding this comment.
Hey @mikekryjak ! The idea is to prevent quantities from being modified after they are used. When get is called it sets two attributes: "final" and "final-domain"
https://github.com/bendudson/hermes-3/blob/master/include/component.hxx#L117
When set is called it checks if these attributes have been set:
https://github.com/bendudson/hermes-3/blob/master/include/component.hxx#L231
To allow quantities to be used in the domain before boundary conditions have been applied, there is getNoBoundary that only sets the "final-domain" attribute:
https://github.com/bendudson/hermes-3/blob/master/include/component.hxx#L183
This allows setBoundary to set the boundary because it only checks the "final" attribute:
https://github.com/bendudson/hermes-3/blob/master/include/component.hxx#L261
In this case the boundary condition on velocity depended on the collision frequency, and the collisions component used the velocity to calculate friction terms, but only in the domain. When collisions are calculated it therefore should use getNoBoundary, which will allow a boundary to be applied later but prevent the values in the domain from being modified.
Both get and getBoundary have an optional second argument location. This is a string that is included in the error messages from set and setBoundary. These tell the user where the quantity was used; otherwise the user just has to guess which components are in the wrong order. The easiest way to set that string is to use GET_VALUE and GET_NOBOUNDARY. These combine the name of the file and the line number where they are run, passing this as the location to get:
https://github.com/bendudson/hermes-3/blob/master/include/component.hxx#L163
There was a problem hiding this comment.
Wow, I'm glad I'm learning about this! I think we need to put this in the docs under a new section called "Developer manual" or similar. I raised an issue: #299
The perpendicular momentum of parallel momentum should be separate from the parallel viscosity term.
Allow parallel flow into the target, by setting the component of the velocity into the target to zero. This is a combination of the parallel flow and perpendicular flow.
Sets a Neumann boundary condition on the parallel velocity, and calculates the perpendicular velocity (i.e. neutral pressure gradient) at the target such that the net flow into the target is zero.
MK comments
Here is my understanding of how this boundary condition works: