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/)
-   -   problem with mixed/Robin boundary condition for Temperature (https://www.cfd-online.com/Forums/fluent-udf/149780-problem-mixed-robin-boundary-condition-temperature.html)

serene6390 March 8, 2015 14:03

problem with mixed/Robin boundary condition for Temperature
 
Hi, all

I'm trying to build a mixed boundary condition for temperature profile, the boundary condition is an expression related to both Temperature and Temperature gradient, but there's some error come out after I initialize.

My code is:
DEFINE_PROFILE(Temperature_profile,t,i)
{
face_t f;
cell_t c;
Thread*t0;
real x[ND_ND];
real y;

begin_f_loop(f,t)
{
t0=THREAD_T0(t);
c=F_C0(f,t);
F_CENTROID(x,f,t);
y=x[1];
F_PROFILE(f,t,i)=(200-20*(1-y)+C_T_G(c,t0)[0]/0.002)/(100+9.8*(1-y);
}
end_f_loop(f,t)
}

My current physical model is very simple, just a 2D rectangular area.
Thank you so much.

PS: I don't know why but the program sometimes works and sometimes not, but even if it could run successfully, the result seems not correct.

The error looks like this:
MPI Application rank 0 exited before MPI_Finalize() with status 2
The f1 process could not started

`e` March 8, 2015 14:46

Here's a relevant thread and have you tried running Fluent in serial instead of parallel?

serene6390 March 8, 2015 15:23

Quote:

Originally Posted by `e` (Post 535206)
Here's a relevant thread and have you tried running Fluent in serial instead of parallel?

Hi,

Thanks for your reply, but when I try to use serial instead of parallel, there's another error comes out:

Error: received a fatal signal (segmentation fault)

`e` March 8, 2015 18:20

Have you interpreted or compiled the UDF? Try compiling the UDF.

Ensure the RHS for F_PROFILE is correct and use trailing periods to evaluate 200, etc, as real data types.

Lastly, try setting the RHS of F_PROFILE to a constant value and if this run still fails, then perhaps there's something wrong with the mesh (maybe Fluent is trying to access a cell face that doesn't exist).

serene6390 March 8, 2015 22:17

I interpreted the UDF, is compiling going to make a difference?
I'm thinking the error might caused by the index, do you think it's correct that on the LHS I have F_PROFILE(f,t,i) and on the RHS I have C_T_G(c,to)[0]?

Thank you.

`e` March 8, 2015 23:04

When troubleshooting code it's important to first isolate what the problem exactly; you can achieve this task by building the program step by step (or removing/simplifying your code step by step). I've suggested a method of trying to isolate the problem code above.

serene6390 March 8, 2015 23:19

Sorry that I didn't mention that I've tried setting the RHS as constant and it works. I also tried making the RHS as 1-y, it also works well.

`e` March 8, 2015 23:26

It appears that gradient data may or may not be defined in the first iteration according to HenrikS in this post (try his suggestion).


All times are GMT -4. The time now is 12:46.