# Writing the area-weighted average value in file

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

 November 1, 2006, 07:42 Writing the area-weighted average value in file #1 Shamsi 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 kenischi 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 Shamsi 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 Shamsi 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 Shamsi 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 Shamsi 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; }

 Thread Tools 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 On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post SAM Main CFD Forum 24 July 8, 2015 06:15 Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 18:18 flakid OpenFOAM Installation 16 December 28, 2010 09:48 rasma OpenFOAM Installation 9 July 30, 2010 04:43 hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24

All times are GMT -4. The time now is 00:14.

 Contact Us - CFD Online - Privacy Statement - Top