Use input field/vector location for CELL_DEFAULT in vecops - #1293
Conversation
Now consistently treats CELL_DEFAULT
| TRACE("Grad( Field3D )"); | ||
|
|
||
| if(outloc_x == CELL_DEFAULT) | ||
| if (outloc_x == CELL_DEFAULT) { |
There was a problem hiding this comment.
I think this might be dangerous, currently assume that either all components are at the same location or all are staggered in direction of component. Here we're allowing some to be set from input field and others to set from argument.
There was a problem hiding this comment.
I realise you're not changing this but thought I should flag!
There was a problem hiding this comment.
Yes, I think it's probably weird to consider a vector with components at different locations, I'm not sure when you would want that. So I don't really know what use-case this overload is for.
There was a problem hiding this comment.
I think it's for the single location overload taking CELL_VSHIFT to set things in the staggered in each direction case. I think we'd like the three location overload to be hidden if this where possible, or possibly just have the two things merged.
There was a problem hiding this comment.
Ah, I see! Yes, maybe we just shouldn't expose this as part of the public API
EDIT: and similarly for the other three location overloads
There was a problem hiding this comment.
Yup, maybe with an ASSERT for further safety?
|
Sounds like This PR is the minimal set of changes to make vecops not completely broken. This is blocking for v4.2, as elm-pb won't run without it, so I'd like to get this in and try and fix vecops properly in either 4.2.1 or 4.3 |
| outloc_x = f.getLocation(); | ||
| if(outloc_y == CELL_DEFAULT) | ||
| } | ||
| if (outloc_y == CELL_DEFAULT) { |
There was a problem hiding this comment.
As above, can we just pass this through?
|
We need to make sure "top-level" checks take into account if staggered grids are actually be used |
coordinates. Replaces throw with ASSERT
|
A further issue here -- routines like |
Ensure location of result set in vecops routines
|
#1308 (into this branch) attempts to fix some of these issues. |
Currently impossible to handle
…ult-more-pass-through Vecops consistent cell default add more checking on location
|
I'm happy with this. @johnomotani you're basically in charge of staggering code at this point, do you want to sign off on this? |
|
|
||
| /// Advection of a scalar field \p f by a velocity vector \p v | ||
| /// | ||
| /// Both vectors must be at the same location, which cannot be CELL_VSHIFT |
There was a problem hiding this comment.
This should say 'The vector and the field must...'.
| result += FDDZ(metric->J*vcn.z, f, outloc); | ||
| result = FDDX(metric->J * vcn.x, f, outloc); | ||
| result += FDDY(metric->J * vcn.y, f, outloc); | ||
| result += FDDZ(metric->J * vcn.z, f, outloc); |
| Field3D result(localmesh); | ||
| result = FDDX(metric->J * vcn.x, f, outloc, method); | ||
| result += FDDY(metric->J * vcn.y, f, outloc, method); | ||
| result += FDDZ(metric->J * vcn.z, f, outloc, method); |
Also clarify that Div cannot have outloc == VSHIFT
Not currently supported, as it would involve "cross-staggering" terms
|
@johnomotani That should be everything fixed now! |
Some operations used
CELL_DEFAULTto meanCELL_CENTRE, others used it to mean use the input field/vector location, others didn't handle it at all. Now all vector operations use it to mean use the input field/vector location.