|
[Sponsors] |
How to generate Time varying Inlet velocity with a particular profile |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 5, 2018, 17:45 |
How to generate Time varying Inlet velocity with a particular profile
|
#1 |
New Member
Faiaz Khaled
Join Date: Oct 2017
Location: United States of America
Posts: 17
Rep Power: 9 |
p { margin-bottom: 0.1in; line-height: 120%; } Hello Everyone,
I am doing Phd in civil engineering. I am at the initial phase of my research. I am using Openfoam. I am new to OpenFoam. I have made some progress but right now I need help with the following issue I am having. I am trying to produce time varying inflow with a profile which is similar to wind behavior in atmospheric boundary layer. I was able to generate inlet velocity with a logarithmic profile. But, what I need to learn right now is to generate time varying inlet velocity with my particular profile. I was able to generate the non uniform profile (not varying with time) of wind flow by changing the inlet velocity boundary condition in the following way. inlet { type fixedValue; value nonuniform List<vector> 2640 ( ( -16.76486314 0 0 ) ( -16.76486314 0 0 ) ( -16.76486314 0 0 ) ( -16.76486314 0 0 ) ( -16.76486314 0 0 ) ………………………… ………………………... Can you please let me know if this is possible in OpenFoam and if it is possible then can you please share some idea or relevant materials with me. I have also come across groovyBC. Is it feasible to use groovyBC for my purpose? Please let me know. Thank you. Regards, Faiaz Khaled |
|
June 6, 2018, 04:35 |
|
#2 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Hi!
Try to search for that in the forum. As I remember this question comes up really often. But for a guess if you need a BC which is not implemented, you can use codedFixedValueFvPatchField: https://cpp.openfoam.org/v5/classFoa...d.html#details You can write your own BC pretty easily. If the time dependence of your velocity cannot be expressed as a function, try to use an interpolation table. For example the fanPressureFvPatch field is using an interpolation table, so you can figure out how could you implement it: https://cpp.openfoam.org/v5/fanPress...8C_source.html I'm not so familiar with groovyBC, it is just a hint, so I hope someone can help you with groovyBC. |
|
July 3, 2018, 10:52 |
|
#3 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 |
I've used groovyBC for generating time/space varying boundary conditions before. Usage is very straightforward. Here's an old link with examples : http://openfoamwiki.net/index.php/Co...Usage_Examples. groovyBC is now just part of swak4foam, but I do not think the usage will have changed much from the samples provided.
Caelan |
|
July 6, 2018, 07:27 |
|
#4 | |
Member
Cristina Hernandez
Join Date: May 2018
Posts: 35
Rep Power: 8 |
Quote:
So far I have just managed to do a matlab script that calculates the values for the velocity profile and then prints them as a nonUniform list, but this is not practical if I want to make changes in my mesh (which will change the coordinates and number of points). Ideally, I would like to be able to specify directly to OpenFOAM the velocity inlet profile as a function of the height, and then get the list of values directly. Have you made any progress on this? |
||
July 10, 2018, 17:31 |
|
#5 | |
New Member
Faiaz Khaled
Join Date: Oct 2017
Location: United States of America
Posts: 17
Rep Power: 9 |
Quote:
I hope you are fine. As I said before, I was able to generate logarithmic velocity (without making it time varying) in the method shown in this video tutorial https://www.youtube.com/watch?v=K-nAF3qAPTc I hope this will help. But, I think there are other smarter ways to do this. You can also write your own boundary condition (by changing the .H and .C files) to get it done. The link I am sharing here should help you learn how to do that. http://www.tfd.chalmers.se/~hani/kur...yCondition.pdf I am not an expert. But, right now I am trying add fluctuation to the inflow velocity profile. Thank you, Regards, Faiaz |
||
July 11, 2018, 06:48 |
|
#6 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Hi!
I wrote a little bullshit code for you which sets the x component of the velocity equal to the y coordinate of the face centre. Of course this is useless, but i hope it can help you to write your own BC. You can simply add time dependence if you want. After running you can easily check if your BC is what you want or not. Code:
inlet { type codedFixedValue; value uniform (0 0 0); name codedStuff; code #{ //Initialize velocity with zeroes vectorField veloc(patch().size(), vector(0, 0, 0)); //Go through all face centres: const vectorField& centre(patch().Cf()); forAll(centre, i) { veloc[i].x() = centre[i].y(); } //Apply the calculated velocities operator==(veloc); #}; codeInclude #{ #}; //codeOptions //#{ // -I$(LIB_SRC)/surfMesh/lnInclude //#}; } |
|
July 11, 2018, 09:23 |
|
#7 |
Member
Cristina Hernandez
Join Date: May 2018
Posts: 35
Rep Power: 8 |
Hi Faiaz, thanks for your tips!
I also came up with the youtube tutorial you shared and this is the way I was generating my inlet profile, but I find this very time consuming. Apart from the inlet, I also want to have the internalField defined as a power law profile (at the 0 time directory), so that's the reason why I was looking for a way to define both the internal field and the boundary mathematically. I assume you haven't tried that and you are just creating a script that writes the U file for you, am I right? Let me know if you have any ideas about this and thanks for your help, Cristina |
|
July 11, 2018, 09:28 |
|
#8 | |
Member
Cristina Hernandez
Join Date: May 2018
Posts: 35
Rep Power: 8 |
Quote:
Thanks for your answer. My objective is to define mathematically not only the boundaries but also the internalField. Do you think I could apply this same code to specify the internal field? If so, how would you suggest to do it, because for the internalField I cannot specify "type codedFixedvalue" so I don't know how to implement it. Thanks in advance! Cristina |
||
July 11, 2018, 09:37 |
|
#9 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Hi!
With setFields you can set the initial values for the internal field, but it can use only the followings, which are mostly primitives and predefined zones. But why do you want to define the internalField? This should be your solution, and if you know the internal field, you don't need any calculations. Code:
43 ( boundaryToFace boxToCell boxToFace boxToPoint cellToCell cellToFace cellToPoint cylinderAnnulusToCell cylinderToCell faceToCell faceToFace faceToPoint faceZoneToCell faceZoneToFaceZone fieldToCell labelToCell labelToFace labelToPoint nbrToCell nearestToCell nearestToPoint normalToFace patchToFace pointToCell pointToFace pointToPoint regionToCell regionToFace rotatedBoxToCell searchableSurfaceToFaceZone setAndNormalToFaceZone setToCellZone setToFaceZone setToPointZone setsToFaceZone shapeToCell sphereToCell surfaceToCell surfaceToPoint targetVolumeToCell zoneToCell zoneToFace zoneToPoint ) |
|
July 11, 2018, 09:59 |
|
#10 | |
Member
Cristina Hernandez
Join Date: May 2018
Posts: 35
Rep Power: 8 |
Quote:
If I only specify a logarithmic law in the inlet (time directory 0), it takes around 50s of simulation for the conditions of the inlet to reach all the domain. What I want is to have a logarithmic velocity profile in all the domain for t=0 (to avoid this simulation time) and then let OpenFOAM solve p and U fields. |
||
July 11, 2018, 10:12 |
|
#11 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Is it a transient or a steady simulation? 50 sec in real time? It's not a long simulation time I think.
And what if you just solve it once, and then just map the converged solution from the "empty" case to the "obstacle" case? Like this you will have a good starting point so you should reach convergence pretty fast. And it is much simpler than write some code to set the initial field in the whole domain i think. (At least I think you can set the initial field as you want only if you write some code for it.) I'm also not sure if setting the velocity field is enough without the proper pressure field. Since the U and p equations are coupled, the "bad" initial pressure field will blow up your nicely defined velocity field. But it is just a guess. I think you should just use mapping from an "empty" case to an obstacle case. It is not time consuming and you can find mapping example somewhere in the tutorials (maybe cavity case). Of course like this you still have to solve the "empty" case, but just once. |
|
July 12, 2018, 07:13 |
|
#12 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Hi crizpi21!!
I just accidentally found something which could be useful for you if you still want to define your internal field: https://cpp.openfoam.org/v6/classFoa...m.html#details Honestly i have never used it but i think this is what you need. |
|
July 18, 2018, 06:11 |
|
#13 | |
Member
Cristina Hernandez
Join Date: May 2018
Posts: 35
Rep Power: 8 |
Hi simrego, thanks for your help! I decided to follow your advise: run an "empty" case to obtain the U profile and then map the solution into the "obstacle" case. This way, I am sure that the fields (U,p, k, omega) are consistent, rather than defining only U.
Quote:
I have a last question that maybe you could answer. For my real case, I have a rather fine mesh and I have used the same fine mesh for the "empty" case, so it took long until I got the desired U profile. I am not sure if I could use a coarser mesh just for the empty case (to speed up) and then map the solution to the fine mesh or if I will loose accuracy in my U field during this mapping process. What do you think? Thanks again for your help! Cristina |
||
July 18, 2018, 06:20 |
|
#14 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
You can use a coarser mesh and of course you will loose accuracy since your geometry will be totally different but it can be a good initial guess for the fields.
I think 50s won't be enough since it is a transient case. You should monitor some quantity and when you'll see some oscillations you can say that you won. Check this link from slide 136. I hope it'll help to understand. http://www.wolfdynamics.com/wiki/fvm_crash_intro.pdf |
|
June 1, 2021, 08:38 |
Time-varying atmBoundaryLayerInletVelocity
|
#15 |
New Member
Aina
Join Date: Jan 2020
Location: Spain
Posts: 9
Rep Power: 6 |
Hi everyone,
I am simulating an Atmospheric Boundary Layer, so I am using the following inlet boundary condition: inlet { type atmBoundaryLayerInletVelocity; initABL false; Uref constant 1: Zref constant 0.15; kappa 0.41; Cmu 0.9; . . . } Now, I want to generate time-varying inlet velocity using the type atmBoundaryLayerInletVelocity. For that, I want the velocity Uref to ramp from the value Uref=1 to the value Uref=3 in the time interval between t1=0 and t2=0.1 for example. I would like to know if it is possible and how to do that. Thanks for your help! Aina |
|
June 3, 2021, 07:16 |
|
#16 | |
New Member
Aina
Join Date: Jan 2020
Location: Spain
Posts: 9
Rep Power: 6 |
Quote:
Hi everyone After some tests, I finally find a way to time-varying the scalar variable Uref in the function type atmBoundaryLayerInletVelocity. inlet { type atmBoundaryLayerInletVelocity; initABL false; kappa 0.41; Cmu 0.09; C1 0; C2 1; flowDir constant (1 0 0); zDir constant (0 0 1); Uref table ( (0 1) (0.5 3) ); Zref constant 0.15; z0 constant 0.001; d constant 0; value uniform (0 0 0); } |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Time varying velocity inlet boundary conditions using TableFile.H | pruthvi1991 | OpenFOAM Running, Solving & CFD | 4 | November 4, 2015 01:22 |
3d velocity profile at velocity inlet | swethaprakash | FLUENT | 3 | September 1, 2015 03:10 |
Micro Scale Pore, icoFoam | gooya_kabir | OpenFOAM Running, Solving & CFD | 2 | November 2, 2013 14:58 |
dynamic Mesh is faster than MRF???? | sharonyue | OpenFOAM Running, Solving & CFD | 14 | August 26, 2013 08:47 |
time varying inlet velocity | shillin.ks | OpenFOAM | 4 | June 29, 2012 06:51 |