|
[Sponsors] |
June 17, 2018, 08:51 |
syntax error
|
#1 | |
New Member
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8 |
I am getting the following error :-
..\..\src\tegtr.c(22): error C2143: syntax error: missing ';' before '{' for following code :- Quote:
I have also tried to solve the error following this link :- what is syntax error : missing ')' before ';' But it didn't work. Any suggestions will be greatly appreciated. Thank you |
||
June 17, 2018, 11:01 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Your code has a definition for rho_function within the cell loop; this definition should be moved above the DEFINE_DIFFUSIVITY call. Also, these lines of code are redundant (not used):
Code:
real T; T = C_T(c,t); ... real T; T = C_T(cell, thread); |
|
June 17, 2018, 11:38 |
|
#3 |
New Member
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8 |
Thank you, it worked
|
|
June 17, 2018, 12:42 |
|
#4 | |
New Member
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8 |
Is it necessary to define the rho_function() inside the loop?
Because without the loop I don't get any error but with the loop I am getting the following error:- ..\..\src\tegtr.c(10): error C2449: found '{' at file scope (missing function header?) ..\..\src\tegtr.c(18): error C2059: syntax error: '}' for the following code:- Quote:
|
||
June 17, 2018, 22:22 |
|
#5 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
The functions should be defined outside of the loops and other functions. Remember that we can use 1.e-3 instead of calling pow(10,-3); improving readability and slightly reducing the compute time. Similarly, if the power is an integer, then expanding the power expression is the standard approach.
The DEFINE_DIFFUSIVITY macro is called for each cell (check the UDF manual for the description), and therefore you do not use the cell loop. The trailing dot is especially important for divisions such as 1/x. Here is the corrected code: Code:
#include "udf.h" #include "math.h" enum { teg, N_REQUIRED_UDS }; real rho_function(real T) { return -3.982e-5 + 2.98e-7*T - 4.685e-10*T*T + 2.51e-12*T*T*T; } DEFINE_DIFFUSIVITY(teg_diffusivity, c, t, i) { C_UDSI(c,t,teg) = rho_function(C_T(c,t)); return 1./C_UDSI(c,t,teg); } |
|
June 18, 2018, 04:53 |
|
#6 | ||
New Member
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8 |
Thanks Mr. 'e' your advice always works.
Actually I am solving the following equation:- ∇V= -α(T)∇T-ρ(T)J for which 2 UDS are as follows:- Quote:
Quote:
And also there is a term 'J' in the equation for which I need to create a profile on which I am still working. |
|||
June 18, 2018, 07:47 |
|
#7 | |
New Member
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8 |
And what can you say about the following error:-
..\..\src\teg2.c(12): error C2065: 'thread': undeclared identifier ..\..\src\teg2.c(12): error C2223: left of '->t' must point to struct/union I get this error frequently. I don't get this, since thread is a data type why do we need to declare it? I get this error for the following code :- Quote:
|
||
June 18, 2018, 08:30 |
|
#8 |
Senior Member
Cees Haringa
Join Date: May 2013
Location: Delft
Posts: 607
Rep Power: 0 |
what are you trying to do with the thread t thing? point to itself?
I think you are looking for Code:
Thread *t; begin_thread_loop_c { - insert the cell loop -} If you want to select a single thread, use: Code:
t = Lookup_Thread(domain,zone_ID); |
|
June 18, 2018, 11:05 |
|
#9 |
New Member
Animesh Sahoo
Join Date: May 2018
Posts: 20
Rep Power: 8 |
yeah I got it. You mean I don't need to point to itself if I am going to use it in the UDS to store another value.
Thank you |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM] an error in Calculator's equation | immortality | ParaView | 12 | June 29, 2021 01:10 |
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries | NickG | OpenFOAM Installation | 3 | December 30, 2019 01:21 |
Pressure outlet boundary condition | rolando | OpenFOAM Running, Solving & CFD | 62 | September 18, 2017 07:45 |
[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 |
Undeclared Identifier Errof UDF | SteveGoat | Fluent UDF and Scheme Programming | 7 | October 15, 2014 08:11 |