CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

print residuals in txt

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By denis.sanga@hotmail.it

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 21, 2018, 04:42
Default print residuals in txt
  #1
New Member
 
DS
Join Date: May 2016
Posts: 28
Rep Power: 10
denis.sanga@hotmail.it is on a distinguished road
Goodmorning, I need to save the residuals in a .txt file and I found online the following code:

HTML Code:
#include "udf.h"DEFINE_ADJUST(my_adjust,domain)
{
int nw;
real scaled_res;
FILE *fp;
fp = fopen("output_test","a");
fprintf(fp,"\n");
fprintf(fp, "current iter = %d\n",count2[nres-1]);
for (nw=0; nw<MAX_EQNS; ++nw)
{
if (strlen(DOMAIN_EQN_LABEL(domain,nw))>0)
{
scaled_res = DOMAIN_RES(domain,nw)[nres-1]/
DOMAIN_RES_SCALE(domain,nw)[nres-1];
fprintf(fp,"%s equation: %g\n",DOMAIN_EQN_LABEL(domain,nw),scaled_res);
}
}
fclose(fp);
}

and I would like the following output:
"current iter = 1
continuity equation: 1
x-velocity equation: 1.01033e-08
y-velocity equation: 1.01114e-08
z-velocity equation: 0.000495387
energy equation: 5.91456e-08
k equation: 0.77859
epsilon equation: 0.7963"


But an error occur about the DOMAIN_RES(domain,nw)[nres-1] and DOMAIN_RES_SCALE(domain,nw)[nres-1] variables : "subscripted value is neither array nor pointer".

can someone help me to solve the problem?
thank you very much
best regards
DS
wc34071209 likes this.
denis.sanga@hotmail.it is offline   Reply With Quote

Reply

Tags
domain_eqn_label, domain_res, domain_res_scale, residuals


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get Sutherland and JANAF coefficients of air? immortality OpenFOAM Running, Solving & CFD 64 October 18, 2022 11:17
Hybrid discretisation - blend factor gcoopermax CFX 5 September 23, 2016 09:05
[blockMesh] Another cylinder question bendel_boy OpenFOAM Meshing & Mesh Conversion 5 January 6, 2015 06:09
motorBike Residuals for SST k-omega... and mine JR22 OpenFOAM Running, Solving & CFD 6 August 1, 2013 10:08
judging convergence through residuals MachZero Main CFD Forum 7 December 25, 2012 13:18


All times are GMT -4. The time now is 10:55.