CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to set up an own solver (https://www.cfd-online.com/Forums/openfoam-programming-development/158984-how-set-up-own-solver.html)

Gerrit September 7, 2015 06:34

How to set up an own solver
 
Hi,

I wanted to follow this manual to customize a simpleFoam solver. I followed it as far as possible, but as soon as enter wmake I receive this:

Code:

make: *** No rule to make target `simpleFoam.dep', needed by `Make/linux64GccDPOpt/dependencies'.  Stop.
Does anyone know what to do?

In my folders is no simpleFoam.dep file.


I am using OpenFoam 2.4 on Ubuntu 14.04.

Did someone experienced that already?

Thanks
Gerrit

huangxianbei September 7, 2015 06:54

try: wclean and then wmake
This is usually caused by the existing of the old .dep file.

Gerrit September 7, 2015 06:58

Thanks for the answer, but still the same...

alexeym September 7, 2015 08:39

Hi,

Since usually "I wanted to follow this manual to customize a simpleFoam solver" and the error after means "I missed certain step", my guess will be: your Make/files file still contains simpleFoam.C but you have renamed this file to something more suitable for your purposes (my_neat_little_simple_foam_derivative.C for example).

And answering your second question: yes, several times. Use forum search and you will find similar questions asked and answered.

Gerrit September 7, 2015 09:05

Hi Alex,

you were somehow right! Although I checked my procedure several times, I missed to change the header of the files file...

Thanks anyway!

Edit:
If someone is interested in using simpleFoam with temperatures as a tutorial, this might help:

http://www.cloudpyme.eu/wp-content/u...on4-Slides.pdf

Gerrit September 12, 2015 10:24

1 Attachment(s)
Hi,

for my project I need something to track particles, but solve as well as turbulent case. I found a guideline for a combination of simpleFoam and the Lagrangian solidParicle.
http://www.tfd.chalmers.se/~hani/kur...tonPersson.pdf

I am trying this now for some days, but I cannot build the solver and hope to find some help here.

After wmake I receive the following:
Code:

Making dependency list for source file injectorSolidParticle.C
could not open file cyclicAMIPolyPatch.H for source file injectorSolidParticle.C due to No such file or directory
could not open file meshTools.H for source file injectorSolidParticle.C due to No such file or directory
Making dependency list for source file injectorSolidParticleIO.C
could not open file cyclicAMIPolyPatch.H for source file injectorSolidParticleIO.C due to No such file or directory
could not open file meshTools.H for source file injectorSolidParticleIO.C due to No such file or directory
Making dependency list for source file injectorSolidParticleCloud.C
could not open file cyclicAMIPolyPatch.H for source file injectorSolidParticleCloud.C due to No such file or directory
could not open file meshTools.H for source file injectorSolidParticleCloud.C due to No such file or directory
Making dependency list for source file injectorSolidParticleFoam.C
could not open file cyclicAMILduInterface.H for source file injectorSolidParticleFoam.C due to No such file or directory
could not open file cyclicAMIPolyPatch.H for source file injectorSolidParticleFoam.C due to No such file or directory
could not open file fvIOoptionList.H for source file injectorSolidParticleFoam.C due to No such file or directory
could not open file meshTools.H for source file injectorSolidParticleFoam.C due to No such file or directory
could not open file createFvOptions.H for source file injectorSolidParticleFoam.C due to No such file or directory
SOURCE=injectorSolidParticle.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam240/src/turbulenceModels    -I/opt/openfoam240/src/turbulenceModels/incompressible/RAS/RASModel    -I/opt/openfoam240/src/transportModels    -I/opt/openfoam240/src/transportModels/incompressible/singlePhaseTransportModel    -I/opt/openfoam240/src/finiteVolume/lnInclude    -I/opt/openfoam240/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/opt/openfoam240/src/OpenFOAM/lnInclude -I/opt/openfoam240/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/injectorSolidParticle.o
In file included from /opt/openfoam240/src/lagrangian/basic/lnInclude/Cloud.H:342:0,
                from injectorSolidParticleCloud.H:40,
                from injectorSolidParticle.C:26:
/opt/openfoam240/src/lagrangian/basic/lnInclude/Cloud.C:34:32: fatal error: cyclicAMIPolyPatch.H: No such file or directory
 #include "cyclicAMIPolyPatch.H"
                                ^
compilation terminated.
make: *** [Make/linux64GccDPOpt/injectorSolidParticle.o] Error 1

I am a little bit lost, as I do not know where to start debugging. Especially as the file cyclicAMIPolyPatch.H for example exists in src folder....
Furthermore it becomes really weird as none of the scripts in my folder call that file....

Can someone give a hint how/where to start?


Thank you!

alexeym September 12, 2015 16:25

Hi,

Since it is Håkan Nilsson's course I would propose that code is for foam-extend and could compile under OpenFOAM with certain corrections.

Since the error is caused by cyclicAMIPolyPatch.H, you can try to use

Code:

alexey at daphne in src$ pwd
/Users/alexey/OpenFOAM/OpenFOAM-2.4.x/src
alexey at daphne in src$ find . -name 'cyclicAMIPolyPatch.H'
./meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H
./meshTools/lnInclude/cyclicAMIPolyPatch.H

(2.4.x is just an example, in original OpenFOAM this file is in meshTools from version 2.1.x; 2.1.x is the earliest version I have on my laptop). So you have to add "-I$(LIB_SRC)/meshTools/lnInclude" to Make/options file to build be code.

Then if you try to build the code you have attached to the message, you need to add also "-I$(LIB_SRC)/fvOptions/lnInclude" and "-I$(LIB_SRC)/sampling/lnInclude" for Make/options file.

After these additions there is only problem at line 103 of injectorSolidParticleCloud.C, and it look like messed up comment. Overall code in the archive looks quite strange in the places with errors.

Gerrit September 14, 2015 08:29

Hi Alex,

thank you so much for your answer! I did what you told me to!

The search for cyclicAMIPolyPatch.H gave the following. Looks like yours in my opinion.

Code:

gerrit@gerrit-HP-Pavilion-dv7-Notebook-PC:/opt/openfoam240/src$ find . -name 'cyclicAMIPolyPatch.H'
./meshTools/lnInclude/cyclicAMIPolyPatch.H
./meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H

Now I receive a new error:

Code:

linux64GccDPOpt/options:62: *** commands commence before first target.  Stop.
wmake error: file 'Make/linux64GccDPOpt/objectFiles' could not be created in /home/gerrit/OpenFOAM/gerrit-2.4.0/applications/solvers/injectorSolidParticleFoam

What does the first one mean? I do understand the second line, but it is nonsense, because there is a folder called linux64GccDPOpt....

Thanks again!

Edit: Generally, how can I look in such cases for errors? Take the make/files file and check all listed files by hand?

alexeym September 14, 2015 09:09

Hi,

Post your Make/options. This time I can not guess what you have put there.

Gerrit September 14, 2015 10:49

Hi here you go, the make/options file:

Code:

EXE_INC = \
    -I$(LIB_SRC)/turbulenceModels \
    -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
    -I$(LIB_SRC)/finiteVolume/lnInclude  \
    -I$(LIB_SRC)/lagrangian/basic/lnInclude
    -I$(LIB_SRC)/meshTool/lnInclude
    -I$(LIB_SRC)/fvOptions/lnInclude
    -I$(LIB_SRC)/sampling/lnInclude

EXE_LIBS = \
    -lincompressibleRASModels \
    -lincompressibleTransportModels \
    -lfiniteVolume  \
    -llagrangian \
    -lincompressibleTurbulenceModel


alexeym September 14, 2015 10:57

Well, as you can see there are \ symbols at the end of certain lines. They are there for purpose - https://www.gnu.org/software/make/ma...ing-Lines.html.

Your addition does not contain \ before new lines, so make (since wmake is just a wrapper around make) is quite unhappy about your addition. Make it:

Code:

EXE_INC = \
    -I$(LIB_SRC)/turbulenceModels \
    -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
    -I$(LIB_SRC)/finiteVolume/lnInclude  \
    -I$(LIB_SRC)/lagrangian/basic/lnInclude \
    -I$(LIB_SRC)/meshTool/lnInclude \
    -I$(LIB_SRC)/fvOptions/lnInclude \
    -I$(LIB_SRC)/sampling/lnInclude

EXE_LIBS = \
    -lincompressibleRASModels \
    -lincompressibleTransportModels \
    -lfiniteVolume  \
    -llagrangian \
    -lincompressibleTurbulenceModel


Gerrit September 14, 2015 13:15

Ok. I did not know that! Thanks for the input! Now my message after wclean and wmake is again:

Code:

Making dependency list for source file injectorSolidParticle.C
could not open file cyclicAMIPolyPatch.H for source file injectorSolidParticle.C due to No such file or directory
could not open file meshTools.H for source file injectorSolidParticle.C due to No such file or directory
Making dependency list for source file injectorSolidParticleIO.C
could not open file cyclicAMIPolyPatch.H for source file injectorSolidParticleIO.C due to No such file or directory
could not open file meshTools.H for source file injectorSolidParticleIO.C due to No such file or directory
Making dependency list for source file injectorSolidParticleCloud.C
could not open file cyclicAMIPolyPatch.H for source file injectorSolidParticleCloud.C due to No such file or directory
could not open file meshTools.H for source file injectorSolidParticleCloud.C due to No such file or directory
Making dependency list for source file injectorSolidParticleFoam.C
could not open file cyclicAMILduInterface.H for source file injectorSolidParticleFoam.C due to No such file or directory
could not open file cyclicAMIPolyPatch.H for source file injectorSolidParticleFoam.C due to No such file or directory
could not open file cellSet.H for source file injectorSolidParticleFoam.C due to No such file or directory
could not open file AMIPatchToPatchInterpolation.H for source file injectorSolidParticleFoam.C due to No such file or directory
could not open file meshTools.H for source file injectorSolidParticleFoam.C due to No such file or directory
SOURCE=injectorSolidParticle.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam240/src/turbulenceModels -I/opt/openfoam240/src/turbulenceModels/incompressible/RAS/RASModel -I/opt/openfoam240/src/transportModels -I/opt/openfoam240/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam240/src/finiteVolume/lnInclude -I/opt/openfoam240/src/lagrangian/basic/lnInclude -I/opt/openfoam240/src/meshTool/lnInclude -I/opt/openfoam240/src/fvOptions/lnInclude -I/opt/openfoam240/src/sampling/lnInclude -IlnInclude -I. -I/opt/openfoam240/src/OpenFOAM/lnInclude -I/opt/openfoam240/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/injectorSolidParticle.o
In file included from /opt/openfoam240/src/lagrangian/basic/lnInclude/Cloud.H:342:0,
                from injectorSolidParticleCloud.H:40,
                from injectorSolidParticle.C:26:
/opt/openfoam240/src/lagrangian/basic/lnInclude/Cloud.C:34:32: fatal error: cyclicAMIPolyPatch.H: No such file or directory
 #include "cyclicAMIPolyPatch.H"
                                ^
compilation terminated.

As far as I understand it does not find the library cyclicAMIPolyPatch,H...
Can I somehow repair that? I guess it's only a link missing

The strange part is still that I do not use that file. When I search in my folder (injectorSolidParticleFoam) for it I do not get an answer, meaning it is not used in any of the files... (I searched with the command below)
Code:

find . -name 'cyclicAMIPolyPatch.H'

alexeym September 14, 2015 13:41

In message #11 I have just copies your options without verifying paths (though it seems, you've copied path from previous messages). Yet, correct path for include compiler flag is

Code:

-I$(LIB_SRC)/meshTools/lnInclude

Gerrit September 15, 2015 02:27

Ok, now we come closer :D

Code:

injectorSolidParticleCloud.C: In member function ‘void Foam::injectorSolidParticleCloud::move(const dimensionedVector&)’:
injectorSolidParticleCloud.C:101:78: error: no matching function for call to ‘Foam::injectorSolidParticle::injectorSolidParticle(Foam::injectorSolidParticleCloud&, Foam::vector&, Foam::label&, Foam::scalar&, Foam::vector&)’
    injectorSolidParticle*ptr= new injectorSolidParticle(*this,pos,cellI,d,vel);
                                                                              ^
injectorSolidParticleCloud.C:101:78: note: candidates are:
In file included from injectorSolidParticleCloud.H:41:0,
                from injectorSolidParticleCloud.C:26:
injectorSolidParticle.H:131:9: note: Foam::injectorSolidParticle::injectorSolidParticle(const Foam::polyMesh&, Foam::Istream&, bool)
        injectorSolidParticle
        ^
injectorSolidParticle.H:131:9: note:  candidate expects 3 arguments, 5 provided
In file included from injectorSolidParticle.H:259:0,
                from injectorSolidParticleCloud.H:41,
                from injectorSolidParticleCloud.C:26:
injectorSolidParticleI.H:45:8: note: Foam::injectorSolidParticle::injectorSolidParticle(const Foam::polyMesh&, const vector&, Foam::label, Foam::label, Foam::label, Foam::scalar, const vector&)
 inline Foam::injectorSolidParticle::injectorSolidParticle
        ^
injectorSolidParticleI.H:45:8: note:  candidate expects 7 arguments, 5 provided
In file included from injectorSolidParticleCloud.H:41:0,
                from injectorSolidParticleCloud.C:26:
injectorSolidParticle.H:58:7: note: Foam::injectorSolidParticle::injectorSolidParticle(const Foam::injectorSolidParticle&)
 class injectorSolidParticle
      ^
injectorSolidParticle.H:58:7: note:  candidate expects 1 argument, 5 provided
make: *** [Make/linux64GccDPOpt/injectorSolidParticleCloud.o] Error 1

that is what I now receive. Sounds like something is overdefined, or?

alexeym September 15, 2015 03:09

Hi,

The error is self-explanatory: the number of parameters you have passed to constructor is wrong. Since the tutorial you are referencing was created for OpenFOAM 1.7.x it is not surprising that constructors could be changed.

Post your source code, maybe someone will find time to a) download it, b) try to compile it, c) find correct number of arguments to constructor, d) fix other errors, e) post solution here.

Also on the page, where you have found PDF file with report, there are tutorials about C++ and OpenFOAM. Read them before posting questions, since programming using forum is slow and counter-productive.

Gerrit September 15, 2015 03:18

1 Attachment(s)
I will do so! Thanks for your answer and your help so far!

Gerrit September 21, 2015 05:54

Hi,

I am still working on it and trying to understand the errors...
Whatever, I found a page, where they do the same process just instead of simpleFoam with interFoam.
As interFoam seems to be made for two phase flow, I am now a little bit confused, if I followed the correct idea...

Would interFoam combined with solidParticle a better choice? Or is it as well depending on the particle size?

Thanks!

amuzeshi February 28, 2018 12:21

I have prepared injectorSolidParticleFoam using this tutorial from chalmers. when I want " wmake " , this error happens; why?
Code:

injectorSolidParticleCloud.C: In member function ‘void Foam::injectorSolidParticleCloud::move(const dimensionedVector&)’:
injectorSolidParticleCloud.C:88:77: error: no matching function for call to ‘Foam::injectorSolidParticle::injectorSolidParticle(Foam::injectorSolidParticleCloud&, Foam::vector&, Foam::label&, Foam::scalar&, Foam::vector&)’
 injectorSolidParticle * ptr= new injectorSolidParticle(*this,pos,cellI,d,vel);
                                                                            ^
injectorSolidParticleCloud.C:88:77: note: candidates are:
In file included from injectorSolidParticleCloud.H:41:0,
                from injectorSolidParticleCloud.C:26:
injectorSolidParticle.H:142:9: note: Foam::injectorSolidParticle::injectorSolidParticle(const Foam::polyMesh&, Foam::Istream&, bool)
        injectorSolidParticle
        ^
injectorSolidParticle.H:142:9: note:  candidate expects 3 arguments, 5 provided
In file included from injectorSolidParticle.H:272:0,
                from injectorSolidParticleCloud.H:41,
                from injectorSolidParticleCloud.C:26:
injectorSolidParticleI.H:45:8: note: Foam::injectorSolidParticle::injectorSolidParticle(const Foam::polyMesh&, const barycentric&, Foam::label, Foam::label, Foam::label, Foam::scalar, const vector&)
 inline Foam::injectorSolidParticle::injectorSolidParticle
        ^
injectorSolidParticleI.H:45:8: note:  candidate expects 7 arguments, 5 provided
In file included from injectorSolidParticleCloud.H:41:0,
                from injectorSolidParticleCloud.C:26:
injectorSolidParticle.H:66:7: note: Foam::injectorSolidParticle::injectorSolidParticle(const Foam::injectorSolidParticle&)
 class injectorSolidParticle
      ^
injectorSolidParticle.H:66:7: note:  candidate expects 1 argument, 5 provided
injectorSolidParticle.H:66:7: note: Foam::injectorSolidParticle::injectorSolidParticle(Foam::injectorSolidParticle&&)
injectorSolidParticle.H:66:7: note:  candidate expects 1 argument, 5 provided
make: *** [Make/linux64GccDPInt32Opt/injectorSolidParticleCloud.o] Error 1



All times are GMT -4. The time now is 12:52.