Page 1 of 1

Advice on solving convection-diffusion equation

Posted: Tue Aug 20, 2024 11:51 am
by ibartol
Hi all,

I need to solve the transport of a scalar in blood flow and determine its concentration in different regions over time. I have a few ideas on how to approach this problem, which I've outlined below, but I would appreciate some external input from the code maintainers on what might be the best approach. To obtain the velocity field, I will use the solution provided by svSolver. I assume this is a diluted problem, so there is no feedback from the scalar T to the fluid.

The transport equation I am looking to solve is the following: (I think mathjax is not supported)
[math] \frac{\partial T}{\partial t} + \nabla \cdot (\mathbf{u} T) - \nabla \cdot (D_T \nabla T) = 0 [\math]

This is the simple convection-diffusion equation without sources. The methods I am considering to solve this problem are:
  1. Convert the VTU solution to OpenFOAM-readable files and use scalarTransportFoam: This would involve solving the problem at each time step using OpenFOAM. However, it will require some work on setting the boundary conditions appropriately.
  2. Discretize the equation using a finite element approach: I could implement the solution using VTK in C++ or Python. I believe there are tutorials and papers available on this formulation and how to implement it for unstructured meshes.
  3. Implement the solution for the transport equation directly in svSolver: This option would require some guidance from the developers on how to proceed and which files to focus on. Additionally, I have no experience with Fortran programming, so I would need to learn the language. Despite this, I believe it would be the most beneficial option for the community in the long run.
I think this could be a valuable feature to implement in the future. I have compiled svSolver from source, so I am willing to contribute something directly to the solver and test it out. However, it will likely take me a month or so, given that I am completely new to Fortran. I would appreciate hearing your feedback on this and any suggestions you might have for approaching this problem. Perhaps you have a better idea!

Thanks a lot!

Best,
Ignacio

Re: Advice on solving convection-diffusion equation

Posted: Wed Aug 21, 2024 6:21 pm
by davep
Hi Ignacio,

The svFSIplus code has support for an advection-diffusion equation, see the dye_AD example.

To simulate convection set the Coupled parameter to true

Code: Select all

<Add_equation type="scalarTransport" >
   <Coupled> true </Coupled>
...
</Add_equation>

Btw, any new solver development should be done in the svFSIplus code. The svSolver code will be archived soon.

Cheers,
Dave

Re: Advice on solving convection-diffusion equation

Posted: Thu Aug 22, 2024 7:01 am
by ibartol
Great! Thanks a lot for your answer. I was not aware of that solver, so thanks for pointing that out! I will switch to svFSIPlus then.

Also, while I was working on a VTK script to convert .vtu and .vtp to OpenFOAM readable meshes and velocity fields, I thought of something that may be of interest. I will open an issue on simVascular because I think it's a bug according to the guidelines of the Forum.

Thanks again!

Best,
Ignacio