CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to compile a new solver in OpenFOAM-2.1.0? (http://www.cfd-online.com/Forums/openfoam-programming-development/96462-how-compile-new-solver-openfoam-2-1-0-a.html)

sandy January 23, 2012 23:17

How to compile a new solver in OpenFOAM-2.1.0?
 
Who can tell me how to compile a new solver in OpenFoam-2.1.0? I did them step by step following in http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam , however, I got error informations as follows:

MyinterFoam.C:65:41: fatal error: ../interFoam/correctPhi.H: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/MyinterFoam.o] Error 1

olivierG January 24, 2012 06:50

hello,

It work with 2.1.x too.
Take a look at http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2010/anneKoesters/anneKoestersReport.pdf, there is a clear exemple here.

The basic step are still:
1) copy the solver, i.e cp -r FOAM_SOLVERS/multiphase/interFoam in your use dir, i.e WM_PROJECT_USER_DIR/application/solver/multiphase/myInterFoam
2) change all interFoam by "myInterFoam" (or other name !) for:
- interFoam.C
- in Make/files
3) change in Make/files EXE = $(FOAM_APPBIN) by $FOAM_USER_APPBIN
4) if in files/option you have some "EXEC_INC = \
then change -I../blabla by -I$(LIB_SRC)/.. to link to the good lib.

5) wclean && wmake

6) if all compile well, the modify the solver ..


regards,
olivier

gregor January 24, 2012 09:21

In your case the simplest solution would be, to copy the correctPhi.H file from the interFoam folder into your own solver folder

sandy January 24, 2012 20:57

Hi olivierG, you think, how can I link it? This file is in FOAM_SOLVERS but not in FOAM_SRC ?

Yes, gregor, I revise the " .C" file.

Thanks.

Mahyar Javidi December 18, 2012 19:17

Hi guys

I have a similar problem in compiling the modified interFoam solver, I just added 2*alpha1*ghf*fvc::snGrad(rho) instead of ghf*fvc::snGrad(rho) to the UEq.H in the interFoam and after comilation it I got this error;

/opt/openfoam211/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’ [-Wunused-variable]
make: *** [Make/linux64GccDPOpt/my_interFoam.o] Error 1

Can any body help me with it.
Thanks

adambarfi December 19, 2012 02:05

Quote:

Originally Posted by Mahyar Javidi (Post 398154)
Hi guys

I have a similar problem in compiling the modified interFoam solver, I just added 2*alpha1*ghf*fvc::snGrad(rho) instead of ghf*fvc::snGrad(rho) to the UEq.H in the interFoam and after comilation it I got this error;

/opt/openfoam211/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’ [-Wunused-variable]
make: *** [Make/linux64GccDPOpt/my_interFoam.o] Error 1

Can any body help me with it.
Thanks

this is just a warning. look at some lines further back in your log, the error is there.

Mahyar Javidi December 29, 2012 21:09

Hi Mostafa

I think there is just a warning but when I use :
ls $FOAM_USER_APPBIN
I can not see my new solver in the list and I do not know why.

Thanks

adambarfi December 30, 2012 01:13

I mean these info you added to your last post just contain a warning. the error is somewhere upper lines in your log!

Mahyar Javidi December 31, 2012 16:29

Hi again
I compile the solver again and I think this should be the error:

In file included from new-interFoam.C:89:0:
UEqn.H: In function ‘int main(int, char**)’:
UEqn.H:29:51: error: no match for ‘operator-’ in ‘Foam::operator*(const Foam::tmp<Foam::GeometricField<double, PatchField, GeoMesh> >&, const Foam::tmp<Foam::GeometricField<double, PatchField, GeoMesh> >&) [with PatchField = Foam::fvsPatchField, GeoMesh = Foam::surfaceMesh]((*(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >*)(& Foam::fvc::snGrad(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = double]()))) - Foam::operator*(const Foam::tmp<Foam::Field<double> >&, const Foam::UList<double>&)((* &(& Foam::fvc::snGrad(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = double]().Foam::tmp<T>::operator const T& [with T = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>]())->Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::<anonymous>.Foam::DimensionedF ield<double, Foam::surfaceMesh>::<anonymous>.Foam::Field<double >::<anonymous>.Foam::List<double>::<anonymous>)) ’


I appreciate any help

Mahyar Javidi December 31, 2012 16:50

Hi

As I realized, I have not done correctly multiplying the 2*alpha1 to the line 29 in the UEqn.H
I do not know how to do that correctly, Can you help with that coding part?

Thanks

nimasam January 1, 2013 00:01

Hi dear mahyar
use
Code:

2*fvc::interpolate(alpha1)

Mahyar Javidi January 1, 2013 00:48

Hi Nima

Thanks for the help. This is the second time you are solving my problem and I appreciate it.

Sherlock_1812 November 28, 2013 00:48

Hi all,

I have been compiling solvers in my user directory and have been successful. But I'm getting this error now.

Code:

Making dependency list for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file fvCFD.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file volFieldsFwd.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file surfaceFieldsFwd.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file fvMatricesFwd.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file nearWallDist.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file volFields.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file surfaceFields.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file fvm.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file fvc.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file fvMatrices.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file bound.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file fvPatchField.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file fvMesh.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file simpleControl.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file readGravitationalAcceleration.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file createPhi.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file initContinuityErrs.H for source file buoyantBoussinesqSimpleFoamTemp.C
could not open file continuityErrs.H for source file buoyantBoussinesqSimpleFoamTemp.C
SOURCE=buoyantBoussinesqSimpleFoamTemp.C ;  g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam222/src/finiteVolume/lnInclude -I/opt/openfoam222/src/sampling/lnInclude -I/opt/openfoam222/src/meshTools/lnInclude -I/opt/openfoam222/src/fvOptions/lnInclude -I/opt/openfoam222/src/turbulenceModels -I/opt/openfoam222/src/turbulenceModels/incompressible/RAS/lnInclude -I/opt/openfoam222/src/transportModels -I/opt/openfoam222/src/transportModels/incompressible/singlePhaseTransportModel  -IlnInclude -I. -I/opt/openfoam222/src/OpenFOAM/lnInclude -I/opt/openfoam222/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linuxGccDPOpt/buoyantBoussinesqSimpleFoamTemp.o
buoyantBoussinesqSimpleFoamTemp.C:48:19: fatal error: fvCFD.H: No such file or directory
compilation terminated.
make: *** [Make/linuxGccDPOpt/buoyantBoussinesqSimpleFoamTemp.o] Error 1

The solver is not able to access the header files of the solver's .C file. What might be the problem?

Thanks in advance.

olivierG November 28, 2013 04:18

hello,

You don't have access to the openFoam file so check:
- source the bashrc is not done ?
- you loose the right permission to read/write in your solver directory and the read where openFoam is.

regards,
olivier

Sherlock_1812 November 28, 2013 04:56

Hi Oliver,

- I have properly sourced the .bashrc file.
- Where/how do i see if I have permission to access openfoam files?

adarsh tiwari April 7, 2014 23:28

Hi Sherlock,

for accesing any of the system files in ubuntu you must have some 'super-user' type of credentials.

you can type
Code:

sudo nautilus
in the terminal to get a graphical interface else you may use
Code:

sudo su
which directs you to be the superuser

But,, please be careful because this are very powerful commands so, using it improperly, you may damage your OS.:p:D

Hence, be specific about your commands and tasks and don't make any doubtful changes ins system files.;);)

Cheers,:D:D
Adarsh Tiwari

chrisb2244 April 8, 2014 02:06

Quote:

Originally Posted by Sherlock_1812 (Post 463864)
Hi Oliver,
- Where/how do i see if I have permission to access openfoam files?

If you move to your .../OpenFOAM/OpenFoam-x.x.x/ directory, or the src subdirectory, and type `ls -l` you'll get a set of permissions shown - they are the parts to the left of the list.

E.g.

Code:

-rwxrwxr-x  1 christian christian    932  2月 11 20:59 Allwmake
drwxrwxr-x  5 root      root        4096  2月 11 20:59 applications
drwxrwxr-x  3 christian christian  4096  2月 11 20:59 bin
-rw-rw-r--  1 christian christian  35647  2月 11 20:59 COPYING
drwxrwxr-x  6 christian christian  4096  2月 11 20:59 doc
drwxrwxr-x  6 christian christian  4096  4月  4 10:09 etc
-rw-r--r--  1 christian christian 316210  4月  2 09:34 log.Allwmake2
drwxr-xr-x  3 christian christian  4096  4月  1 17:16 platforms
-rw-rw-r--  1 christian christian  7611  2月 11 20:59 README.html
-rw-rw-r--  1 christian christian  1587  2月 11 20:59 README.org
drwxrwxr-x 37 root      root        4096  2月 11 20:59 src
drwxrwxr-x 16 root      root        4096  2月 11 20:59 tutorials
drwxrwxr-x  6 root      root        4096  4月  1 17:16 wmake

states that I own most of the directories, whilst I have changed the owner of src, tutorials, wmake and applications to root (so that I can't accidentally alter them). However, permissions are (directory) Read/Write/eXecute/r/w/x/r/w/x for owner (first 3), group (second 3, and the second word after permissions is the group which owns the file/directory), and everyone else. So you'll see that everyone can read and execute the files within application, but only the owner 'root', or members of the group 'root' can write to the files within the directory 'application'

premal July 30, 2014 06:34

please tell me how can i compile new solver in existing OPENFOAM?

Quentin July 30, 2014 08:24

Hi,

1) Copy an existing solver which is similar to what you want to do in a personal repertory.
2) change name of your solver. for example, remplace all "LTSInterFoam" by "my_LSInterFoam" in files name and files content.
3) in Make/file change also the solver name by the new name and EXE = $(FOAM_APPBIN)/my_LTSInterFoam by EXE = $(FOAM_USER_APPBIN)/my_LTSInterFoam
4) wmake it from the shell in the appropriate directory
5) try he new solver

6) if it's ok, you can make your modifications ; you have to wmake it again before using.

openFoam documentation after googling "compile solver openFOAM"

krishtej23 September 27, 2014 15:12

Problem in compiling
 
Hi,

I am trying to simulate a drop case in OF 2.3.0 using compressibleMultiphaseInterFoam. I tried it 2 times, yet the gravity acts in +Y axis when I set it to -Y axis. To trick it, I changed gravity direction to +Y axis, now the gravity acts in +Y axis only. The same case was run in other models interFoam, multiphaseInterFoam in older versions of OF.
Now I tried to compile the compressibleMultiphaseInterFoam solver from OF 2.3.0 in OF 2.2.2. I get an error which I dont understand. Error is in 'typescript' file in the .rar file attached. I has also added the solver in .rar file. Please some one help me. I need it.
Thanks a ton in advance.
.rar file can be downloaded here.


All times are GMT -4. The time now is 15:58.