|
[Sponsors] | |||||
UDF for mass and heat source with heat transfer |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|
|
#21 | |
|
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 10 ![]() |
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 |
||
|
|
|
||
|
|
|
#22 |
|
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 10 ![]() |
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. |
|
|
|
|
|
|
|
|
#23 | |
|
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 10 ![]() |
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. |
||
|
|
|
||
|
|
|
#24 |
|
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 10 ![]() |
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. |
|
|
|
|
|
|
|
|
#25 |
|
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 10 ![]() |
||
|
|
|
|
|
|
|
#26 |
|
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 10 ![]() |
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. |
|
|
|
|
|
|
|
|
#27 | |
|
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 10 ![]() |
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) } } |
||
|
|
|
||
|
|
|
#28 |
|
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 10 ![]() |
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. |
|
|
|
|
|
|
|
|
#29 |
|
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 10 ![]() |
Code:
thread =Lookup_Thread(domain,zone);
begin_c_loop(cell,thread)
{
}
end_c_loop(cell,thread)
|
|
|
|
|
|
|
|
|
#30 | |
|
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 10 ![]() |
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. |
||
|
|
|
||
|
|
|
#31 |
|
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 10 ![]() |
Do you mean that your code is working now?
|
|
|
|
|
|
|
|
|
#32 |
|
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 10 ![]() |
yes it is working.
|
|
|
|
|
|
|
|
|
#33 |
|
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 10 ![]() |
Ok! Then you can forget the Define_adjust and just use the code that works.
How did you fix the code? |
|
|
|
|
|
|
|
|
#34 |
|
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 10 ![]() |
||
|
|
|
|
|
|
|
#35 |
|
New Member
Join Date: Jun 2017
Posts: 19
Rep Power: 10 ![]() |
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.
|
|
|
|
|
|
|
|
|
#36 | |
|
New Member
Maitray sharma
Join Date: Aug 2017
Posts: 7
Rep Power: 10 ![]() |
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 |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
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 |