CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Constant velocity field

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Antimony
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 16, 2012, 12:44
Default Constant velocity field
  #1
Per
New Member
 
Per Christian Endresen
Join Date: Feb 2012
Location: Trondheim, Norway
Posts: 13
Rep Power: 14
Per is on a distinguished road
Dear all

I have (most likely) an unusual problem. I want to set a constant velocity field in a part of the solution domain. Let's say (1 0 0) for simplicity; and I want this value to be constant throughout the whole simulation. Please note that this not is an investigation of an actual physical problem. I only want to investigate the effect of this imposed velocity field.

I tried to use setFields, but as expected it only gave the desired velocity field as an initial condition at T=0. I have searched the forum, but have not yet found a solution that does not involve altering the source code. Does anyone know if this is possible without altering the source code?

Thanks in advance for replies.
Regards
Per
Per is offline   Reply With Quote

Old   May 16, 2012, 12:49
Default
  #2
Member
 
fisch
Join Date: Feb 2010
Posts: 97
Rep Power: 16
fisch is on a distinguished road
Using a boundary condition at this point could solve your problem
but then you have to define a BC for p etc, too...
fisch is offline   Reply With Quote

Old   May 22, 2012, 04:29
Default
  #3
Per
New Member
 
Per Christian Endresen
Join Date: Feb 2012
Location: Trondheim, Norway
Posts: 13
Rep Power: 14
Per is on a distinguished road
I actually want to impose a velocity field on a control volume; not a surface or a point. So I guess a boundary condition will not be sufficient. Is there no way to set a fixed velocity inside some chosen cells (or control volume)?

Regards
Per
Per is offline   Reply With Quote

Old   May 22, 2012, 10:28
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Per View Post
I actually want to impose a velocity field on a control volume; not a surface or a point. So I guess a boundary condition will not be sufficient. Is there no way to set a fixed velocity inside some chosen cells (or control volume)?

Regards
Per
There are two ways:
- you modify the solver to fix the values during the solution of the linear equation. All these methods are based on the setValues-method of fvMatrix. One would be the explicitSource-class in OF (havn't used that yet). The other would be forceEquation in swak4Foam (I think there is a discussion on this somewhere here on the board). explicitSource sets a constant value in a fixed cell region. forceEquation can use any expression (for the value and the location)
- the other method would be to use a functionObject to reset the field in a specific region after the solution process. That is more of a hack but works in a lot of instances. One such functionObject would be manipulateField in the swak4Foam-suite. But maybe there are others
gschaider is offline   Reply With Quote

Old   May 23, 2012, 05:23
Default
  #5
Per
New Member
 
Per Christian Endresen
Join Date: Feb 2012
Location: Trondheim, Norway
Posts: 13
Rep Power: 14
Per is on a distinguished road
Thanks for the reply Bernhard

I guess I have to install swak4Foam. Since I have trouble with compiling (due to dependency problems), is it possible to download and install swak4Foam without compiling? I ask because I read something about it at https://openfoam-extend.svn.sourcefo...ies/swak4Foam/. I did not install OF on the system myself. The one who did had problems with compiling, and therefor installed pre-compiled OF libraries and utilities.

Btw, I use OF 2.1.0.

Regards
Per
Per is offline   Reply With Quote

Old   May 23, 2012, 07:01
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Per View Post
Thanks for the reply Bernhard

I guess I have to install swak4Foam. Since I have trouble with compiling (due to dependency problems), is it possible to download and install swak4Foam without compiling? I ask because I read something about it at https://openfoam-extend.svn.sourcefo...ies/swak4Foam/. I did not install OF on the system myself. The one who did had problems with compiling, and therefor installed pre-compiled OF libraries and utilities.

Btw, I use OF 2.1.0.

Regards
Per
Dependencies for swak4Foam are not too bad: only flex and bison

It is true. In the swak4Foam-sources there is everything needed to roll Debian-packages (this is needed for the yearly Workshop-ISO) But I don't have the time (nor am I very motivated as I don't have Ubuntu/Debian systems nor have the people I work for) to roll binary releases in addition to the source releases. I have said it before: if someone volunteers to do that I will gladly assist her (same goes for anyone who wants to package RPM-releases)
gschaider is offline   Reply With Quote

Old   September 4, 2015, 04:18
Default
  #7
Senior Member
 
Eloïse
Join Date: Jul 2012
Location: Trondheim, Norway
Posts: 113
Rep Power: 14
Eloise is on a distinguished road
Quote:
Originally Posted by Per View Post
I actually want to impose a velocity field on a control volume; not a surface or a point. So I guess a boundary condition will not be sufficient. Is there no way to set a fixed velocity inside some chosen cells (or control volume)?
Hi Per!
I have the intention to do something similar. Could you give me some feedback about the methods you tested? What were pros and cons? What finally worked?
Thanks!
Eloïse
Eloise is offline   Reply With Quote

Old   February 27, 2018, 01:11
Default
  #8
Member
 
Join Date: Jan 2018
Location: Malaysia
Posts: 58
Rep Power: 8
jiahui_93 is on a distinguished road
Quote:
Originally Posted by Per View Post
Dear all

I have (most likely) an unusual problem. I want to set a constant velocity field in a part of the solution domain. Let's say (1 0 0) for simplicity; and I want this value to be constant throughout the whole simulation. Please note that this not is an investigation of an actual physical problem. I only want to investigate the effect of this imposed velocity field.

I tried to use setFields, but as expected it only gave the desired velocity field as an initial condition at T=0. I have searched the forum, but have not yet found a solution that does not involve altering the source code. Does anyone know if this is possible without altering the source code?

Thanks in advance for replies.
Regards
Per
Hi, I am facing the same problem as you. I saw your post when i plan to started a new thread here. haha. May I ask for your advice on this matter if you had solved it? I would be very grateful for your help. Thanks =)
jiahui_93 is offline   Reply With Quote

Old   February 27, 2018, 02:00
Default
  #9
Senior Member
 
Join Date: Aug 2013
Posts: 407
Rep Power: 16
Antimony is on a distinguished road
Hi,

Does not a combination of fvOptions and codedSource boundary condition help?

Cheers,
Antimony
jiahui_93 likes this.
Antimony is offline   Reply With Quote

Old   February 27, 2018, 12:52
Default
  #10
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by jiahui_93 View Post
Hi, I am facing the same problem as you. I saw your post when i plan to started a new thread here. haha. May I ask for your advice on this matter if you had solved it? I would be very grateful for your help. Thanks =)
Try the "fixedValue" fvOption
jiahui_93 likes this.
__________________
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
gschaider is offline   Reply With Quote

Old   February 28, 2018, 11:04
Default
  #11
Member
 
Join Date: Jan 2018
Location: Malaysia
Posts: 58
Rep Power: 8
jiahui_93 is on a distinguished road
Quote:
Originally Posted by Antimony View Post
Hi,

Does not a combination of fvOptions and codedSource boundary condition help?

Cheers,
Antimony

Quote:
Originally Posted by gschaider View Post
Try the "fixedValue" fvOption
Hi, Thanks for the help and suggestions. I learned a new thing FvOptions works, i use scalarFixedValueConstraint and vectorFixedValueConstraint as following:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  plus                                  |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
carIntFixedScalar
{
type scalarFixedValueConstraint;
active yes;
scalarFixedValueConstraintCoeffs
{
selectionMode cellZone;
cellZone carIntCZ;
fieldValues
{
P  0;
k  0;
epsilon  0;
}
}
}

carIntFixedVector
{
type vectorFixedValueConstraint;
active yes;
vectorFixedValueConstraintCoeffs
{
selectionMode cellZone;
cellZone carIntCZ;
fieldValues
{
U  (0 0 0);
}
}
}


// ************************************************************************* //
But the movingWall of my solid(20 m/s U, 0 P) within the domain(0 U, 0 P) seems cannot generate any airflow U. It come out to be whole things has no flow. May I get some opinion on how to get the movingWall to produce airflow. I mean theoretically moving solid should produce air velocity and pressure surrounding it, is it? May I get some suggestion on this matter? Is fvOptions useful in this? Thanks
jiahui_93 is offline   Reply With Quote

Old   February 28, 2018, 11:22
Default
  #12
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by jiahui_93 View Post
Hi, Thanks for the help and suggestions. I learned a new thing FvOptions works, i use scalarFixedValueConstraint and vectorFixedValueConstraint as following:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  plus                                  |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
carIntFixedScalar
{
type scalarFixedValueConstraint;
active yes;
scalarFixedValueConstraintCoeffs
{
selectionMode cellZone;
cellZone carIntCZ;
fieldValues
{
P  0;
k  0;
epsilon  0;
}
}
}

carIntFixedVector
{
type vectorFixedValueConstraint;
active yes;
vectorFixedValueConstraintCoeffs
{
selectionMode cellZone;
cellZone carIntCZ;
fieldValues
{
U  (0 0 0);
}
}
}


// ************************************************************************* //
But the movingWall of my solid(20 m/s U, 0 P) within the domain(0 U, 0 P) seems cannot generate any airflow U. It come out to be whole things has no flow. May I get some opinion on how to get the movingWall to produce airflow. I mean theoretically moving solid should produce air velocity and pressure surrounding it, is it? May I get some suggestion on this matter? Is fvOptions useful in this? Thanks
Without more details (for instance: is carIntCZ next to the movingWall?) it is hard to tell
__________________
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
gschaider is offline   Reply With Quote

Old   February 28, 2018, 13:46
Default
  #13
Member
 
Join Date: Jan 2018
Location: Malaysia
Posts: 58
Rep Power: 8
jiahui_93 is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Without more details (for instance: is carIntCZ next to the movingWall?) it is hard to tell
Hi, thanks again for help and i'm sry for lack of info. Here are my posts for more details:

PimpleDyMFoam --Simulate turbulence caused by moving object

Linear motion of a solid inside a fluid

Actually, i am trying to build a 3D hollow box(car) moving in a rectangular tube domain (shaft), and i aim to mesh the space btwn hollow box and rectangular tube to study the external airflow and pressure and turbulence parameters. This is my starting step to learn the simulation of aerodynamic outside vehicle or body within a domain. It seems didnt work if delete the cells within the box to make it hollow. So, i am now trying to set every fields of cellZone in the car (carIntCZ) to be zero value. Is appropriate?
I am sry for my dummy questions. Thanks a lot =)
jiahui_93 is offline   Reply With Quote

Old   March 8, 2018, 08:27
Default
  #14
Senior Member
 
Eloïse
Join Date: Jul 2012
Location: Trondheim, Norway
Posts: 113
Rep Power: 14
Eloise is on a distinguished road
Quote:
Originally Posted by jiahui_93 View Post
This is my starting step to learn the simulation of aerodynamic outside vehicle or body within a domain.
Hi,
Have you tried the motorbike tutorial to get started?
Regards,
Eloïse
Eloise is offline   Reply With Quote

Reply

Tags
constant, field, setfields, vector, velocity


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
real velocity field from energy spectrum Angel Main CFD Forum 7 December 13, 2013 21:40
How to install CGNS under windows xp? lzgwhy Main CFD Forum 1 January 11, 2011 19:44
how to make velocity field constant with time openfoam1 OpenFOAM 0 February 1, 2010 16:53
Constant field inside the volume Ben Makhal CFX 10 February 6, 2008 17:32
fixed velocity field Glen CFX 3 August 28, 2006 13:17


All times are GMT -4. The time now is 22:41.