I used two methods to define the fluid density and viscosity expressions: FORTRAN user routines and MEI expressions. By comparing the results, both methods actually have the same effect. Because I already talked about the first method in the previous tutorial post, I focus on the second one here. Before following, make sure you read "Installation of Code_Saturne 2.0-rc1 on Ubuntu 9.10" and installed 2.0-rc1 with MEI properly.
With the SaturneGUI program, when using 'Physical properties > Fluid properties' to define fluid properties, we have options 'constant', 'user law' and 'user subroutine(usphyv)'. If the property is a constant, fill a value below as a reference value. If select 'user law', MEI expressions can be inputted by clicking the following edit button. Finally, as mentioned previously, the option 'user subroutine' is for using FORTRAN routines to define the properties.
Click the edit button, and see a dialog as the figure below shows. I input a simple density expression as an illustration. Actually there are three tabpages here and the third one also contains an example. TempC is a pre-defined variable, which can be looked up from the second tabpage 'Predefined symbols'. Most operators like +, -, *, /, and ^ can be used, and even simple statements like if ... else can be applied.
Then we don't need to define the temperture dependent density in FORTRAN user routines any more. Obviously this MEI method is more straightforward. I don't say more about the viscosity part, because it is almost the same.
Re-use density value when calculating dynamic viscosity
Dynamic viscosity is the product of density and kinematic viscosity . Sometimes when only a kinematic viscosity expression is available, we need to calculate the dynamic viscosity value with the help of the correlation, .
When using FORTRAN user routines of Code_Saturne, it is possible to realise the correlation directly, which actually implies the previously calculated density value could be read for the viscosity calculating part to use. However, on the other hand, within MEI we don't have a pre-defined symbol, for example rho, to express density when defining a dynamic viscosity mu, and thus we have to expand the rho expression with its original and complicated form into the mu definition expression.
Fortunately, Alexandre gives a patch to implement the idea (see the conversation). After apply the patch accordingly, re-compile ncs, a pre-defined variable rho can then be used for the mu definition. I tested the patch and it works properly.
Post-processing with ParaView
In order to judge whether both methods yield the same effect, the calculation results are analysed. If select to export results into 'EnSight Gold' format, ParaView is going to be used.
ParaView is a cross-platform tool to perform post-processing of numerical simulations. For a beginner I guess it slightly confusing about the mouse controls to move its camera view; at least for me it was true. Actually, select the menu item 'Edit > Settings...' and in the 'Options' dialog ship into the category 'Render View > Camera', can find and modify the controls.
It is not difficult to use ParaView to see the surface plot of a specific parameter, for example, temperature. Select the cell data TempC from the toolbar and the view can then be like this:
From the picture we can see the development of the thermal boundary layer attched to the top and the bottom surfaces of the channel. From the legend the temperature range is found to be 50 to 91.7293 degree C (50 degree C is the inlet temperature), which actually implies the density and viscosity ranges. With MATLAB I estimated them.
>> TempC = [50, 91.7293];
>> rho = 895 ./ (1 + 6.5e-4 .* (TempC - 20))
rho =
877.8813 855.1304
>> visc = rho .* (0.75857 * (1.8 .* TempC + 32).^-2.34)
visc =
0.0087 0.0028
Select the data Density and LamVisc in ParaView and see their ranges are 855.12872 to 877.88129 and 0.0027963 to 0.0087367, respectively. They match the results given by MATLAB very well expect the density at 91.7293 degree C, for which there is a very small error, 0.0002%. Thereby, we are happy to see Code_Saturne correctly used the parameter expressions as we expected.
Meanwhile, I compared the results from MEI and FORTRAN user routines, and found their results match exactly, which could imply they have the same effect.
Velocity development along the centreline
Using the filter 'Plot Over Line' we can examine the fluid flow velocity along the centreline of the 2D channel.
Apparently, the velocity rises rapidly at the beginning stage of the channel flow, and then gradually falls. The rise stage is actually within the entrance distance for the flow to be fully developed. On the other hand, the gradual reduction is because of the temperature dependency of the fluid viscosity, as discussed in the previous post "CFD tutorial: laminar flow along a 2D channel - Part I".
hello
ReplyDeletei am also trying same problem my problem is
laminar flow over backward facing step
by using SIMPLE method i write the code for SIMPLE but it not working some time i dont know where is the problem so please help me
Hi Pashya,
ReplyDeleteIt is quite possible to follow the example I wrote here to solve a backward facing step case by using SALOME and Code_Saturne. Do you mean you have to write your own code and you already wrote it?
What is the problem practically? Can you give more details?
Regards,