Difference between revisions of "Howto adding a new solver to foamX"

From OpenFOAMWiki
m (Reverted edit of Ckowpu, changed back to last version by Bgschaid)
Line 1: Line 1:
'''The information in this section is outdated since Version 1.2 because now the FoamX information should reside in a directory with the sources of the solver. See the ReleaseNotes for 1.2 until this page ist updated.'''
+
FoamX at start-up will look through through a predefined set of directories to find directories with a FoamX subdirectory. These directories are taken to be utilities or solvers which need to be added to FoamX.  
 +
For solvers it looks through directories
 +
* <tt>$WM_PROJECT_DIR</tt>/applications/solvers
 +
* <tt>$WM_PROJECT_USER_DIR</tt>/applications/solvers,
  
To add a new solver to FoamX you have to write the corresponding configuration file.
+
for utilities it looks through directories
 +
* <tt>$WM_PROJECT_DIR</tt>/applications/utilities
 +
* <tt>$WM_PROJECT_USER_DIR</tt>/applications/utilities.
  
The easiest way is to take the configuration (<tt>.cfg</tt>) file of a standard application which behaves similarly to the one you want to add from <tt>$FOAMX_SYSTEM_CONFIG</tt> and to copy it to <tt>FOAMX_USER_CONFIG</tt>.
+
The easiest way is to copy the <tt>FoamX</tt> directory of an existing solver/utility and rename the top <tt>.cfg</tt> file to your solver. Make sure that the
 +
* directory name
 +
* top level solver name
 +
* .cfg file in the FoamX directory
 +
are all consistent.
  
 
For example, if your application is similar to icoFoam, take  
 
For example, if your application is similar to icoFoam, take  
  
<tt>$FOAMX_SYSTEM_CONFIG/applications/incompressible/icoFoam</tt>
+
<tt>$WM_PROJECT_DIR/applications/solvers/incompressible/icoFoam/FoamX</tt>
  
 
and copy it to
 
and copy it to
  
<tt>$FOAMX_USER_CONFIG/applications/incompressible/myFoam</tt>
+
<tt>$WM_PROJECT_USER_DIR/applications/solvers/myFoam</tt>
  
where <tt>myFoam</tt> is the name of your new solver.
+
where <tt>myFoam</tt> is the name of your new solver and move
 +
 
 +
<tt>FoamX/icoFoam.cfg</tt>
 +
 
 +
to
 +
 
 +
<tt>FoamX/myFoam.cfg</tt>
  
 
Adapt the configuration file and the dictionaries to your needs and change <tt>/Make/files</tt> to match your application name.
 
Adapt the configuration file and the dictionaries to your needs and change <tt>/Make/files</tt> to match your application name.
  
 
Create a case (right click on the root directory in the case browser) and you will have <tt>myFoam</tt> to choose from.
 
Create a case (right click on the root directory in the case browser) and you will have <tt>myFoam</tt> to choose from.
 
(Sources: [http://openfoam.cfd-online.com/forum/messages/1/156.html?1106735185][http://openfoam.cfd-online.com/forum/messages/1/371.html])
 

Revision as of 20:28, 27 November 2006

FoamX at start-up will look through through a predefined set of directories to find directories with a FoamX subdirectory. These directories are taken to be utilities or solvers which need to be added to FoamX. For solvers it looks through directories

  • $WM_PROJECT_DIR/applications/solvers
  • $WM_PROJECT_USER_DIR/applications/solvers,

for utilities it looks through directories

  • $WM_PROJECT_DIR/applications/utilities
  • $WM_PROJECT_USER_DIR/applications/utilities.

The easiest way is to copy the FoamX directory of an existing solver/utility and rename the top .cfg file to your solver. Make sure that the

  • directory name
  • top level solver name
  • .cfg file in the FoamX directory

are all consistent.

For example, if your application is similar to icoFoam, take

$WM_PROJECT_DIR/applications/solvers/incompressible/icoFoam/FoamX

and copy it to

$WM_PROJECT_USER_DIR/applications/solvers/myFoam

where myFoam is the name of your new solver and move

FoamX/icoFoam.cfg

to

FoamX/myFoam.cfg

Adapt the configuration file and the dictionaries to your needs and change /Make/files to match your application name.

Create a case (right click on the root directory in the case browser) and you will have myFoam to choose from.