Help compiling code (newbie)
Hi everyone,
Im currently doing my dissertation at University of Bath, UK on cyclocopter rotors and found the following blog post: http://lordvon64.blogspot.co.uk/2014...87540156025031 The model he has made closely follows the experimental data from other cyclocopters and I would love to be able to run/edit his code, listed on github here: https://github.com/lordvon/OpenFOAM_...ster/cycloRamp Now, bear with me at this point, I am totally new to OpenFOAM, and I dont know how to run this code. I have installed OpenFOAM correctly (done a few of the tutorials to confirm) and downloaded the repository from Github. What is the next step? In the files on Github he has the 'compiling new OpenFOAM source' file, which lists how to compile. All the steps until the last line seem to have been done in the downloaded repository, if I am correct? The files in /Make have been made. The last line details adding the line to controlDict, does this mean I go into controlDict in the system files and add the line? then run the file remake? If anyone could give me an idiots guide to doing this I would be very much appreciated, starting from the begining. The author of the blog is helpful but being in different time zones the reply's are quite delayed. Thanks, Tom |
Hi Tom,
It looks like you're pretty close. If you have already compiled that library you should be pretty close. The last step is to add a line to the controlDict of whatever case you're running this on but there is a typo in his instructions. There should be a semicolon closing the parentheses ; like this: libs ( "libCycloRamp.so" ); Do you already have an example case that will engage the functionality of this new library? Cheer! Kyle Quote:
|
Ah OK, I think I get hwo it works now.
I was thinking of the code uplaoded to Github as the code to run on its own. But its actually just the library which other code uses to run. So I need to find out the example that will use this library, then add the line you said to the controlDict file of that example, then run that example as normal? It doesnt mention anythign about that in his blog post does it? The only sentance that soudns like it points to the right example is 'I used the pimpleDyMFoam solver in PISO mode (no SIMPLE iterations)'. Does that mean anything? Thanks for your help Tom |
Without an example case you're going to have to effectively reverse engineer the case configuration. Also, it looks like the mesh he's using its awfully complicated in terms of multiple embedded rotational sliding boundary interfaces.
After having a quick look at his code its going to be really difficult to put a case together from scratch, even with a ton of OpenFOAM experience. I think your best bet is to get in touch with the original developer and ask for an example case. Cheers, Kyle |
Hi Kyle,
Thanks for the info. Ive contacted the author and he is going to post a case file to this thread, which should help me get the simulation up and running. Thanks for the help, im sure I may have a couple more questions lol, using OpenFOAM is on a whole different level to what im used to Tom |
1 Attachment(s)
You will not have to reverse-engineer anything!!! I am the author of the post mentioned above. Here I have attached the case and mesh files for the cyclorotor simulation. Here is how I use it:
-I view the mesh by 'gmsh main.geo' inside the mesh folder. I change whatever I need in mesh/inputs.geo. -run './parallel runname' in the main directory (where case and mesh reside) -That's it! That is after of course you have compiled the custom solidBodyMotionFunctions that were referenced above, and installed gmsh. Also, you might have to chmod +x a few files to make them executable. Please let me know of any questions! |
I think my problem is with compiling the solver at the moment. when I run the make command I get the following :
wmakeLnInclude: linking include files to ./lnInclude Making dependency list for source file cycloRamp.C SOURCE=cycloRamp.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam230/src/dynamicFvMesh/lnInclude -I/opt/openfoam230/src/dynamicFvMesh/solidBodyMotionFvMesh/lnInclude -IlnInclude -I. -I/opt/openfoam230/src/OpenFOAM/lnInclude -I/opt/openfoam230/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/cycloRamp.o In file included from cycloRamp.H:38:0, from cycloRamp.C:26: /opt/openfoam230/src/dynamicFvMesh/lnInclude/solidBodyMotionFunction.H: In static member function ‘static Foam::autoPtr<Foam::solidBodyMotionFunction> Foam::solidBodyMotionFunction::adddictionaryConstr uctorToTable<solidBodyMotionFunctionType>::New(con st Foam::dictionary&, const Foam::Time&) [with solidBodyMotionFunctionType = Foam::solidBodyMotionFunctions::cycloRamp]’: /opt/openfoam230/src/dynamicFvMesh/lnInclude/solidBodyMotionFunction.H:90:9: instantiated from ‘Foam::solidBodyMotionFunction::adddictionaryConst ructorToTable<solidBodyMotionFunctionType>::adddic tionaryConstructorToTable(const Foam::word&) [with solidBodyMotionFunctionType = Foam::solidBodyMotionFunctions::cycloRamp]’ cycloRamp.C:46:1: instantiated from here /opt/openfoam230/src/dynamicFvMesh/lnInclude/solidBodyMotionFunction.H:90:9: error: cannot allocate an object of abstract type ‘Foam::solidBodyMotionFunctions::cycloRamp’ cycloRamp.H:53:7: note: because the following virtual functions are pure within ‘Foam::solidBodyMotionFunctions::cycloRamp’: /opt/openfoam230/src/dynamicFvMesh/lnInclude/solidBodyMotionFunction.H:110:50: note: virtual Foam::autoPtr<Foam::solidBodyMotionFunction> Foam::solidBodyMotionFunction::clone() const /opt/openfoam230/src/dynamicFvMesh/lnInclude/solidBodyMotionFunction.H:90:9: warning: control reaches end of non-void function [-Wreturn-type] make: *** [Make/linux64GccDPOpt/cycloRamp.o] Error 1 It looks like its throwing up a few errors, do you have any idea what it means? |
Hi Thomas,
I made sure it worked before I uploaded it to Github, though the instructions could be better, which I have updated based on feedback from this thread. Please delete the cycloRamp library files and redownload them and try again. This time, only doing these few things: -type 'sudo' and then login -Go inside the main directory of the downloaded files (where Make, cycloRamp.C,cycloRamp.h,etc. reside) -Make the freshly downloaded file executable by 'chmod +x remake' -Run './remake' If you do not get errors, great! Compiling always seems to be the biggest obstacle in running custom OpenFOAM stuff. You then can run a simulation with './parallel yourRunName' in the main directory of the case files I uploaded to this thread. Even if you get errors then, they will be very easy to debug. Since you and I have spent a bit of time on this, I am determined to get it working for you :) Which version of OpenFOAM are you using? |
Iv followed the instructions but still get a couple of error messages,a lthough it is far fewer than before.
I get: linux64GccDPOpt/options:7: *** commands commence before first target. Stop. wmake error: file 'Make/linux64GccDPOpt/objectFiles' could not be created in /home/tom/OpenFOAM/tom-2.3.0/applications/solvers/cycloRamp cp: cannot stat `/home/tom/OpenFOAM/root-2.3.0/platforms/linux64GccDPOpt/lib/libCycloRamp.so': No such file or directory In your 'compiling new OpenFOAM source' file you have the text to put in the options file as different to the file you uploaded. Ive tried both and get the same error though. It feels like its so close. Im using OpenFOAM 2.3.0 :) |
Oops, I guess they are different but they both should work. After a little Google searching, it might be the format of the text in the Make/options file. I updated the file on Github, and all I did was remove the tabs. Try and see if anything is different.
I wish I could test it, but it works as is on my computer unfortunately. |
Im getting further and further each time I go through. At the moment its making the /Make/linux64GccDPOpt files and a /lnInclude folder with links to the .C and .H files.
However there is still an error: cycloRamp.C:46:1: instantiated from here /opt/openfoam230/src/dynamicFvMesh/lnInclude/solidBodyMotionFunction.H:90:9: error: cannot allocate an object of abstract type ‘Foam::solidBodyMotionFunctions::cycloRamp’ cycloRamp.H:53:7: note: because the following virtual functions are pure within ‘Foam::solidBodyMotionFunctions::cycloRamp’: /opt/openfoam230/src/dynamicFvMesh/lnInclude/solidBodyMotionFunction.H:110:50: note: virtual Foam::autoPtr<Foam::solidBodyMotionFunction> Foam::solidBodyMotionFunction::clone() const /opt/openfoam230/src/dynamicFvMesh/lnInclude/solidBodyMotionFunction.H:90:9: warning: control reaches end of non-void function [-Wreturn-type] make: *** [Make/linux64GccDPOpt/cycloRamp.o] Error 1 cp: cannot stat `/home/tom/OpenFOAM/root-2.3.0/platforms/linux64GccDPOpt/lib/libCycloRamp.so': No such file or directory Looks like its on line 46 of cycloRamp.C, running this bit of code: namespace Foam { namespace solidBodyMotionFunctions { defineTypeNameAndDebug(cycloRamp, 0); addToRunTimeSelectionTable ( solidBodyMotionFunction, cycloRamp, dictionary ); } } Any ideas? Tom |
Could be the version. Ill try out 230, as I used 222. Or, you could try out 222. I will try to let you know tomorrow.
|
Hi,
Success on the compiling front, I installed 222 and it compiled perfectly. Now just got to figure out how to run the other code. When the code runs I get a warning that it could not load libCycloBucket.so. Is there another library called this? The github code only has cycloRamp.so. I also get one for libRampedAxisRotationMotion.so, this is on Github so I will compile it and that error should go away Tom |
1 Attachment(s)
Great!
libCycloBucket and libRampedAxisRotationMotion were other custom codes of mine I made for different pitching schedule and ramping up the rotor speed for (supposedly) faster transient simulation, respectively. They are utilized in 'system/controlDict' and 'constant/dynamicMeshDict'. In dynamicMeshDict you specify rotation speed and for my custom code the cyclorotor parameters. It is an error on my part that those case files use cycloBucket instead of cycloRamp in the dynamicMeshDict. So, I have attached the case files that work the same way as the earlier one, except that it has the correct dynamicMeshDict (no need to recompile, etc.). But you should compile rampedAxisRotationMotion if its no problem, otherwise you will need to change the dynamicMeshDict to not use it, and instead use the standard OpenFOAM mesh rotation function, which does a hard start. The mesh in the new attached case files is different. If you prefer the old mesh, simply copy over your old 'mesh' to replace the one in the new attachment. (I also changed the cyclorotor.zip posted earlier to avoid confusion) Just as a side note, in libCycloRamp the pitching motion is sinusoidal with respect to azimuthal position (of the blade w.r.t. rotor center). In libCycloBucket the pitching schedule looks more like a clipped sine wave. So if you are interested in implementing this or other more interesting pitching schedules as a function of azimuthal position, let me know and I can upload it. Pretty much any arbitrary sufficiently-smooth pitching schedule is possible with the method described in "Design, Development, and Flight Test of a Small-Scale Cyclogyro UAV Utilizing a Novel Cam-Based Passive Blade Pitching Mechanism" by Zachary Adams, et al. I do not know where to get the PDF for free for everyone, but since you are a University undergrad you should be able to access it for free somehow. |
Excellent, closer than ever.
I make it through the set up; till the run case question its all fine with no errors. However when I run the case I get the followign error: Selecting dynamicFvMesh multiSolidBodyMotionFvMesh Selecting solid-body motion function rampedAxisRotationMotion [0] [0] [0] --> FOAM FATAL IO ERROR: [0] keyword CofG is undefined in dictionary "/home/tom/OpenFOAM/OpenFOAM-2.2.2/cyclorotor/runname/processor0/../constant/dynamicMeshDict.multiSolidBodyMotionFvMeshCoeffs.r otorVolume.rampedAxisRotationMotionCoeffs" [0] [0] file: /home/tom/OpenFOAM/OpenFOAM-2.2.2/cyclorotor/runname/processor0/../constant/dynamicMeshDict.multiSolidBodyMotionFvMeshCoeffs.r otorVolume.rampedAxisRotationMotionCoeffs from line 26 to line 26. [0] [0] From function dictionary::lookupEntry(const word&, bool, bool) const [0] in file db/dictionary/dictionary.C at line 402. [0] FOAM parallel run exiting [0] rampedAxisRotationMotion compiled correctly with no errors but it looks like this is an error in that library Tom |
Alright I think we are out of the woods. These are just typos (i had different versions of rampedAxisRotationMotion). I uploaded the corrected cases once again to the links above. The only thing that is different is 'constant/dynamicMeshDict'.
|
Almost there,
I get the error when I run the case: [0] file: /home/tom/Desktop/cyclorotor/2/processor0/0/p at line 0. [0] [0] From function regIOobject::readStream() [0] in file db/regIOobject/regIOobjectRead.C at line 73. [0] FOAM parallel run exiting [0] There is the folder '0' in the /runname folder, with the p file in, but not within the individual processor folders. It says this for all 4 processors (0, 1, 2, 3) The newly updated zip files also have 1 error in the mesh but I copied over the old mesh and its working perfectly so no worries there. Thanks for all the help. I really appreciate it Tom |
I think an error is occurring earlier. Please put all output into a text file and upload it.
|
When I run ./parallel I get the following:
Code:
root@tom-770Z5E-780Z5E:~/Desktop/cyclorotor# ./parallel 1 |
and after I run case:
Code:
/*---------------------------------------------------------------------------*\ |
All times are GMT -4. The time now is 01:15. |