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

Adding source term to u eq

Register Blogs Community New Posts Updated Threads Search

Like Tree15Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 14, 2008, 04:24
Default hi everybody, me again with a
  #1
Member
 
robert maduta
Join Date: Mar 2009
Posts: 33
Rep Power: 17
roberthino is on a distinguished road
hi everybody, me again with a problem :-)
i now try to run my rans channel flow with cyclic boundary conditions, therefor i have to ad an extra term to the u eq in simpleFoam.C to keep a constant pressure gradient along the channel.
i really dont have a clue how to modify the u eq. i tried to do it like this:
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
+ 0.018
);

where 0.018 is the constant. this isnt working and it isnt compiling. maybe someone can help and tell me how to exactly implement the term.
thx
greetings robert
roberthino is offline   Reply With Quote

Old   March 14, 2008, 06:50
Default hi, 0.018 is a scalar not a
  #2
Senior Member
 
Stephan Gerber
Join Date: Mar 2009
Location: Germany
Posts: 118
Rep Power: 17
stephan is on a distinguished road
hi,

0.018 is a scalar not an vector while U is a vector.
try to put the 0.018 as a component of a vector - this should work.
stephan
stephan is offline   Reply With Quote

Old   March 14, 2008, 09:56
Default You must add volVectorField wi
  #3
Senior Member
 
Marhamat Zeinali
Join Date: Mar 2009
Location: Tehran, Tehran, iran
Posts: 107
Rep Power: 17
marhamat is on a distinguished road
You must add volVectorField with correct dimension
marhamat is offline   Reply With Quote

Old   March 14, 2008, 15:22
Default is there an example where i ca
  #4
Member
 
robert maduta
Join Date: Mar 2009
Posts: 33
Rep Power: 17
roberthino is on a distinguished road
is there an example where i can have a look in the code where a constant term is added? do i only have to add the term + volVectorField(0.018, 0, 0)?
roberthino is offline   Reply With Quote

Old   March 14, 2008, 18:17
Default Hello Robert, you can add i
  #5
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Hello Robert,

you can add it exactly as g (gravity) is added.

For sake of simplicity of use, just add the vector you want to add to the momentum equation to your transportProperties dictionary (check dimensions):

myVector myVector [0 1 -1 0 0 0 0] (0.018 0 0);

then read it in createFields.H after the dictionary declaration:

dimensionedVector myVector
(
transportProperties.lookup("myVector")
);

and then add it to the equation ( ... + myVector).

Regards,
Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   March 14, 2008, 18:18
Default I mean you must define new va
  #6
Senior Member
 
Marhamat Zeinali
Join Date: Mar 2009
Location: Tehran, Tehran, iran
Posts: 107
Rep Power: 17
marhamat is on a distinguished road
I mean you must define new variable as a volVectorField with correct dimension.
>such as:
volVectorField NSconstant=fvm::ddt(U);
forAll(mesh.C(),i)
{
NSconstant[i]=(0.018,0,0);
}
>then

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
+ NSconstant
)
songwukong and Luttappy like this.
marhamat is offline   Reply With Quote

Old   March 14, 2008, 23:46
Default You're right. Just shorter:
  #7
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
You're right. Just shorter:

volScalarField myVectorField("myVectorField", myVector & mesh.C());

Regards,
Alberto
Luttappy likes this.
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   March 15, 2008, 01:36
Default Thank's Alberto I prefere you
  #8
Senior Member
 
Marhamat Zeinali
Join Date: Mar 2009
Location: Tehran, Tehran, iran
Posts: 107
Rep Power: 17
marhamat is on a distinguished road
Thank's Alberto
I prefere your method too.
marhamat is offline   Reply With Quote

Old   March 15, 2008, 09:02
Default well since my knowledge in c++
  #9
Member
 
robert maduta
Join Date: Mar 2009
Posts: 33
Rep Power: 17
roberthino is on a distinguished road
well since my knowledge in c++ is very very small i try to do it the first way described by alberto. as i understodd there has to be a file (transportproperties) where i first have to define this 0.018. then i have to ad it in the createfields so that the incompressible solver can read it. then i can finally ad the term in the momentum equation. well i managed to change the createfields the proper way and also put in the term in the momentum eq. but i cant find the transportProperties file where i have to ad
myVector myVector [0 1 -1 0 0 0 0] (0.018 0 0);
maybe you can help me out?
roberthino is offline   Reply With Quote

Old   March 15, 2008, 10:11
Default hi, go to the tutorials-dir
  #10
Senior Member
 
Stephan Gerber
Join Date: Mar 2009
Location: Germany
Posts: 118
Rep Power: 17
stephan is on a distinguished road
hi,

go to the tutorials-dir in one of the cases from settlingFoam - there is a file called actually "environmentalProperties". just give the file a new name.
regards
stephan
stephan is offline   Reply With Quote

Old   March 15, 2008, 10:35
Default Robert, I wrote a tutorial
  #11
Senior Member
 
Michael Jaworski
Join Date: Mar 2009
Location: Champaign, IL, USA
Posts: 126
Rep Power: 17
mike_jaworski is on a distinguished road
Robert,
I wrote a tutorial on adding a scalar transport equation and modifying the transportProperties dictionary (and how to read these things in openFOAM). It's on the wiki and maybe you can use it to help write your solver:

http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

Good luck,
Mike J.
Luttappy likes this.
mike_jaworski is offline   Reply With Quote

Old   March 16, 2008, 09:34
Default hi all, i posted this message
  #12
Member
 
robert maduta
Join Date: Mar 2009
Posts: 33
Rep Power: 17
roberthino is on a distinguished road
hi all, i posted this message under the installation topics and now also here so that maybe you have an idea.
i did everything the way how michael described it in the tutorial he wrote. the problem is that when i try to compile everything i got the following error message:

robert@robert-laptop:~/OpenFOAM/OpenFOAM-1.4.1/applications/solvers/incompressible/simpleFoam$ wmake
g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/robert/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -I/home/robert/OpenFOAM/OpenFOAM-1.4.1/src/turbulenceModels -I/home/robert/OpenFOAM/OpenFOAM-1.4.1/src/transportModels -IlnInclude -I. -I/home/robert/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread Make/linuxGccDPOpt/simpleFoam.o -L/home/robert/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt \
-lincompressibleTurbulenceModels -lincompressibleTransportModels -lfiniteVolume -lmeshTools -lOpenFOAM -ldl penFOAM/linux/gcc-4.2.1/lib/libiberty.a -o /home/robert/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/simpleFoam
g++: penFOAM/linux/gcc-4.2.1/lib/libiberty.a: No such file or directory
make: *** [/home/robert/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/simpleFoam] Error 1
robert@robert-laptop:~/OpenFOAM/OpenFOAM-1.4.1/applications/solvers/incompressible/simpleFoam$

do i have to install any extra package to get rid of the problem? i already installed the binutils-dev package some time ago. i hope someone canhelp me
roberthino is offline   Reply With Quote

Old   March 16, 2008, 11:32
Default hi, there should be a page
  #13
Senior Member
 
Stephan Gerber
Join Date: Mar 2009
Location: Germany
Posts: 118
Rep Power: 17
stephan is on a distinguished road
hi,

there should be a page called "how to compile openfoam". on this page you will find answers about the missing libiberty - i guess a partial reinstall of the binutils is what you need.
regards
stephan
stephan is offline   Reply With Quote

Old   March 16, 2008, 16:56
Default Robert, Try to go to /home/ro
  #14
New Member
 
David Palko
Join Date: Mar 2009
Location: Stockholm
Posts: 17
Rep Power: 17
dpalko is on a distinguished road
Robert,
Try to go to /home/robert/OpenFOAM/linux/gcc-4.2.1/lib and check if you have the file libiberty.a there. If not, try to download gcc-4.2.1 from OpenFoam webpage once more and unpack it. Maybe it helps.

David
dpalko is offline   Reply With Quote

Old   March 17, 2008, 04:06
Default jep, i already have the file.
  #15
Member
 
robert maduta
Join Date: Mar 2009
Posts: 33
Rep Power: 17
roberthino is on a distinguished road
jep, i already have the file. well i installed on another machine now suse and there after downloading the packages compiling works.
with adding a source term which has the exact value of my pressure gradient and setting pressure and everything as cyclic i dont get the suspected results. i took 700 cells in channel height direction and 2 to 4 in channel lenght direction. the solution always gives cyclic positive velocities at channel inlet and outlet and in the channel half negative velocities. should i change the number of cells in channel length direction to 1?
roberthino is offline   Reply With Quote

Old   March 17, 2008, 07:32
Default just to give an update. i thin
  #16
Member
 
robert maduta
Join Date: Mar 2009
Posts: 33
Rep Power: 17
roberthino is on a distinguished road
just to give an update. i think adding only a source term to the equation and choosing cyclic boundary conditions is not possible. i think the mass conservation is not necessarily fulfilled. i am trying to do my channel flow simulation now with boundaryFoam since i heard it works already with correctors for the mass conservation. the problem is that i dont see the boundaryFoam application in my FoamX-GUI. anyone knows what to do?
roberthino is offline   Reply With Quote

Old   April 14, 2008, 05:35
Default hi, i am trying to add a conc
  #17
Member
 
davey david
Join Date: Mar 2009
Posts: 54
Rep Power: 17
suredross is on a distinguished road
hi,
i am trying to add a concentration equation to the icofoam solver to cater for different liquids of different concentrations.how do i go about it?should i follow the same procedure as how to add temperature?

thanks
davey
suredross is offline   Reply With Quote

Old   April 14, 2008, 10:25
Default hi Mike J, i was trying to fo
  #18
Member
 
davey david
Join Date: Mar 2009
Posts: 54
Rep Power: 17
suredross is on a distinguished road
hi Mike J,
i was trying to follow your tutorial to add an equation(for concentration) to the icofoam solver but it seems not to be working for me.could you explain,please,how you got this eqn:

fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(DT, T)
);

TEqn.solve?

i am new to Openfoam and cfd and cant seem to get around this obstacle.

thanks
davey
suredross is offline   Reply With Quote

Old   March 19, 2009, 03:47
Default inquiry
  #19
New Member
 
andrianomena
Join Date: Mar 2009
Location: madagascar
Posts: 23
Rep Power: 17
sambatra is on a distinguished road
Hi there,
I'm kinda new to openfoam, and now I'm trying to learn more about it, it's very interesting but little hard. I got a question.
Can anybody comment a bit on this piece of code (it is in turbfoam code):

volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
.......
U-=rUA*fvc::grad(p);
what I dont get is the 'UEqn.A()' (access function?) and the "U-=rUA*fvc::grad(p)"
last one, what does "fvc::interpolate(U) & mesh.Sf()"
I know the syntax interpolate but my trouble is the meaning of "& mesh.Sf()"
sambatra is offline   Reply With Quote

Old   March 19, 2009, 03:54
Question inquiry
  #20
New Member
 
andrianomena
Join Date: Mar 2009
Location: madagascar
Posts: 23
Rep Power: 17
sambatra is on a distinguished road
Hi there,
I'm kinda new to openfoam, and now I'm trying to learn more about it, it's very interesting but little hard. I got a question.
Can anybody comment a bit on this piece of code (it is in turbfoam code):

volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
.......
U-=rUA*fvc::grad(p);
what I dont get is the 'UEqn.A()' (access function?) and the "U-=rUA*fvc::grad(p)"
last one, what does "fvc::interpolate(U) & mesh.Sf()"
I know the syntax interpolate but my trouble is the meaning of "& mesh.Sf()"
openfoam_aero likes this.
sambatra 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
Adding Source term of a new field at the inlet vatant OpenFOAM Running, Solving & CFD 0 October 14, 2006 16:42
Adding Source term of a new field at the inlet vatant OpenFOAM Running, Solving & CFD 0 October 14, 2006 16:39
Adding a momentum source term segersson OpenFOAM Running, Solving & CFD 5 March 3, 2006 00:06
Adding a source term to continuity eqn(UDF) Sebeci FLUENT 0 April 20, 2003 04:12
adding source term confusion tedmcc CFX 4 September 27, 2001 06:05


All times are GMT -4. The time now is 14:22.