Difference between revisions of "HowTo Adding a new boundary condition"
From OpenFOAMWiki
m |
|||
Line 15: | Line 15: | ||
# <tt>$wmake libso</tt> | # <tt>$wmake libso</tt> | ||
# Add whatever new dictionary entries are needed to your initial conditions files, such as <tt>0/U</tt> and <tt>0/P</tt> files. | # Add whatever new dictionary entries are needed to your initial conditions files, such as <tt>0/U</tt> and <tt>0/P</tt> files. | ||
− | # Add <tt>libs ( " | + | # Add <tt>libs ( "libcustomFvPatchField.so" "libOpenFOAM.so" )</tt> to <tt>controlDict</tt> |
# It should run now. | # It should run now. | ||
With reference to [http://www.cfd-online.com/Forums/openfoam/72434-custom-boundary-condition-openfoam.html]. | With reference to [http://www.cfd-online.com/Forums/openfoam/72434-custom-boundary-condition-openfoam.html]. | ||
[[User:Marupio|Marupio]] 17:00, 26 February 2010 (UTC) | [[User:Marupio|Marupio]] 17:00, 26 February 2010 (UTC) |
Revision as of 21:48, 28 February 2010
First look at groovyBC. If this isn't suitable, follow these steps below.
- Choose a boundary condition that is close to the one you want - we'll call it originalFvPatchField.
- Copy the directory contents to anywhere (say run/myCode).
- Rename all the copied files to a new name (say customFvPatchField).
- Search & replace all text in all the new files old name for new name (originalFvPatchField replaced with customFvPatchField)
- Modify the code to suit your needs.
- Create the directory structure: myCode/Make, and create files and options in it.
- Put the relevant info into files:
- Search for <originalFvPatchField</tt> in finiteVolume/Make/files.
- Copy the relevant entry (entries) into your myCode/Make/files
- Rename the entries as necessary - rename it with your customFvPatchField naming (if there's an s on the end, keep it there).
- 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
- 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.
- $wmake libso
- Add whatever new dictionary entries are needed to your initial conditions files, such as 0/U and 0/P files.
- Add libs ( "libcustomFvPatchField.so" "libOpenFOAM.so" ) to controlDict
- It should run now.
With reference to [1]. Marupio 17:00, 26 February 2010 (UTC)