CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

adding source term to interDyMFoam

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

Like Tree1Likes
  • 1 Post By ssss

Reply
 
LinkBack Thread Tools Display Modes
Old   September 2, 2014, 03:27
Default adding source term to interDyMFoam
  #1
New Member
 
esmaeil
Join Date: Jul 2013
Posts: 5
Rep Power: 5
agar_shod is on a distinguished road
I am new in openFoam programming.
I am going to add a source term in momentum equation in interDyMFoam which equation is shown in the picture.
as you can see there are different term which are in x and y directions ,the most important thing is the source term should be actived for x>x1 which x1 is an specific location in domain and the source term is dependent on x.
Is there any idea?
thanks a lot
Attached Images
File Type: jpg domain1.jpg (23.1 KB, 34 views)
File Type: png source.png (16.1 KB, 34 views)
agar_shod is offline   Reply With Quote

Old   September 2, 2014, 03:32
Default
  #2
Senior Member
 
anonymous
Join Date: Aug 2014
Posts: 198
Rep Power: 4
ssss is on a distinguished road
You could set a field name alphaSources, which should be 0 where you don't want to have the sources terms, and 1 if you want to have de sources. This can be done with groovyBC or funkySetFields , and you'll need to modify the createFields.H in the solver to read the new field

After that just multiply sources*alphaSources, taking care that both have the same type definition. You may have to play a bit with it.
Judy likes this.
ssss is offline   Reply With Quote

Old   September 2, 2014, 05:57
Default
  #3
New Member
 
esmaeil
Join Date: Jul 2013
Posts: 5
Rep Power: 5
agar_shod is on a distinguished road
thanks, its seems to be a good idea...
the variable Ca which defined in the picture is dependent to x. does openfoam recognize the x??? or should we have to define the x?? if yes how???
agar_shod is offline   Reply With Quote

Old   September 2, 2014, 06:38
Default
  #4
Senior Member
 
anonymous
Join Date: Aug 2014
Posts: 198
Rep Power: 4
ssss is on a distinguished road
Quote:
Originally Posted by agar_shod View Post
thanks, its seems to be a good idea...
the variable Ca which defined in the picture is dependent to x. does openfoam recognize the x??? or should we have to define the x?? if yes how???
You can define anote field with funkySetFields or setFields (search in google, there are tons of information).This utilities let you set the fields with conditionals, and you can access the position as you want (pos().x)
ssss is offline   Reply With Quote

Old   September 2, 2014, 10:34
Default
  #5
Senior Member
 
Jens Höpken
Join Date: Apr 2009
Location: Duisburg, Germany
Posts: 156
Rep Power: 9
jhoepken is on a distinguished road
Send a message via Skype™ to jhoepken
Have a look at fvOptions. I would select all relevant cells via a cellZone and then code my own fvOption, which can be added to the solver at runtime. If you hardcode that into the solver, you have to recompile it and have your own custom solver, which is not as versatile as the fvOptions approach.
__________________
Blog: sourceflux.de/blog
"The OpenFOAM Technology Primer": sourceflux.de/book
Twitter: @sourceflux_de
Interested in courses on OpenFOAM?
jhoepken is offline   Reply With Quote

Old   September 6, 2014, 03:11
Default
  #6
New Member
 
esmaeil
Join Date: Jul 2013
Posts: 5
Rep Power: 5
agar_shod is on a distinguished road
thanks for your attention
should I use funky set field in order to define two conditional function ?
how can I define two conditions in funkysetfields?
In all of examples which I have seen just one condition were set.
thanks in advance
agar_shod is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem adding a source term in interfoam's alphaEqn.H Quentin OpenFOAM Running, Solving & CFD 1 July 30, 2014 05:33
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 11:32
momentum source term zwdi FLUENT 13 December 5, 2013 18:58
Adding volumetric Source Term mohanamuraly OpenFOAM 0 May 17, 2009 22:00
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


All times are GMT -4. The time now is 13:10.