time ave. of velocities with turbomachinery module active

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
vgm567
Posts: 17
Joined: Tue Oct 14, 2014 3:51 pm

time ave. of velocities with turbomachinery module active

Post by vgm567 »

Hi,

I am having trouble trying to calculate the time moments of the relative velocities for my case (which uses transient turbomachinery model). I have included the relevant function as per Example 5 from doxygen in cs_user_parameters.c. However I find that when the following line

Code: Select all

const cs_rotation_t *rot = cs_glob_rotation

is executed the variable rot doesnot contain the correct values for omega and axis but zeroes for both. I have called the function rotation_define in cs_user_parameters.f90 to provide my values for rotation vector and invariant point. I even tried placing the cs_rotation_define function within the time-moments code. Please see my attached src files and listing.

(FYI, the simulations run fine and only calculating these particular moments is the issue).

Apologies in advance if this problem is trivial (as I am not very proficient with C).

Many thanks,

Michael
Attachments
src_tmom.tar
(190 KiB) Downloaded 191 times
Yvan Fournier
Posts: 4082
Joined: Mon Feb 20, 2012 3:25 pm

Re: time ave. of velocities with turbomachinery module activ

Post by Yvan Fournier »

Hello,

When using the transient turbomachinery model, you should not call define cs_rotation_define in your user functions (as the rotation is already defined using the rotor-stator model).

Note that a bug relative to time moments starting at times other than zero was recently fixed, so before bug-fix version 4.0.5 is released, you should add cs_time_moment.c from the repository
http://code-saturne.org/viewvc/saturne/ ... iew=markup to your user subroutines.

Also, the user examples (http://code-saturne.org/doxygen/src/parameters.html, "Time moment related options") might interest you, as there is an example specific to turbomachinery.

Regards,

Yvan
vgm567
Posts: 17
Joined: Tue Oct 14, 2014 3:51 pm

Re: time ave. of velocities with turbomachinery module activ

Post by vgm567 »

Yvan Fournier wrote: Also, the user examples (http://code-saturne.org/doxygen/src/parameters.html, "Time moment related options") might interest you, as there is an example specific to turbomachinery.
Thanks Yvan for the quick response.

Actually I am using the code from above mentioned example (example 5). I have rerun my case with the new cs_time_moments.c in my SRC and also not calling rotation_define. But I still face the same problem, i.e. when const cs_rotation_t *rot = cs_glob_rotation is executed rot does not contain the correct values of omega and axis, only zeroes. (I have defined these in cs_user_turbomachinery.c)

Many thanks for your help

Regards

Michael
Yvan Fournier
Posts: 4082
Joined: Mon Feb 20, 2012 3:25 pm

Re: time ave. of velocities with turbomachinery module activ

Post by Yvan Fournier »

Hello,

This is strange. Could you try using cs_glob_turbomachinery->rotation instead of cs_glob_rotation to see if things are any different (they should not, as cs_glob_rotation should point to cs_glob_turbomachinery->rotation in this case, but it's safe to check).

Do you also confirm that the computation still runs normally, and you rotor does move, even when you have this issue ?

Regards,

Yvan
vgm567
Posts: 17
Joined: Tue Oct 14, 2014 3:51 pm

Re: time ave. of velocities with turbomachinery module activ

Post by vgm567 »

Hello,

Based on your reply I made the change by using this line

Code: Select all

const cs_rotation_t *rot = (const cs_turbomachinery_t *)cs_glob_turbomachinery->rotation;
to replace

Code: Select all

const cs_rotation_t *rot = cs_glob_rotation;
I am unsure whether this is what you meant? To compile this I had to modify and include cs_turbomachinery.h in my SRC (file attached), so I am thinking that I am not on the correct track. The issue still remains however. I can confirm that my simulations are not affected at all (there is mesh rotation of the rotor group), it just the issue with calculating these set of time moments.
Attachments
cs_turbomachinery.h
(9.62 KiB) Downloaded 190 times
Yvan Fournier
Posts: 4082
Joined: Mon Feb 20, 2012 3:25 pm

Re: time ave. of velocities with turbomachinery module activ

Post by Yvan Fournier »

Hello,

I had forgotten that we have one rotation structure per defined rotor, plus one base null-rotation defined for cells not belonging to the rotor. So:

Code: Select all

const cs_rotation_t *rot = (const cs_turbomachinery_t *)cs_glob_turbomachinery->rotation;
will access the initial nul-rotation, while:

Code: Select all

const cs_rotation_t *rot = (const cs_turbomachinery_t *)(cs_glob_turbomachinery->rotation + 1);
will access the first rotation (probably the one you are looking for).

For a given cell (cell_id)

Code: Select all

const cs_rotation_t *rot = (const cs_turbomachinery_t *)(cs_glob_turbomachinery->rotation + tbm->cell_rotor_num[cell_id]);
Will provide you the appropriate rotation.

Regards,

Yvan
vgm567
Posts: 17
Joined: Tue Oct 14, 2014 3:51 pm

Re: time ave. of velocities with turbomachinery module activ

Post by vgm567 »

Hello Yvan,

Many thanks. This works now. :)
Also just a note, that I find cs_glob_turbomachinery is defined in cs_turbomachinery.c and not in cs_turbomachinery.h.

Regards

Michael
Post Reply