UDF获取计算中的残差
已有 1165 次阅读2013-4-17 13:48
|个人分类:UDF使用技巧
This is an example to print the residuals on the console.
#include "udf.h"
DEFINE_ON_DEMAND(residual_list)
{
int nw;
real scaled_res;
Domain*domain=Get_Domain(1);
for(nw=0; nw<MAX_EQNS; ++nw)
{
if(strlen(DOMAIN_EQN_LABEL(domain,nw))>0)
{
if(0==DOMAIN_RES_SCALE(domain,nw)[nres-1])
DOMAIN_RES_SCALE(domain,nw)[nres-1]=1;
scaled_res=DOMAIN_RES(domain,nw)[nres-1]/DOMAIN_RES_SCALE(domain,nw)[nres-1];
Message("%s equation,residual=%g\n",DOMAIN_EQN_LABEL(domain,nw ),scaled_res);
}
}
}