Page 1 of 1

Predefined angular displacement on turbomachinery model

Posted: Wed Nov 20, 2019 4:50 pm
by bstorti
Hello, I'm trying to model the aerodynamics of an object in a three-dimensional domain.
The main idea is to simulate the fluid-dynamics around the object while it's moving with a prescribed time-dependent angular displacement.
To accomplish this, my idea is to use the Turbo-machinery model, which I'm kind of familiar with.
I've two domains: 1) A fixed domain (box) and 2) the rotational mesh with the object inside (sphere domain) in the center of the box.

I need to know if it is possible to set in the rotational domain:
- Prescribe angular displacement (theta_x, theta_y, theta_z) as a function of time.
- Prescribe rotation axis as a function of time (in order to represent the rotation of the object in the three-dimensional space).

As far as I know, one can set the angular velocity and the rotation axis with constant parameters from the GUI. However, I don't know if it is possible to set those values as variables function of time.

Is the usage of the Turbo-machinery model a proper approach to assess this kind of problems?

Thanks in advance,

Regards, Bruno.

Re: Predefined angular displacement on turbomachinery model

Posted: Thu Nov 21, 2019 8:29 am
by Yvan Fournier
Hello,

To modify the rotation velocity, you can use the "cs_turbomachinery_set_rotation_velocity" function in a user function called each time step (for example cs_user_extra_operations).

To modify the rotation axis, you would need to add a ""cs_turbomachinery_set_rotation_axis" function, to access and modify the _turbomachinery[<rotor_id>] structure in cs_turbomachinery.c. This should not be difficult, but the user source files are not currently enough for this.

Best regards,

Yvan

Re: Predefined angular displacement on turbomachinery model

Posted: Mon Jan 06, 2020 8:24 pm
by bstorti
Hello Yvan,

Thank you for your help and your quick answer.

We have some setbacks given that the function "cs_turbomachinery_set_rotation_velocity" is implemented in the version 5.3 of Code Saturne, and we were working with the 5.0 version. Therefore, we had to install that version in our HPC cluster.

We have followed your suggestions with the following results:
1) The "cs_turbomachinery_set_rotation_velocity" function worked perfect when we called it from the subroutine cs_user_extra_operations-turbomachinery.cpp. Next we have attached a simple gif with the movement of an object that one can obtain using the turbomachinery model.

2) We have some issues regarding the function implementation to modify the rotation axis. We have tried to implement the following function in "cs_turbomachinery.c":

void cs_turbomachinery_set_rotation_axis(int rotor_num, double axis[3])
{
cs_turbomachinery_t *tbm = _turbomachinery;

for(int i=0; 1<3; i++){
(tbm->rotation + rotor_num)->axis = axis;
}
}


The codes compiled well. However, when we run the case, we obtain the following error:

SIGSEGV signal (forbidden memory area access) intercepted!

Call stack:
1: 0x7f7a1c9bf01a <+0x13e01a> (libc.so.6)
2: 0x7f7a1fbee705 <cs_map_name_to_id_try+0x75> (libsaturne-5.3.so)
3: 0x7f7a1fb32a26 <+0x1aca26> (libsaturne-5.3.so)
4: 0x402052 <cs_user_extra_operations+0xc2> (cs_solver)
5: 0x7f7a1fa3ac8f <caltri_+0x1dce> (libsaturne-5.3.so)
6: 0x7f7a211898cf <cs_run+0x55f> (libcs_solver-5.3.so)
7: 0x7f7a21189225 <main+0x125> (libcs_solver-5.3.so)
8: 0x7f7a1c8a33d5 <__libc_start_main+0xf5> (libc.so.6)
9: 0x401eb9 <> (cs_solver)
End of stack


Any idea what is wrong in the "cs_turbomachinery_set_rotation_axis"?

Thank you very much in advance.

Regards,

Bruno

Re: Predefined angular displacement on turbomachinery model

Posted: Mon Jan 06, 2020 10:57 pm
by Yvan Fournier
Hello,

I think you should replace:

Code: Select all

for(int i=0; 1<3; i++){
  (tbm->rotation + rotor_num)->axis = axis;
}
with:

Code: Select all

for(int i=0; 1<3; i++){
  (tbm->rotation + rotor_num)->axis[i] = axis[i];
}
Best regards,

Yvan

Re: Predefined angular displacement on turbomachinery model

Posted: Tue Jan 07, 2020 6:12 pm
by bstorti
Hello Yvan,
It seems like when we have copied the codes to the forum, the braces didn't copy at all..
Although there was an error in the for loop (1<3 :oops: ) and we have found another silly bug in another subroutine.

Everything is working perfect now. We have attached a gif where it can be seen the object moving with a prescribed rotation and displacement.

Once again, thank you very much for you support.

Best regards,

Bruno