CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   do i need to compile after changing a .h file (http://www.cfd-online.com/Forums/openfoam-programming-development/97112-do-i-need-compile-after-changing-h-file.html)

sto16 February 9, 2012 04:33

do i need to compile after changing a .h file
 
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

laurensvd February 9, 2012 09:30

Any change in source code (including *.h header files) need to be recompiled :)

sto16 February 9, 2012 11:44

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?!

laurensvd February 9, 2012 11:50

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?)

sto16 February 9, 2012 12:08

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....

laurensvd February 10, 2012 03:47

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 ;)

sto16 February 10, 2012 03:52

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?

laurensvd February 10, 2012 04:33

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

sto16 February 10, 2012 04:50

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?

laurensvd February 10, 2012 05:21

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.

sto16 February 10, 2012 08:28

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 February 10, 2012 10:05

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? :confused:

laurensvd February 10, 2012 10:43

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.

sto16 February 10, 2012 12:34

yes...its running....thank you so much!

have a nice weekend....


All times are GMT -4. The time now is 16:09.