CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to compile a BC (https://www.cfd-online.com/Forums/openfoam-programming-development/128854-how-compile-bc.html)

xxxx January 22, 2014 16:07

How to compile a BC
 
Hello,

I'm trying to learn how to compile a BC within OF 2.1.1 . I tried to follow the instructions by openfoamwiki (http://openfoamwiki.net/index.php/Ho...dary_condition) but I'm not able to make it work.
I copied all the files in opt/openfoam211/..../finiteVolume/fvPatchFields/..../fixedValue/ in a new directory. I renamed all the files adding the "my" prefix. Within all the files I replaced all the fixedValueFvPatchField occurrences with myfixedValueFvPatchField as indicated by the guide.
I created the Make dir with Make/files file:
myfixedValueFvPatchField.C

LIB = $FOAM_USER_LIBBIN/libmyfixedValueFvPatch

and Make/options file:

EXE_INC =\
-I$(LIB_SRC)/finiteVolume/lnInclude

LIB_LIBS =\
-lfiniteVolume

1st question: In openfoamwiki they say to :
  1. Search for originalFvPatchField in finiteVolume/Make/files.
  2. Copy the relevant entry (entries) into your myCode/Make/files
This is not clear to me and if I do so I get errors. That's why I put "myfixedValueFvPatchField.C" in the files file.

2nd question:
When I try wmake libso I get errors because "in myfixedValueFvPatch.C.....myfixedValueFvPatch<type > is not a type name... " (or something alike)at line 36 (you can refer to the fixedValue source code, since I didn't change it).

Can you help me with this problem please?
I will be grateful

louisgag January 23, 2014 04:55

Hint: Here's my "files" file which works,
Code:

fvPatchFields = fields/fvPatchFields
derivedFvPatchFields = $(fvPatchFields)/derived
$(derivedFvPatchFields)/myMovingWallSlip/myMovingWallSlipFvPatchVectorField.C
LIB = $(FOAM_USER_LIBBIN)/libmyFiniteVolume

and here's my "options" file,
Code:

EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \

EXEC_LIBS =

consider also that my BC is using the directory structure USR-DIR/fields/fvPatchFields/... so that $(derivedFvPatchFields)/myMovingWallSlip/myMovingWallSlipFvPatchVectorField.C points to an actual file...

-Louis

xxxx January 24, 2014 16:28

Thank you louisgag.

Actually I could compile the BC and solve the problem by myself.
The point is that I used as a basis for myBC the basic/fixedValue BC.
Starting from a derived BC it was simple to understand what to do and make it work.
However I still have a question: consider the src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H file.
At lines 50 and following, you can find:
template<class Type>
class fixedValueFvPatchField
:
public fvPatchField<Type>

Is it because fixedValueFvPatchField is a general type and becames a specific class only when you specify if it either refers to a scalar or a vectorial field?

louisgag January 24, 2014 18:42

Quote:

Originally Posted by xxxx (Post 471674)
Is it because fixedValueFvPatchField is a general type and becames a specific class only when you specify if it either refers to a scalar or a vectorial field?

Yes, I'm pretty sure it is as such. It will be scalar for pressure and vector for veolcity...


All times are GMT -4. The time now is 15:50.