xin.yang
Subscriber

Thanks for your reply, Dr Amine and Rob.

1, I suppose you are suggesting using built-in compiler for cpp code needs cpp-based header file.

2, I just tried to compile the 'define_on_demand' file, there are lots of errors from fluent  2020R2.

3, I tried the following three codes, all returns lots of errors from fluent console:

Code 1:

#include "udf.h"
#include \    // right?
DEFINE_ON_DEMAND(on_demand_calc)
{
    std::vector kk = { 1.0,2.0,3.0 }; // This is not typical vector initialization, need be vector
    Message("Vector={%lf, %lf, %lf}\n", kk[0], kk[1], kk[2]); // no Message0
}

Code 2:

#include "udf.h"

DEFINE_ON_DEMAND(on_demand_calc)
{
    std::vector kk = { 1.0,2.0,3.0 }; 
    Message("Vector={%lf, %lf, %lf}\n", kk[0], kk[1], kk[2]); // no Message0
}

Code 3:

#include "udf.h"
#include
DEFINE_ON_DEMAND(on_demand_calc)
{
    std::vector kk = { 1.0,2.0,3.0 }; 
    Message("Vector={%lf, %lf, %lf}\n", kk[0], kk[1], kk[2]); // no Message0
}

4, The following code is working OK using in-built compiler after I remove 'vector' and use 'array'. But obviously, this is not using vector.

Code:

#include "udf.h"

DEFINE_ON_DEMAND(on_demand_calc)
{
    double kk[3] = { 1.0,2.0,3.0 };
    Message("Vector={%lf, %lf, %lf}\n", kk[0], kk[1], kk[2]);
}