February 26, 2015

Convection and diffusion, transport equations in OpenFOAM

26.2.15 Posted by Florin 1 comment
In the CFDPython series I showed the components of the Navier-Stokes equations and I've solved them one by one; this helped a lot in understanding the complexity of the momentum equations.
In this post I will show the effects of diffusion and convection in a passive scalar transport problem solved with OpenFOAM. The domain and mesh is taken from the shock tube problem.
The scalar is initiated with zero everywhere but for a 1 m strip at the middle of the domain, where the scalar has value 1; initialization is made with the setFields dictionary.
The required files for this type of analysis can be copied from the scalarTransportFoam tutorial, but need some editing.
The transport equation for this scalar is the following:
in which the first term in the left hand side is the time derivative of the scalar which accounts for the change in time. The second term in the left hand side is the convection term; this accounts for the transport of the scalar due to the velocity of the fluid. The right hand side is the diffusion term; this is the transport due to scalar concentration and will make the scalar to spread from high concentration to low concentration even with zero velocity; DT is the diffusivity constant and controls how fast will the scalar spread in the domain.

In the next section we see this equation solved with different values of velocity and diffusivity; choosing the velocity to be zero, we will solve only for diffusion; making the diffusivity constant zeros, we will solve only for the convection. All simulations run for 5 seconds.

Diffusion only: u = 0 m/s, DT = 0, 1e-4, 1e-2, 1 m2/s
The scalar gets transported in the domain even if the fluid is motionless; the first case can be seen as the initial condition; in the last case the diffusion is so strong that the scalar is less than 0.25 in the whole domain.

Convection only: DT = 0 m2/s, u = 0, 0.25, 0.5, 1 m/s
The scalar is moved in the domain with the speed of the fluid; the first case can be seen as initial condition; notice that as the scalar is moved, there is a smearing similar with the diffusion seen above; this is called numerical diffusion by CFD developers but this is actually a numerical error; the second thing to notice here is that the higher the speed, the higher the numerical error.

Convection and diffusion with diffusivity 1e-4: u = 0, 0.25, 0.5, 1 m/s
Here we have both diffusion and convection; the diffusivity constant is 1e-4, but if you compare these results with those from convection only, no apparent difference can be seen; this is because the numerical diffusion is bigger than the actual diffusion; if such problems arise special discretization schemes must be used in order to eliminated the numerical diffusion.

Convection and diffusion with diffusivity 1e-2: u = 0, 0.25, 0.5, 1 m/s
This time the actual diffusion is bigger than the numerical diffusion and the error is not apparent.

I hope this post helped you gain a better understanding of the Navier-Stokes equations and its components; if you have any questions or observations, please leave a comment below.





1 comment:

  1. Please, haw can'I modify the transportProperties dictionary if the diffusivity is different for first middle of the domain (say 0.01) and the second (say 0.02).

    ReplyDelete