CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (http://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   Compile boundary condition as a new dynamic library (http://www.cfd-online.com/Forums/openfoam-meshing/76354-compile-boundary-condition-new-dynamic-library.html)

mohanphy May 23, 2010 13:06

Compile boundary condition as a new dynamic library
 
Dear All,

I am trying to Compile boundary condition as a new dynamic library. I following this tutorials: http://openfoamwiki.net/index.php/Tu....28OF-1.4.1.29

I have done the following steps :

openfoam@Mohan:~/OpenFOAM/openfoam-1.6/src/finiteVolume/fields/fvPatchFields/derived$ svn checkout http://openfoam-extend.svn.sourcefor...bolicVelocity/
A parabolicVelocity/parabolicVelocityFvPatchVectorField.C
A parabolicVelocity/parabolicVelocityFvPatchVectorField.H
U parabolicVelocity
Checked out revision 1738.

I have downloaded it :

openfoam@Mohan:~/OpenFOAM/openfoam-1.6/src/finiteVolume/fields/fvPatchFields/derived$ cd parabolicVelocity/


openfoam@Mohan:~/OpenFOAM/openfoam-1.6/src/finiteVolume/fields/fvPatchFields/derived/parabolicVelocity$ ls
parabolicVelocityFvPatchVectorField.C parabolicVelocityFvPatchVectorField.H

openfoam@Mohan:~/OpenFOAM/openfoam-1.6/src/finiteVolume/fields/fvPatchFields/derived/parabolicVelocity$ mkdir Make

openfoam@Mohan:~/OpenFOAM/openfoam-1.6/src/finiteVolume/fields/fvPatchFields/derived/parabolicVelocity$ ls
Make parabolicVelocityFvPatchVectorField.H
parabolicVelocityFvPatchVectorField.C

openfoam@Mohan:~/OpenFOAM/openfoam-1.6/src/finiteVolume/fields/fvPatchFields/derived/parabolicVelocity$ cd Make/

openfoam@Mohan:~/OpenFOAM/openfoam-1.6/src/finiteVolume/fields/fvPatchFields/derived/parabolicVelocity/Make$ vim files

openfoam@Mohan:~/OpenFOAM/openfoam-1.6/src/finiteVolume/fields/fvPatchFields/derived/parabolicVelocity/Make$ vim options

wmake will show the following message :

openfoam@Mohan:~/OpenFOAM/openfoam-1.6/src/finiteVolume/fields/fvPatchFields/derived/parabolicVelocity/Make$ wmake libso

wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file parabolicVelocityFvPatchVectorField.C
SOURCE=parabolicVelocityFvPatchVectorField.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/openfoam/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/openfoam/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/openfoam/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/parabolicVelocityFvPatchVectorField.o
'/home/openfoam/OpenFOAM/openfoam-1.6/lib/linuxGccDPOpt/libmyBCs.so' is up to date.
openfoam@Mohan:~/OpenFOAM/openfoam-1.6/src/finiteVolume/fields/fvPatchFields/derived/parabolicVelocity$ ls
lnInclude parabolicVelocityFvPatchVectorField.C parabolicVelocityFvPatchVectorField.H
Make parabolicVelocityFvPatchVectorField.dep

It has successfully creates "libmyBCs.so" in /home/openfoam/OpenFOAM/openfoam-1.6/lib/linuxGccDPOpt/libmyBCs.so

The tutorials saying that I need to add the following line in system/controlDict file: libs ("libmyBCs.so");

The problem is I don't know where is the system/controlDict file (absolute path). some one please explain me to find system/controlDict file.

Thanks & Rg
Mohan L

sihaqqi March 22, 2013 10:42

Mohan

I am after this parabolic velocity patch .C and .H. I use openFoam 2.1. the link you have given does not have these files. Can you please post these. The need is very urgent because first I have to understand them as a beginner in OpenFoam and then I shall have to convert in 1/7th power law.

I shall be grateful

regards

wyldckat March 24, 2013 15:01

Greetings sihaqqi,

They are available here: https://github.com/ogoe/OpenFOAM-1.6...bolicVelocity/

Direct links:
Best regards,
Bruno

sihaqqi March 24, 2013 19:26

Dear Bruno

Many thanks for this.
Thanks & Regards

Sihaqqi

sihaqqi March 25, 2013 03:26

Bruno

Can you please advise where I can get Make files and options from for this thing

Regards

wyldckat March 25, 2013 16:57

Quote:

Originally Posted by sihaqqi (Post 416125)
Can you please advise where I can get Make files and options from for this thing

It's explained in the first link on this thread: http://openfoamwiki.net/index.php/Tu....28OF-1.4.1.29

nadine July 25, 2013 06:22

Hello,

I don't know if I am really unlucky, but none of the links refering to parapolicVelocity are working!!!

Can someone help me and post a valid link so I can add this condition and compile it?

Thanks a lot,
Nadine

nadine July 25, 2013 09:48

Re-Hello,

Finally i found source files using this link:

https://github.com/Unofficial-Extend...eld.H.svn-base

I saved both the .C and .H in a file outside openfoam and followed the instructions givin in wiki to add my library and linked it dynamically by adding libs ("libmyBCs.so"); in my controlDict.

Than I ran the simulation but I got an error message, indicating that there is no such a boundary condition and giving me choices between the classical boundaries found in openfoam!!!

what did I do wrong and how can I fix it!
Help!

Waiting for your answers, even if it s summer time :)

Nadine,

alexeym July 25, 2013 11:17

Quote:

Originally Posted by nadine (Post 441947)
Re-Hello,

Finally i found source files using this link:

https://github.com/Unofficial-Extend...eld.H.svn-base

I saved both the .C and .H in a file outside openfoam and followed the instructions givin in wiki to add my library and linked it dynamically by adding libs ("libmyBCs.so"); in my controlDict.

Than I ran the simulation but I got an error message, indicating that there is no such a boundary condition and giving me choices between the classical boundaries found in openfoam!!!

what did I do wrong and how can I fix it!
Help!

Waiting for your answers, even if it s summer time :)

Nadine,

Can you, please, post your case files?

wyldckat August 18, 2013 12:21

Greetings to all!

@Nadine: I don't know if you've fixed the problem you reported about, but here is summary and updated building instructions, based on 1.6-ext and http://openfoamwiki.net/index.php/Tu....28OF-1.4.1.29 - edit: and yes it should work for almost any version of OpenFOAM!

Run these commands:
Code:

mkdir -p $FOAM_RUN
cd $FOAM_RUN/..
mkdir parabolicVelocity
cd parabolicVelocity

wget "http://sourceforge.net/p/openfoam-extend/OpenFOAM-1.6-ext/ci/master/tree/src/finiteVolume/fields/fvPatchFields/derived/parabolicVelocity/parabolicVelocityFvPatchVectorField.C?format=raw" -O parabolicVelocityFvPatchVectorField.C
wget "http://sourceforge.net/p/openfoam-extend/OpenFOAM-1.6-ext/ci/master/tree/src/finiteVolume/fields/fvPatchFields/derived/parabolicVelocity/parabolicVelocityFvPatchVectorField.H?format=raw" -O parabolicVelocityFvPatchVectorField.H

mkdir Make
echo 'parabolicVelocityFvPatchVectorField.C'  > Make/files
echo 'LIB = $(FOAM_USER_LIBBIN)/libmyBCs'  >> Make/files

echo 'EXE_INC =  -I$(LIB_SRC)/finiteVolume/lnInclude'  > Make/options
echo 'EXE_LIBS = '  >> Make/options

wmake libso

The I used the tutorial "incompressible/simpleFoam/pitzDaily" as basis and edited the files:
  • "system/controlDict" - Added the line:
    Code:

    libs ("libmyBCs.so");
  • "0/U" - changed the BC "inlet" to this:
    Code:

        inlet
        {
            type            parabolicVelocity;
            n              (1 0 0);
            y              (0 1 0);
            maxValue        1;
            value          (0 0 0); // Dummy for paraFoam, which will NOT show a correct profile at time 0.
        }

Then to run the case, I simply run:
Code:

blockMesh
simpleFoam

Best regards,
Bruno

wzx1989221 January 2, 2014 10:29

Dear Bruno,

I find your post very useful. Just want to know if it is possible to do the parabolic inlet in that way using OF 2.1? Or is it only applicable in OF 1.6-ext version?

Looking forward to your reply. Thank you very much.

Best regards,
Tony

wyldckat January 2, 2014 18:22

Greetings Tony,

Quote:

Originally Posted by wzx1989221 (Post 468380)
I find your post very useful. Just want to know if it is possible to do the parabolic inlet in that way using OF 2.1? Or is it only applicable in OF 1.6-ext version?

Good question! I've updated post #10 to add a note about that.

I forgot to mention back then, but it's sort-of implied that these instructions are for any OpenFOAM version, but rely on the source code of OpenFOAM-1.6-ext. Actually, now it's foam-extend 3.0, but this boundary condition is pretty much the same ;).

Best regards,
Bruno

wzx1989221 January 2, 2014 19:02

Dear Bruno,

Thank you very much for the reply. Actually I have checked out that it works well with OF 2.1.

One thing is that I tried to use it for 3D pipe flow, but the profile turned out to be varying in only one direction like in channel. Any suggestions on making it work for pipe?

Best regards,
Tony

wyldckat January 2, 2014 19:40

Hi Tony,

Mmm... what you are looking for is a paraboloid: http://en.wikipedia.org/wiki/Paraboloid
But this boundary condition from 1.6-ext is only "parabolic" :)

The idea is that you need to modify the source code of the method "updateCoeffs()". Essentially, you need to modify these two lines of code:
Code:

// Calculate local 1-D coordinate for the parabolic profile
scalarField coord = 2*((c - ctr) & y_)/((bb.max() - bb.min()) & y_);

vectorField::operator=(n_*maxValue_*(1.0 - sqr(coord)));

Right now I don't have much time to look into this. But let me know if you don't manage to solve this by yourself. And if you are able to, do share the solution!

Best regards,
Bruno

wzx1989221 January 3, 2014 08:34

Hi Bruno,

Many thanks for the tips. I will look into that to see if I can resolve it. I will share the solution if I make it.

Regards,
Tony


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