Making changes to the files under /opt/openfoam directory
Hi dear Foamers,
I am trying to modify some utilities and make some small changes in them, but I do not want to make new utilities, because changes are so small. For example I am trying to write out "Total cell numbers" while I am running "checkMesh" utility. I don't want to make a new "checkMesh2" utility to do this. Just want to make the small change in the source file and compiling "checkMesh" utility again. My openFOAM is installed in /opt directory. is it possible to do this? Best regards, Mojtaba |
as opt is writing protected for user , you should be root,
i guess using sudo wmake will solve your problem, or you may want to compile it as usual, then put your binary file where present checkMesh binary file is placed |
Quote:
Well actually sudo wmake doesn't help, I don't know why yet. I was thinking about deleting compiled binaries of checkMesh (or maybe wclean it) and then compile my new utility with the same name (checkMesh) in FOAM_USER_APPBIN. Your second idea is interesting. I will report back the results. best |
salam
Greetings Mojtaba,
following instruction: Code:
1. cp -r $FOAM_UTILITIES/mesh/manipulation/checkMesh $FOAM_RUN/checkMesh2 Hassan:) |
Quote:
Well this procedure doesn't actually replace the utility "checkMesh". I think it simply makes a new utility named "checkMesh2". I prefer to have the old checkMesh utility with some new changes, without compiling a whole new utility named "checkMesh2". best, Mojtaba |
Problem is solved,
Thank you Nima and Hassan for your suggestions. :) Well actually solution was quite easy as Nimasam said. Here is the step by step procedure: 1- Copy your desired utility into $WM_PROJECT_USER_DIR/applications/utilities 2- modify the code and make your desired modifications. 3- Do not change *.C file name and do not change the name in /Make/files 4- run wmake 5- sudo rm /opt/openfoam---/platforms/linux64GccDPOpt/bin/utility i.e: sudo rm /opt/openfoam---/platforms/linux64GccDPOpt/bin/checkMesh Note: --- is your Of version 6- sudo cp $WM_PROJECT_USER_DIR/applications/utilities/utility /opt/openfoam---/platforms/linux64GccDPOpt/bin/ i.e: sudo cp $WM_PROJECT_USER_DIR/applications/utilities/checkMesh /opt/openfoam---/platforms/linux64GccDPOpt/bin/ And you are done ;) Best Wishes, Mojtaba |
Hi, I want to make some little modifications to my previous post.
Here is the updated procedure: 1- Copy your desired utility into $WM_PROJECT_USER_DIR/applications/utilities 2- modify the code and make your desired modifications. ***3- Do not change *.C file name and do not change the name in /Make/files but instead change FOAM_APPBIN into FOAM_USER_APPBIN 4- run wmake 5- sudo rm /opt/openfoam<version>/platforms/linux64GccDPOpt/bin/utility i.e: sudo rm /opt/openfoam221/platforms/linux64GccDPOpt/bin/checkMesh ***6- sudo cp $WM_PROJECT_USER_DIR/platforms/linux64GccDPOpt/bin/utility /opt/openfoam<version>/platforms/linux64GccDPOpt/bin/ i.e: ***sudo cp $WM_PROJECT_USER_DIR/platforms/linux64GccDPOpt/bin/checkMesh /opt/openfoam221/platforms/linux64GccDPOpt/bin/ I hope it helps a bit. Best. |
All times are GMT -4. The time now is 21:14. |