HowTo Adding a new boundary condition

From OpenFOAMWiki
Revision as of 10:39, 15 January 2014 by Louisgag (Talk | contribs)

First look at groovyBC. If this isn't suitable, follow these steps below.

  1. Choose a boundary condition that is close to the one you want - we'll call it originalFvPatchField.
  2. Copy the directory contents to anywhere (say run/myCode).
  3. Rename all the copied files to a new name (say customFvPatchField).
for i in `ls`; do mv $i `echo $i|sed s/originalFvPatchField/customFvPatchField/g`;done
  1. Search & replace all text in all the new files old name for new name (originalFvPatchField replaced with customFvPatchField)
for i in `ls`; do sed -i s/originalFvPatchField/customFvPatchField/g $i;done
  1. Modify the code to suit your needs.
  2. Create the directory structure: myCode/Make, and create files and options in it.
  3. Put the relevant info into files:
    1. Search for originalFvPatchField in finiteVolume/Make/files.
    2. Copy the relevant entry (entries) into your myCode/Make/files
    3. Rename the entries as necessary - rename it with your customFvPatchField naming (if there's an s on the end, keep it there).
    4. Tell it what the new library name will be. Use $(FOAM_USER_LIBBIN) instead of $(FOAM_LIBBIN), and add lib to the front of the new name. It should look something like: LIB = $(FOAM_USER_LIBBIN)/libcustomPatchField
  4. The options file should have EXE_INC (for any includes such as -I$(LIB_SRC)/finiteVolume/lnInclude for finiteVolume) and LIB_LIBS (for included libraries, such as -lfiniteVolume for finiteVolume). Look at other LIB_LIBS for examples.
  5. $wmake libso
  6. Add whatever new dictionary entries are needed to your initial conditions files, such as 0/U and 0/P files.
  7. Add libs ( "libcustomFvPatchField.so" "libOpenFOAM.so" ) to controlDict
  8. It should run now.

With reference to [1]. Marupio 17:00, 26 February 2010 (UTC)