# Moment calculation (Hydrofoil)

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Search this Thread Display Modes
 February 21, 2020, 07:26 Moment calculation (Hydrofoil) #1 New Member   Yann Join Date: Feb 2020 Posts: 8 Rep Power: 4 Hello, I am a French student (sorry for my English), I try to use Ansys Fluent to calculate the forces applied on a flapping hydrofoil in order to find the best propulsion parameters. I read a lot on the Internet to learn more about Ansys, and here are my settings and model that I chose: - Transient - Viscous model: SST transition - liquid water - triangular mesh method - dynamic mesh: smoothing diffusion (diffusion parameter = 1) - methods: PISO (gradient: based on least squares cells, pressure: Presto, Momentum: QUICK, and others: Second Order) The foil moves with UDF. (omega = -theta * w * cos (w * time); vel = ho * w * sin (w * time); cg_vel [0] = 0.0; cg_vel [1] = vel; cg_vel [2] = 0.0; cg_omega [0] = 0.0; cg_omega [1] = 0.0; cg_omega [2] = omega; ) The time step is 0.001 s I calculate the lifting and drag coefficients / forces and the moment applied to the foil using the tool: 'Report definitions -> Forces'. The solution has converged but I find the results bizarre: the curve of the moments is not symmetrical with respect to the point T/2 a complete period. screenshot I expected it to be like that. I think it should be symmetrical because the profile of the foil is symmetrical (NACA00012) and the pitch movement is sinusoidal. Then I use the moment values ​​to calculate the efficiency and I'm afraid the result will be wrong. Is there an offset value to consider? Or did I do something wrong? Thank you, Yann Last edited by YKNIPP; February 21, 2020 at 12:53. Reason: flapping instead of flying

 February 21, 2020, 10:29 Oscillating hydrofoil? #2 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 33 Are you including the oscillations of the hydrofoil? If not, then you do not need to include any UDF or motion of the hydrofoil. Hydrofoil can be fixed in it's position and the flow is solved around it. Assuming that the foil is oscillating, you will have to average the coefficient over time, at least over three flow-times excluding the first flow-time, where flow-time could be defined as the ratio of the chord length to the freestream velocity. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.

 February 21, 2020, 12:52 #3 New Member   Yann Join Date: Feb 2020 Posts: 8 Rep Power: 4 Sorry, I meant flapping instead of flying.... (I edit my 1st message) Yes the hydrofoil has an oscillating motion thanks to UDF. Here is more details about what I did with the force/moment results : Instantaneous power needed to move the hydrofoil is defined like that : P(t)=- Fy(t) * (dy/dt) - M(t) *(dθ/dt) Then I calculate the power needed for each time step over two periods, and i calculate the mean power over one period. (I exclude the first period as you said) And I define the efficiency as follow : η=(Fxmean* U)/(Pmean) I have strange results and I think the problem comes from the moment calculation in Ansys (as I said in my first message), but I don't know why.

 February 21, 2020, 15:33 Symmetry and Periodicity #4 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 33 Moment calculation requires a center point to be defined. However, in you case, due to translational velocity, center of moment might be changing. What's the reason for expecting a symmetric result about T/2? Is it because the motion is simple harmonic? Results would be periodic but asymmetric and the result predicted appear to show good periodicity. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.

 February 21, 2020, 16:58 #5 New Member   Yann Join Date: Feb 2020 Posts: 8 Rep Power: 4 The center of moment is the origin (and the center of rotation of the foil too). But I thought this point would follow the hydrofoil in its mouvement as the center of rotation does, but I might be wrong. Well yes... what I said in the first message is not really clear. I think that as the mouvement is harmonic and the profile of the foil is symmetrical, the curve of moment between T/2 - T should be the exact opposite of the curve between 0 - T/2 (+T/2 translated), as it is for the curve of lift/drag.

February 26, 2020, 12:32
#6
New Member

Yann
Join Date: Feb 2020
Posts: 8
Rep Power: 4
Hello,

I want to modify moment center as a function of time (because the hydrofoil moves).
I read that I have to use commands in : Solution -> Calculation Activities -> Execute commands

Here is the command I want to use :
Quote:
 (Define t (rpgetvar'flow-time)) solve/monitors/force/set-moment-monitor cm-z y 7 , y y cm-z.txt n n 0 (* 0.1 (- 1 (cos (* 7.0685 t)))) 0 0 1
It seems to work fine but I don't find the "cm-z.txt" file... Could you help me with that ?
EDIT : when I stop the calculation at first time step I have the file in the directory, then it disappears.

Thank you
Yann

Last edited by YKNIPP; February 26, 2020 at 15:08.

 February 27, 2020, 05:36 Overwriting #7 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 33 What is happening is the expected outcome of the procedure? Since you are setting it up as an execute-command, it will overwrite the file at the frequency that you specify. That's because flow-time changes but the name of the file does not. So, you have to give a name that is changing at the same frequency that you use for modifying the moment center. Fixed file name will not work. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.

 February 27, 2020, 06:07 #8 New Member   Yann Join Date: Feb 2020 Posts: 8 Rep Power: 4 Thank you for your answer. Is there a way to add the value ofcm-z in a list or change the file name with the flow time ?

 February 27, 2020, 06:42 %t #9 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 33 Try using %t in the file name, e.g., cm_z_%t.xy %t will be replaced automatically by the current time-step. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.

 February 27, 2020, 14:07 #10 New Member   Yann Join Date: Feb 2020 Posts: 8 Rep Power: 4 I tried with %t but that didn't work. I'm a beginner so I don't understand everything. But from what I understood, functions in Fluent are in scheme language, and %t is in C for printf i think. The file name is string objet and flowtime is a number. So I have to convert t into string object : (define t (rpgetvar'flow-time)) (define s (number->string t)) Then in solve/monitors/force/set-moment-monitor I have to call s for the file name, but how can i do it? Thank you for your answer.

 February 27, 2020, 17:09 Scheme #11 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 33 %t is a Fluent journal directive and has got nothing to do with C or Scheme here. However, if this is not working, which is little strange, then you may use ti-menu-load-string with format. ti-menu-load-string is a scheme command that accepts any journal command as an argument. The benefit is that you can combine multiple journal commands before feeding it to ti-...,e.g., (define fname (string-append "cm-z_" (number->string (rpgetvar 'flow-time)) ".txt")) Now, the variable fname looks like cm-z_1.215.txt at time 1.215 s. This can be fed as argument to the command as (ti-menu-load-string (format #f "report ....~a ...", fname)) In place of ..., you have to use your full command. Place ~a where filename should come. This is like %s in C. This will be replaced by value of the variable fname. Rest of the command will be executed as it is. Also note that whole of the command can also be defined as either a single variable or multiple variables, then appended as a single variable, and fed to ti-... __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.

February 28, 2020, 16:01
#12
New Member

Yann
Join Date: Feb 2020
Posts: 8
Rep Power: 4
Hello,

Thank you very much for your answer.
I tried what you said,
Quote:
 (Define t (rpgetvar'flow-time)) (Define fname (string-append "cm-z_" (number->string t) ".txt")) (ti-menu-load-string (format #f "solve/monitors/force/set-moment-monitor cm-z y 7 , y y ~a n n 0 (* 0.1 (- 1 (cos (* 7.0685 t)))) 0 0 1" fname))
In the console it seems to work : it displays "Information: Converting monitor cm-z to report definition."

But nothing is wrote in directory. However, when I stop calculation then I restart it, it writes the last timestep's report file in the directory.
I have the same problem as before, except that the file name changes.

EDIT :
I tried with report/forces/wall-moment :
Quote:
 (Define t (rpgetvar'flow-time)) (Define fname (string-append "cm-z_" (number->string t) ".txt")) (ti-menu-load-string (format #f "report/forces/wall-moment n 7 , 0 (* 0.1 (- 1 (cos (* 7.0685 t)))) 0 0 1 y ~a" fname))
But the file is very difficult to exploit (I must extract the value of moment with Python at each timestep), therefore solve/monitors/force/set-moment-monitor is easier to work with.
Have you an idea why solve/monitors/force/set-moment-monitor does not write the report file ? otherwise doesn't matter I will try to work with report/forces/wall-moment.

Last edited by YKNIPP; February 28, 2020 at 16:26. Reason: Another method

 February 28, 2020, 16:13 Version #13 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 33 You appear to be using version 19.x. Do check for the validity of the commands then. It is possible that the order for the TUI is different. Another thing you need to do is to define all this in a file as a scheme function and then only call that function within Execute Commands. To define a scheme function, define all the commands within (define functionName (...) ) You can call it by any name, so, you can use any variable in place of functionName. Then all your commands go within (). And then in the Execute Commands, you just put (functionName) __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. Last edited by vinerm; February 28, 2020 at 16:17. Reason: Additional Information

 February 28, 2020, 18:46 #14 New Member   Yann Join Date: Feb 2020 Posts: 8 Rep Power: 4 I am using version 18.1. Do you think that creating a scheme function will solve the problem? I tried to create a new report file which contains cm-z (calculated with execute-commands solve/...) AND lift/drag force calculated with Fluent Report Definitions. I don't know why but this new report Files is filled at each time step as desired. However, the value in the report file false : when I display manually the value of cm-z with "compute" in report definition, it displays a different value than in the report file. The values in the report file seem to be the moment in 0 (origin). Those are the same values than others I calculated last week in Report Definition with moment center in 0. But the values displayed with "compute" of solve/... Execute-Commands are the same than the values calculated with report/..., that I think are the good values. So I think Fluent computes the good values with solve/..., but reports false values. I have deleted all old moment calculation in Report Definition, still the same problem. Then I have tried to create a new clean Ansys file, still the same problem. It is very weird and it starts to annoy me... I think I will use report/forces/wall-moment Execute Commands which seem to work, but return complicated files, then I will hack with Python the report files. Nevertheless thank you for your patience and your help.

 March 1, 2020, 05:01 Pick #15 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 33 That is not a bad option. However, there is one thing you might find helpful in picking up particular value from the report, since you mentioned that the output of command is rather complicated. Enter the following command in Fluent and read through it. (pick-docu) This shows documentation for undocumented pick commands that can be used to do what you intend to do later with Python. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post mannobot Main CFD Forum 3 December 7, 2018 09:37 toil CFX 15 May 22, 2017 04:06 amin_u50 AVL FIRE 0 August 6, 2014 08:34 mannobot FLUENT 1 June 2, 2010 04:20 Alberto Schroth FLUENT 0 May 16, 2000 08:19

All times are GMT -4. The time now is 03:46.

 Contact Us - CFD Online - Privacy Statement - Top