CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] storeOldTime() and groovyBC oldTime()

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

Like Tree4Likes
  • 2 Post By Tobi
  • 1 Post By Tobi
  • 1 Post By Tobi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 19, 2015, 12:31
Default storeOldTime() and groovyBC oldTime()
  #1
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hey all,

for a more complex boundary I need to know the previous mag of a vector field, to be able to compute the gradient (sign is important). For that I checked goovyBC and want to use oldTime(field). This is only working if the old field exist. In my case I get the same values for the old and actual value:

Code:
            "HF=sum(mag(heatFlux));"
            "oldHF=sum(mag(oldTime(heatFlux)));"
They are identical for each time steps which can not be possible (source of heat is powered off for example).

Therefore I implemented the following line in my code:
Code:
heatFlux.storeOldTime();
Compiled successfully but I still do not get different values!
Can somebody suggest something?

Thanks for any help.
rajibroy and Bana like this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   August 20, 2015, 03:23
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
It would be also possible if we can define a boolean in groovy that is not changing till some criterion is reached again.

Hence I am not getting a result with groovyBC, I will code this into my solver and create a variable that can be called by groovyBC.
Bana likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   August 20, 2015, 10:25
Default
  #3
Senior Member
 
Saideep
Join Date: Apr 2015
Location: INDIA
Posts: 203
Rep Power: 11
Saideep is on a distinguished road
Hi Tobi;

To have the previous time step variable value i guess the oldTime() function could be used.

Saideep
Saideep is offline   Reply With Quote

Old   August 20, 2015, 10:51
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

thanks for the replay.
As I showed in the first post, the values were the same:

Code:
"new=max(magHeatFlux);"
"old=max(oldTime(magHeatFlux);"
With the debug flag on, it gave me identical values.
Anyway. I solved this problem now using C++ in the solver. Here I generated a new register field on which groovy has access. Its like a switch and in groovy I have no access like:

Code:
"TonOff=max(Ton);"
Where Ton is set in the *.C file of my solver.
Unfortunatelly Ton is a volScalarField at the moment that stores 0 or 1 (for all cells). Its working fine but the better way would be to generate a registry object as bool or scalar and use that to access in groovy. But at the moment I have no time to figure out how to create a registry booleans / scalar.
Bana likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   August 20, 2015, 11:59
Default
  #5
Senior Member
 
Saideep
Join Date: Apr 2015
Location: INDIA
Posts: 203
Rep Power: 11
Saideep is on a distinguished road
Hi,

Just wanted to know why you are using max function for all the variables?

Saideep
Saideep is offline   Reply With Quote

Reply

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



All times are GMT -4. The time now is 03:31.