Drag Coefficient Calculation in version 3.0.5

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
ibrahimyaacob
Posts: 12
Joined: Tue Mar 17, 2015 7:28 am

Drag Coefficient Calculation in version 3.0.5

Post by ibrahimyaacob »

Hello,

I am new to code_saturne and I am using the version 3.0.5. I'd like to calculate the Drag coefficient of at the wall and the force acting on it as well. I have not found the term " Drag Coefficient" and "force" in the GUI but there is a term called efforts which I assume it to be force. However for the efforts, I realise that it only appears in the post processing only and not on the listing. I am also new to Paraview as well which i do not know how to extract values from the the post processing

my problem is.. how do i get the values of drag coefficient and the force acting on the wall to be appear in the listing. Please help me..

Thank You

Ibrahim
Yvan Fournier
Posts: 3105
Joined: Mon Feb 20, 2012 3:25 pm

Re: Drag Coefficient Calculation in version 3.0.5

Post by Yvan Fournier »

Hello,

I am not too sure about available examples, but you can call effort computation routines (see src/base/post_util.f90 in the code sources) in cs_user_extra_operations.f90, and sum/print what you need.

The post_efforts, post_efforts_normal, and post_efforts_tangential routines are also used in src/base/dvvpst, if you need to see how they are used (in this case, for the postprocessing you mentioned).

Regards,

Yvan
Brian Angel
Posts: 98
Joined: Mon Jul 22, 2013 12:53 pm

Re: Drag Coefficient Calculation in version 3.0.5

Post by Brian Angel »

Hello,

You can print the forces on the wall to the listing file using for example the user routine cs_user_extra_operations.f90. If you look in the EXAMPLES directory in the SRC directory located in the Code_Saturne directory structure where you are running your calculation, there are example routines shwoing how this can be done (for v3.2.1 of Code_Saturne there are two example routines coded and to print values to the listing file one can use "write(nfecra)").

To calculate the drag coefficient, this can also be done in cs_user_extra_operations.f90.

Best regards,

Brian Angel.
ibrahimyaacob
Posts: 12
Joined: Tue Mar 17, 2015 7:28 am

Re: Drag Coefficient Calculation in version 3.0.5

Post by ibrahimyaacob »

Thanks both of you for the reply, I have found the files cs_user_extra_operations.f90 in the SRC/REFERENCE directory and in SRC/EXAMPLE directory there's

1. cs_user_extra_operations-energy_balance.f90
2. cs_user_extra_operations-extract_1d_profile.f90
3. cs_user_extra_operations-force_temperature.f90
4. cs_user_extra_operations-global_efforts.f90
5. cs_user_extra_operations-parallel_operations.f90
6. cs_user_extra_operations-print_statistical_moment.f90

Like i said, im new at this and as i read the manual, it said that i must put the subroutine from the SRC/REFERENCE directory directly into the SRC directory after i changed the parameters.

My question now is what should i do with the examples? i reckon i should use the cs_user_extra_operations-global_efforts.f90 but still i have no idea how should i do this.

secondly, in the example, i have searched the term "drag coefficient" but i couldnt find it. What should i do again?

Thank You
Brian Angel
Posts: 98
Joined: Mon Jul 22, 2013 12:53 pm

Re: Drag Coefficient Calculation in version 3.0.5

Post by Brian Angel »

Hello,

The routines in the SRC/REFERENCE directory are to be used in the SRC directory once you have coded what you want to do. The routines in the SRC/EXAMPLES directory are there to give you an indication of what variables are available and how they can be coded.

If the coding in the routine in the EXAMPLES directory corresponds to exactly what you want, then you should be able to use this example routine directly in the SRC directory without having to do any coding yourself. All you will need to do is to change the example routine name to that in the REFERENCE directory, e.g. change cs_user_extra_operations-global_efforts.f90 to cs_user_extra_operations.f90.

For drag coefficient, you will need to code it. I'll have a look and come back to you with an example.

Best regards,

Brian Angel.
Brian Angel
Posts: 98
Joined: Mon Jul 22, 2013 12:53 pm

Re: Drag Coefficient Calculation in version 3.0.5

Post by Brian Angel »

Hello,

I forgot to add that another good way to search for variables and to better understand Code_Saturne is to look at the Code_Saturne programmers documentation. This can be found as follows:

- click on "Documentation" on the Code_Saturne home page
- then click on the link "Doxygen" in the "Documentation" panel
- below the title Documentation, click on the link "Doxygen Code_Saturne Documentation Link"

This last click will open up the "Code_Saturne Documentation" page. There you can search and find explanations for all the variables used by Code_Saturne as well as other very useful information.

Best regards,

Brian Angel.
ibrahimyaacob
Posts: 12
Joined: Tue Mar 17, 2015 7:28 am

Re: Drag Coefficient Calculation in version 3.0.5

Post by ibrahimyaacob »

Hello again

Brian, right now im no longer having problem in viewing the efforts in listing. Also i have found out Paraview can do the same thing without having to do the coding.

My current problem is that i wanted to calculate the drag coefficient.. How and where do i code the formula Cf = F/0.5*rho*A*v^2.

Also, I am confused about the effort, F, used in the formula.. From the post processing, code saturne return;

Efforts(x,y,z), Tangential Efforts(x,y,z) and Normal efforts..

Which one should I use in the Drag coefficient formula and how do I get the value of F?

Thank You
Post Reply