|
[Sponsors] |
August 10, 2016, 13:20 |
timestep extraction for macro
|
#1 |
Senior Member
Manu Chakkingal
Join Date: Feb 2016
Location: Delft, Netherlands
Posts: 129
Rep Power: 10 |
Hello
I want to have a time weighted average of certain field. To do that I require the time step information .But for each time step a zone is created.But I am not able to extract the timestep array nor the solution time array of the zones . The timestep is required in place where SOLTIME is calculated but wrong output. SOLUTIONTIME :gives only the time of current frame but of no use when looped with zones.It still displaces the time of the active GUI. This part of macro is of interest to me..The whole macro can be seen below after the **** lines ------------------------------------------------------------------- $!LOOP |DN| $!ACTIVEFIELDZONES = [|ALOOP|] $!VARSET |SOLTIME|[|ALOOP|] = [|ALOOP|]|TIME| $!VarSet |ALOOP| += 1 $!ENDLOOP $!PAUSE "The soltime array is |SOLTIME| " $!LOOP |DN| $!ALTERDATA EQUATION = "{AVERAGE} = (1-|WEIGHT|)*{AVERAGE} + |WEIGHT|*V|AVEVAR|[|KLOOP|]" $!VarSet |KLOOP| += 1 $!VarSet |WEIGHT| =(1/(1+|SOLTIME|[|KLOOP|]-|SOLTIME|[|KLOOP|-1])) $!ENDLOOP ************************************************** **************************** #!MC 1410 #Macro for finding an average value for an IJ- or IJK-ordered zone. #------------------------------------------------------------------ #This macro creates a new variable that is set to the AVERAGE of a #chosen variable. This AVERAGE is calculated for all of the points in the #lowest ACTIVE zone in your dataset. This macro only works on I-, IJ-, #and IJK-ordered data. #This macro will NOT work properly if your zone is Finite Element. #To use this macro, do the following: #1. before running the macro, determine which zone you want to find #the average value for. In Plot Attributes, deactivate all zones lower #than the one you want to average. For example, if I want to find the average #Temparature value for zone 3, I would deactivate zones 1 and 2. #2. Run the macro. Enter the number of the variable you want to #average. For example, if you want to find the average of variable ##4: Temperature, enter '4'. #3. If you were not in 2D mode prior to running the macro, you will #need to switch back to your original frame mode by clicking on the #appropriate sidebar button after running the macro. $!GETUSERINPUT |AVEVAR| INSTRUCTIONS = "Enter the number of the variable to average." $!GETUSERINPUT |ZONEI| INSTRUCTIONS = "Enter the number of the ZONE to START averaging." $!GETUSERINPUT |ZONEL| INSTRUCTIONS = "Enter the number of the ZONE to STOP averaging." $!DRAWGRAPHICS FALSE $!ALTERDATA EQUATION = "{AVERAGE} = 0" $!FRAMEMODE = TWOD $!VarSet |KLOOP| = (|ZONEI|) $!VarSet |ALOOP| = (|ZONEI|) $!VarSet |DN| = (|ZONEL|-|ZONEI|+1) $!VarSet |WEIGHT| =1 $!LOOP |DN| $!ACTIVEFIELDZONES = [|ALOOP|] $!VARSET |SOLTIME|[|ALOOP|] = [|ALOOP|]|TIME| $!VarSet |ALOOP| += 1 $!ENDLOOP $!PAUSE "The soltime array is |SOLTIME| " $!LOOP |DN| $!ALTERDATA EQUATION = "{AVERAGE} = (1-|WEIGHT|)*{AVERAGE} + |WEIGHT|*V|AVEVAR|[|KLOOP|]" $!VarSet |KLOOP| += 1 $!VarSet |WEIGHT| =(1/(1+|SOLTIME|[|KLOOP|]-|SOLTIME|[|KLOOP|-1])) $!ENDLOOP $!GLOBALSCATTER VAR = |NUMVARS| $!DRAWGRAPHICS TRUE #$!PAUSE "The average Value of Variable |AVEVAR| is |MAXS|"
__________________
Regards Manu |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
error with smaller timestep ? | Thomas MADELEINE | FLUENT | 0 | August 8, 2016 14:02 |
Problem with an old Simulation | FrankW | CFX | 3 | February 8, 2016 05:28 |
Modifying sonicFoam to run with variable timestep - strange results | dalaron | OpenFOAM Programming & Development | 1 | September 2, 2013 08:21 |
Restart 2-way FSI with different timestep? | Lance | CFX | 10 | April 17, 2013 01:37 |
Timestep and Pressure Correction Relationship in SIMPLE | rks171 | Main CFD Forum | 23 | May 4, 2012 02:04 |