|
[Sponsors] |
Compile boundary condition as a new dynamic library |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 23, 2010, 14:06 |
Compile boundary condition as a new dynamic library
|
#1 |
New Member
Mohan
Join Date: Jan 2010
Posts: 4
Rep Power: 16 |
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 |
|
March 22, 2013, 10:42 |
|
#2 |
Senior Member
starter
Join Date: Sep 2012
Posts: 125
Rep Power: 16 |
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 |
|
March 24, 2013, 15:01 |
|
#3 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings sihaqqi,
They are available here: https://github.com/ogoe/OpenFOAM-1.6...bolicVelocity/ Direct links:
Bruno
__________________
|
|
March 24, 2013, 19:26 |
|
#4 |
Senior Member
starter
Join Date: Sep 2012
Posts: 125
Rep Power: 16 |
Dear Bruno
Many thanks for this. Thanks & Regards Sihaqqi |
|
March 25, 2013, 03:26 |
|
#5 |
Senior Member
starter
Join Date: Sep 2012
Posts: 125
Rep Power: 16 |
Bruno
Can you please advise where I can get Make files and options from for this thing Regards |
|
March 25, 2013, 16:57 |
|
#6 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Quote:
__________________
|
||
July 25, 2013, 07:22 |
|
#7 |
Member
nadine moussa
Join Date: Mar 2012
Posts: 30
Rep Power: 14 |
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 |
|
July 25, 2013, 10:48 |
|
#8 |
Member
nadine moussa
Join Date: Mar 2012
Posts: 30
Rep Power: 14 |
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, |
|
July 25, 2013, 12:17 |
|
#9 | |
Senior Member
|
Quote:
|
||
August 18, 2013, 13:21 |
|
#10 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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
Code:
blockMesh simpleFoam Bruno
__________________
Last edited by wyldckat; January 2, 2014 at 19:18. Reason: see |
|
January 2, 2014, 11:29 |
|
#11 |
Member
Tony
Join Date: Nov 2013
Posts: 35
Rep Power: 13 |
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 |
|
January 2, 2014, 19:22 |
|
#12 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings Tony,
Quote:
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
__________________
|
||
January 2, 2014, 20:02 |
|
#13 |
Member
Tony
Join Date: Nov 2013
Posts: 35
Rep Power: 13 |
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 |
|
January 2, 2014, 20:40 |
|
#14 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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))); Best regards, Bruno
__________________
|
|
January 3, 2014, 09:34 |
|
#15 |
Member
Tony
Join Date: Nov 2013
Posts: 35
Rep Power: 13 |
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 |
|
August 6, 2015, 07:20 |
|
#16 | |
New Member
vipin
Join Date: Jun 2015
Posts: 14
Rep Power: 11 |
Quote:
I followed the above instruction to get parabolic inlet velocity and also i got same profile like i.e. variation along one direction only did you get it corrected....if yes, please help me to correct it. regard vipin |
||
August 23, 2016, 09:46 |
|
#17 |
Member
Rudolf Hellmuth
Join Date: Sep 2012
Location: Dundee, Scotland
Posts: 40
Rep Power: 14 |
Paraboloid velocity profile on a circular patch:
Code:
inlet { type codedFixedValue; value uniform (0 0 0); redirectType Poiseuille; code #{ const fvPatch& boundaryPatch = patch(); const vectorField& Cf = boundaryPatch.Cf(); vectorField& U = *this; //gfunc calculates the function on decomposed patches for parallel runs. scalar patchArea = gSum(boundaryPatch.magSf()); //Info << "Patch area: " << patchArea << endl; vector ctr = gSum(boundaryPatch.magSf()*Cf)/patchArea; //Info << "Patch center: " << ctr << endl; scalar R = sqrt(patchArea/constant::mathematical::pi); //Info << "Patch radius: " << R << endl; vector n = gSum(boundaryPatch.magSf()*boundaryPatch.nf())/patchArea; //Info << "Patch mean normal: " << normal << endl; scalar Umean = 1.0; forAll(Cf, i) { U[i] = -n*2.0*Umean*(1.0 - sqr(mag(Cf[i] - ctr)/R)); } // operator==(vector(1.0, 0.0, 0.0)); #}; } I hope it can help you, Rudolf |
|
November 18, 2016, 08:40 |
Paraboloid velocity profile on a square channel ?
|
#18 | |
Senior Member
vidyadhar
Join Date: Jul 2016
Posts: 138
Rep Power: 10 |
Quote:
Hello Rudolf, I have seen your post on paraboloid profile for a circular patch. I would like to implement paraboloid profile for a square patch, since, in my case, I have to give fully developed profile at the inlet to a square channel. Can you help me in implementing the same. Thanks & Regards, vidyadhar |
||
November 18, 2016, 09:51 |
|
#19 | |
Member
Rudolf Hellmuth
Join Date: Sep 2012
Location: Dundee, Scotland
Posts: 40
Rep Power: 14 |
Quote:
Try this: Code:
// patch area scalar A = gSum(patch().magSf()); // patch normal vector is the weighted mean of patch face normal // vectors vector np = gSum(patch().magSf()*patch().nf())/A; // patch centre is the weighted mean of patch face centres vector O = gSum(patch().magSf()*patch().Cf())/A; // local position of cell centres (referenced on the patch centre) scalarField pos = mag(patch().Cf() - O); // patch lengths on x and y directions scalar X = 1.0; scalar Y = 1.4; fixedValueFvPatchVectorField::operator== ( -np*vmean*2.0 *(1.0 - sqr(pos.x()/X))*(1.0 - sqr(pos.y()/Y)) ); Good luck! Rudolf |
||
November 18, 2016, 10:07 |
|
#20 |
Senior Member
vidyadhar
Join Date: Jul 2016
Posts: 138
Rep Power: 10 |
Hello Rudolf,
Thank you for the immediate help. I will test the code and get back to you with the outcomes. Thanks & Regards, vidyadhar |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
compile errors of boundary condition "expDirectionMixed" | liying02ts | OpenFOAM Bugs | 2 | February 1, 2010 21:11 |
how to set up a wall boundary condition according to calculated wall shear stress? | gameoverli | OpenFOAM Pre-Processing | 1 | May 21, 2009 09:28 |
How to define a dynamic Boundary Condition? | abrahamgx | CFX | 2 | March 10, 2009 00:03 |
How to define a dynamic Boundary Condition? (New) | abrahamgx | CFX | 2 | March 9, 2009 08:43 |
Dynamic Temperature Boundary Condition | Kshitij | FLUENT | 0 | October 12, 2005 14:40 |