|
[Sponsors] |
August 5, 2011, 15:28 |
|
#41 |
Member
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 16 |
Hi. I don't know if it's because I'm using openFoam 2.0.0, but I get this error after trying to run the code
Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam200/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #1 Foam::sigSegv::sigHandler(int) in "/opt/openfoam200/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #2 in "/lib/libc.so.6" #3 std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) in "/usr/lib/libstdc++.so.6" #4 in "/home/alexander/OpenFOAM/alexander-2.0.0/platforms/linux64GccDPOpt/bin/inletBC" #5 __libc_start_main in "/lib/libc.so.6" #6 in "/home/alexander/OpenFOAM/alexander-2.0.0/platforms/linux64GccDPOpt/bin/inletBC" Segmentation fault |
|
August 8, 2011, 06:32 |
|
#42 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
|
||
August 8, 2011, 08:33 |
|
#43 | |
Member
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 16 |
Quote:
Code: Code:
#include "fvCFD.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { argList::validArgs.append("patchName"); # include "setRootCase.H" word patchName(args.args()[3]); # include "createTime.H" # include "createMesh.H" # include "createFields.H" # include "initContinuityErrs.H" Info<< "This utility initializes gamma values for boundary patches based on" <<endl; Info<< "a geometric limit. Default is set to: z>=0 ==>gamma=0, z<o ==>gamma=1." <<endl; Info<< "These settings are presently only changeable by modifying the source code." <<endl; Info<< "Source code to be found in: OF/user/applications." <<endl; Info<< "Change code (.C file) according your needs and in that directory run wmake." <<endl; Info<< "\nStarting time loop\n" << endl; // Get index of patch label inletPatchID = mesh.boundaryMesh().findPatchID(patchName); // Get reference to boundary value const fvPatchVectorField& centre = mesh.C().boundaryField()[inletPatchID]; //Uncomment the line for your case: U for velocity cases, gamma for gamma cases fvPatchVectorField& Inlet = U.boundaryField()[inletPatchID]; //fvPatchScalarField& targetPatch = gamma.boundaryField()[inletPatchID]; // loop over all hub faces forAll(Inlet, faceI) { // get coordinate for face centre const vector& c = centre[faceI]; // c[0] is X coordinate, c[1] is Y coordinate, c[2] is Z coordinate // Apply boundary condition based in one coordinate (X, Y, or Z). if (c[2] < 0.3) //if true: below watersurface { //targetPatch[faceI] = scalar (1); Inlet[faceI] = vector (1, 0, 0); } //if false: at or above watersurface else { //targetPatch[faceI] = scalar (0); Inlet[faceI] = vector (10 ,0 ,0); } } // Force the write //gamma.write(); U.write(); Info<< "\n ExecutionTime = " << runTime.elapsedCpuTime() << " s\n" << endl; Info<< "End" << endl; return(0); } Code:
Making dependency list for source file inletBC.C SOURCE=inletBC.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/finiteVolume/lnInclude -I/opt/openfoam200/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/inletBC.o /opt/openfoam200/src/finiteVolume/lnInclude/initContinuityErrs.H: In function int main(int, char**): /opt/openfoam200/src/finiteVolume/lnInclude/initContinuityErrs.H:37: warning: unused variable cumulativeContErr g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/finiteVolume/lnInclude -I/opt/openfoam200/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed Make/linux64GccDPOpt/inletBC.o -L/opt/openfoam200/platforms/linux64GccDPOpt/lib \ -lfiniteVolume -lmeshTools -lOpenFOAM -ldl -lm -o /home/alexander/OpenFOAM/alexander-2.0.0/platforms/linux64GccDPOpt/bin/inletBC |
||
August 8, 2011, 10:44 |
|
#44 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
If I'm wrong then I can't help you. If I'm right you'll either have to recompile OF or find out which compiler was actually used for your distro Good luck |
||
August 8, 2011, 10:56 |
|
#45 |
Member
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 16 |
I copied the icoFoam source and added a scalar transport model for Temperature following an online tutorial and it ran perfectly. I will pursue a new direction thanks.
|
|
August 8, 2011, 11:39 |
|
#46 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
word patchName(args.args()[3]); that is pre 1.5-convention. Use 0 instead of 3. |
||
August 8, 2011, 12:38 |
|
#47 |
Member
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 16 |
Ahh. Thank you. I fixed this since I am running OF 2.0.0. It worked, but then I get the same error further into the code...
Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Reading field U This utility initializes gamma values for boundary patches based on a geometric limit. Default is set to: z>=0 ==>gamma=0, z<o ==>gamma=1. These settings are presently only changeable by modifying the source code. Source code to be found in: OF/user/applications. Change code (.C file) according your needs and in that directory run wmake. Starting time loop #0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam200/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #1 Foam::sigSegv::sigHandler(int) in "/opt/openfoam200/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #2 in "/lib/libc.so.6" #3 in "/home/alexander/OpenFOAM/alexander-2.0.0/platforms/linux64GccDPOpt/bin/inletBC" #4 __libc_start_main in "/lib/libc.so.6" #5 in "/home/alexander/OpenFOAM/alexander-2.0.0/platforms/linux64GccDPOpt/bin/inletBC" Segmentation fault alexander@alexander-G50VT:~/OpenFOAM/alexander-2.0.0/run/testCase$ |
|
August 8, 2011, 15:08 |
|
#48 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
If that is too much action for you sprinkle the code with "Info << "-statements and see how far it gets (my personal guess is that you specified a nno-existing patch, because the code never checks whether the patch is really there) |
||
August 8, 2011, 15:26 |
|
#49 |
Member
Alex
Join Date: Jun 2010
Location: Planet Earth
Posts: 43
Rep Power: 16 |
Thank you for the Info<< sprinkler idea. I did it and realized that my loop wasn't accepting the parameters in forAll(). Looking further into the problem I noticed that the patchID was -1 for all patches meaning it wasn't retrieving the patch correctly. I just fed the program the value 4 for my inlet and it works fine now.
Thanks again! |
|
November 5, 2012, 06:56 |
|
#50 | |
New Member
Qiong
Join Date: Oct 2012
Posts: 3
Rep Power: 14 |
Quote:
hi Markc I am a new hand in OpenFoam, in my case I want to set the blasius profile at inlet, but I have no ideal about these. I try to use your file in my case, but it doesnŽt work, because the youdidnŽt set the type name of the new boundary, if I use setboundarygamma in 0file, It couldnŽt be recognize. please forgive me if my question is stupid. Thanks in advance. now I know it, thank you very much. I mix the solver and the new boundary condition. thank you very much. Taylor Last edited by Taylor; November 6, 2012 at 08:49. |
||
November 5, 2012, 07:01 |
|
#51 |
New Member
Qiong
Join Date: Oct 2012
Posts: 3
Rep Power: 14 |
hi,
I am sorry if I disturb you. do you solve the blasuis boundary condition in OpenFoam? now I am crazy for this problem. Taylor |
|
November 6, 2012, 08:47 |
|
#52 | |
New Member
Qiong
Join Date: Oct 2012
Posts: 3
Rep Power: 14 |
Quote:
thank you very much, I use it and works fine, really thank you |
||
September 13, 2013, 13:20 |
|
#53 |
Senior Member
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17 |
Dear everybody,
In this forum you explain how to implement a non-uniform value as boundary condition. For instance, U=whatever. I need to implement a non uniform temperature gradient as boundary condition. How can I do it? Regards |
|
September 16, 2013, 16:20 |
|
#54 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
From me you're going to hear "groovyBC". Others will tell you "coded". Second is with C++-programming, first without
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
|
September 19, 2013, 06:45 |
|
#55 |
Member
Zacarias Carral
Join Date: Sep 2012
Posts: 35
Rep Power: 14 |
Dear Bernard,
I agree that "groovyBC" is an option but perhaps there is a way to program a non uniform temperature gradient. Does anybody know how to program it? |
|
February 12, 2014, 07:04 |
|
#56 |
Senior Member
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17 |
Dear everybody,
I am using groovyBC to set the boundary condition gradT=2*x I have written this code: top { type groovyBC; gradientExpression "gradT"; fractionExpression "0"; variables "gradT=2*mesh.C().component(vector::X);"; timelines ( ); } And I have the following error: --> FOAM FATAL ERROR: Parser Error at "1.3-6" :"field mesh not existing or of wrong type" "2*mesh.C().component(vector::X)" " ^^^^ " From function parsingValue in file lnInclude/CommonValueExpressionDriverI.H at line 802. FOAM exiting How can I call x coordinate using groovyBC? |
|
February 13, 2014, 08:08 |
|
#57 |
Senior Member
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17 |
Problem solved. This is the correct code:
top { type groovyBC; gradientExpression "gradT"; fractionExpression "0"; variables "gradT=2*pos().x;"; timelines ( ); } |
|
October 21, 2014, 14:28 |
Boundary on the variable boundaryField
|
#58 |
New Member
---
Join Date: Jan 2013
Posts: 17
Rep Power: 13 |
Hi you all,
I think that your proposal solution for a variable boundary condition (I understand in time) is to modify the solver. I would like to have a variable boundary condition depending on the position on the boundary itself. My approach is to modify the (for example) U values list and on the boundary set the value of each element on a list. The thing to know is if this is possible, and if it is how I do that? which is the element order? example: Inlet { list of values on each boundary element } Thanks in advance |
|
October 21, 2014, 15:37 |
|
#59 |
Senior Member
Yuehan
Join Date: Nov 2012
Posts: 142
Rep Power: 14 |
i dont think doing this way is a wise idea, it is doable though.
|
|
October 22, 2014, 15:52 |
|
#60 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Possible solutions are the coded-BoundaryCondition that comes with OpenFOAM (there you've got to program in C++) or the groovyBC that comes with swak4Foam (a bit easier to use I like to think)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Specifying nonuniform initial condition | msyaml | OpenFOAM Running, Solving & CFD | 65 | April 25, 2016 05:23 |
Nonuniform initial condition using cellSetDict | rinao | OpenFOAM Running, Solving & CFD | 6 | January 9, 2013 01:42 |
Nonuniform boundary syntax | juho | OpenFOAM Running, Solving & CFD | 1 | December 11, 2008 17:13 |
Set nonuniform boundary values | nikwin | OpenFOAM Running, Solving & CFD | 1 | November 30, 2008 08:12 |
Nonuniform gradient boundary condition | ankgupta8um | OpenFOAM Running, Solving & CFD | 1 | March 14, 2006 02:34 |