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

uff error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 3, 2016, 03:18
Default uff error
  #1
New Member
 
Zheng Mengyi
Join Date: Dec 2015
Location: TOKYO
Posts: 5
Rep Power: 10
zjuevol is on a distinguished road
i want to build a simple electric potential using udf for practice
and here is the simple code

#include "udf.h"

DEFINE_ADJUST(potential,domain)
{
Thread *t;
cell_t c;
face_t f;
real x[ND_ND]

thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
C_CENTROID(x,c,t);
C_UDSI(c,t,0) = 10.*x[2];
}
end_c_loop(c,t)
}
}

when i try to interpret udf the error comes

line:10 parse error
line 12 c_loop_last:undeclared variable

i can not figure out where is wrong with this two line
(thread_loop_c(t,domain) and begin_c_loop(c,t))
and i wander if there anyone can give me some help?

any advise will be a big help for me
thank you
zjuevol is offline   Reply With Quote

Old   February 3, 2016, 06:56
Default
  #2
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
you missed the ; after the real x[ND_ND]
Bruno Machado is offline   Reply With Quote

Old   February 3, 2016, 23:37
Default
  #3
New Member
 
Zheng Mengyi
Join Date: Dec 2015
Location: TOKYO
Posts: 5
Rep Power: 10
zjuevol is on a distinguished road
Quote:
Originally Posted by Bruno Machado View Post
you missed the ; after the real x[ND_ND]
thanks for your help
i add the ; and it successfully interpreted into the fluent
but after calculate i check the value of udsi it is all zero!
do you have any idea about this ?
zjuevol is offline   Reply With Quote

Old   February 4, 2016, 06:51
Default
  #4
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by zjuevol View Post
thanks for your help
i add the ; and it successfully interpreted into the fluent
but after calculate i check the value of udsi it is all zero!
do you have any idea about this ?
have you hooked the UDF? did you define diffusivity and boundary conditions?
Bruno Machado is offline   Reply With Quote

Old   February 4, 2016, 21:14
Default
  #5
New Member
 
Zheng Mengyi
Join Date: Dec 2015
Location: TOKYO
Posts: 5
Rep Power: 10
zjuevol is on a distinguished road
thanks for your reply
since it was the first time to use UDF and may have lots of thing i don't know.
i use this code just try to give UDSI0 some value which did not work know.
As you replied i think you mean i have to set the transport equation and set boundary condition, and the UDSI0 should be calculated by fluent rather than give it by user directly?
again thank you sincerely
zjuevol is offline   Reply With Quote

Old   February 5, 2016, 05:59
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
If you want to store the potential in a memory location, I think you should have a UDM (User Defined Memory), not a UDS (User Defined Scalar).

Code:
C_UDMI(c,t,0) = 10.*x[2];
For Fluent, a UDS is used for something that is transported by your flow. The electric potential is not affected by your flow (except for very unusual situations when you are working with charged fluids), so use a UDM instead.
pakk is offline   Reply With Quote

Old   February 5, 2016, 07:52
Default
  #7
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by zjuevol View Post
thanks for your reply
since it was the first time to use UDF and may have lots of thing i don't know.
i use this code just try to give UDSI0 some value which did not work know.
As you replied i think you mean i have to set the transport equation and set boundary condition, and the UDSI0 should be calculated by fluent rather than give it by user directly?
again thank you sincerely
There are few things you need to consider:
If there is no source term, field is not affected by flow and also there is no need to compute gradient, you can use UDM to define it, as Pakk said.

If any of the previous mentioned considerations are false, you need to define it through UDS; If so, you need to define the domains it is solved (in the menu, Domain -> User Defined -> Scalars) and also the diffusivity of it in the materials menu.
Bruno Machado is offline   Reply With Quote

Old   February 8, 2016, 23:22
Smile
  #8
New Member
 
Zheng Mengyi
Join Date: Dec 2015
Location: TOKYO
Posts: 5
Rep Power: 10
zjuevol is on a distinguished road
Quote:
Originally Posted by pakk View Post
If you want to store the potential in a memory location, I think you should have a UDM (User Defined Memory), not a UDS (User Defined Scalar).

Code:
C_UDMI(c,t,0) = 10.*x[2];
For Fluent, a UDS is used for something that is transported by your flow. The electric potential is not affected by your flow (except for very unusual situations when you are working with charged fluids), so use a UDM instead.
thanks you for replay i will try UDM to do it
zjuevol is offline   Reply With Quote

Old   February 8, 2016, 23:24
Default
  #9
New Member
 
Zheng Mengyi
Join Date: Dec 2015
Location: TOKYO
Posts: 5
Rep Power: 10
zjuevol is on a distinguished road
Quote:
Originally Posted by Bruno Machado View Post
There are few things you need to consider:
If there is no source term, field is not affected by flow and also there is no need to compute gradient, you can use UDM to define it, as Pakk said.

If any of the previous mentioned considerations are false, you need to define it through UDS; If so, you need to define the domains it is solved (in the menu, Domain -> User Defined -> Scalars) and also the diffusivity of it in the materials menu.
thanks for all the thing you teach me i will try UDM first
zjuevol is offline   Reply With Quote

Reply

Tags
fluent - udf


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
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries NickG OpenFOAM Installation 3 December 30, 2019 01:21
[blockMesh] blockMesh with double grading. spwater OpenFOAM Meshing & Mesh Conversion 92 January 12, 2019 10:00
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh gschaider OpenFOAM Community Contributions 300 October 29, 2014 19:00
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 10:17
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51


All times are GMT -4. The time now is 17:44.