|
[Sponsors] |
June 2, 2014, 13:55 |
Source term error can't be solved
|
#1 |
Senior Member
Join Date: Jan 2012
Posts: 197
Rep Power: 14 |
Hi This is my source term for turbulent dissipation gradient in z direction
DEFINE_SOURCE(dissipation_gradient,cell,thread,dS, eqn) { real source; source=C_D_G(cell,thread)=-0.000003; dS[eqn]=0.; return source; } Hopefully the above structure is correct After interpreting in Fluent, I got following message: invalid lvalue in assignment (in line starting with source=C_D_G(cell,thread)=-0.000003 I couldn't understand the meaning of this message Actually I just wanna have a source term for depsilon/dz Can anyone help me sort it out? Thanks in advance |
|
June 2, 2014, 14:23 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
What do you want to achieve with the line "source=C_D_G(cell,thread)=-0.000003"?
Does the variable "source" needs to be set to the value of C_D_G(cell,thread), or to -0.000003? Or do you want the value of C_D_G(cell_thread) to change? The compiler does not understand what you want... |
|
June 2, 2014, 14:27 |
|
#3 | |
Senior Member
Join Date: Jan 2012
Posts: 197
Rep Power: 14 |
Quote:
Thanks for your reply first of all Currently I have a formula: depsilon/dz=constant I wanna add this formula into fluid zone in the form of source term Just now I found I missed one component in that line: [2] direction vector Now the compiler can read my code without any warning However, in terms of my case, do you have any comment? I wonder if I'm doing this correctly |
||
June 3, 2014, 02:12 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
You did not answer my questions, so I don't know what you want your code to do. Therefore I don't know what your code should look like.
|
|
June 3, 2014, 04:16 |
|
#5 | |
Senior Member
Join Date: Jan 2012
Posts: 197
Rep Power: 14 |
Quote:
I wanna apply a shear stress in my fluid zone In order to do this, I derived du/dz and depsilon/dz which are acting in the effect of shear stress Look forward to hearing from you |
||
June 3, 2014, 08:18 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
My questions were:
Does the variable "source" needs to be set to the value of C_D_G(cell,thread), or to -0.000003? Or do you want the value of C_D_G(cell_thread) to change? These ones need an answer. |
|
June 3, 2014, 08:26 |
|
#7 | |
Senior Member
Join Date: Jan 2012
Posts: 197
Rep Power: 14 |
Quote:
The source is a constant value in -0.000003 |
||
June 3, 2014, 10:41 |
|
#8 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
But in a programming language, you are giving instructions to the computer. What do you want the computer to do?
-Computer, please change the value of C_D_G into -0.000003. -Computer, please change the value of source into -0.000003. -Computer, please change the value of source into the value of C_D_G. Which one is it? With the code you had before, the computer did not know which one you meant. (You say "the value of C_D_G is -0.000003", but that does not make clear if C_D_G already has that value, or if you want to change it into that value.) |
|
June 3, 2014, 11:00 |
|
#9 | |
Senior Member
Join Date: Jan 2012
Posts: 197
Rep Power: 14 |
Quote:
I only want to add a source term in U equation to act like a shear stress Currently I got: depsilon/dz=-0.000003 In terms of my case, how can I let PC know depsilon/dz=-0.000003? Do you mind modifying what I wrote in code in a correct way? |
||
June 4, 2014, 03:32 |
|
#10 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
I think what you mean is:
source = -0.000003; It looks like you added C_D_G(cell,thread) in the code to inform Fluent that you are talking about depsilon/dz, am I right? If so, this is not the correct place; you do that by selecting in Fluent where you add this source. Honestly, I don't know if there is a place where you can hook it to the turbulent dissipation gradient in z direction, that is beyond my knowledge. |
|
June 4, 2014, 04:57 |
|
#11 | |
Senior Member
Join Date: Jan 2012
Posts: 197
Rep Power: 14 |
Quote:
In terms of velocity gradient: du/dz DEFINE_SOURCE(shear_stress,cell,thread,dS,eqn) { real source; source=C_DUDZ(cell,thread)=0.003251; dS[eqn]=0.; return source; } I put this source term in the x momentum equation Do I think I wrote this code correctly? Thanks |
||
June 4, 2014, 05:00 |
|
#12 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
No. You make exactly the same mistake. The solution is therefore exactly the same.
|
|
June 4, 2014, 05:17 |
|
#13 | |
Senior Member
Join Date: Jan 2012
Posts: 197
Rep Power: 14 |
Quote:
I think the place to hook this source term is correct Maybe some problems existed in the structure of code I found that the unit of source term in momentum equation is n/m3 I also noticed that du/dz is a constant in my code, there is no variable for derivation, right? |
||
June 4, 2014, 05:56 |
|
#14 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
You have the same code, only with C_DUDZ instead of C_D_G and 0.003251 in stead of -0.000003.
Everything I said before therefore also applies to this code, only replace "C_D_G" in my comments by "C_DUDZ", and "-0.000003" by "0.003251". Literally. |
|
June 4, 2014, 06:04 |
|
#15 | |
Senior Member
Join Date: Jan 2012
Posts: 197
Rep Power: 14 |
Quote:
Only except C_D_G (maybe turbulent dissipation rate equation) Just I have no idea how to modify my code in a correct structure |
||
June 4, 2014, 06:24 |
|
#16 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
I showed you how to modify your code for the turbulent dissipation gradient case. For the x momentum equation case, the modification is exactly the same, only replace "C_D_G" by "C_DUDZ", and "-0.000003" by "0.003251". Literally.
|
|
June 4, 2014, 07:37 |
|
#17 | |
Senior Member
Join Date: Jan 2012
Posts: 197
Rep Power: 14 |
Quote:
I didn't get your point of modifying the code I do want the computer to know that C_DUDZ=0.003251, perhaps source will not be equal to 0.003251 |
||
June 4, 2014, 07:45 |
|
#18 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
Then please re-read my message of today, 09:32. I gave you a direct answer, and tried to explain you why your way of thinking failed here.
|
|
June 4, 2014, 07:47 |
|
#19 | |
Senior Member
Join Date: Jan 2012
Posts: 197
Rep Power: 14 |
Quote:
Only put source = constant value in the momentum equation or epsilon equation? This is my understanding |
||
June 4, 2014, 07:54 |
|
#20 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
That is indeed what I am saying.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] funkyDoCalc with OF2.3 massflow | NiFl | OpenFOAM Community Contributions | 14 | November 25, 2020 03:30 |
How to define a transient species source term? | aleisia | FLUENT | 3 | March 7, 2011 22:58 |
pisoFoam compiling error with OF 1.7.1 on MAC OSX | Greg Givogue | OpenFOAM Programming & Development | 3 | March 4, 2011 17:18 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 10:23 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 17:51 |