|
[Sponsors] |
June 28, 2017, 03:05 |
define_on_demand:Initialization of a scalar
|
#1 |
New Member
Mat
Join Date: Jan 2017
Posts: 23
Rep Power: 9 |
How to use a define_on_demand macro to initialize a scalar in the field?
|
|
June 28, 2017, 06:47 |
|
#2 |
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9 |
This is for all cells:
Code:
DEFINE_ON_DEMAND (scalar_init) { float x = 1.0; /*your value here*/ Thread *thread; cell_t cell; Domain *domain = Get_Domain(1); thread_loop_c(thread,domain) { begin_c_loop(cell,thread) { C_UDSI(cell,thread,0) = x; } end_c_loop(cell,thread) } } |
|
June 28, 2017, 08:45 |
|
#3 |
New Member
Mat
Join Date: Jan 2017
Posts: 23
Rep Power: 9 |
Thank you so much for the reply.
Actually, I am looking for assigning a constant value('0') for all the cells in a particular thread at the start of the calculation. I wrote my UDF like this #include "udf.h" DEFINE_ON_DEMAND(rec) { Domain *d; int zone_id=3; Thread *t = Lookup_Thread(d,zone_id); cell_t c; d = Get_Domain(1); thread_loop_c(t,d) { begin_c_loop(c,t) { C_UDMI(c,t,0) = 0; } end_c_loop(c,t) } } Then I interpret this udf. but i dont know how to proceed further. how can i assign the value '0' for all the cells at the beginning of calculation? Will it assign automatically after i interpret the udf? |
|
June 28, 2017, 09:46 |
|
#4 |
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9 |
Do you have some non-zero values in UDM-0?
You have to use the DEFINE_ON_DEMAND - macro with manual command. http://jullio.pe.kr/fluent6.1/help/h...-use-on-demand Or you can use the Fluent patch panel: https://www.sharcnet.ca/Software/Flu...g/node1035.htm |
|
June 28, 2017, 09:49 |
|
#5 |
New Member
Mat
Join Date: Jan 2017
Posts: 23
Rep Power: 9 |
Thank you so much...
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' | muth | OpenFOAM Running, Solving & CFD | 3 | August 27, 2018 05:18 |
Division by zero exception - loop over scalarField | Pat84 | OpenFOAM Programming & Development | 6 | February 18, 2017 06:57 |
Issue symmetryPlane 2.5d extruded airfoil simulation | 281419 | OpenFOAM Running, Solving & CFD | 5 | November 28, 2015 14:09 |
Diverging solution in transonicMRFDyMFoam | tsalter | OpenFOAM Running, Solving & CFD | 30 | July 7, 2014 07:20 |
compressible flow in turbocharger | riesotto | OpenFOAM | 50 | May 26, 2014 02:47 |