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 Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 31, 2017, 09:09
Exclamation Initialize a field with function
  #1
New Member
 
Oğuzhan Demir
Join Date: Dec 2016
Posts: 19
Rep Power: 9
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, 09:34
Default
  #2
New Member
 
Join Date: Mar 2015
Posts: 16
Rep Power: 11
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, 09:44
Default
  #3
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20
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, 11:06
Default
  #4
New Member
 
Oğuzhan Demir
Join Date: Dec 2016
Posts: 19
Rep Power: 9
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, 11:07
Default
  #5
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20
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, 11:09
Default
  #6
New Member
 
Oğuzhan Demir
Join Date: Dec 2016
Posts: 19
Rep Power: 9
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, 11:23
Default
  #7
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20
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, 04:31
Default
  #8
New Member
 
Oğuzhan Demir
Join Date: Dec 2016
Posts: 19
Rep Power: 9
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, 10:50
Default
  #9
Member
 
Vedamt Chittlangia
Join Date: Feb 2016
Posts: 64
Rep Power: 9
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, 10:54
Default
  #10
New Member
 
Oğuzhan Demir
Join Date: Dec 2016
Posts: 19
Rep Power: 9
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


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 91 December 21, 2022 04:50
cannot find grid field function in custom field function mehdiataei FLUENT 0 March 19, 2017 04:53
[snappyHexMesh] How to define to right point for locationInMesh Mirage12 OpenFOAM Meshing & Mesh Conversion 7 March 13, 2016 14:07
OpenFOAM static build on Cray XT5 asaijo OpenFOAM Installation 9 April 6, 2011 12:21
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 04:37


All times are GMT -4. The time now is 19:47.