CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Please help me specify the Desity and viscosity for each cell

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 4, 2005, 22:20
Default Dear all: I am eager to you
  #1
Senior Member
 
Guoxiang
Join Date: Mar 2009
Posts: 109
Rep Power: 17
liugx212 is on a distinguished road
Dear all:

I am eager to your help because I am a new learner in openfoam. I have a trouble that how to control the desity and viscosity for each cell for several days. So could you please give some advice and help?

my try to give code as:
scalarField& nuInternal = nu.internalField();
const scalarfield& nuInternal = nu.internalField();
forAll (nuInternal, celli)
{
}

Thanks deeply,
Guoxiang
liugx212 is offline   Reply With Quote

Old   December 4, 2005, 22:32
Default you can make: forAll(nu,cellI
  #2
Member
 
olivier Petit
Join Date: Mar 2009
Location: Göteborg, Sweden
Posts: 67
Rep Power: 17
olivier is on a distinguished road
you can make:
forAll(nu,cellI)
{
nu[cellI]=...
}
so you can change the value of nu in each cell.

enjoy
olivier is offline   Reply With Quote

Old   December 4, 2005, 22:54
Default Dear olivier baily: Thanks
  #3
Senior Member
 
Guoxiang
Join Date: Mar 2009
Posts: 109
Rep Power: 17
liugx212 is on a distinguished road
Dear olivier baily:

Thanks for your help!
Yes, I have tried just now. But there are some errors as follows. Also, I think the "rho", "E" are specified as the same way, right?

Again, Thanks and have great day.

Guoxiang


errors:

stressedFoam.C:115: error: 'scalarField' was not declared in this scope
stressedFoam.C:115: error: 'nuInternal' was not declared in this scope
stressedFoam.C:115: error: 'struct Foam::dimensionedScalar' has no member named 'internalField'
stressedFoam.C:116: error: expected initializer before '&' token


115: scalarField& nuInternal = nu.internalField();
116: const scalarfield& nuInternal = nu.internalField();
liugx212 is offline   Reply With Quote

Old   December 4, 2005, 23:49
Default You can't use internalField f
  #4
Member
 
olivier Petit
Join Date: Mar 2009
Location: Göteborg, Sweden
Posts: 67
Rep Power: 17
olivier is on a distinguished road
You can't use internalField function to a scalarField but you can use it with the volScalarField..
for each sacalarField you can change the value in the cell with the same way.
---
olivier
olivier is offline   Reply With Quote

Old   December 5, 2005, 02:35
Default Dear olivier baily: Sorry t
  #5
Senior Member
 
Guoxiang
Join Date: Mar 2009
Posts: 109
Rep Power: 17
liugx212 is on a distinguished road
Dear olivier baily:

Sorry to bore you again. I really a new comer so I have some questions. please do not mind me.

As you said, I modified as:
115: const volScalarField& nuInternal = nu.internalField();
116: forAll (nuInternal, celli)
117: {
118: nuInternal[celli] = 1;
119: }

But I was told as follows:
115: struct Foam::dimensionedScalar has no member named internalField
118: error: assignment of read-only location


Could you please give help again.
Thanks and sorry to bore you.
Guoxiang
liugx212 is offline   Reply With Quote

Old   December 5, 2005, 06:13
Default Try (haven't tried it myself):
  #6
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
Try (haven't tried it myself):

scalarField& nuInternal = nu.internalField();

forAll (nuInternal, celli)
{
nuInternal[celli] = 1;
}
mattijs is offline   Reply With Quote

Old   December 5, 2005, 11:20
Default Dear Mattijs Janssens: Than
  #7
Senior Member
 
Guoxiang
Join Date: Mar 2009
Posts: 109
Rep Power: 17
liugx212 is on a distinguished road
Dear Mattijs Janssens:

Thanks for your help. There was said that:
error: 'struct Foam::dimensionedScalar' has no member named 'internalField'
for this line:
scalarField& nuInternal = nu.internalField();

I am findind where is error. Could you please give help again.

Thanks deeply,
Guoxiang
liugx212 is offline   Reply With Quote

Old   December 5, 2005, 12:30
Default Dear all: I am eager to get
  #8
Senior Member
 
Guoxiang
Join Date: Mar 2009
Posts: 109
Rep Power: 17
liugx212 is on a distinguished road
Dear all:

I am eager to get your help.
Please help me see the code again since I have no ideas to debug this.

// set the nu for each cell
116: volScalarField& nuInternal = nu.internalField();
forAll (nuInternal, celli)
{
if (componentValue[celli] > 0)
nuInternal[celli] = 0.3;
else nuInternal[celli] = 0.1;
}
// set the rho for each cell
125: volScalarField& rhoInternal = rho.internalField();
forAll (rhoInternal, celli)
{
if (componentValue[celli] > 0)
rhoInternal[celli] = 2000000;
else rhoInternal[celli] = 20000;
}

// set the E for each cell
134: volScalarField& EInternal = E.internalField();
forAll (EInternal, celli)
{
if (componentValue[celli] > 0)
EInternal[celli] = 7854;
else EInternal[celli] = 1000;
}

Error as:

stressedFoam.C:116: error: 'struct Foam::dimensionedScalar' has no member named 'internalField'
stressedFoam.C:125: error: 'struct Foam::dimensionedScalar' has no member named 'internalField'
stressedFoam.C:134: error: 'E' was not declared in this scope
stressedFoam.C:134: error: '<typeprefixerror>E' previously declared here



Thanks deeply,
Guoxiang
liugx212 is offline   Reply With Quote

Old   December 5, 2005, 16:28
Default Daer All: Please give piece
  #9
Senior Member
 
Guoxiang
Join Date: Mar 2009
Posts: 109
Rep Power: 17
liugx212 is on a distinguished road
Daer All:

Please give pieces of advice and help.

Thanks,
Guoxiang
liugx212 is offline   Reply With Quote

Old   December 8, 2005, 12:58
Default Dear all: I still not get s
  #10
Senior Member
 
Guoxiang
Join Date: Mar 2009
Posts: 109
Rep Power: 17
liugx212 is on a distinguished road
Dear all:

I still not get sucess. Could you please give some advice and help.

Thanks a lot.

Guoxiang
liugx212 is offline   Reply With Quote

Old   December 9, 2005, 06:11
Default dear Guoxiang, i am sorry t
  #11
Member
 
VVqf
Join Date: Mar 2009
Location: Braunschweig
Posts: 66
Rep Power: 17
vvqf is on a distinguished road
dear Guoxiang,

i am sorry to say it, but you do need do more programming. Check your src file, whether all needed .inc files are included. go into the error, locate and fix it.

if you don't get answer anymore, either it's too basic, or too difficult that nobody can answer.
vvqf is offline   Reply With Quote

Old   April 29, 2008, 05:42
Default The advice above, I've used th
  #12
New Member
 
Christian Andersen
Join Date: Mar 2009
Location: Aalborg, Denmark
Posts: 8
Rep Power: 17
christian_andersen is on a distinguished road
The advice above, I've used this for a Eddy-Break-up model for combustion.

It works fine when run on 1 CPU, but when I try to run it parallel - it fails!

Any advice? Does anyone know what the problem is?

Best
Christian Andersen
christian_andersen 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
turbulent viscosity limited to viscosity ratio of Hua FLUENT 7 September 27, 2019 07:42
turbulent viscosity limited to viscosity ratio... frank FLUENT 19 December 15, 2015 23:54
"turbulent viscosity limited to viscosity ratio" olivier FLUENT 11 October 10, 2015 06:49
turbulent viscosity limited to viscosity ratio Elizabeth FLUENT 13 December 16, 2014 09:57
Turbulent viscosity Limited to viscosity ratio Adrian FLUENT 12 September 21, 2011 05:22


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