|
[Sponsors] |
August 24, 2011, 18:18 |
codedFixedValue boundary condition
|
#1 |
Member
Neilson Whit
Join Date: Aug 2011
Posts: 74
Rep Power: 15 |
Dear All;
I am trying to define a moving wall boundary condition, X component velocity will change with a function of sin(). the block below does not take calculated ux value. How can I get calculated value as a boundary condition like (ux 0 0) ?. movingWall_1 { type codedFixedValue; value uniform (0 0 0); redirectType rampedFixedValue; code #{ double ux=(0.5*sin(3.14*this->db().time().value())/2); #}; } best regards. |
|
August 24, 2011, 22:29 |
|
#2 |
New Member
Aidan
Join Date: Apr 2010
Posts: 18
Rep Power: 16 |
I think it might be something like
Code:
movingWall_1 { type codedFixedValue; value uniform (0 0 0); redirectType rampedFixedValue; code #{ vector ((0.5*sin(3.14*this->db().time().value())/2), 0, 0); #}; } |
|
August 25, 2011, 02:16 |
|
#3 |
Member
Lars Kiewidt
Join Date: Sep 2009
Location: Germany
Posts: 54
Rep Power: 17 |
That looks like something oscillating! Do you know the oscillatingFixedValue BC? It comes naturally with OpenFOAM. Check out the article in the Wiki.
http://openfoamwiki.net/index.php/Ma...tingFixedValue |
|
August 25, 2011, 04:14 |
|
#4 |
Member
Neilson Whit
Join Date: Aug 2011
Posts: 74
Rep Power: 15 |
flowman: thank you for the reply but it does not work.
LarsPT : thank you too, yes this is oscilating. However, I also need different step or oscilating functions, I should imlement in this way. any help aprreciated. thank you. |
|
August 25, 2011, 08:13 |
|
#5 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Code:
(*this)==vector(0.5*sin(3.14*this->db().time().value())/2,0,0); I personally still prefer to write such simple boundary conditions as Code:
type groovyBC; valueExpression "vector(0.5*sin(3.1414*time())/2,0,0)"; Bernhard |
||
August 25, 2011, 09:40 |
|
#6 |
Member
Neilson Whit
Join Date: Aug 2011
Posts: 74
Rep Power: 15 |
gschaider thank you! it works.
|
|
October 9, 2011, 17:51 |
|
#7 |
New Member
Anders
Join Date: Nov 2010
Posts: 10
Rep Power: 16 |
Dear all,
I can not get this boundary condition to work (see below), has anyone else gotten this error and have a solution? Many thanks, Anders Create time Create mesh for time = 0 Selecting dynamicFvMesh dynamicMotionSolverFvMesh Selecting motion solver: displacementLaplacian [0] [2] [1] [1] [1] --> FOAM FATAL IO ERROR: [1] Unknown patchField type codedFixedValue for patch type wall Valid patchField types are : 25 ( angularOscillatingDisplacement angularOscillatingVelocity calculated cyclic cyclicSlip empty fixedNormalSlip fixedValue mixed nonuniformTransformCyclic oscillatingDisplacement oscillatingVelocity processor processorCyclic sixDoFRigidBodyDisplacement slip surfaceDisplacement surfaceSlipDisplacement symmetryPlane timeVaryingUniformFixedValue uncoupledSixDoFRigidBodyDisplacement uniformFixedValue value wedge zeroGradient ) [1] [3] [0] -------------------------------------------------------------------------- |
|
October 10, 2011, 05:30 |
|
#8 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
|
||
October 10, 2011, 06:39 |
|
#9 |
New Member
Anders
Join Date: Nov 2010
Posts: 10
Rep Power: 16 |
Hello Bernhard,
Yes it is OF 2.0, and I have allowed the use of dynamic code in the "global" controlDict. |
|
October 11, 2011, 05:55 |
|
#10 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
It is compiled into finiteVolume, so it should be in that list. Maybe the problem is that your patch is a wall (not a patch). But I'm not an expert on the codedBC (only used it once out of curiosity)
|
|
October 11, 2011, 16:37 |
|
#11 |
New Member
Anders
Join Date: Nov 2010
Posts: 10
Rep Power: 16 |
Ok, I tried codedFixedValue on the inlet (which is a patch and not a wall) in the wingMotion tutorial and it works! But if it does not work for walls, why is there an example of a codedFixedValue boundary condition for a movingWall in the C++ documentation of the codedFixedValue?
Still speaking of the wingMotion tutorial; if I want the wing (patch type wall) to move according to user supplied code, I have to find some other way than the codedFixedValue BC? I am confused :S Inlet BC (U file): inlet { type codedFixedValue; value $internalField; redirectType ramp; code #{ (*this)==vector(min(100, 0.1*this->db().time().value()),0,0); #}; } Output: /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.0.1 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.0.1-51f1de99a4bc Exec : pimpleDyMFoam Date : Oct 11 2011 Time : 20:56:33 Host : anlj-laptop PID : 3089 Case : /home/anlj/OpenFOAM/anlj-2.0.1/run/tutorials/wingMotion/wingMotion2D_pimpleDyMFoam nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Selecting dynamicFvMesh dynamicMotionSolverFvMesh Selecting motion solver: displacementLaplacian Selecting motion diffusion: inverseDistance Reading field p Reading field U Using dynamicCode for patch inlet on field U at line 12593 in "/home/anlj/OpenFOAM/anlj-2.0.1/run/tutorials/wingMotion/wingMotion2D_pimpleDyMFoam/0/U::boundaryField::inlet" Reading/calculating face flux field phi Selecting incompressible transport model Newtonian Selecting turbulence model type RASModel Selecting RAS turbulence model kOmegaSST kOmegaSSTCoeffs { alphaK1 0.85034; alphaK2 1; alphaOmega1 0.5; alphaOmega2 0.85616; gamma1 0.5532; gamma2 0.4403; beta1 0.075; beta2 0.0828; betaStar 0.09; a1 0.31; c1 10; } Reading field rAU if present PIMPLE: no residual control data found. Calculations will employ 2 corrector loops Starting time loop .... Best regards, Anders |
|
October 11, 2011, 18:05 |
|
#12 | |||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Quote:
Quote:
Code:
inlet { type groovyBC; value $internalField; valueExpression "vector(min(100,time()),0,0)"; } |
||||
October 11, 2011, 20:51 |
|
#13 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
Quote:
As for the moving wing, shouldn't it be a mesh motion, not a field motion!? But if it is meant to be a field motion, then why not set it as a movingWall instead of just wall? Best regards, Bruno
__________________
|
||
October 12, 2011, 09:28 |
|
#14 |
New Member
Anders
Join Date: Nov 2010
Posts: 10
Rep Power: 16 |
Gents,
Thanks for your replies. My goal here is to implement a quite advanced control algorithm for the movement of a wall in my simulation (which is not the wingMotion tutorial, I just use that one as a test case) so groovyBC is not an option. Previously (OF 1.7) I used the timeVaryingUniformFixedValue BC on my moving wall (in the pointDisplacment file) and had the wall moving in a prescribed matter, i.e. a passiv solution. Now I want to switch to the codedFixedValue and have the wall move according to instructions from a control algorithm, i.e. an active solution. The patch type in the constant/polyMesh/boundary file must be set to WALL, otherwise I can not use turbulnce wall functions on my moving wall since wall functions are made for patch type wall only, and not for patch type patch as well? When a wall moves, the movingWall BC must be applied on that wall in the U-file as I understand it? Then in the pointDisplacment file, instead of the sixDOF BC (as in wingMotion tutorial) I want to write my own C++ code. I thought codedFixedValue would let me do that..... Bruno; did you mean that that codedFixedValue BC is only for fields and can not be used for mesh motion? Is that why it does not work? Best regards, Anders |
|
October 12, 2011, 17:17 |
|
#15 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Anders,
Quote:
OK, basically said motion solver is explicitly specified in the file "constant/dynamicMeshDict" which states the following interesting code: Code:
dynamicFvMesh dynamicMotionSolverFvMesh; motionSolverLibs ("libfvMotionSolvers.so"); solver displacementLaplacian; diffusivity inverseDistance (wing); Code:
Selecting dynamicFvMesh dynamicMotionSolverFvMesh Selecting motion solver: displacementLaplacian Code:
componentLaplacian displacementFvMotionSolver interpolation laplacian layeredSolver SBRStress Now you have (at least) two options:
edit: here's another possibility, shown in the folder "tutorials/basic/potentialFoam/cylinder/constant/polyMesh/blockMeshDict", where it shows how to code the desired text on-the-fly... but I don't know its limitations. All I know is that OpenFOAM 2.0 keeps blowing my mind... this "#codeStream" business seems pretty powerful! Best regards, Bruno
__________________
Last edited by wyldckat; October 12, 2011 at 18:09. Reason: see "edit:" |
||
October 17, 2011, 20:49 |
|
#16 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
Dear all,
Thanks a lot for the rich info. I would like to do something similar. I guess from what I've read, and for my case, I will base a point (motionSolver) BC on the timeVaryingUniformFixedValue. Apart from that comes my ignorance-rich question: In both fvPatch and pointPatch, what is the difference between a fixedValue and a uniformFixedValue BC? Best regards Hisham |
|
March 20, 2012, 10:38 |
|
#17 |
Senior Member
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 131
Rep Power: 15 |
Dear Hisham
How can I write the codedFixedValue boundary condition for U(x) = 2 U_0 (1 - x^2 / r^2 ) where U_0 and r are known. Thanks |
|
March 20, 2012, 11:39 |
|
#18 | |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
Quote:
Nevertheless, it should go something like: Code:
inlet { type codedFixedValue; value $internalField; redirectType ramp; code #{ scalar U_0 = 5, r = 10; // Values you need fixedValueFvPatchField<vector> myPatch(this->Cf().size()); forAll(this->Cf(), i) { myPatch[i] = vector( 2*U_0*(1 - Foam::pow(this->Cf()[i].x(), 2) / r / r )),0,0); } (*this)== myPatch; #}; } Last edited by Hisham; March 20, 2012 at 12:05. |
||
March 20, 2012, 13:06 |
|
#19 |
Senior Member
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 131
Rep Power: 15 |
Dear Hisham,
Thanks for your quick reply. I am using of-2.1.0. Is it possible to use groovyBC in this version? I have checked this but i am confused. I will try to implement your suggession about the codedFixedValue. Thanks for your help. |
|
March 20, 2012, 13:17 |
|
#20 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Domain Imbalance | HMR | CFX | 5 | October 10, 2016 06:57 |
Can anyone give me some hint on how to make traction free boundary condition? | poplar | OpenFOAM | 3 | January 14, 2015 03:37 |
Boundary Conditions | Thomas P. Abraham | Main CFD Forum | 20 | July 7, 2013 06:05 |
Setting outlet Pressure boundary condition using CAFFA code | Mukund Pondkule | Main CFD Forum | 0 | March 16, 2011 04:23 |
How to set boundary condition in Fluent for the fo | Peiyong | FLUENT | 1 | November 10, 2006 12:44 |