CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Creating new boundary conditions from existing ones (https://www.cfd-online.com/Forums/openfoam-solving/72621-creating-new-boundary-conditions-existing-ones.html)

rassilon February 12, 2010 02:43

Creating new boundary conditions from existing ones
 
I need to create a new boundary condition, so have been experimenting with editing and compiling an existing condition. At the moment I am just trying to change the name of a condition - nothing more - as a proof of concept of being able to edit and compile.

I have been using the following method to make a statically linked solver and boundary condition 'package'

1. Make a copy of my case folder

2. Copy my solver (interFoam) into my case folder ($OpenFOAM/apps/case/interFoam)

3. Copy the contents of the boundary condition I am trying to rename into the solver folder (timeVaryingFixedUniformFixedValue)

4. Rename the solver folder (myInterFoam)

5. In the myInterFoam folder, rename the following files:
timeVaryingFixedUniformFixedValueFvPatchField.C -> myTimeVaryingFixedUniformFixedValueFvPatchField.C
timeVaryingFixedUniformFixedValueFvPatchField.H -> myTimeVaryingFixedUniformFixedValueFvPatchField.H
timeVaryingFixedUniformFixedValueFvPatchFields.C -> myTimeVaryingFixedUniformFixedValueFvPatchFields.C
timeVaryingFixedUniformFixedValueFvPatchFields.H -> myTimeVaryingFixedUniformFixedValueFvPatchFields.H
timeVaryingFixedUniformFixedValueFvPatchFieldsFwd. H -> myTimeVaryingFixedUniformFixedValueFvPatchFieldsFw d.H

6. Edit the files using a text editor, replacing all instances of timeVaryingUniformFixedValue with myTimeVaryingUniformFixedValue

7. Add the following to the second line of the Make/files file:
myTimeVaryingFixedUniformFixedValueFvPatchField.C
timeVaryingFixedUniformFixedValueFvPatchFields.C

8. Modify the final line so that it reads:
EXE = $(FOAM_USER_APPBIN)/myInterFoam

9. Add the following to the header of the interFoam.C file:
myTimeVaryingFixedUniformFixedValueFvPatchField.H
myTimeVaryingFixedUniformFixedValueFvPatchFields.H

10. Compile using:
wclean
rm -rf Make/linux*
wmake

I have got this method to work for a simple boundary condition (totalPressure), but when I attempt to compile this more complex boundary condition, I receive numerous instances of the following error:

Quote:

myTimeVaryingUniformFixedValueFvPatchField.C:38: error: redefinition of ‘Foam::myTimeVaryingUniformFixedValueFvPatchField< Type>::myTimeVaryingUniformFixedValueFvPatchField( const Foam::fvPatch&, const Foam: DimensionedField<Type, Foam::volMesh>&)’
myTimeVaryingUniformFixedValueFvPatchField.C:38: error: ‘Foam::myTimeVaryingUniformFixedValueFvPatchField< Type>::myTimeVaryingUniformFixedValueFvPatchField( const Foam::fvPatch&, const Foam: DimensionedField<Type, Foam::volMesh>&)’ previously declared here
What am I doing wrong? Is there something that I am missing when I am editing my boundary condition files by hand prior to compiling?

Any pointers would be greatly appreciated!


R


All times are GMT -4. The time now is 01:39.