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

A NEW solver for steady Poissonbs equation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 4, 2005, 14:13
Default I need to solve a 1d axisymmet
  #1
Ali (Ali)
Guest
 
Posts: n/a
I need to solve a 1d axisymmetric problem in a channel (1d steady state solution of pipe flow under constant pressure gradient). So, I would use an axisymmetric geometry and set number of cells in "x" direction equal to one and left and right boundaries as 'empty' and say number of grids in "r" direction 100 grids (lower boundary is axis, upper one is wall, and front and back boundaries as wedge). Now about solver, this is the equation:

1/r*d/dr(r*dU/dr)+Px=0

where Px is pressure gradient in "x" direction, I start with laplacianFOAM, rename it to channel1dFoam. Then, in the main 'channel1dFoam', I need to define a vector in "Px".

I define it like below:


Info<< "\nCalculating velocity distribution\n" << endl;


dimensionedVector Px
(
"Px",
dimensionSet(1, -2, -2, 0, 0, 0, 0),
vector(-0.1,0,0),
);


for (runTime++; !runTime.end(); runTime++)
{
Info<< "\n Time = " << runTime.timeName() << nl << endl;

# include "readSIMPLEControls.H"

for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
solve
(
Px + fvm::laplacian(1, U)
);
}


When I compile it, I get this error. Any clue what to do:

ali@ns microFluid1dFoam]$ wmake

SOURCE_DIR=.
SOURCE=channel1dFoam.C ; g++ -m32 -Dlinux -DlinuxOpt -DscalarMachine -DoptSolvers -Wall -W -Wno-unused-parameter -O3 -ffast-math -DNoRepository -ftemplate-depth-30 -I/home/ali/foam/foam2.3.2/src/foam/lnInclude -IlnInclude -I. -DWM_PROJECT_VERSION='"'2.3.2'"' -I/home/ali/foam/foam2.3.2/src/cfdTools/incompressible -I/home/ali/foam/foam2.3.2/src/cfdTools/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxOpt/channel1dFoam.o
channel1dFoam.C: In function `int main(int, char**)':
channel1dFoam.C:54: error: expected primary-expression before ')' token
make: *** [Make/linuxOpt/channel1dFoam.o] Error 1


Sorry if this seems stupid question.
  Reply With Quote

Old   February 4, 2005, 14:28
Default boundaryFoam does what you ne
  #2
Henry Weller (Henry)
Guest
 
Posts: n/a
boundaryFoam does what you need
  Reply With Quote

Old   February 6, 2005, 18:57
Default If I have this equation: 1/
  #3
Ali (Ali)
Guest
 
Posts: n/a
If I have this equation:

1/r*d/dr(r*dU/dr) = k*tanh(U)

where 'k' is a constant.

volScalarField tanhU = tanh(U);

tmp UrEqn
(
fvm::laplacian(mm, U)
==
fvm::Sp(k, tanhU)
);

solve(UrEqn);

where mm=1 is just a constant.

when I compile it, it gives no error, but when I want to run it, it gives this error:


Time = 1

--> FOAM FATAL ERROR : incompatible fields for operation
[tanhU] == [tanh(U)]

Function: checkMethod(const fvMatrix&, const fvMatrix&)
in file: /home/ali/foam/foam2.3.2/src/foam/lnInclude/fvMatrix.C at line: 936.

FOAM aborting


I don't know what's wrong, as if I change tanh(U) to U itself, there is no problem and it works. What I'm missing here?


Another thing is that if I have the main variable (here 'U') in the RHS of equation, I should use 'Sp()' function for source term (as I've used in the above equation), otherwise, if the RHS doesn't contain main variable U and would be something like

mu*1/r*d/dr(r*dU/dr)=-Px

where Px is just an independent scalar that's given, we do not necessary need to use can use 'Sp()' and the following also works:

solve
(
fvm::laplacian(mu, UExact) + gradP

);

where 'mu' is kinematic viscosity.

Is my perception right or I can implement every equation without using 'Sp()' or it's better I always use 'Sp()'? Please guide me. Thanks.
  Reply With Quote

Old   February 7, 2005, 05:01
Default Also, how to use spatial i
  #4
Ali (Ali)
Guest
 
Posts: n/a
Also,

how to use spatial integration in openFOAM's FVM formulation. i.e. if I find a scalar say 'T' from solving one of the above equations and want to calculate this integral:

from 0 to R (bounds):
Integral{(dT/dr)*(dT/dr)*r*dr}

or another intergral:

from 0 to R (bounds):
Integral{T*r*dr}

How can I do this? Thanks.
  Reply With Quote

Old   February 7, 2005, 05:38
Default You cannot solve the equation
  #5
Niklas Nordin (Niklas)
Guest
 
Posts: n/a
You cannot solve the equation treating tan(U) implicitly.

fvm::laplacian(mm, U)
==
k*tanhU

is what you want

fvm::Sp(k, tanhU)
constructs a matrix treating the variable tanhU implicit, not U (which is what I think you want)
  Reply With Quote

Old   February 7, 2005, 13:26
Default Now, it's becoming interestin
  #6
Ali (Ali)
Guest
 
Posts: n/a
Now, it's becoming interesting:

If the RHS is tanh(T) it works, but if it's sinh(T), it diverges quickly and gives very high numbers that are unaccetbale. It's odd because in MATLAB it's solvable, but here it can't be solved. Even if I start from a good intial condition for T, again it doesn't work.

fvm::laplacian(mm, T)
==
k*sinh(T)

where mm=1. The linearized version (if we assume sinh(T)=T for small enough T) is easily solvable if I replace sinh(T) by T itself.

Any clue where the problem would be?

PS: I even changed the nNonOrthogonaslCorrectors and used a couple of different laplacian schemes, but no success.
  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
Steady State All Mach Numbers Solver mkraposhin OpenFOAM Running, Solving & CFD 0 March 9, 2009 04:22
High Ma Steady Solver lgriffiths OpenFOAM Running, Solving & CFD 4 January 13, 2008 10:00
Steady and unsteady solver sam thompson FLUENT 1 April 20, 2006 13:39
Can Poissonbs equation be solved in FOAM like this luckyluke OpenFOAM Running, Solving & CFD 0 May 1, 2005 20:20
steady or unsteady equation? Harry Qiu FLUENT 0 April 2, 2001 07:35


All times are GMT -4. The time now is 20:34.