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

How to compile a new solver in OpenFOAM-2.1.0?

Register Blogs Community New Posts Updated Threads Search

Like Tree12Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 23, 2012, 23:17
Default How to compile a new solver in OpenFOAM-2.1.0?
  #1
Senior Member
 
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 18
sandy is on a distinguished road
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
uckmhnds and Shitiz like this.
sandy is offline   Reply With Quote

Old   January 24, 2012, 06:50
Default
  #2
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 18
olivierG is on a distinguished road
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
frantov, jeicek, 6863523 and 5 others like this.
olivierG is offline   Reply With Quote

Old   January 24, 2012, 09:21
Default
  #3
Member
 
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 89
Rep Power: 17
gregor is on a distinguished road
In your case the simplest solution would be, to copy the correctPhi.H file from the interFoam folder into your own solver folder
charlliemarshalll likes this.
gregor is offline   Reply With Quote

Old   January 24, 2012, 20:57
Default
  #4
Senior Member
 
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 18
sandy is on a distinguished road
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.

Last edited by sandy; January 24, 2012 at 21:43.
sandy is offline   Reply With Quote

Old   December 18, 2012, 19:17
Default
  #5
New Member
 
anonymous
Join Date: Jan 2012
Location: Canada
Posts: 24
Rep Power: 14
Mahyar Javidi is on a distinguished road
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
Mahyar Javidi is offline   Reply With Quote

Old   December 19, 2012, 02:05
Default
  #6
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Quote:
Originally Posted by Mahyar Javidi View Post
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.
adambarfi is offline   Reply With Quote

Old   December 29, 2012, 21:09
Default
  #7
New Member
 
anonymous
Join Date: Jan 2012
Location: Canada
Posts: 24
Rep Power: 14
Mahyar Javidi is on a distinguished road
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
Mahyar Javidi is offline   Reply With Quote

Old   December 30, 2012, 01:13
Default
  #8
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
I mean these info you added to your last post just contain a warning. the error is somewhere upper lines in your log!
adambarfi is offline   Reply With Quote

Old   December 31, 2012, 16:29
Default
  #9
New Member
 
anonymous
Join Date: Jan 2012
Location: Canada
Posts: 24
Rep Power: 14
Mahyar Javidi is on a distinguished road
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:perator*(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:perator*(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>:perator const T& [with T = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>]())->Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::<anonymous>.Foam:imensionedF ield<double, Foam::surfaceMesh>::<anonymous>.Foam::Field<double >::<anonymous>.Foam::List<double>::<anonymous>)) ’


I appreciate any help
Mahyar Javidi is offline   Reply With Quote

Old   December 31, 2012, 16:50
Default
  #10
New Member
 
anonymous
Join Date: Jan 2012
Location: Canada
Posts: 24
Rep Power: 14
Mahyar Javidi is on a distinguished road
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
Mahyar Javidi is offline   Reply With Quote

Old   January 1, 2013, 00:01
Default
  #11
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
Hi dear mahyar
use
Code:
2*fvc::interpolate(alpha1)
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   January 1, 2013, 00:48
Default
  #12
New Member
 
anonymous
Join Date: Jan 2012
Location: Canada
Posts: 24
Rep Power: 14
Mahyar Javidi is on a distinguished road
Hi Nima

Thanks for the help. This is the second time you are solving my problem and I appreciate it.
Mahyar Javidi is offline   Reply With Quote

Old   November 28, 2013, 00:48
Default
  #13
Senior Member
 
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13
Sherlock_1812 is on a distinguished road
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.
__________________
Regards,

Srivaths
Sherlock_1812 is offline   Reply With Quote

Old   November 28, 2013, 04:18
Default
  #14
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 18
olivierG is on a distinguished road
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
olivierG is offline   Reply With Quote

Old   November 28, 2013, 04:56
Default
  #15
Senior Member
 
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13
Sherlock_1812 is on a distinguished road
Hi Oliver,

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

Srivaths
Sherlock_1812 is offline   Reply With Quote

Old   April 8, 2014, 00:28
Default
  #16
Member
 
adarsh tiwari's Avatar
 
adarsh tiwari
Join Date: Feb 2014
Location: Bangalore
Posts: 42
Blog Entries: 5
Rep Power: 12
adarsh tiwari is on a distinguished road
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.

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

Cheers,
Adarsh Tiwari
Hunk@cfd likes this.
adarsh tiwari is offline   Reply With Quote

Old   April 8, 2014, 03:06
Default
  #17
Member
 
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 13
chrisb2244 is on a distinguished road
Quote:
Originally Posted by Sherlock_1812 View Post
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'
chrisb2244 is offline   Reply With Quote

Old   July 30, 2014, 07:34
Default
  #18
New Member
 
Premal Sheth
Join Date: Jun 2012
Location: Ahmadabad, Gujarat, India
Posts: 27
Rep Power: 14
premal is on a distinguished road
Send a message via Yahoo to premal Send a message via Skype™ to premal
please tell me how can i compile new solver in existing OPENFOAM?
premal is offline   Reply With Quote

Old   July 30, 2014, 09:24
Default
  #19
New Member
 
Quentin Coispeau
Join Date: Nov 2013
Posts: 17
Rep Power: 13
Quentin is on a distinguished road
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"
Quentin is offline   Reply With Quote

Old   September 27, 2014, 16:12
Default Problem in compiling
  #20
New Member
 
krishh
Join Date: Apr 2012
Posts: 16
Rep Power: 14
krishtej23 is on a distinguished road
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.
krishtej23 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
Viscoelastic Fluid Flows using OpenFOAM The solver viscoelasticFluidFoam jovani OpenFOAM Running, Solving & CFD 475 January 13, 2023 09:21
Acoustic Solver with openfoam acoustica OpenFOAM Programming & Development 110 February 24, 2021 19:50
Working directory via command line Luiz CFX 4 March 6, 2011 21:02
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 wyldckat OpenFOAM Announcements from Other Sources 3 September 8, 2010 07:25
AMG solver in Openfoam gonski Main CFD Forum 0 November 25, 2007 06:20


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