CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Problem with a new solver (https://www.cfd-online.com/Forums/openfoam-solving/60515-problem-new-solver.html)

Constantinos Zervides (Zervides) May 26, 2004 12:33

Hello all. I have created a n
 
Hello all. I have created a new solver and i wanted to compile it. Everything was done based on the instractions of the user guide. I managed to reach the point where i had to link the new user defined libraries to excisting applications. I have done everything as it says in the user guide page U-80 but when i run wmake libso in the /home/foam/user2.2/applications/foamUser directory i get the following:
/home/mpp03cz/foam/foam2.2/wmake/wmakeLnInclude: linking include files to /home/mpp03cz/foam/mpp03cz2.2/applications/src/foamUser/lnInclude

Making dependency list for source file libfoamUser.C
libso
SOURCE_DIR=.
SOURCE=libfoamUser.C ; g++ -Dlinux -DlinuxGcc3OptLAM -DscalarMachine -DoptSolvers -DUSEMPI -Wall -O2 -DNoRepository -ftemplate-depth-30 -I/home/mpp03cz/foam/foam2.2/src/foam/lnInclude -IlnInclude -I. -I/home/mpp03cz/foam/foam2.2/src/lam-6.5.9/platforms/linuxGcc3OptLAM/include -I/usr/X11/include -DWM_PROJECT_VERSION='"'2.2'"' -fPIC -c $SOURCE -o Make/linuxGcc3OptLAM/libfoamUser.o
/home/mpp03cz/foam/foam2.2/wmake/bashScripts/mkObjectDir /home/mpp03cz/foam/mpp03cz2.2/lib/linuxGcc3OptLAM/libfoamUser
rm -f so_locations
cd Make/linuxGcc3OptLAM ; \
g++ -Dlinux -DlinuxGcc3OptLAM -DscalarMachine -DoptSolvers -DUSEMPI -Wall -O2 -DNoRepository -ftemplate-depth-30 -I/home/mpp03cz/foam/foam2.2/src/foam/lnInclude -IlnInclude -I. -I/home/mpp03cz/foam/foam2.2/src/lam-6.5.9/platforms/linuxGcc3OptLAM/include -I/usr/X11/include -DWM_PROJECT_VERSION='"'2.2'"' -fPIC -shared libfoamUser.o -L/home/mpp03cz/foam/foam2.2/lib/linuxGcc3OptLAM -l... -lnew -lisoLESmodels -lLESfilters -lincompressibleTransportModels -lcfdTools -lstressedFoam -lcellDecompFiniteElement -lfemStress -lcontinuumFoam -lvelocityStresedFoam -o /home/mpp03cz/foam/mpp03cz2.2/lib/linuxGcc3OptLAM/libfoamUser.so
/usr/bin/ld: cannot find -lcontinuumFoam
collect2: ld returned 1 exit status
make: *** [/home/mpp03cz/foam/mpp03cz2.2/lib/linuxGcc3OptLAM/libfoamUser.so] Error 1

What did i do wrong and how do i correct it?

Mattijs Janssens (Mattijs) May 26, 2004 12:50

The only library search path
 
The only library search path ('-L') I see in your output is:

/home/mpp03cz/foam/foam2.2/lib/linuxGcc3OptLAM

so there is no libcontinuumFoam.so in there?

When you made your libcontinuumFoam.so where did it go to?

Mattijs

Constantinos Zervides (Zervides) May 26, 2004 16:59

The libcontinuumFoam.so can b
 
The libcontinuumFoam.so can be found under:
/home/mpp03cz/foam/mpp03cz2.2/lib/linuxGcc30ptLAM

Costas

Chris Greenshields (Chris) May 27, 2004 04:06

You need to add to LIB_LIBS i
 
You need to add to LIB_LIBS in your foamUser/Make/files file:
-L$(FOAM_USER_LIBBIN)

in order to direct the compiler to the directory where your continuumFoam library is.

Make sure you include appropriate backslashes (\) for line continuations (as you can see in the files file)

Constantinos Zervides (Zervides) May 27, 2004 05:20

Dear Chris Thank yo
 
Dear Chris
Thank you very much for your help. What i did was to include the -L$(FOAM_USER_LIBBIN) in the foamUser/Make/options file and that solved the problem.

Costas

Mattijs Janssens (Mattijs) September 3, 2004 06:41

Hello Mark, about your ico
 
Hello Mark,

about your icoFoam extension:

> Can I just confirm that the correct place is in this part of the code?
> fvVectorMatrix UEqn
> (
> fvm::ddt(U)
> + fvm::div(phi, U)
> - fvm::laplacian((Ns/rho), U)
> - fvc::div(sigma/rho)
> );
Correct - this will include your sigma term into the discretised momentum equation (split into A() and H() and the pressure solver step will use those)


> The other problem that I would appreciate your advice on is that the case I am
> investigating is at low Reynolds numbers. So I again have to lower the time
> step. At the moment it is taking a very long time to solve for a small
> geometry with a course mesh. Any suggestions?

icoFoam does a momentum predictor step. This is an explicit calculation of new velocities based on existing pressure. (line 58 in Foam2.3 icoFoam.C) For your case which is likely to be dominated by viscous effects/your source term rather than convection you are probably better off not doing this predictor step.

Mattijs

Mark Beard (Beard) September 3, 2004 07:29

Mattijs, I am using icoFoa
 
Mattijs,

I am using icoFoam2.2 and I am unsure which line you are referring to. Can I just check that by removing this line I can decrease the solve time by eliminating a calculation that is unnecessary for my problem due to the large viscous forces?

Also, is there any benefit in changing the number of nCorrectors in the PISO loop?

Thanks,
Mark

Mattijs Janssens (Mattijs) September 3, 2004 07:44

The velocity gets updated in
 
The velocity gets updated in

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

which will solve the discretised momentum equation with explicit pressure driving force and update the velocity. This is the line you could try commenting out.

There might be a benefit in changing (probably increasing) the number of piso correctors for suc a low Re case. You might want to try going up to 5 - 10 but it is impossible to tell beforehand.

Mattijs

Mark Beard (Beard) September 6, 2004 15:13

Hi Mattijs, You mentioned
 
Hi Mattijs,

You mentioned I might suffer from staggering and would be better off evaluating sigma on the face of each cell. What would be the best way to achieve this?

Would altering the fvScheme used to solve for sigma help in anyway?

Thanks again for your help with this.

Mark

Mattijs Janssens (Mattijs) September 7, 2004 04:42

Hi Mark, sigma is presumab
 
Hi Mark,

sigma is presumably from velocity gradients?
- the velocity gradient gets calculated from the neighbouring cell values.
- so when you do a div of the sigma (which will interpolate cell sigma to the faces) you end up using information from neighbours of neighbours.

This usually means that a variation (in velocity) of +-+-+ over the five cells of your stencil will not be 'seen' (i.e. the div(sigma) will not see a difference between above and a uniform distribution)

Changing the fvScheme will not help since they don't have an overview of what is happening on your stencil. They operate on the (two neighbouring cells of a) face only.

Mattijs

Mark Beard (Beard) September 7, 2004 05:08

Mattijs, Thanks for the ex
 
Mattijs,

Thanks for the explanation and you are correct in thinking sigma is calculated from the velocity gradients. However, I am not sure how to correct this problem. How can I interpolate sigma to the cell faces based upon its immediate neighbours?

Mark

Mattijs Janssens (Mattijs) September 7, 2004 05:23

Hi Mark, this is getting a
 
Hi Mark,

this is getting a bit technical. You might want to get Gavin involved. I hear this is similar to the way Reynolds stresses are handled and he certainly has more experience than me in this field.

Mattijs

chafi_fatima_zohra May 13, 2005 11:10

hi, in icoFoam , the equati
 
hi,

in icoFoam , the equation is set:
solve(UEqn == -fvc::grad(p));
then , we obtain a velocity field in X direcion "u", in Y direction "v" and in Z dirction "w".
in this case u, v and w depends on grad p.

I want to modify the velovity equation only in the direction of Z and I want to obtain this:
in the direction of X etY, u and v dependent of grad p.
but in the direction of Z, w depend of grad p and another term which I want to add. how to solve this system of equation?

can you help me

chris10 June 7, 2005 10:50

hi all, i have created a ne
 
hi all,

i have created a new solver and i have compiled it successfully, but when i tried to calculate an example i get the following errors:


free(): invalid pointer 0x80b7400!
free(): invalid pointer 0x80b9d78!
free(): invalid pointer 0x80bcb30!
free(): invalid pointer 0x80be000!
free(): invalid pointer 0x80ba2b8!
free(): invalid pointer 0x80b9a38!
free(): invalid pointer 0x80b9a78!
free(): invalid pointer 0x80bdaa8!
free(): invalid pointer 0x80bc590!
Segmentation fault
.

The adresses of the invalid pointers are always the same, so i think it is a static problem.

who can help me?

valentine August 16, 2005 12:28

Hi, Please help. I was tryi
 
Hi,

Please help. I was trying to compile a new solver, which I did. Most of it is built from icoFoam with only minor changes like incomparating mechanical properties and calculateStress.H. Am able to preprocess my case from FoamX and all my added fields are appearing and can be edited but when I try to run the case it hungs with this statement "Application started with pid 18933" or a different number would appear with my different attempts. I dont know where the problem is.

Best regards,

Valentine.

valentine August 22, 2005 09:26

What is the meaning of 'Ns' in
 
What is the meaning of 'Ns' in the numerical expression below

> fvVectorMatrix UEqn
> (
> fvm::ddt(U)
> + fvm::div(phi, U)
> - fvm::laplacian((Ns/rho), U)
> - fvc::div(sigma/rho)
> );


All times are GMT -4. The time now is 16:21.