I would like to try to modify a solver in order to be able to generate a moving source term inside a domain.

In details, I would like to create a transient solver, add vorticity at some point in the domain, and move this point with respect to time on a prescribed trajectory in my domain.

Does anyone have an idea on how to proceed to realize something like that?

One way to accomplish this with a minimum of C++-programming would be swak4Foam. See transient source term for an example on how you have to modify the solver in two places and then use any function for the source term

I downloaded swak4Foam, installed it. I also modified pimpleFoam in order to be able to add a momentumSource term. Now I have to find the way to create an expression which will create me some swirl in my domain!

Is it possible to recreate this cellSet every time step or every "n" time steps? Let say I want to define a plane in my domain on which I want to define some parameter, and I want to make this plane move with respect to time. Is there a way to do that? How would you proceed?

Is it possible to recreate this cellSet every time step or every "n" time steps? Let say I want to define a plane in my domain on which I want to define some parameter, and I want to make this plane move with respect to time. Is there a way to do that? How would you proceed?

I've played with the idea, but havn't implemented it yet. It shouldn't be too hard to implement. Reason why I havn't done so is a) I never needed it until now b) if another program (functionObject or solver) that isn't aware that a cellSet might change its size uses this then this feature would have the potential to create segmentation faults.

Where would you use that cellSet? If it is the region where you want your source term defined then the (required) "condition" parameter is exactly what you need. If you want to modify an existing field in memory then the manipulateField-functionObject (which has a similar condition) might be your friend

Don't really look at the values, they are only for testing.
With this dictionnary, I managed to add a source term moving in my field. The problem is that I face a constraint which is the size of my mesh. You see I use the condition "pos().z<=Z+0.01 && pos().z>=Z-0.01" to impose my source term. The "+-0.01" is comming from the size of my cells which are 0.01m. If I use a smaller value, the source term is null everywhere in the field. But this way I capture two cells.

The problem is that with this value, my term jumps from one cell to the next one, and I would like to get something smoother.
I will try to make a small movie to show you if needed.

Don't really look at the values, they are only for testing.
With this dictionnary, I managed to add a source term moving in my field. The problem is that I face a constraint which is the size of my mesh. You see I use the condition "pos().z<=Z+0.01 && pos().z>=Z-0.01" to impose my source term. The "+-0.01" is comming from the size of my cells which are 0.01m. If I use a smaller value, the source term is null everywhere in the field. But this way I capture two cells.

The problem is that with this value, my term jumps from one cell to the next one, and I would like to get something smoother.
I will try to make a small movie to show you if needed.

I understand the problem, but I fail to see how a cellSet would help here.

I think one solution could be to have instead of the step you're using a smoother function that covers more cells but drops of quite quickly to 0 outside of the region of interest (something that looks like a Gauss-function. I'll call it like that)

Steps would be
1. Calculate "Gauss"
2. Volume-integrate it and compare to the desired integral (due to the discretization it won't be exactly the same)
3. Scale whole Gauss so that it fits the integral
4. Use as source term

The scaling takes care of the "now you see it, now you don't"-effect you described above

The continuous nature of the function makes sure that cells do not immediately switch from no-source to full-source (in time) which may lead to weird behaviour at the "boundary" of the source

or is there a way to directly add Uy and Uz induced by my vortex to my flow field?

There is an object forceEquation in swak that allows you to fix the values in a certain region (see the interFoamWithFixed-example). Of course doing that has to be done with care as it may lead to situations were conservation is violated.

The problem I see for your application is that you want one component of U to be "free". That is currently possible (I'm not totally sure if it is even feasible without a lot of dirty workarounds)

Yes the basic idea is just that I want to add some velocity to my velocity components in one plane, here Vy and Vz. The other component is usually 0 unless I impose a inlet value in my domain.

I will have a look at the forceEquation.

The momentumSource as I have added it in the equation above is supposed to be a massic force, right? I am currently adding some kind of vector which qualitatively makes the flow spin as want it to spin. But I have not found the physical equation allowing me to define mathematically the value of this source term based on the circulation for instance.