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

Source term error can't be solved

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 2, 2014, 13:55
Default Source term error can't be solved
  #1
Senior Member
 
Join Date: Jan 2012
Posts: 197
Rep Power: 14
itsme_kit is on a distinguished road
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
itsme_kit is offline   Reply With Quote

Old   June 2, 2014, 14:23
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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...
pakk is offline   Reply With Quote

Old   June 2, 2014, 14:27
Default
  #3
Senior Member
 
Join Date: Jan 2012
Posts: 197
Rep Power: 14
itsme_kit is on a distinguished road
Quote:
Originally Posted by pakk View Post
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...
Hi pakk

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
itsme_kit is offline   Reply With Quote

Old   June 3, 2014, 02:12
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   June 3, 2014, 04:16
Default
  #5
Senior Member
 
Join Date: Jan 2012
Posts: 197
Rep Power: 14
itsme_kit is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.
Hi PAKK

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
itsme_kit is offline   Reply With Quote

Old   June 3, 2014, 08:18
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   June 3, 2014, 08:26
Default
  #7
Senior Member
 
Join Date: Jan 2012
Posts: 197
Rep Power: 14
itsme_kit is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.
the value of C_D_G is -0.000003

The source is a constant value in -0.000003
itsme_kit is offline   Reply With Quote

Old   June 3, 2014, 10:41
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.)
pakk is offline   Reply With Quote

Old   June 3, 2014, 11:00
Default
  #9
Senior Member
 
Join Date: Jan 2012
Posts: 197
Rep Power: 14
itsme_kit is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.)
I have to say I got a little bit confused now

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?
itsme_kit is offline   Reply With Quote

Old   June 4, 2014, 03:32
Default
  #10
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   June 4, 2014, 04:57
Default
  #11
Senior Member
 
Join Date: Jan 2012
Posts: 197
Rep Power: 14
itsme_kit is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.
Yes, I noticed this problem too, I will try to sort it out and let you know any update

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
itsme_kit is offline   Reply With Quote

Old   June 4, 2014, 05:00
Default
  #12
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
No. You make exactly the same mistake. The solution is therefore exactly the same.
pakk is offline   Reply With Quote

Old   June 4, 2014, 05:17
Default
  #13
Senior Member
 
Join Date: Jan 2012
Posts: 197
Rep Power: 14
itsme_kit is on a distinguished road
Quote:
Originally Posted by pakk View Post
No. You make exactly the same mistake. The solution is therefore exactly the same.
What mistake do you mean?

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?
itsme_kit is offline   Reply With Quote

Old   June 4, 2014, 05:56
Default
  #14
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   June 4, 2014, 06:04
Default
  #15
Senior Member
 
Join Date: Jan 2012
Posts: 197
Rep Power: 14
itsme_kit is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.
I think C_DUDZ can be hooked in x momentum equation

Only except C_D_G (maybe turbulent dissipation rate equation)

Just I have no idea how to modify my code in a correct structure
itsme_kit is offline   Reply With Quote

Old   June 4, 2014, 06:24
Default
  #16
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   June 4, 2014, 07:37
Default
  #17
Senior Member
 
Join Date: Jan 2012
Posts: 197
Rep Power: 14
itsme_kit is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.
Hi

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
itsme_kit is offline   Reply With Quote

Old   June 4, 2014, 07:45
Default
  #18
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   June 4, 2014, 07:47
Default
  #19
Senior Member
 
Join Date: Jan 2012
Posts: 197
Rep Power: 14
itsme_kit is on a distinguished road
Quote:
Originally Posted by pakk View Post
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.
do you mean I get rid of C_DUDZ and C_D_G?

Only put source = constant value in the momentum equation or epsilon equation?

This is my understanding
itsme_kit is offline   Reply With Quote

Old   June 4, 2014, 07:54
Default
  #20
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
That is indeed what I am saying.
pakk is offline   Reply With Quote

Reply


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
[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


All times are GMT -4. The time now is 10:19.