CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   define_profile and F_UDMI (https://www.cfd-online.com/Forums/fluent-udf/151640-define_profile-f_udmi.html)

philus April 14, 2015 10:02

define_profile and F_UDMI
 
Hi all,

I am trying to set a particular wall heat transfer coefficient to an external wall. I also wanted to monitor the value computed by my UDF, then I used the user-defined memory. But the correspondent variable (when I search for it in FLuent) is always zero. Note that if I write in the UDF printf('variable name') I get the good values....but I need to put these values into a variable!

I copy paste the simplified UDF:

Code:

DEFINE_PROFILE(name,t,i)
{
  real h;
  begin_f_loop(f,t){
    h=10.0;
    F_UDMI(f,t,0) = h;
    printf("h:%f\n",h);
    F_PROFILE(f,t,i)= h;
  }
  end_f_loop(f,t)
}

I have the impression that the UDF works well for setting the boundary condition (the results that I obtain from the simulation corresponds to what I was expecting), but I cannot monitor the variable (h) that I have created: the corresponding User Defined Memory variable (User Memory 0) is always nil.

Can someone explain me what is the problem?

Thanks in advance
philus

pakk April 14, 2015 10:57

I have seen this behavior too. The UDM stored with F_UDMI did not show up in my Fluent results. I don't know if this is intended or a bug, but I found a workaround that worked for me:
Code:

F_UDMI(f,t,0) = h;
C_UDMI(F_C0(f,t),THREAD_T0(t),0) = F_UDMI(f,t,0);


philus April 15, 2015 04:56

Hi pakk,

effectively this workaround works well, thank you!!

philus

anonymous96_ November 5, 2023 07:46

Hi Pakk

I am trying to calculate volumetric flow rate through an interior surface and using DEFINE_ON_DEMAND macro for the same. A piece of my code is as follows:
DEFINE_ON_DEMAND(ach_udf)
{

Thread *t;
face_t f;

Domain *d;


real A[ND_ND];

real ACHt_mean_out=0;
real ACHt_mean_in=0;

t = Lookup_Thread(d,2);

begin_f_loop(f,t)
{
F_AREA(A,f,t);
real vel_roof= F_FLUX(f,t)/(NV_MAG(A)*1.12);
if (vel_roof>0)
{
ACHt_mean_out += vel_roof*NV_MAG(A);
}
else
{
ACHt_mean_in +=vel_roof*NV_MAG(A);
}
}
end_f_loop(f,t)


}

The code is compiled successfully but as soon as I am executing it using EXECUTE_ON_DEMAND, it is giving the following error:
Node 1: Process 20248: Received signal SIGSEGV.

================================================== ============================

================================================== ============================

Node 999999: Process 6872: Received signal SIGSEGV.

================================================== ============================

================================================== =================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= RANK 2 PID 4296 RUNNING AT DESKTOP-PA0EM1I
= EXIT STATUS: -1 (ffffffff)

Can anyone tell how to fix this?

AlexanderZ November 6, 2023 04:31

d is not defined

compile code and READ log to avoid typoes

anonymous96_ November 6, 2023 05:11

Thankyou Alexander. If figured that out but I am getting stuck at one more point. I have posted in another thread and you are a part of it too. Can you please look into it.

anonymous96_ November 6, 2023 05:16

https://www.cfd-online.com/Forums/fl...egv-error.html

Can you please look into it Alexander?


All times are GMT -4. The time now is 22:56.