|
[Sponsors] |
June 19, 2012, 15:54 |
Oscilating cross-wind
|
#1 |
New Member
Dave Crossley
Join Date: Oct 2010
Posts: 18
Rep Power: 16 |
All OFers,
I am having trouble creating an oscillating cross-wind velocity over my wing. I used to be able to use 'timeVaryingUniformInletOutlet' but since the update this has changed. I have found this OF site (below) to help guide me but it doesn't quite appear to be working. http://www.openfoam.org/version2.1.0...conditions.php My Case I am trying to keep a constant velocity of 5m/s (through x-axis) through a box shaped domain and with an additional fluctuating cross-wind (FCW) in the y direction. With my 'time-velocity.txt' file I have created a fluctuating velocity using a sine wave where only y-direction velocity changes e.g.(5 FCW 0) so OF can model exactly the velocity I require at each time step. Below is the original BC: type timeVaryingUniformInletOutlet; value uniform (5 0 0); outOfBounds warn; fileName "time-velocity.txt" Attempts Using the above web link I can't quite work out how the BC is setup or if there is an alternative method to gain the same cross-wind results. type uniformFixedValue; uniformValue tableFile; tableFileCoeffs { outOfBounds warn; fileName "time-velocity.txt"; }; I have also tried 'oscillatingFixedValue' but I get double Scalar errors, also I have tried some of the mapping BCs but again they don't quite work for me. For instance the BC requires additional 'points' in the constant/boundaryData/inlet folder (I am not sure how to do this/what points it requires). I would very much appreciate some advice as I am struggling on this reasonably simple problem. Thank you in advance. |
|
June 24, 2012, 06:39 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings Dave,
Navein asked me about this very same question the other day and I said then I would answer here... so here it is:
Bruno
__________________
|
|
June 25, 2012, 04:53 |
|
#3 |
New Member
Dave Crossley
Join Date: Oct 2010
Posts: 18
Rep Power: 16 |
Excellent, thank you so much for your help.
I just have one minor problem. After running T-junction and opening paraFoam I get this error. --> FOAM FATAL IO ERROR: keyword hasHeaderLine is undefined in dictionary "/home/david/Desktop/TJunctionOsc/0.1/U::boundaryField::inlet::csvFileCoeffs" file: /home/david/Desktop/TJunctionOsc/0.1/U::boundaryField::inlet::csvFileCoeffs from line 3909 to line 3913. From function dictionary::lookupEntry(const word&, bool, bool) const in file db/dictionary/dictionary.C at line 400. FOAM exiting Segmentation fault The error is clearly due to 'hasHeaderLine' line but this is required to identify the header line (as you well know). Any ideas? I am currently running in OF v2.1, hopefully it's not a version problem as it is not practical to upgrade right now. thanks again David |
|
June 25, 2012, 18:30 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi David,
I saw your bug report: http://www.openfoam.org/mantisbt/view.php?id=564 I've checked and indeed this has already been fixed in OpenFOAM 2.1.x. Attached is a case without the header line in the CSV file. You can always do this the other way around: use a CSV with a header line! Best regards, Bruno
__________________
|
|
June 26, 2012, 08:59 |
|
#5 |
New Member
Dave Crossley
Join Date: Oct 2010
Posts: 18
Rep Power: 16 |
Hi Bruno,
I'm not sure what's going on, so far I am still coming across errors regarding the 'HeaderLine'. My first issue is the following. I have ran your T-junction with and without a header but when I move to the next time step in paraFoam the software crashes relaying an error of (after selecting 'U' and 'surface'): --> FOAM FATAL IO ERROR: keyword hasHeaderLine is undefined in dictionary "/home/david/Desktop/TJunctionOsc_NoHeader/0.1/U::boundaryField::inlet::csvFileCoeffs" file: /home/david/Desktop/TJunctionOsc_NoHeader/0.1/U::boundaryField::inlet::csvFileCoeffs from line 3909 to line 3913. From function dictionary::lookupEntry(const word&, bool, bool) const in file db/dictionary/dictionary.C at line 400. FOAM exiting Could you confirm that this is the case your end? My second issue is my oscillating case, I have set my case up with your help but again the HeaderLine keeps giving me errors when I decompose (with and without headers). Do you think I have made a BC error or is it a bad installation of OF? Attached is my current case. Constant folder was too big and my time-velocity.txt file also had to be chopped down a lot. Hope this helps identify my annoying problem. Regards Dave |
|
June 26, 2012, 17:57 |
|
#6 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Dave,
OK, the problem is this: OpenFOAM 2.1.0 has this bug, while the latest 2.1.x (git repository version) does not have this bug. I haven't checked OpenFOAM 2.1.1. You have two possible fixes:
Bruno
__________________
|
|
February 18, 2015, 15:24 |
|
#7 |
Member
Jack
Join Date: Aug 2012
Posts: 47
Rep Power: 14 |
Hi Guys,
I know this is an old thread, but I am looking at implementing: timeVaryingMappedFixedValue in OF-2.3.0 for incoming turbulent wakes (ux,uy,k,omega profiles required) being translated vertically. (I have the profiles I want.) I have used timeVaryingMappedFixedValue to provide a spatial profile, i.e. by just specifying the profile in 0. My question is regarding how I could loop through time directories 0, 1, ..., T then return to 0 and loop back through (i.e. the uniformFixedValue behaviour for the out of bounds repeat). (Whilst the profiles are linearly interpolated between 0 and 1 when 0<t<1 etc. Is there a way to do this? Any help towards the correct BC would be great. Thanks Jack |
|
February 18, 2015, 15:40 |
|
#8 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings Jack,
Sorry, but I read your post twice, but I still can't figure out what exactly what you're trying to do, where and why From your description, my guess is that without an image explaining what you're trying to do, I won't be able to figure it out Or at least a practical example. Best regards, Bruno
__________________
|
|
February 18, 2015, 15:58 |
|
#9 |
Member
Jack
Join Date: Aug 2012
Posts: 47
Rep Power: 14 |
Hi, thanks for the response,
I think the answer I am looking for is quite simple, I just wanted to know if there was a neat way of doing it... I have a profile which I want to prescribe at the inlet and then translate it vertically. However after a given time it resets to its initial position. (The actual profile is coming from moving bars in a linear turbine cascade and is serving as an inlet to my simulation - I have attached an image to the kind of geometry I am imitating - the bars are outside of my domain and the inflow of my simulation is the moving wakes from these. Playing with the timeVaryingMappedFixedValue I see that it linearly(?) interpolates the values between two time directories, but I would like a reset option (without having to write out every timestep, as the speed of the bars (and hence the time directories of any reset) depend on the inflow velocity which I will have to find by running the case iteratively. Thanks a lot Jack |
|
February 18, 2015, 17:02 |
|
#10 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Jack,
OK, the few neurons that are still working properly in my head at this time of the night, have finally managed to figure it out what you mean and want to do! If the interpolation was done with the "uniformFixed" boundary condition, I think it already has this feature. Problem is that this boundary condition "timeVaryingMappedFixedValue" doesn't have this feature. You'll need to create a new boundary condition (or modify the current one, if you feel lucky ) based on the source code folder indicated by this command: Code:
echo $FOAM_SRC/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/ The relevant parts of the source code should be as follows:
In addition, you might want to suggest this as a feature here: http://www.openfoam.org/bugs/ Best regards, Bruno |
|
February 18, 2015, 17:42 |
|
#11 |
Member
Jack
Join Date: Aug 2012
Posts: 47
Rep Power: 14 |
Thats brilliant, thanks a lot. I ll post here tomorrow with completed bc hopefully as a useful solution!
Jack |
|
February 18, 2015, 20:20 |
|
#12 |
Member
Jack
Join Date: Aug 2012
Posts: 47
Rep Power: 14 |
Hi,
So I have made the modification to the three occurrences: Code:
this->db().time().value() Code:
fmod(this->db().time().value(),sampleTimes_[endSampleTime_].value()) I now think this boundary condition will do what I want it to do, so thank's a lot! (It will break if 0 is not the start of the modulo period, but defining carefully the boundary data should clear it up. There is now however a problem at runtime - but for just the last time step: *** Error in `simpleFoam': corrupted double-linked list: 0x0000000001b16200 *** [1] 20669 abort (core dumped) simpleFoam I have attached both the BC (should anyone want it) and the pitzdaily case (only modified bc for U) -> I added AverageIO to the Make folder, largely just because it was there - but on removal of AverageIO the error went away. Bit confused by that, but hey. Thanks Jack Ps. CFD-online is not allowing me to attach stuff. So will do so when I have further tested it in the situation that I want to apply it in |
|
February 19, 2015, 09:51 |
|
#13 |
Member
Jack
Join Date: Aug 2012
Posts: 47
Rep Power: 14 |
Dear Bruno,
Sorry for the pestering. I think I have a better solution now, I would just like to confirm! I will before hand run Fourier decomposition of my inlet profile and then try to use codedMixedValue: e.g. Code:
code #{ scalar a_i = x_1; // known from a priori fourier decomp. ... scalar a_n = x_n; scalar c = cons; // speed of wave scalar L = cons; // length of domain {NOT SURE 1 (U)} = a_i * cos(constant::mathematical::twoPi * {NOT SURE 2 (y)} - c * db().time().value())/L) + (similar sin term); operator==({NOT SURE 3}) {NOT SURE 1 (U)} is the velocity for the patch, which is a function of y and t. {NOT SURE 2} is the y coordinate of the patch and {NOT SURE 3} is how to update it. Also the a_i coefficients will be different for u,v & w, so if I specify e.g. Code:
vector a_i(v1,v2,v3); Thank you very much, your help is greatly appreciated Jack |
|
February 22, 2015, 10:02 |
|
#14 | ||
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Jack,
Quote:
But my guess is that you didn't follow "protocol" (which honestly, I do have plans to write about, but simply haven't managed to get to it):
Quote:
I believe that if you formulate at least the full mathematical concept of what you're trying to implement, both of us (you and me) would very likely have an easier task on translating it to source code. Best regards, Bruno |
|||
February 23, 2015, 17:37 |
|
#15 |
Member
Jack
Join Date: Aug 2012
Posts: 47
Rep Power: 14 |
Dear Bruno,
After a little bit of work and useful direction, I think I am almost there... In terms of the maths I am all set, the basic idea is to take a points profile for U,k,omega & p and write them all as sums of cosines and sines by using python before hand: Code:
code #{ //This file was writing by setupInletBoundary.py //Save on fileIO later fixedValueFvPatchField<scalar> myPatch(*this); scalar L = 0.799000; scalar vbar = 0.422; int numModes = 20; double a[20] = { 0.018350, 0.000013, ...., // not sure if I can post these online (the original profiles are a companies property) -0.000032 }; double b[20] = { 1.000000, 0.000784, ..., // Not sure if I can post these online -0.000002 }; forAll(this->patch().Cf(),i) { myPatch[i] = 0; for(int iter=0;iter<numModes;iter++){ myPatch[i] += scalar ( a[iter]*cos( iter * constant::mathematical::twoPi * (this->patch().Cf()[i].y() - vbar*db().time().value() )/L ) + b[iter]*sin( iter * constant::mathematical::twoPi * (this->patch().Cf()[i].y() - vbar*db().time().value() )/L ) ); } }; Info << "IN K\n\n\n\n" << endl; operator==(myPatch); #}; Code:
Info << "IN K\n\n\n\n" << endl; A BIGGER problem at the moment is that k and omega are IDENTICAL, despite using two different pieces of code: Code:
code #{ //This file was writing by setupInletBoundary.py //Save on fileIO later fixedValueFvPatchField<scalar> myPatchO(*this); scalar L = 0.799000; scalar vbar = 0.422; int numModes = 20; double ae[20] = { ... }; double be[20] = { ... }; double ak[20] = { ... }; double bk[20] = { ... }; forAll(this->patch().Cf(),i) { scalar k = scalar(0); scalar eps = scalar(0); for(int iter=0;iter<numModes;iter++){ k += scalar ( ak[iter]*cos( iter * constant::mathematical::twoPi * (this->patch().Cf()[i].y() - vbar*db().time().value() )/L ) + bk[iter]*sin( iter * constant::mathematical::twoPi * (this->patch().Cf()[i].y() - vbar*db().time().value() )/L ) ); eps += scalar ( ae[iter]*cos( iter * constant::mathematical::twoPi * (this->patch().Cf()[i].y() - vbar*db().time().value() )/L ) + be[iter]*sin( iter * constant::mathematical::twoPi * (this->patch().Cf()[i].y() - vbar*db().time().value() )/L ) ); } Info << "\n\n\n\n" << eps << " " << k << endl; // NOT WRITTEN myPatchO[i] = eps / (0.09 * k); }; operator==(myPatchO); #}; Code:
*** Error in `reconstructPar': double free or corruption (fasttop): 0x00000000012d15a0 *** Will it matter that in the 0/ folder I am doing (including it): Code:
inflow { type codedFixedValue; redirectType ramp; // what are the point of these options!? #include "../constant/boundarySetup/codedU.bc" value uniform (0.745 0.708 0); } Thanks for any help! This is a really powerful BC, but I am not quite using it right yet! Best regards Jack |
|
February 23, 2015, 19:26 |
|
#16 |
Member
Jack
Join Date: Aug 2012
Posts: 47
Rep Power: 14 |
Scratch everything I just said! I realised the redirectType needs to be unique!
Jack |
|
August 4, 2015, 00:58 |
|
#17 |
New Member
ravi
Join Date: Nov 2013
Posts: 10
Rep Power: 13 |
Hi Guys,
My question is similar to the one asked here. At different % of radius, I want to hook radial, tangential, axial velocities and turbulent kinetic energy and turbulent eddy dissipation values. Somebody pls help me in making use of "myDataFile" approach as my data contains 50 rows. Encountered an error even after trying as suggested by "wyldckat" in this link: http://www.cfd-online.com/Forums/ope...ross-wind.html [^]. I am using openfoam 2.4.0 ------------------------------------------------------------------------------- --> FOAM FATAL IO ERROR: keyword uniformValueCoeffs is undefined in dictionary "/home/cfd11/TJunctionOsc/0/U.boundaryField.inlet" file: /home/cfd11/TJunctionOsc/0/U.boundaryField.inlet from line 25 to line 34. From function dictionary::subDict(const word& keyword) const in file db/dictionary/dictionary.C at line 648. FOAM exiting -------------------------------------------------------------------------------- [ Moderator note: moved from http://www.cfd-online.com/Forums/ope...nlet-file.html ] Last edited by wyldckat; August 16, 2015 at 15:31. Reason: see "Moderator note" |
|
August 16, 2015, 15:29 |
|
#18 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Attached is the file "TJunctionOsc24.tar.gz" which has the case updated for OpenFOAM 2.4, in reference to the following quoted post:
Quote:
|
||
July 13, 2018, 19:18 |
|
#19 | |
New Member
Faiaz Khaled
Join Date: Oct 2017
Location: United States of America
Posts: 17
Rep Power: 9 |
Quote:
I hope you are fine. I spent some time on reading the questions and replies on this thread. This thread looks to be more useful for my case. I am new to openfoam. I am trying to generate a time varying logarithmic velocity profile. For that purpose, I am trying to follow the steps and case files you provided here. In summary, I want openfoam to read the velocity profile at each time step. I am trying use PisoFoam with a inlet velocity profile as yours. I am providing that here, Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.x | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { inlet { type uniformFixedValue; value uniform (0 0 0); uniformValue csvFile; csvFileCoeffs { fileName "$FOAM_CASE/myDataFile.txt" outOfBounds clamp; hasHeaderLine true; refColumn 0; componentColumns (1 2 3); // vector example } } outlet1 { type inletOutlet; inletValue uniform (0 0 0); value uniform (0 0 0); } outlet2 { type inletOutlet; inletValue uniform (0 0 0); value uniform (0 0 0); } defaultFaces { type fixedValue; value uniform (0 0 0); } } // ************************************************************************* // Code:
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 5.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 5.0-dbb428a3a855 Exec : pimpleFoam Date : Jul 19 2018 Time : 15:17:53 Host : "faiaz-Lenovo-ideapad-320-15IKB" PID : 16895 I/O : uncollated Case : /home/faiaz/practice2/TJunctionOsc nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10) allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 PIMPLE: Operating solver in PISO mode Reading field p Reading field U --> FOAM FATAL IO ERROR: keyword nHeaderLine is undefined in dictionary "/home/faiaz/practice2/TJunctionOsc/0/U.boundaryField.inlet" file: /home/faiaz/practice2/TJunctionOsc/0/U.boundaryField.inlet from line 25 to line 34. From function const Foam::entry& Foam::dictionary::lookupEntry(const Foam::word&, bool, bool) const in file db/dictionary/dictionary.C at line 566. FOAM exiting Thank you. Regards, Faiaz Khaled Last edited by wyldckat; July 25, 2019 at 20:27. Reason: [QUOTE]->[CODE] |
||
July 25, 2019, 20:38 |
|
#20 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Quick answer @faiazk: Sorry for the really late reply, but someone else also asked me about this recently and I came looking for this thread.
The usage instructions for OpenFOAM 5 are provided here: https://cpp.openfoam.org/v5/classFoa...V.html#details - however, there were a few changes made to OpenFOAM 5 that are not updated in that page. If I'm not mistaken, this: Code:
uniformValue csvFile; uniformValueCoeffs { fileName "$FOAM_CASE/myDataFile.txt" outOfBounds clamp; hasHeaderLine true; nHeaderLine 1; mergeSeparators false; refColumn 0; componentColumns (1 2 3); // vector example } Code:
uniformValue csvFile; uniformValueCoeffs { file "$FOAM_CASE/myDataFile.txt"; outOfBounds clamp; nHeaderLine 1; mergeSeparators false; refColumn 0; componentColumns (1 2 3); // vector example }
__________________
|
|
Tags |
crosswind, mappedfixedvalue, oscillation, timevarying |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
simulating wind shear profile for a wind turbine--> How??? | mohammad | CFX | 14 | August 25, 2014 10:09 |
FSI - Wind Turbine | AUN | CFX | 13 | August 29, 2012 17:44 |
simulating wind shear profile for a wind turbine--> How??? | mohammad | FLUENT | 0 | April 15, 2012 00:54 |
Simulate the wind profile on a wind turbine---> HOW ???? | mohammad | Main CFD Forum | 0 | April 13, 2012 09:07 |
Macro fan modeling considering cross wind effect | microfin | FLUENT | 0 | January 1, 2012 04:07 |