|
[Sponsors] |
UDF for mass and heat source with heat transfer |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 8, 2017, 06:03 |
|
#21 | |
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9 |
Quote:
DEFINE_ADJUST is used at the beginning DEFINE_ON_DEMAND is used with manual command. I would use a DEFINE_ON_DEMAND for initialization: Code:
DEFINE_ON_DEMAND (udm_init) { Thread *thread; cell_t cell; Node *node; Domain *domain = Get_Domain(1); thread_loop_c(thread,domain) { begin_c_loop(cell,thread) { C_UDMI(cell,thread,0) = 0.0; C_UDMI(cell,thread,1) = 0.0; C_UDMI(cell,thread,2) = 0.0; C_UDMI(cell,thread,3) = 0.0; C_UDMI(cell,thread,4) = 0.0; } end_c_loop(cell,thread) } } You can also use fluent patch panel if you don't want to use UDF: https://www.sharcnet.ca/Software/Flu...g/node1384.htm |
||
June 8, 2017, 06:22 |
|
#22 |
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9 |
So you have non-zero mass source with this code? how is your solution stopping?
Last edited by KaLium; June 8, 2017 at 09:37. |
|
June 9, 2017, 11:13 |
|
#23 | |
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 9 |
Quote:
Thank you very much for suggestion regarding DEFINE_ON_DEMAND macro. I have added it to my udf but again solution is stopping after every time step showing "FLUENT received fatal signal (ACCESS VIOLATION)". It proceeds if I calculate it further but only for single time step. |
||
June 9, 2017, 13:34 |
|
#24 |
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9 |
Maybe you should replace your execute_at_end macro with adjust-macro.
Also add the thread - loop. Similar than in my define_on_demand code. |
|
June 9, 2017, 15:15 |
|
#25 |
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 9 |
||
June 10, 2017, 21:23 |
|
#26 |
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 9 |
Hi KaLium,
I have finally moved forward from the error, thank you very much for your suggestions without your suggestions it would have been very difficult to move further. I have used DEFINE_EXECUTE_AT_END, should also be possible by using DEFINE_ADJUST, I shall try it. But again I did not find anything stored in UDM. |
|
June 10, 2017, 21:33 |
|
#27 | |
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 9 |
Quote:
DEFINE_ON_DEMAND (udm_init) { real x[ND_ND]; Thread *thread; cell_t cell; //Node *node; int zone = 3; Domain *domain = Get_Domain(1); thread =Lookup_Thread(domain,zone); thread_loop_c(thread,domain) { begin_c_loop(cell,thread) { C_UDMI(cell,thread,0) = 0.0; C_UDMI(cell,thread,1) = 0.0; C_UDMI(cell,thread,2) = 0.0; C_UDMI(cell,thread,3) = 0.0; C_UDMI(cell,thread,4) = 0.0; } end_c_loop(cell,thread) } } |
||
June 12, 2017, 07:52 |
|
#28 |
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9 |
Code:
DEFINE_ON_DEMAND (udm_init) { Thread *thread; cell_t cell; int zone = 3; Domain *domain = Get_Domain(1); thread =Lookup_Thread(domain,zone); begin_c_loop(cell,thread) { C_UDMI(cell,thread,0) = 0.0; C_UDMI(cell,thread,1) = 0.0; C_UDMI(cell,thread,2) = 0.0; C_UDMI(cell,thread,3) = 0.0; C_UDMI(cell,thread,4) = 0.0; } end_c_loop(cell,thread) } You don't need the "node". I copied that from my old code as a mistake. |
|
June 12, 2017, 09:10 |
|
#29 |
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9 |
Code:
thread =Lookup_Thread(domain,zone); begin_c_loop(cell,thread) { } end_c_loop(cell,thread) |
|
June 12, 2017, 14:17 |
|
#30 | |
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 9 |
Quote:
I have tried to use DEFINE_ADJUST instead of DEFINE_EXECUTE_AT_END but not fruitful so far, however it solves problem when I use DEFINE_EXECUTE_AT_END and also storing values in UDM. |
||
June 12, 2017, 14:46 |
|
#31 |
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9 |
Do you mean that your code is working now?
|
|
June 12, 2017, 15:55 |
|
#32 |
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 9 |
yes it is working.
|
|
June 13, 2017, 03:56 |
|
#33 |
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9 |
Ok! Then you can forget the Define_adjust and just use the code that works.
How did you fix the code? |
|
June 13, 2017, 12:47 |
|
#34 |
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 9 |
||
June 14, 2017, 04:15 |
|
#35 |
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 9 |
so basically I have used DEFINE_INIT and DEFINE_EXECUTE_AT_END .........and apparently the problem was with DEFINE_EXECUTE_AT_END macro ie. the missing thread loop as I have said.
|
|
October 13, 2017, 05:04 |
|
#36 | |
New Member
Maitray sharma
Join Date: Aug 2017
Posts: 7
Rep Power: 9 |
Quote:
For this metal hydride absorption problem, why are you giving initial pressure to all cell zone instead to giving the pressure at the inlet of cylinder? |
||
Tags |
define_init, define_source, heat flux udf, mass source term, source energy term |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for heat transfer coeff. in porous media | parvaz747 | FLUENT | 0 | November 16, 2016 13:35 |
Difficulty In Setting Boundary Conditions | Moinul Haque | CFX | 4 | November 25, 2014 18:30 |
Problem in UDF time dependent vloumetric heat source | eng_yasser_2020 | Fluent UDF and Scheme Programming | 0 | March 30, 2014 09:07 |
Question about heat transfer coefficient setting for CFX | Anna Tian | CFX | 1 | June 16, 2013 07:28 |
UDF - Heat transfer coefficient | kulasekharan | FLUENT | 3 | August 12, 2004 08:09 |