|
[Sponsors] |
[swak4Foam] storeOldTime() and groovyBC oldTime() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 19, 2015, 11:31 |
storeOldTime() and groovyBC oldTime()
|
#1 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
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)));" Therefore I implemented the following line in my code: Code:
heatFlux.storeOldTime(); Can somebody suggest something? Thanks for any help.
__________________
Keep foaming, Tobias Holzmann |
|
August 20, 2015, 02:23 |
|
#2 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
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.
__________________
Keep foaming, Tobias Holzmann |
|
August 20, 2015, 09:25 |
|
#3 |
Senior Member
Saideep
Join Date: Apr 2015
Location: INDIA
Posts: 203
Rep Power: 12 |
Hi Tobi;
To have the previous time step variable value i guess the oldTime() function could be used. Saideep |
|
August 20, 2015, 09:51 |
|
#4 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
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);" 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);" 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.
__________________
Keep foaming, Tobias Holzmann |
|
August 20, 2015, 10:59 |
|
#5 |
Senior Member
Saideep
Join Date: Apr 2015
Location: INDIA
Posts: 203
Rep Power: 12 |
Hi,
Just wanted to know why you are using max function for all the variables? Saideep |
|
|
|