|
[Sponsors] |
February 3, 2016, 03:18 |
uff error
|
#1 |
New Member
Zheng Mengyi
Join Date: Dec 2015
Location: TOKYO
Posts: 5
Rep Power: 10 |
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 |
|
February 3, 2016, 06:56 |
|
#2 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
you missed the ; after the real x[ND_ND]
|
|
February 3, 2016, 23:37 |
|
#3 |
New Member
Zheng Mengyi
Join Date: Dec 2015
Location: TOKYO
Posts: 5
Rep Power: 10 |
||
February 4, 2016, 06:51 |
|
#4 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
||
February 4, 2016, 21:14 |
|
#5 |
New Member
Zheng Mengyi
Join Date: Dec 2015
Location: TOKYO
Posts: 5
Rep Power: 10 |
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 |
|
February 5, 2016, 05:59 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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]; |
|
February 5, 2016, 07:52 |
|
#7 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
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. |
||
February 8, 2016, 23:22 |
|
#8 | |
New Member
Zheng Mengyi
Join Date: Dec 2015
Location: TOKYO
Posts: 5
Rep Power: 10 |
Quote:
|
||
February 8, 2016, 23:24 |
|
#9 | |
New Member
Zheng Mengyi
Join Date: Dec 2015
Location: TOKYO
Posts: 5
Rep Power: 10 |
Quote:
|
||
Tags |
fluent - udf |
|
|
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 |