CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

How fluent solver work inside the fluent?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 28, 2023, 07:27
Default How fluent solver work inside the fluent?
  #1
Member
 
Chhotelal
Join Date: Jun 2023
Posts: 31
Rep Power: 2
Chhotelal1234 is on a distinguished road
I want to know, how Fluent Solver takes the variable and calculates the value when uploading the UDF function.

In a simple case, I upload only the DEFINE INIT function and initialized the problem, the value is not getting the true value.
#include "udf.h"

#define M 0.25
#define RHO 1600
#define E 0.4
#define Tref 300
#define Tin 300


int last_timestep = -1;

DEFINE_INIT(initial_humidity, d)
{
real Tabs, w, a, b, C, Pvs, RH;
Thread *t;
cell_t c;

thread_loop_c(t, d)
{
begin_c_loop(c, t)
{
C_T(c, t) = Tin;

Tabs = C_T(c, t);

Pvs = 0.1 * exp(27.0214 - (6887 / Tabs) - (5.31 * log(Tabs / 273.16))); /* Eq(25) */
b = 2.667e-7 * pow((1 - (Tabs / 641.7)), -23.438);
C = 1 / (4e5 * pow(Tabs, -2.1166));
a = b * pow(1000 * M, 1 / C);
RH = 1 - exp(-a / Tabs); /* Eq (15) */

if (RH > 0.99)
{
RH = 0.99;
}

w = (Pvs * RH * 0.62189) / (101.3 - Pvs * RH); /* Eq (26) */

}
end_c_loop(c, t)
Message ("realative humidity:%f\n", w);
Message ("Pv:%f\n", Pvs);
Message ("RH:%f\n", RH);
}
}

================================================== ============================
Error is coming, and the value getting Zero at the initial condition
initial_humidity
Done.
realative humidity:0.000000
Pv:0.000000
RH:0.000000

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

Node 10: Process 22992: Received signal SIGSEGV.
Chhotelal1234 is offline   Reply With Quote

Old   July 30, 2023, 06:13
Default
  #2
Member
 
thedal's Avatar
 
Thamilmani M
Join Date: Sep 2017
Location: IIT Bombay, Mumbai
Posts: 52
Rep Power: 8
thedal is on a distinguished road
Which variable are you trying to initialize here?

You are initializing temperature as Tin and calling C_T again to calculate some function. Why?
__________________
Always
Thedal
thedal is offline   Reply With Quote

Old   July 30, 2023, 06:20
Default
  #3
Member
 
thedal's Avatar
 
Thamilmani M
Join Date: Sep 2017
Location: IIT Bombay, Mumbai
Posts: 52
Rep Power: 8
thedal is on a distinguished road
Also try
begin_c_loop_all(c, t) instead and check what happens.
DEFINE_INIT is executed only once during initialization.
__________________
Always
Thedal
thedal is offline   Reply With Quote

Old   July 30, 2023, 06:32
Default
  #4
Member
 
thedal's Avatar
 
Thamilmani M
Join Date: Sep 2017
Location: IIT Bombay, Mumbai
Posts: 52
Rep Power: 8
thedal is on a distinguished road
I think the formulation is correct. only problem could be with the begin_c_loop(c, t)
__________________
Always
Thedal

Last edited by thedal; July 30, 2023 at 06:38. Reason: mistaken
thedal is offline   Reply With Quote

Old   July 30, 2023, 07:46
Default
  #5
Member
 
Chhotelal
Join Date: Jun 2023
Posts: 31
Rep Power: 2
Chhotelal1234 is on a distinguished road
I want to initialize the relative humidity value here. I do the same thing to replace by begin_c_loop_all(c, t) but the same error is coming
relative humidity:0.000000
Pv:0.000000
RH:0.000000

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

Node 5: Process 27536: Received signal SIGSEGV.

= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= RANK 10 PID 21372 RUNNING AT DESKTOP-MGARH2C
= EXIT STATUS: -1 (ffffffff)
================================================== =================================
The fl process could not be started.
Chhotelal1234 is offline   Reply With Quote

Old   July 30, 2023, 08:19
Default
  #6
Member
 
Chhotelal
Join Date: Jun 2023
Posts: 31
Rep Power: 2
Chhotelal1234 is on a distinguished road
This may occur by not defining the allocating memory. it might be right.
Chhotelal1234 is offline   Reply With Quote

Reply

Tags
alexanderz


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
foam-extend-4.1 release hjasak OpenFOAM Announcements from Other Sources 19 July 16, 2021 05:02
Selection of solver in ANSYS Fluent for given mach number Ankit Patel FLUENT 9 January 29, 2021 04:44
Fluent Adjoint Solver for compressible flow b.shuvayan FLUENT 2 January 30, 2015 07:27
simpleFoam parallel solver & Fluent polyhedral mesh Zlatko OpenFOAM Running, Solving & CFD 3 September 26, 2014 06:53
The fluent stopped and errors with "Emergency: received SIGHUP signal" yuyuxuan FLUENT 0 December 3, 2013 22:56


All times are GMT -4. The time now is 04:40.