Writing the area-weighted average value in file
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
|
Re: Writing the area-weighted average value in fil
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 |
Re: Writing the area-weighted average value in fil
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 |
Re: Writing the area-weighted average value in fil
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
|
Re: Writing the area-weighted average value in fil
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
|
Re: Writing the area-weighted average value in fil
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; } |
All times are GMT -4. The time now is 07:04. |