CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Adding Temperature Field to mhdFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/216861-adding-temperature-field-mhdfoam.html)

ErenC April 22, 2019 11:29

Adding Temperature Field to mhdFoam
 
Greetings!

I am really new to OpenFOAM. I am trying to add energy equation to mhdFoam. I found this (energy equation for icofoam) and I am trying to adapt that to mhdFoam. I created files and created a folder named "mymhdFoam" but "wmake" doesnt work at all. So I can't even run a case to diagnose my errors. Error is related to being root user but sudo not working. I made an google search tried everything. Still nothing.

Error is:
"
mkdir: cannot create directory '/opt/openfoam6/platforms/linux64ccDPInt320pt/aplications' : Permission denied


/opt/openfoam6/wmake/wmake: line 410: make: command not found


/opt/openfoam6/wmake/wmake: line 413: make: command not found


wmake error: file '/opt/openfoam6/platforms/linux64ccDPInt320pt/aplications/solvers/electromagnetics/mymhdFoam/sourceFiles' could not be created in /opt/openfoam6/applications/solvers/electromagnetics/mymhdFoam
"







Any help would be great.

t.teschner April 22, 2019 11:55

looks like you are writing to the install directory of openfoam, not to your local directory. what does your "files" file say inside your Make folder?

it should look something like

mymhdFoam.C

EXE = $(FOAM_USER_APPBIN)/mymhdFoam

(notice here that i changed FOAM_APPBIN to FOAM_USER_APPBIN as well). You should not need to use sudo privileges to compile your solver.

Another reason could be that OpenFOAM (for some reason, probably related to write permission issues) can not create the folder to place your solver into. I had this issue once (I think) and a "hack" was to simply create the folder myself, i.e. inside your local openfoam folder you would need to create the folders "platforms/linux64ccDPInt320pt/aplications" ... by the way, are you sure that it is aplications and not applications? maybe there is a type somewhere in your script and this could cause the issue?

ErenC April 22, 2019 12:34

Quote:

Originally Posted by t.teschner (Post 731489)
looks like you are writing to the install directory of openfoam, not to your local directory. what does your "files" file say inside your Make folder?

it should look something like

mymhdFoam.C

EXE = $(FOAM_USER_APPBIN)/mymhdFoam

(notice here that i changed FOAM_APPBIN to FOAM_USER_APPBIN as well). You should not need to use sudo privileges to compile your solver.

Another reason could be that OpenFOAM (for some reason, probably related to write permission issues) can not create the folder to place your solver into. I had this issue once (I think) and a "hack" was to simply create the folder myself, i.e. inside your local openfoam folder you would need to create the folders "platforms/linux64ccDPInt320pt/aplications" ... by the way, are you sure that it is aplications and not applications? maybe there is a type somewhere in your script and this could cause the issue?


Dr. Teschner,

Thank you for your quick reply. Yes it is "applications" I am using ubuntu in a different computer so I typed all the statements above, so it is a typo.

I changed "mhdFoam" statements inside the Make/files with "mymhdFoam" no mistake there. I just added the USER statement inside the "EXE = $(FOAM_USER_APPBIN)/mymhdFoam" as you recommended But error still consists.

wmake error: file "Make/linux64ccDPInt320Opt/sourceFiles coul not be created in /correspondingpath(this is not what terminal says)"

I think its about:
/opt/openfoam6/wmake/wmake: line 410 make: command not found
/opt/openfoam6/wmake/wmake: line 413 make: command not found

I checked that lines but I don't know what to do there.

t.teschner April 22, 2019 13:48

hmm, but you are invoking wmake in the terminal inside the folder where your source code is located? did you load the openfoam environment variables before? i.e. did you type something like this before into your terminal: source /opt/openfoam6/etc/bashrc ?

ErenC April 22, 2019 14:47

Quote:

Originally Posted by t.teschner (Post 731500)
hmm, but you are invoking wmake in the terminal inside the folder where your source code is located? did you load the openfoam environment variables before? i.e. did you type something like this before into your terminal: source /opt/openfoam6/etc/bashrc ?


Oh, I am sorry I should have mentioned all the steps. Yes, I am opening "mymhdFoam" folder in GUI, and by right clicking inside the folder I am opening terminal, after that I am executing bashrc file like you said "source /opt/openfoam6/etc/bashrc" I am also executing "mkdir -p $FOAM_RUN"
but "mkdir -p $FOAM_RUN" but I think mkdir step doesn't have a significance at this step because error message doesn't change in either way.

I copied all openfoam files from /opt/openfoam6 to my home folder. I tried in there, this time inside mymhdFoam/Make there is a linux64GccDPInt32Opt folder but no file inside and error message consist of permission denied.

ErenC April 22, 2019 16:18

Apparently I had to install "make"

This thread has the answer but It's not over yet! I just created the source files, all is good. But, mymhdFoam foam still not working...

I have to mention that files inside the /Make/linux64GccDPInt32Opt are protected and owned by root. All the other files are owned by me. Something is fishy and I really, really understand why ubuntu computers doesn't usually get virus. Even I can't make a change in system files...

t.teschner April 23, 2019 01:26

ah, we were having much more fundamental problems :3 ... ok, in this case, i would recommend to install the essentials with sudo apt-get install build-essential (which would have also installed make), in this way you will have most / all of the required development tools you need and avoid similar problems in the future.



well, it doesn't change your problem now, what does your terminal output when you type "echo $FOAM_USER_APPBIN" or "echo $FOAM_RUN"?

the mkdir -p $FOAM_RUN will just create a folder in which you can place all your simulations. The -p just says that the folder will be created if not already present, so it will not have any influence here

ErenC April 23, 2019 14:09

Ah, thank you! As I said I am fairly new to OpenFOAM environment.


echo $FOAM_USER_APPBIN gives:

/home/erenc/openFOAM/erenc-6/platforms/linux64GccDPInt32Opt/bin

echo $FOAM_RUN gives:

/home/erenc/OpenFOAM/erenc-6/run

t.teschner April 23, 2019 15:30

ok, so it is in your local directory (/home/erenc/...), so i am a bit confused why you would get write permission issues. so now when you type wmake in your solver directory, it still gives you the error of write permission? that's strange, because the environmental variable $FOAM_USER_APPBIN is pointing to the right location (to your home folder /home/erenc/openFOAM/erenc-6/platforms/linux64GccDPInt32Opt/bin) while the error message says that it tries to write to a system path (/opt/openfoam6/platforms/linux64ccDPInt320pt/applications, which should be the same path as your $FOAM_APPBIN path (I would assume), you could double check by typing echo $FOAM_APPBIN) ... actually, the last folder should be bin, not applications, are you sure that you set used FOAM_USER_APPBIN and not FOAM_USER_APP ? there is a difference (but I doubt that it makes a difference).

Just to check, can you post the content of the files and options files inside your Make directory?

ErenC April 23, 2019 15:57

Sooo, my main files was inside the:
/opt/openfoam6
and my local files was inside the:
/home/OpenFoam/erenc-v1806 etc.

After reading your commend I created that dir "home/erenc/OpenFOAM/erenc-6 moved files there, wmake now works!

Altough I can just start to diagnose my errors but still a progress! :)
I kinda feel like I wasted your time till now with this newbie problems, sorry about that! and thanks a lot! If I can't make any progress I will try to bother you again! :)

t.teschner April 25, 2019 01:14

no worries, glad i could help :) ... good luck in you endeavors with openfoam

sadsid May 24, 2020 13:40

Erenc: Done with adding temperature equation ? I want to discuss


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