|
[Sponsors] |
August 21, 2018, 04:42 |
print residuals in txt
|
#1 |
New Member
DS
Join Date: May 2016
Posts: 28
Rep Power: 10 |
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 |
|
Tags |
domain_eqn_label, domain_res, domain_res_scale, residuals |
|
|
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 |