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

Making changes to the files under /opt/openfoam directory

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Mojtaba.a

Reply
 
LinkBack Thread Tools Display Modes
Old   August 2, 2013, 11:01
Default Making changes to the files under /opt/openfoam directory
  #1
Senior Member
 
Mojtaba.a's Avatar
 
Mojtaba Amiraslanpour
Join Date: Jun 2011
Location: Zanjan, Iran
Posts: 188
Rep Power: 5
Mojtaba.a is on a distinguished road
Send a message via Yahoo to Mojtaba.a
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
__________________
Complex Heat & Flow Simulation Research Group
If you can't explain it simply, you don't understand it well enough. "Richard Feynman"
Mojtaba.a is offline   Reply With Quote

Old   August 2, 2013, 13:01
Default
  #2
Senior Member
 
Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,048
Blog Entries: 1
Rep Power: 13
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
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
__________________
Training Course on OpenFOAM at (http://www.isme.ir/)
My Weblog (http://openfoam.blogfa.com/)
nimasam is offline   Reply With Quote

Old   August 2, 2013, 15:01
Default
  #3
Senior Member
 
Mojtaba.a's Avatar
 
Mojtaba Amiraslanpour
Join Date: Jun 2011
Location: Zanjan, Iran
Posts: 188
Rep Power: 5
Mojtaba.a is on a distinguished road
Send a message via Yahoo to Mojtaba.a
Quote:
Originally Posted by nimasam View Post
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
Thank you dear Nima,
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
__________________
Complex Heat & Flow Simulation Research Group
If you can't explain it simply, you don't understand it well enough. "Richard Feynman"
Mojtaba.a is offline   Reply With Quote

Old   August 2, 2013, 15:11
Default salam
  #4
Member
 
Hassan
Join Date: Oct 2012
Location: Iran
Posts: 60
Rep Power: 3
luckycfd is on a distinguished road
Greetings Mojtaba,
following instruction:
Code:
1. cp -r $FOAM_UTILITIES/mesh/manipulation/checkMesh $FOAM_RUN/checkMesh2
2. cd $FOAM_RUN/checkMesh2
3. making your changes in the relevant source file
4.  Change your Make/files to:
                 printMeshStats.C
                 checkTopology.C
                 checkGeometry.C
                 checkMesh.C

                 EXE = $(FOAM_USER_APPBIN)/checkMesh2
5. Compile:
                  wclean
                  rm r Make/linux*
                  wmake
Best regards,
Hassan
luckycfd is offline   Reply With Quote

Old   August 2, 2013, 15:21
Default
  #5
Senior Member
 
Mojtaba.a's Avatar
 
Mojtaba Amiraslanpour
Join Date: Jun 2011
Location: Zanjan, Iran
Posts: 188
Rep Power: 5
Mojtaba.a is on a distinguished road
Send a message via Yahoo to Mojtaba.a
Quote:
Originally Posted by luckycfd View Post
Greetings Mojtaba,
following instruction:
Code:
1. cp -r $FOAM_UTILITIES/mesh/manipulation/checkMesh $FOAM_RUN/checkMesh2
2. cd $FOAM_RUN/checkMesh2
3. making your changes in the relevant source file
4.  Change your Make/files to:
                 printMeshStats.C
                 checkTopology.C
                 checkGeometry.C
                 checkMesh.C

                 EXE = $(FOAM_USER_APPBIN)/checkMesh2
5. Compile:
                  wclean
                  rm r Make/linux*
                  wmake
Best regards,
Hassan
Thank you dear Hassan ,

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
__________________
Complex Heat & Flow Simulation Research Group
If you can't explain it simply, you don't understand it well enough. "Richard Feynman"
Mojtaba.a is offline   Reply With Quote

Old   August 2, 2013, 15:48
Default
  #6
Senior Member
 
Mojtaba.a's Avatar
 
Mojtaba Amiraslanpour
Join Date: Jun 2011
Location: Zanjan, Iran
Posts: 188
Rep Power: 5
Mojtaba.a is on a distinguished road
Send a message via Yahoo to Mojtaba.a
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
luckycfd likes this.
__________________
Complex Heat & Flow Simulation Research Group
If you can't explain it simply, you don't understand it well enough. "Richard Feynman"
Mojtaba.a is offline   Reply With Quote

Old   September 27, 2013, 15:46
Default
  #7
Senior Member
 
Mojtaba.a's Avatar
 
Mojtaba Amiraslanpour
Join Date: Jun 2011
Location: Zanjan, Iran
Posts: 188
Rep Power: 5
Mojtaba.a is on a distinguished road
Send a message via Yahoo to Mojtaba.a
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.
__________________
Complex Heat & Flow Simulation Research Group
If you can't explain it simply, you don't understand it well enough. "Richard Feynman"
Mojtaba.a is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Waves2Foam Related Topics ngj OpenFOAM Running, Solving & CFD 818 July 9, 2014 16:53
Release of a Wave Generation and Absorption Toolbox for OF ngj OpenFOAM Announcements from Other Sources 37 June 21, 2014 12:08
build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Installation 14 April 23, 2013 13:59
OpenFoam install script Error during paraFoam installation SePe OpenFOAM Installation 10 June 19, 2010 15:15
Gerris software installation mer Main CFD Forum 2 November 12, 2005 08:50


All times are GMT -4. The time now is 23:35.