Difference between revisions of "How to add temperature to icoFoam"

From OpenFOAMWiki
(How to add temperature transport to icoFoam)
(added copy and recompile section)
Line 6: Line 6:
  
 
== Copy and recompile icoFoam ==
 
== Copy and recompile icoFoam ==
This will go through the steps of creating a personal version of icoFoam in the user's subdirectory.
+
//This will go through the steps of creating a personal version of icoFoam in the user's subdirectory.
 +
The first step is to insure that your installation of OpenFOAM works properly and compiles the unedited solver.
 +
First, bring up a console and move to your OpenFOAM installation folder.
 +
<pre>cd OpenFOAM</pre>
 +
 
 +
Your particular OpenFOAM installation folder will have a version number following it such as:
 +
<pre>cd OpenFOAM-1.4.1-dev</pre>
 +
 
 +
OpenFOAM has organized the solvers as separate from the source code of OpenFOAM calling them 'applications'. Inside the 'applications' folder, there are subdirectories including one for solvers. Have a look around, but this tutorial goes for icoFoam which we will copy to our own location:
 +
<pre>cd applications/solvers/incompressible
 +
cp -r icoFoam $FOAM_USER_APPBIN/../../solvers/my_icoFoam
 +
cd $FOAM_USER_APPBIN/../../solvers/my_icoFoam</pre>
 +
 
 +
Now, a couple of alterations need to be made to the make files in order for everything to compile and not overwrite the original solver.
 +
First, rename the primary file to your new solver name and delete the old dependency file:
 +
<pre>mv icoFoam.C my_icoFoam.C
 +
rm icoFoam.dep</pre>
 +
 
 +
Now go into the Make subdirectory and open the 'files' file with your favorite editor.
 +
Change it to read:
 +
<pre>my_icoFoam.C
 +
 
 +
EXE = $(FOAM_USER_APPBIN)/my_icoFoam
 +
</pre>
 +
 
 +
No changes are necessary for the 'options' file.
 +
Delete the old binaries subdirectory:
 +
<pre>rm -rf linuxGccDP0pt
 +
cd ..</pre>
 +
 
 +
Now, test that the renamed solver (and your installation of OpenFOAM) works:
 +
<pre>wmake</pre>
 +
 
 +
If everything worked correctly, your new solver binary should appear in the FOAM_USER_APPBIN directory. check this with:
 +
<pre>ls $FOAM_USER_APPBIN</pre>
  
  
Line 26: Line 60:
 
== Benchmarking your new solver ==
 
== Benchmarking your new solver ==
 
This may end up being a different page, but it will show a case study of the Blasius flat-plate flow problem.
 
This may end up being a different page, but it will show a case study of the Blasius flat-plate flow problem.
 +
--[[User:Mike Jaworski|Mike Jaworski]] 07:05, 22 February 2008 (CET)

Revision as of 06:05, 22 February 2008

1 How to add temperature transport to icoFoam

This HOWTO will cover rudimentary methods for altering an existing solver (icoFoam) to solve thermal transport. The main items to be accomplished are first, to copy and test that your installation of OpenFOAM can compile the existing solver correctly. Once that is accomplished, various small changes are necessary to the solver files themselves and these will be detailed below. Finally, new fields have to be added to the initial and boundary conditions and alterations to the fvSchemes file.

2 Copy and recompile icoFoam

//This will go through the steps of creating a personal version of icoFoam in the user's subdirectory. The first step is to insure that your installation of OpenFOAM works properly and compiles the unedited solver. First, bring up a console and move to your OpenFOAM installation folder.

cd OpenFOAM

Your particular OpenFOAM installation folder will have a version number following it such as:

cd OpenFOAM-1.4.1-dev

OpenFOAM has organized the solvers as separate from the source code of OpenFOAM calling them 'applications'. Inside the 'applications' folder, there are subdirectories including one for solvers. Have a look around, but this tutorial goes for icoFoam which we will copy to our own location:

cd applications/solvers/incompressible
cp -r icoFoam $FOAM_USER_APPBIN/../../solvers/my_icoFoam
cd $FOAM_USER_APPBIN/../../solvers/my_icoFoam

Now, a couple of alterations need to be made to the make files in order for everything to compile and not overwrite the original solver. First, rename the primary file to your new solver name and delete the old dependency file:

mv icoFoam.C my_icoFoam.C
rm icoFoam.dep

Now go into the Make subdirectory and open the 'files' file with your favorite editor. Change it to read:

my_icoFoam.C

EXE = $(FOAM_USER_APPBIN)/my_icoFoam

No changes are necessary for the 'options' file. Delete the old binaries subdirectory:

rm -rf linuxGccDP0pt
cd ..

Now, test that the renamed solver (and your installation of OpenFOAM) works:

wmake

If everything worked correctly, your new solver binary should appear in the FOAM_USER_APPBIN directory. check this with:

ls $FOAM_USER_APPBIN


3 Adding the temperature field

This will show the steps to add another field variable to a solver. Also, add a new dimensioned constant.


4 Adding a new equation to solve

This will show the steps to adding a new equation.


5 Add a new file for initial and boundary conditions

This will show the steps to modifying the t=0 files.

6 What to add in fvSchemes

How to modify fvSchemes for your new solver.

7 Benchmarking your new solver

This may end up being a different page, but it will show a case study of the Blasius flat-plate flow problem. --Mike Jaworski 07:05, 22 February 2008 (CET)