xcompact3d / x3d2

https://xcompact3d.github.io/x3d2
BSD 3-Clause "New" or "Revised" License
3 stars 4 forks source link

Add a new interface in backends for summing two fields #38

Open semi-h opened 7 months ago

semi-h commented 7 months ago

With #37 we have three distinct subroutines carrying out similar work, sum_yintox, sum_zintox, and vecadd. Just like we did in reorder subroutine we can combine all these into one interface with a switch statement.

backend%add(u, u_, SUM_Y2X)

we can make the switch statement optional so that if nothing is passed two arrays are summed without doing any reordering, resulting in the current vecadd.

The only thing is, we need this add to be able to scale u_ at least so that it can be used in the time integrator and also at the very end in the pressure correction step. I don't think we need this scaling option when we're adding a y or z oriented array into x. Given this is the case, is it better to have 2 interfaces, one combines sum_yintox and sum_zintox, and the other just deals with vecadd including scaling the input/output fields? Any thoughts?