|
[Sponsors] |
Writing the area-weighted average value in file |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 1, 2006, 07:42 |
Writing the area-weighted average value in file
|
#1 |
Guest
Posts: n/a
|
Hi, I am solving a unsteady scalar equation. After each time step, I want to write area-weighted average value of scalar at outlet surface in a file. Thanks in advance. Regards, Shamsi
|
|
November 2, 2006, 05:27 |
Re: Writing the area-weighted average value in fil
|
#2 |
Guest
Posts: n/a
|
no problem
easiest-way: go surface-table, choose your size (area-weighted average value) and your related surface,switch to time-step and choose "write" option...edit your file post solution with an editor others sure shemes and udfs kenischi |
|
November 2, 2006, 21:47 |
Re: Writing the area-weighted average value in fil
|
#3 |
Guest
Posts: n/a
|
Thanks Kenischi I am solving a concentration transport equation. Velocities are known. Presently, I am solving the equation for one time step. Then I go to report, then I select surface integrals after that in the Report type I select Mass Weighted Average, in the filed variable I selct User defined scalar (User Scalar 0) and for the surface I select outlet, and then press button for compute. Right Now I am able to get the values for one time step. Is there is any way this value can be written in a file for several time steps?. Thanks in advance.
Regards, Shamsi |
|
November 6, 2006, 04:52 |
Re: Writing the area-weighted average value in fil
|
#4 |
Guest
Posts: n/a
|
Hi, I have found the solution. I click on solve, then on monitor, then on surface, and then define the rest and file name. Thanks, Regards, Shamsi
|
|
November 8, 2006, 06:08 |
Re: Writing the area-weighted average value in fil
|
#5 |
Guest
Posts: n/a
|
Hi, If we write the area-weighted average value in a monitor file, it size is becoming bulky, because its write the value for each and every iterations per step. It is better to write UDF. Any help. Regards, Shamsi
|
|
November 12, 2006, 23:49 |
Re: Writing the area-weighted average value in fil
|
#6 |
Guest
Posts: n/a
|
Hi, Everybody, Following UDF writes the values of final current time without writing the values of iteration per time step. This is unlike the writing in the monitor files, where it writes iteration per step also. Regards, Shamsi
#include "udf.h" int kount = 0; /* define global variable kount */ int kkk,min,max; real ss[200],ss1; DEFINE_ADJUST(demo_calc,d) { cell_t c; Thread *t; kkk=1; if (kount > 1 ) { ss1=ss[kount]; printf("Cuurent_Time = %f %f\n",ss[kount],ss1); if(CURRENT_TIME > ss1) kount++; ss[kount]=CURRENT_TIME; max=kount; printf("kount = %d\n",kount); } else if (kount > 0) { if(CURRENT_TIME >ss1) { kount=kount+1; ss[kount]=CURRENT_TIME; ss1=ss[kount]; printf("kounmid = %d\n",kount); } else { ss1=ss[kount]; printf("Cuurent_Time = %f %f\n",ss[kount],ss1); if(CURRENT_TIME > ss1) kount++; ss[kount]=CURRENT_TIME; printf("kountmidins = %d\n",kount); } } else { kount=kount+1; ss[kount]=CURRENT_TIME; kkk=0; ss1=CURRENT_TIME; printf("kountinside = %d\n",kount); printf("timetinside = %f\n",ss1); min=kount; } } DEFINE_RW_FILE(writer,fp) { FILE *fd; Thread *t; face_t f; real sss,A[ND_ND]; fd=fopen("data.txt","w"); /* begin_f_loop(f,t) { sss=F_U(f,t); } */ for ( kkk=min ; kkk <=max; kkk++) { sss=F_AREA(A,f,t); printf("Writing UDF data to data file...\n"); printf("%f %f",ss[kkk],sss); /* write out kount to data file */ fprintf(fd,"%f\n",ss[kkk]); /* write out kount to data file */ } } DEFINE_DIFFUSIVITY(udsdiffusivity, c, t, i) { return C_MU_T(c,t)+.006482; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Area weighted or mass weighted average | SAM | Main CFD Forum | 31 | April 30, 2018 05:12 |
pisoFoam compiling error with OF 1.7.1 on MAC OSX | Greg Givogue | OpenFOAM Programming & Development | 3 | March 4, 2011 18:18 |
OpenFOAM 1.7.1 installation problem on OpenSUSE 11.3 | flakid | OpenFOAM Installation | 16 | December 28, 2010 09:48 |
1.7.x Environment Variables on Linux 10.04 | rasma | OpenFOAM Installation | 9 | July 30, 2010 05:43 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 02:24 |