|
[Sponsors] |
April 17, 2015, 05:00 |
printf in DEFINE_PROFILE
|
#1 |
Member
Join Date: Jan 2015
Posts: 40
Rep Power: 11 |
Hi all,
there is an "easy" thing that I cannot understand: why the following code do not generate a single output "h=..." in the console, but more than one and less than the face cell number or I don't know what? Code:
DEFINE_PROFILE (name,t,i){ real h; h=some expression; printf("h=%f\n",h); begin_f_loop(f,t){ F_PROFILE(f,z,i)=h; }end_f_loop(f,t) } Can anyone help me on that? Thanks in advance, philus |
|
April 17, 2015, 05:27 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
How many times is the output "h=..." repeated? Are you running Fluent in serial or parallel? I suspect this output would be repeated for each parallel process if it's outside a loop. Each process executes this DEFINE_PROFILE macro.
|
|
April 17, 2015, 05:31 |
|
#3 |
Member
Join Date: Jan 2015
Posts: 40
Rep Power: 11 |
I also thought that, but when I ran Fluent in serial I had it 11 times...
Otherwise I have 100 cells on the boundary, 3 domains... |
|
April 17, 2015, 05:52 |
|
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
How many times was this phrase repeated in parallel, and how many processors were used? When are these outputs printed to the screen: during initialisation, iterations or otherwise?
|
|
April 17, 2015, 05:58 |
|
#5 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
This code is called every time Fluent needs to know the profile.
To make it more concrete, suppose that this is a pressure boundary condition. In every iteration, Fluent may need this profile more than once, depending on which numerical scheme is used, which discretization, and maybe depending on more factors. And if you plot the pressure, Fluent also collects this information, so this code is also run. Fluent could have been programmed differently, such that it executes the code once per iteration, and stores the result in memory, but that is not how it is implemented. |
|
April 17, 2015, 06:13 |
|
#6 |
Member
Join Date: Jan 2015
Posts: 40
Rep Power: 11 |
I copy paste what happens in parallel mode on 2 CPUs. At the beginning I read an initialized simulation. I think that the first time it compute h frome the results of the initialization. After this it does the update (don't know what is it..) and then starts the iterations. There it do 2 times per iteration (so, there you were right!), but at the end...incomprehensible!
Sorry for the long code Code:
Reading "\"| gunzip -c \\\"Flower-h2o-v8-2.dat.gz\\\"\""... 1 user-defined node memory locations, 3829 nodes, binary. Parallel variables... h=... h=... h=... h=... h=... h=... h=... h=... Done. h=... h=... h=... h=... h=... h=... Updating solution at time level N... done. h=... h=... h=... h=... iter continuity x-velocity y-velocity energy time/iter ! 157 solution is converged 157 3.7286e-08 6.4842e-07 9.4505e-07 1.1936e-16 0:00:00 1000 h=... h=... h=... h=... h=... h=... 158 9.1256e-05 8.0999e-02 2.2566e-01 1.3977e-07 0:00:22 999 h=... h=... 159 2.4483e-02 2.9444e-02 3.6535e-01 7.7532e-09 0:00:25 998 h=... h=... [*** I cut the rest.... ***] 195 1.2377e-07 6.8890e-07 1.1911e-06 1.9772e-16 0:00:38 962 h=... h=... ! 196 solution is converged 196 9.4425e-08 5.2995e-07 8.9362e-07 1.9223e-16 0:00:37 961 h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... h=... step flow-time h_ext t_h2o_mean t_tube_mean t_insulation 2 1.0000e+01 nan 3.5315e+02 3.5314e+02 3.1153e+02 Flow time = 10s, time step = 2 |
|
April 17, 2015, 06:19 |
|
#7 |
Member
Join Date: Jan 2015
Posts: 40
Rep Power: 11 |
Ok, thank you pakk and sorry: you answered during I was writing the reply.
I now understand what it happens. I must now understand why, some time, I got different values, but this is my task ;-) Thanks a lot, thanks to everybody! philus |
|
Tags |
define_profile, output, printf, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A problem about 'printf' and 'Message' in UDF. | LICH | Fluent UDF and Scheme Programming | 2 | May 2, 2013 03:45 |
problem printf fluent | marye | FLUENT | 2 | June 7, 2010 06:19 |
C, printf | marye | FLUENT | 0 | June 1, 2010 07:08 |
Problems in compiling paraview in Suse 10.3 platform | chiven | OpenFOAM Installation | 3 | December 1, 2009 08:21 |