xcompact3d / x3d2

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

Add curl operator in solver #45

Closed semi-h closed 6 months ago

semi-h commented 6 months ago

I added two new vector operators

Also renamed original divergence -> divergence_v2p and gradient -> gradient_p2v to clarify that these are switching from vertex grid to pressure grid.

Had a quick chat with @slaizet and he pointed out that we actually check the divergence of velocity field at the pressure grid and divergence of velocity at velocity grid wouldn't be zero. So removing divergence_v2v as we don't see any use case for it.

semi-h commented 6 months ago

I dropped _v2v from the name of the curl subroutine. I realised that we have transeq, der1st, der2nd and so on all start on velocity grid and end on velocity grid. I think it is okay to omit _v2v everywhere, because its the primary grid and making it default makes sense. If we switch from p2v, v2p, or work on pressure grid directly (p2p), it is important to highlight this in the name.

pbartholomew08 commented 6 months ago

I dropped _v2v from the name of the curl subroutine. I realised that we have transeq, der1st, der2nd and so on all start on velocity grid and end on velocity grid. I think it is okay to omit _v2v everywhere, because its the primary grid and making it default makes sense. If we switch from p2v, v2p, or work on pressure grid directly (p2p), it is important to highlight this in the name.

Agreed, the main place where this came up in Xcompact3d was when doing the derivatives/interpolation from velocity to pressure and back again. These were marked v2p or equivalent, otherwise there was generally no marking. I think this gives a good balance between ease of reading and "self documenting" code. If felt necessary we can put comments/documentation about where the transeq and poisson equations operate.