|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
marie
Join Date: May 2010
Posts: 21
Rep Power: 16 ![]() |
Hi,
I have another problem... Just to try, I wanted to put different viscosities to the pair cells and impair cells... #include"udf.h" DEFINE_PROPERTY(cell_viscosity, cell, thread) { real mu_lam; cell_t c; int i; for (i=1, i<200, i++) if ((cell_t ci %2)==0) mu_lam = 2.; else mu_lam = 1.; return mu_lam; } But it doesn't work... I'm new with both Fluent and C++... If anyone could help.. Thanks!! |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Chris
Join Date: Jul 2009
Location: Ohio, USA
Posts: 169
Rep Power: 17 ![]() |
One thing that I noticed is that the for loop should be
for (i = 1; i < 200; i++) Use a semicolon to separate arguments, not a comma. Also, I don't think that if ((cell_t ci %2)==0) will do what you think it will do. ci is a new variable of type cell_t, it's not cell_t c at index i. Are you trying to loop over the cells in a domain? I think there are macros to do that for you. (I have some c++ experience, but not really any experience writing UDFs, so I'm exactly sure how to do that.) One final thing is that UDF's are supposed to be written in c, not c++. |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
marie
Join Date: May 2010
Posts: 21
Rep Power: 16 ![]() |
thank you for your answer!
ok then, C and not C++ I'll try ";" instead of "," I'm trying to do : All the cells at index i pair have viscosity1 All the cells at index i impair have viscosity 2 I have no experience both in writting C and UDFs so I donīt know very well the macros... |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Chris
Join Date: Jul 2009
Location: Ohio, USA
Posts: 169
Rep Power: 17 ![]() |
Section 3.3 in the UDF manual is about looping macros.
|
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
marie
Join Date: May 2010
Posts: 21
Rep Power: 16 ![]() |
Yes, I will see that again... I must have forgotten something...
Thank you for your help! |
|
![]() |
![]() |
![]() |
Tags |
c++, fluent |
Thread Tools | Search this Thread |
Display Modes | |
|
|