Thanks for such amazing codes. I am a beginner and have some questions about preCICE. Specifically, I would like to create a new variable (let’s name it G). G is calculated by the velocity from my solver and OpenFOAM. For instance, read and write G_mysolver and G_OF. I am confused about how could I realize this. It seems like what I could do in the present solver is read and write velocity. My current idea is read velocity from two solvers and calculate Q in codes of preCICE-OF adapter? Does this correct or there is a better method to realize this?
Hi,
Thanks. For instance, let’s set G_OF=u_OF-u_solver and G_solver=u_solver-u_OF. G will be added as a source term in the NS equation. I think what I could do is create a new variable repo to store u_ and couple them. Then calculate G in solver rather than in PreCICE.
To add a new variable to a custom OpenFOAM solver (independent of coupling), you can typically add it to your createFields.H file of the solver. If you register it to the objects’ registry, then you can modify the OpenFOAM adapter to read/write to that.
Unfortunately, you do need to modify the adapter at the moment to do that. We don’t yet support specifying arbitrary fields in the configuration to couple them, but it’s in our long-term plans.
Note that, the current documentation only covers surface-coupled fields. It you want to couple a new field in the complete domain, let me know. We will have some documentation and examples on that soon.