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

Initialize a field with function

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 31, 2017, 10:09
Exclamation Initialize a field with function
  #1
New Member
 
Oğuzhan Demir
Join Date: Dec 2016
Posts: 18
Rep Power: 5
ddemiroguzhan is on a distinguished road
Hi,
I would like to initialize my velocity field (U) with a function, for example a sine function depending on x-coordinate of the cell. Is there a way to do that? I am using OF-4.0.x version.

Thanks in advance.
Oguzhan
ddemiroguzhan is offline   Reply With Quote

Old   July 31, 2017, 10:34
Default
  #2
New Member
 
Join Date: Mar 2015
Posts: 14
Rep Power: 6
sati is on a distinguished road
Hi,
You can use funkySetFields from swak4foam to do that.
sati is offline   Reply With Quote

Old   July 31, 2017, 10:44
Default
  #3
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 253
Rep Power: 16
floquation will become famous soon enough
Quote:
Originally Posted by sati View Post
You can use funkySetFields from swak4foam to do that.
To add to that, here is a small example to initialise a spherical bubble in interFoam:
Code:
funkySetFields -latestTime -keepPatches -field alpha.water -expression "sqr(pos().x-0)+sqr(pos().y-0)+sqr(pos().z-.00150)<sqr(0.0005)?0:1"
Here a mask is used to set the field to 1 (~water) everywhere, except for a sphere with radius 0.0005 and center position (0,0,0.00150), where we set the value to 0 (~air).
floquation is offline   Reply With Quote

Old   July 31, 2017, 12:06
Default
  #4
New Member
 
Oğuzhan Demir
Join Date: Dec 2016
Posts: 18
Rep Power: 5
ddemiroguzhan is on a distinguished road
Thanks for your advise. But I am unable to install swak4Foam for my current OpenFOAM 4.xx version. Any tips?

Oguz
ddemiroguzhan is offline   Reply With Quote

Old   July 31, 2017, 12:07
Default
  #5
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 253
Rep Power: 16
floquation will become famous soon enough
Quote:
Originally Posted by ddemiroguzhan View Post
Thanks for your advise. But I am unable to install swak4Foam for my current OpenFOAM 4.xx version. Any tips?

Oguz
Why are you unable to do that?

I am using OpenFOAM 4.1 with swak4Foam just fine.
floquation is offline   Reply With Quote

Old   July 31, 2017, 12:09
Default
  #6
New Member
 
Oğuzhan Demir
Join Date: Dec 2016
Posts: 18
Rep Power: 5
ddemiroguzhan is on a distinguished road
Quote:
Originally Posted by floquation View Post
Why are you unable to do that?

I am using OpenFOAM 4.1 with swak4Foam just fine.
I have followed
https://openfoamwiki.net/index.php/I...opment_version
and
https://openfoamwiki.net/index.php/I...tion/swak4Foam
but couldn't install and compile it. I know that it may be a simple problem but could you help on that? Thanks a lot man.
ddemiroguzhan is offline   Reply With Quote

Old   July 31, 2017, 12:23
Default
  #7
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 253
Rep Power: 16
floquation will become famous soon enough
Quote:
Originally Posted by ddemiroguzhan View Post
You should indeed use the development version if you wish to use OF41.


Quote:
Originally Posted by ddemiroguzhan View Post
and
https://openfoamwiki.net/index.php/I...tion/swak4Foam
but couldn't install and compile it. I know that it may be a simple problem but could you help on that? Thanks a lot man.
And I cannot help you any further without more detail.

Where exactly does it fail? What is the error?
floquation is offline   Reply With Quote

Old   August 1, 2017, 05:31
Default
  #8
New Member
 
Oğuzhan Demir
Join Date: Dec 2016
Posts: 18
Rep Power: 5
ddemiroguzhan is on a distinguished road
I have installed swak4Foam correctly and solved my problem. Thanks.

Oguz
ddemiroguzhan is offline   Reply With Quote

Old   August 1, 2017, 11:50
Default
  #9
Member
 
Vedamt Chittlangia
Join Date: Feb 2016
Posts: 64
Rep Power: 4
vcvedant is an unknown quantity at this point
Hello Oğuzhan,

How did you install it swak4Foam? can you post the link?

Thanks
vcvedant is offline   Reply With Quote

Old   August 1, 2017, 11:54
Default
  #10
New Member
 
Oğuzhan Demir
Join Date: Dec 2016
Posts: 18
Rep Power: 5
ddemiroguzhan is on a distinguished road
Quote:
Originally Posted by vcvedant View Post
Hello Oğuzhan,

How did you install it swak4Foam? can you post the link?

Thanks
I have installed it as explained in the following links, for openFoam 4.1.

https://openfoamwiki.net/index.php/I...opment_version

https://openfoamwiki.net/index.php/C...m/Installation

You may have problems regarding to bison, you can install it using the instructions also.

Oguzhan
ddemiroguzhan is offline   Reply With Quote

Reply

Tags
function, nonuniform, openfoam

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 90 October 3, 2019 08:01
cannot find grid field function in custom field function mehdiataei FLUENT 0 March 19, 2017 05:53
[snappyHexMesh] How to define to right point for locationInMesh Mirage12 OpenFOAM Meshing & Mesh Conversion 7 March 13, 2016 15:07
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 13:21
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 05:37


All times are GMT -4. The time now is 07:09.