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

do i need to compile after changing a .h file

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

Reply
 
LinkBack Thread Tools Display Modes
Old   February 9, 2012, 04:33
Default do i need to compile after changing a .h file
  #1
New Member
 
tomek
Join Date: Dec 2011
Location: Stuttgart, Germany
Posts: 13
Rep Power: 5
sto16 is on a distinguished road
hello,

i have to change the constants in the calculation for kappa (thermal conductivity) in:

kappa
(
const scalar T
) const
{
scalar Cv_ = this->Cv(T);
return mu(T)*Cv_*(1.32 + 1.77*this->R()/Cv_);

which is calculated in sutherlandTransportI.H.

I need to do this to get a thermal conductivity i can compare with the one i get in fluent.

now i wanted to know if i have to compile the code or if it is not needed when changing .H-Files?

greetz
tomek
sto16 is offline   Reply With Quote

Old   February 9, 2012, 09:30
Default
  #2
Member
 
Laurens Van Dyck
Join Date: Jul 2011
Location: Netherlands/Germany
Posts: 34
Rep Power: 6
laurensvd is on a distinguished road
Any change in source code (including *.h header files) need to be recompiled
laurensvd is offline   Reply With Quote

Old   February 9, 2012, 11:44
Default
  #3
New Member
 
tomek
Join Date: Dec 2011
Location: Stuttgart, Germany
Posts: 13
Rep Power: 5
sto16 is on a distinguished road
thank you....

now i have another problem...

due to backup reasons i had to copy the complete "openfoam201" folder and now have to use the copied, renamed "openfoam_update" where i can make the changes...

now i started to enter the changes in the header file and to fix the .bashrc entries...
after that i wanted to compile with ./allwmake but i got the message:

Error: Current directory is not /opt/openfoam201
Error: Current directory is not $WM_PROJECT_DIR
The environment variables are inconsistent with the installation.
Check the OpenFOAM entries in your dot-files and source them.

do u know what else do i have to change...or did i miss another .bashrc?!
sto16 is offline   Reply With Quote

Old   February 9, 2012, 11:50
Default
  #4
Member
 
Laurens Van Dyck
Join Date: Jul 2011
Location: Netherlands/Germany
Posts: 34
Rep Power: 6
laurensvd is on a distinguished road
Either you miss some changes in your bashrc (what output do you get if you type "$WM_PROJECT_DIR" in terminal?) or you are still loading your old bashrc instead of the new one which you are editing. Check this by seeing if you link to the correct openfoam bashrc file in your linux bashrcfile (> gedit ~/.bashrc , does it have a line similar to . /opt/openfoam201/etc/bashrc or . /opt/openfoam201_update/etc/bashrc in it?)
laurensvd is offline   Reply With Quote

Old   February 9, 2012, 12:08
Default
  #5
New Member
 
tomek
Join Date: Dec 2011
Location: Stuttgart, Germany
Posts: 13
Rep Power: 5
sto16 is on a distinguished road
thank you for the fast answer...

when i edit "$WM_PROJECT_DIR" i get :
bash: /opt/openfoam201: is a directory
as answer... so i guess its still the wrong bash...

i am working with caelinux, so in my bashrc file there is: . /opt/.bashrc-CAE,
- there i changed all entries to openfoam_update...


but i think i found the problem there...in my openfoam_update/etc/.bashrc there is the line:

# Location of installation
# ~~~~~~~~~~~~~~~~~~~~~~~~
export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/openfoam201

do i have to change this? i am a bit afraid of killing it all....
sto16 is offline   Reply With Quote

Old   February 10, 2012, 03:47
Default
  #6
Member
 
Laurens Van Dyck
Join Date: Jul 2011
Location: Netherlands/Germany
Posts: 34
Rep Power: 6
laurensvd is on a distinguished road
You don't "edit" a system variable, you declare it in your bashrc. Inside your /opt/.bashrc-CAE file, it should reference your openfoam_update/etc/.bashrc i suppose? Make sure it does not reference openfoam/etc/.bashrc. Afterwards you still have to edit your openfoam_update/etc/.bashrc such that they all use the new location as visible in the last part of your post. So yes, you need to edit that too

Just some advice for later, before you start editing your system bashrc on so many levels make a backup first
laurensvd is offline   Reply With Quote

Old   February 10, 2012, 03:52
Default
  #7
New Member
 
tomek
Join Date: Dec 2011
Location: Stuttgart, Germany
Posts: 13
Rep Power: 5
sto16 is on a distinguished road
ok i changed the line now...

then i entered:
foamuser2@foamuser2:~$ $WM_PROJECT_DIR

and got the message:
bash: /opt/openfoam_update/openfoam_update: is a directory
foamuser2@foamuser2:~$

but when i start the terminal cae-terminal, then there is the message:

bash: Error: No such file or directory
bash: :: No such file or directory
bash: unknown/unsupported: No such file or directory
bash: naming: No such file or directory
bash: convention: No such file or directory
bash: Error: No such file or directory
bash: :: No such file or directory
bash: unknown/unsupported: No such file or directory
bash: naming: No such file or directory
bash: convention: No such file or directory
bash: Error: No such file or directory
bash: :: No such file or directory
bash: unknown/unsupported: No such file or directory
bash: naming: No such file or directory
bash: convention: No such file or directory

is there still something missing?
sto16 is offline   Reply With Quote

Old   February 10, 2012, 04:33
Default
  #8
Member
 
Laurens Van Dyck
Join Date: Jul 2011
Location: Netherlands/Germany
Posts: 34
Rep Power: 6
laurensvd is on a distinguished road
Double check if you put the right information in. Your $WM_PROJECT_DIR (dont worry if it says its a directory, it should be that ) refers to /opt/openfoam_update/openfoam_update and not /opt/openfoam_update/

Change it in the bashrc to the correct directory and test if it worked (and if the directory exists) by typing:
> cd $WM_PROJECT_DIR
laurensvd is offline   Reply With Quote

Old   February 10, 2012, 04:50
Default
  #9
New Member
 
tomek
Join Date: Dec 2011
Location: Stuttgart, Germany
Posts: 13
Rep Power: 5
sto16 is on a distinguished road
hey...

thank you so much for your help...
sorry when there are some strange questions- its my first time i am doing something like that... by reading my posts i guess you can imagine how confused i am....

i think a backup would have been a good idea...but now there is no way back...it has to work...

ok..you were right - the directory i wrote was wrong...i corrected it and it worked - i directly came to opt/openfoam_update...


but when i start a new terminal- there is still:

bash: Error: No such file or directory
bash: :: No such file or directory
bash: unknown/unsupported: No such file or directory
bash: naming: No such file or directory
bash: convention: No such file or directory
bash: Error: No such file or directory
bash: :: No such file or directory
bash: unknown/unsupported: No such file or directory
bash: naming: No such file or directory
bash: convention: No such file or directory
bash: Error: No such file or directory
bash: :: No such file or directory
bash: unknown/unsupported: No such file or directory
bash: naming: No such file or directory
bash: convention: No such file or directory

i am not sure about the terminology- but do i have to compile my changes to get caelinux understand i changed some directories?
sto16 is offline   Reply With Quote

Old   February 10, 2012, 05:21
Default
  #10
Member
 
Laurens Van Dyck
Join Date: Jul 2011
Location: Netherlands/Germany
Posts: 34
Rep Power: 6
laurensvd is on a distinguished road
No this must be still some errors in your CAE or OpenFoam bashrc.
Check these two files for the words which you see in the error message (unknown/unsupported/naming/convention...). I dont have cae linux so I cant check for my self unfortunately.
laurensvd is offline   Reply With Quote

Old   February 10, 2012, 08:28
Default
  #11
New Member
 
tomek
Join Date: Dec 2011
Location: Stuttgart, Germany
Posts: 13
Rep Power: 5
sto16 is on a distinguished road
i ve been searching for a long time and didnt find anything, so I decided to turn the things around and called my folder openfoam201 and the other of201_original...
this way after declaring my system variables in the bashrc's it works...?!?

so now back to my first question:
i've changed the header file - do i have to compile by using gcc or by using the make-files?
sto16 is offline   Reply With Quote

Old   February 10, 2012, 10:05
Default
  #12
New Member
 
tomek
Join Date: Dec 2011
Location: Stuttgart, Germany
Posts: 13
Rep Power: 5
sto16 is on a distinguished road
i tried to compile the part where i changed the header file by using ./Allwmake

now the problem is:
when i run it as 'normal' user he starts to run but the messages he is entering are like:

...
mkdir: cannot create directory `linux64GccDPOpt': Permission denied
/bin/sh: linux64GccDPOpt/options: No such file or directory
make[2]: *** [linux64GccDPOpt/options] Error 1
/opt/openfoam201/wmake/MakefileFiles:40: linux64GccDPOpt/options: No such file or directory
make[2]: *** No rule to make target `linux64GccDPOpt/options'. Stop.
wmake error: file 'Make/linux64GccDPOpt/objectFiles' could not be created in /opt/openfoam201/applications/solvers/stressAnalysis/solidDisplacementFoam
make[1]: *** [solidDisplacementFoam] Error 1
mkdir: cannot create directory `linux64GccDPOpt': Permission denied
/bin/sh: linux64GccDPOpt/options: No such file or directory
make[2]: *** [linux64GccDPOpt/options] Error 1
/opt/openfoam201/wmake/MakefileFiles:40: linux64GccDPOpt/options: No such file or directory
make[2]: *** No rule to make target `linux64GccDPOpt/options'. Stop.
wmake error: file 'Make/linux64GccDPOpt/objectFiles' could not be created in /opt/openfoam201/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam
make[1]: *** [solidEquilibriumDisplacementFoam] Error 1
make[1]: Target `application' not remade because of errors.
make[1]: Leaving directory `/opt/openfoam201/applications/solvers/stressAnalysis'
make: *** [stressAnalysis] Error 2
make: Target `application' not remade because of errors.

so i thought it might be a permission reason and tried it as sudo:

./Allwmake: line 4: wmakeCheckPwd: command not found
Error: Current directory is not $WM_PROJECT_DIR
The environment variables are inconsistent with the installation.
Check the OpenFOAM entries in your dot-files and source them.

so again it is something with my bash-files?
sto16 is offline   Reply With Quote

Old   February 10, 2012, 10:43
Default
  #13
Member
 
Laurens Van Dyck
Join Date: Jul 2011
Location: Netherlands/Germany
Posts: 34
Rep Power: 6
laurensvd is on a distinguished road
I suppose the openfoam folder is owned by the administrator such that only someone with admin rights can compile, however it is very likely that sudo wont work since wmake is only accessible to you as a user. I would suggest to change the owner of the openfoam folder to yourself instead of admin (chown -R yourname:\ /opt/openfoam) and try to compile again.
laurensvd is offline   Reply With Quote

Old   February 10, 2012, 12:34
Default
  #14
New Member
 
tomek
Join Date: Dec 2011
Location: Stuttgart, Germany
Posts: 13
Rep Power: 5
sto16 is on a distinguished road
yes...its running....thank you so much!

have a nice weekend....
sto16 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
wmake compiling new solver mksca OpenFOAM Programming & Development 13 August 18, 2014 22:26
2.0.x on Mac OSX niklas OpenFOAM Installation on Windows, Mac and other Unsupported Platforms 74 March 28, 2012 16:46
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 12:44
Regarding FoamX running Kindly help out hariya03 OpenFOAM Pre-Processing 0 April 18, 2008 04:26
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00


All times are GMT -4. The time now is 15:22.