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

Creating a solver for the nondimensionalized Navier-Stokes equation

Register Blogs Community New Posts Updated Threads Search

Like Tree12Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 16, 2012, 13:01
Default
  #21
Member
 
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 14
Mehrez is on a distinguished road
dimensions [0 0 0 0 0 0 0];

This line represent the dimension of U and p. I have this line in the 2 files cavity/0/p and cavity/0/U
Mehrez is offline   Reply With Quote

Old   November 16, 2012, 13:04
Default
  #22
Member
 
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 14
Mehrez is on a distinguished road
Dear Tobi,

Here is what I got by setting pGrad pGrad [0 -1 0 0 0 0 0]







Create time

Create mesh for time = 0

Reading transportProperties

Reading field p

Reading field U

Reading/calculating face flux field phi


Starting time loop

Time = 0.005

Courant Number mean: 0 max: 0


--> FOAM FATAL ERROR:
incompatible dimensions for operation
[U[0 -1 0 0 0 0 0] ] - [U[0 -2 0 0 0 0 0] ]

From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&)
in file /opt/openfoam211/src/finiteVolume/lnInclude/fvMatrix.C at line 1316.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#1 Foam::error::abort() in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#2
in "/opt/openfoam211/platforms/linuxGccDPOpt/bin/myIcoFoamB"
#3
in "/opt/openfoam211/platforms/linuxGccDPOpt/bin/myIcoFoamB"
#4
in "/opt/openfoam211/platforms/linuxGccDPOpt/bin/myIcoFoamB"
#5 __libc_start_main in "/lib/i386-linux-gnu/libc.so.6"
#6
in "/opt/openfoam211/platforms/linuxGccDPOpt/bin/myIcoFoamB"
Aborted (core dumped)
ubuntu@ubuntu-VirtualBox:~/OpenFOAM/mehrez-2.1.1/test/cavity$
Mehrez is offline   Reply With Quote

Old   November 16, 2012, 13:10
Default
  #23
Member
 
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 14
Mehrez is on a distinguished road
Even if I do this, it doesn't work :

0/p
dimensions [0 -1 0 0 0 0 0];

0/U
dimensions [0 0 0 0 0 0 0];

transportProperties
Re Re [ 0 -1 0 0 0 0 0 ] 0.01;
gradP gradP [ 0 -2 0 0 0 0 0 ] (0.9 0.2 0);

This is what I got :






Create time

Create mesh for time = 0

Reading transportProperties

Reading field p

Reading field U

Reading/calculating face flux field phi


Starting time loop

Time = 0.005

Courant Number mean: 0 max: 0
DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 6.17543e-06, No Iterations 17
DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 3.68856e-06, No Iterations 14


--> FOAM FATAL ERROR:
LHS and RHS of + have different dimensions
dimensions : [0 2 0 0 0 0 0] + [0 4 -1 0 0 0 0]


From function operator+(const dimensionSet&, const dimensionSet&)
in file dimensionSet/dimensionSet.C at line 514.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#1 Foam::error::abort() in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#2 Foam:perator+(Foam::dimensionSet const&, Foam::dimensionSet const&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#3
at myIcoFoamB.C:0
#4
in "/opt/openfoam211/platforms/linuxGccDPOpt/bin/myIcoFoamB"
#5 __libc_start_main in "/lib/i386-linux-gnu/libc.so.6"
#6
in "/opt/openfoam211/platforms/linuxGccDPOpt/bin/myIcoFoamB"
Aborted (core dumped)
ubuntu@ubuntu-VirtualBox:~/OpenFOAM/mehrez-2.1.1/test/cavity$
Mehrez is offline   Reply With Quote

Old   November 16, 2012, 13:24
Default
  #24
Member
 
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 14
Mehrez is on a distinguished road
Any idea ? does someone know how to ignore the dimension-checking in the "controlDict" file ?

I'm stuck...
Mehrez is offline   Reply With Quote

Old   November 16, 2012, 13:59
Default
  #25
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Oh its not my day today, sorry.
Now I understand what you are doing.

Hmmm I have to try it by my self but i have no time. It should be possible.
Tobi is offline   Reply With Quote

Old   November 16, 2012, 15:17
Default
  #26
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22
Bernhard is on a distinguished road
Quote:
Originally Posted by Mehrez View Post
Any idea ? does someone know how to ignore the dimension-checking in the "controlDict" file ?

I'm stuck...
If you do
cd $FOAM_INST_DIR/OpenFOAM-2.1.0/etc

You can go to the line with dimensionSet (line 400 for me), and change the switch to 0. I assume this does not check the dimensions, but I am not sure about it.

If you don't have privileges to change that controlDict, you can set it in a .OpenFOAM/2.1.0/ folder in your home-directory.

Good luck, I hope this works.
babakflame and Mehrez like this.
Bernhard is offline   Reply With Quote

Old   November 19, 2012, 05:36
Default
  #27
Member
 
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 14
Mehrez is on a distinguished road
Dear both,

It seems that it is working !

Thank you for your precious help.

I hope that this discussion will help other beginners.

Thank you.

Best regards.

Mehrez.
Mehrez is offline   Reply With Quote

Old   November 19, 2012, 05:55
Default
  #28
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Dear Mehrez

It is nice that your solver is working now. However, I think you better track the dimensions of your equation ... It is a very nice feature to override. Especially, if you have problems with verification of your solver.

Regards,
Hisham
Mehrez likes this.
Hisham is offline   Reply With Quote

Old   November 19, 2012, 06:16
Default
  #29
Member
 
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 14
Mehrez is on a distinguished road
Dear Hisham,

If you look just a little above you will see that I tried to multiply the terms of my equation with coefficients of different dimensions to get a dimensionless form of my equation but it did not work and I do not know why ...

Otherwise I have another question, how to have the steady state? (is not more convenient if I modify another solver like SimpleFoam because removing the line ddt (U) on IcoFoam gives a false result)

thank you

Mehrez
Mehrez is offline   Reply With Quote

Old   November 19, 2012, 06:32
Default
  #30
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
You can edit the system/fvSchemes from:
Code:
ddtSchemes
{
    default         Euler;
}
to:
Code:
ddtSchemes
{
    default         steadyState;
}
But that will just automatically ignore the ddt term. So it has the same shortcoming.

Regards,
Hisham
Hisham is offline   Reply With Quote

Old   November 19, 2012, 09:31
Default
  #31
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
I just remembered. You can also try to base your solver on the pimpleFoam solver, which uses a merge of PISO and SIMPLE algorithms.
Hisham is offline   Reply With Quote

Old   November 19, 2012, 11:04
Default
  #32
Member
 
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 14
Mehrez is on a distinguished road
Hi Hisham,

I've found the following text on the OpenFoam tutorial :

" When specifying a time scheme it must be noted that an application designed for transient problems will not necessarily run as steady-state and visa versa. For example the solution will not converge if steadyState is specified when running icoFoam, the transient, laminar incompressible flow code; rather, simpleFoam should be used for steady-state, incompressible flow. "

So, to implement a solver that resolves the following equation (steady-state) :

fvVectorMatrix UEqn
(
// fvm::ddt(U)
Re*(fvm::div(phi, U))
- fvm::laplacian(U)
+ gradP
);

solve(UEqn == -fvc::grad(p));

I need to modify the simpleFoam solver rather than icoFoam.


Looking at the simpleFoam solver, I've found 2 files pEqn.H and UEqn.H but I don't know how to modify the equations... can you please tell me what I need to delete (like the turbulence terms).

Thank you.

Best regards.

Mehrez
Mehrez is offline   Reply With Quote

Old   November 19, 2012, 16:16
Default
  #33
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
OpenFOAM solvers use three major algorithms:
- SIMPLE: for steady state (e.g. simpleFoam)
- PISO: for transient problems (e.g. icoFoam and pisoFoam)
- PIMPLE: for steady state and transient because it is a merge of SIMPLE and PISO (e.g. pimpleFoam)

So as I mentioned earlier you need to base your solver on pimpleFoam. When you compare simpleFoam you need to compare it with pisoFoam because both has turbulence modelling while icoFoam has no turbulence modelling capabilities enabled.

Regards,
Hisham
Mehrez likes this.
Hisham is offline   Reply With Quote

Old   November 19, 2012, 19:38
Default
  #34
Member
 
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 14
Mehrez is on a distinguished road
Dear Hisham,

Thank you for your help.

In pimpleFoam there are 2 files to implement my equation : UEqn.H and pEqn.H , so it is different from icoFoam where I had one file to implement the equation.

Can I do some change on the icoFoam solver to be able to solve with pimple algorithm rather than piso ? If not, in which file do I have to put my equation in the pimpleFoam solver ?

Thank you so much for your help and excuse me for these questions.

best regards.

Mehrez
Mehrez is offline   Reply With Quote

Old   November 20, 2012, 04:28
Default
  #35
Senior Member
 
Elvis
Join Date: Mar 2009
Location: Sindelfingen, Germany
Posts: 620
Blog Entries: 6
Rep Power: 24
elvis will become famous soon enough
Hi,

did you see http://openfoam-extend.sourceforge.n...m/training.htm
take a look at the tutorials "New Developer"

http://switch.dl.sourceforge.net/pro...he_slides2.pdf
=>start @Slide10 to 19 Copy and rename scalarTransportFoam
Mehrez likes this.
elvis is offline   Reply With Quote

Old   December 17, 2012, 11:46
Default
  #36
Member
 
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 14
Mehrez is on a distinguished road
Thank you elvis
Mehrez is offline   Reply With Quote

Old   May 9, 2013, 11:53
Default
  #37
New Member
 
OFghost
Join Date: Feb 2013
Location: Canada
Posts: 8
Rep Power: 13
umar82088 is on a distinguished road
Hi,
I am having the similar problem, please help me to deal with.
Thanks
umar82088 is offline   Reply With Quote

Old   December 11, 2016, 19:04
Smile How to turn off the dimension checking in OpenFOAM
  #38
Senior Member
 
Bill Wang
Join Date: Aug 2014
Posts: 109
Rep Power: 12
6863523 is on a distinguished road
Quote:
Originally Posted by Bernhard View Post
If you do
cd $FOAM_INST_DIR/OpenFOAM-2.1.0/etc

You can go to the line with dimensionSet (line 400 for me), and change the switch to 0. I assume this does not check the dimensions, but I am not sure about it.

If you don't have privileges to change that controlDict, you can set it in a .OpenFOAM/2.1.0/ folder in your home-directory.

Good luck, I hope this works.
Dear Bernhard,
I have copied the controlDict out into the case folder, and changed the dimensionSet from 1 to 0, since I have no permission to change the original local file. But still an error occurs:
Code:
cellSource functionObjects_allvolAverage:All():
total cells =103462
total volume = 0.0400007

Time=0.0125

Courant Number mean:0 max:0

-->FOAM FATAL IO ERROR:
incompatible dimensions for operation
  [U[0 0 -1 0 0 0 0]]+ [U[0 0 -1 0 0 0 0]]

 From function checkMethod (const fcMatrix<Type>&, const fvMatrix<Type>&)
 in file /usr/local/OpenFOAM/OpenFOAM-3.0.1/src/finiteVolume/lnInclude/fcMatrix.C at line 1295.


FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
# Foam::IOerror::abort() at ??:?
#2 void Foam::checkMethod<Foam::Vector<double>>(Foam::fvMatrix<Foam::Vector<double>> const&, Foam::fvMatrix<Foam::Vector<double>> const&, char const*) at ??:?
#3 ? at ??:?
#4 ? at ??:?
#5 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#6 ? at ??:?

Aborted
I have set the dimensions in 0/p, 0/U and the transProperties to be [0 0 0 0 0 0 0].
It seems that the newly created solver does not listen to the modified controDict file.
I am really appreciated for any suggestions.
Thank you in advance.
Best Regards,
Bill
6863523 is offline   Reply With Quote

Old   December 12, 2016, 14:20
Default Why create a non-dimensional solver for NS? Use the existing ones!
  #39
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 16
Santiago is on a distinguished road
Ok, let me leave you some comments about what you are trying to do:

(1) It seems to me that you are trying to solve the equations directly! But as you are currently implementing it will certainly diverge (even if you make it compile) because you are not giving an equation for p (the system is ill-posed), simply as that. Refer to a basic text of CFD to get acquainted with different solution algorithms. The book of Peyret is a nice introduction to the subject.

(2) You don't need this at all! If you choose the natural frequency of the system to be U/L then the dimensional and non-dimensional version of the NS eqns are equivalent, except that the viscous diffusivity multiplying the laplacian term becomes the inverse of the Reynolds number. In other words, when asked for nu in 'transportProperties' you insert 1/Re. No need to play with the dimensions either! PISO/SIMPLE doesn't care (should it?), but FOAM does dimension checking as a convenience for the user and the developer.

TL;DR: Don't bother implementing a new solver, just use ico-/simple-/pisoFoam considering nu equal to the inverse of Reynolds number, unless the natural freq. of the system is given at the boundaries.
babakflame likes this.

Last edited by Santiago; December 12, 2016 at 14:27. Reason: EDIT: Clarified solvers
Santiago is offline   Reply With Quote

Old   December 12, 2016, 15:18
Default the detailed descripition about the problem
  #40
Senior Member
 
Bill Wang
Join Date: Aug 2014
Posts: 109
Rep Power: 12
6863523 is on a distinguished road
Quote:
Originally Posted by Santiago View Post
Ok, let me leave you some comments about what you are trying to do:

(1) It seems to me that you are trying to solve the equations directly! But as you are currently implementing it will certainly diverge (even if you make it compile) because you are not giving an equation for p (the system is ill-posed), simply as that. Refer to a basic text of CFD to get acquainted with different solution algorithms. The book of Peyret is a nice introduction to the subject.

(2) You don't need this at all! If you choose the natural frequency of the system to be U/L then the dimensional and non-dimensional version of the NS eqns are equivalent, except that the viscous diffusivity multiplying the laplacian term becomes the inverse of the Reynolds number. In other words, when asked for nu in 'transportProperties' you insert 1/Re. No need to play with the dimensions either! PISO/SIMPLE doesn't care (should it?), but FOAM does dimension checking as a convenience for the user and the developer.

TL;DR: Don't bother implementing a new solver, just use ico-/simple-/pisoFoam considering nu equal to the inverse of Reynolds number, unless the natural freq. of the system is given at the boundaries.
Dear Santiago,
Thank you for the comments, I have described the problem detailly here, with the related equations and the decomposed pressure. How to use the dimensionless N-S equations in OpenFOAM

This thread may help to explain my problem.
Thank you for the help.
Cheers,
Bill
6863523 is offline   Reply With Quote

Reply

Tags
navier-stokes solver, openfoam


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
suGWFoam: Richards equation solver for porous media flows liu OpenFOAM Announcements from Other Sources 4 February 10, 2021 16:14
Navier Stokes solver Siddharth Main CFD Forum 2 September 13, 2007 02:06
test prob for 2D unsteady navier stokes equation Shah Main CFD Forum 5 April 20, 2007 08:25
Navier Stokes Solver Khan Main CFD Forum 2 December 12, 2006 10:41
help: I am trying to solve Navier Stokes compressible and viscid flow Jose Choy Main CFD Forum 2 May 18, 2000 06:45


All times are GMT -4. The time now is 11:29.