| | 97 | DrawPlots() |
| | 98 | }}} |
| | 99 | [[CollapsibleEnd]] |
| | 100 | [[CollapsibleStart(Average quantities over concentric spherical shells)]] |
| | 101 | {{{ |
| | 102 | ActivateDatabase("localhost:/media/grassdata/erica/from_bluehive/FinalRunsNewest/BP/chombo00046.hdf") |
| | 103 | filename = "average_vrad_00046.curve" |
| | 104 | DeleteActivePlots() |
| | 105 | AddPlot("Pseudocolor", "vrad", 1, 1) |
| | 106 | SetActivePlots(0) |
| | 107 | |
| | 108 | # inner_sphere(): |
| | 109 | AddOperator("Clip", 1) |
| | 110 | ClipAtts = ClipAttributes() |
| | 111 | ClipAtts.quality = ClipAtts.Fast # Fast, Accurate |
| | 112 | ClipAtts.funcType = ClipAtts.Sphere # Plane, Sphere |
| | 113 | ClipAtts.plane1Status = 1 |
| | 114 | ClipAtts.plane2Status = 0 |
| | 115 | ClipAtts.plane3Status = 0 |
| | 116 | ClipAtts.plane1Origin = (0, 0, 0) |
| | 117 | ClipAtts.plane2Origin = (0, 0, 0) |
| | 118 | ClipAtts.plane3Origin = (0, 0, 0) |
| | 119 | ClipAtts.plane1Normal = (1, 0, 0) |
| | 120 | ClipAtts.plane2Normal = (0, 1, 0) |
| | 121 | ClipAtts.plane3Normal = (0, 0, 1) |
| | 122 | ClipAtts.planeInverse = 0 |
| | 123 | ClipAtts.planeToolControlledClipPlane = ClipAtts.Plane1 # None, Plane1, Plane2, Plane3 |
| | 124 | ClipAtts.center = (0, 0, 0) |
| | 125 | ClipAtts.radius = 0.06 |
| | 126 | ClipAtts.sphereInverse = 1 |
| | 127 | SetOperatorOptions(ClipAtts, 1) |
| | 128 | DrawPlots() |
| | 129 | f = open(filename, "w") |
| | 130 | f.write("# average_vrad\n") |
| | 131 | #Query, write average: |
| | 132 | Query("Average Value") |
| | 133 | t2 = GetQueryOutputValue() |
| | 134 | str = "%25.15e %25.15e\n" %(ClipAtts.radius, t2) |
| | 135 | f.write(str) |
| | 136 | RemoveAllOperators(1) |
| | 137 | for i in range(48): |
| | 138 | dx=0.03 |
| | 139 | #inner sphere: |
| | 140 | AddOperator("Clip", 1) |
| | 141 | ClipAtts = ClipAttributes() |
| | 142 | ClipAtts.quality = ClipAtts.Fast # Fast, Accurate |
| | 143 | ClipAtts.funcType = ClipAtts.Sphere # Plane, Sphere |
| | 144 | ClipAtts.plane1Status = 1 |
| | 145 | ClipAtts.plane2Status = 0 |
| | 146 | ClipAtts.plane3Status = 0 |
| | 147 | ClipAtts.plane1Origin = (0, 0, 0) |
| | 148 | ClipAtts.plane2Origin = (0, 0, 0) |
| | 149 | ClipAtts.plane3Origin = (0, 0, 0) |
| | 150 | ClipAtts.plane1Normal = (1, 0, 0) |
| | 151 | ClipAtts.plane2Normal = (0, 1, 0) |
| | 152 | ClipAtts.plane3Normal = (0, 0, 1) |
| | 153 | ClipAtts.planeInverse = 0 |
| | 154 | ClipAtts.planeToolControlledClipPlane = ClipAtts.Plane1 # None, Plane1, Plane2, Plane3 |
| | 155 | ClipAtts.center = (0, 0, 0) |
| | 156 | ClipAtts.radius = 0.06 + i*dx |
| | 157 | ClipAtts.sphereInverse = 0 |
| | 158 | SetOperatorOptions(ClipAtts, 1) |
| | 159 | #Outer-sphere: |
| | 160 | AddOperator("Clip", 1) |
| | 161 | ClipAtts = ClipAttributes() |
| | 162 | ClipAtts.quality = ClipAtts.Fast # Fast, Accurate |
| | 163 | ClipAtts.funcType = ClipAtts.Sphere # Plane, Sphere |
| | 164 | ClipAtts.plane1Status = 1 |
| | 165 | ClipAtts.plane2Status = 0 |
| | 166 | ClipAtts.plane3Status = 0 |
| | 167 | ClipAtts.plane1Origin = (0, 0, 0) |
| | 168 | ClipAtts.plane2Origin = (0, 0, 0) |
| | 169 | ClipAtts.plane3Origin = (0, 0, 0) |
| | 170 | ClipAtts.plane1Normal = (1, 0, 0) |
| | 171 | ClipAtts.plane2Normal = (0, 1, 0) |
| | 172 | ClipAtts.plane3Normal = (0, 0, 1) |
| | 173 | ClipAtts.planeInverse = 0 |
| | 174 | ClipAtts.planeToolControlledClipPlane = ClipAtts.Plane1 # None, Plane1, Plane2, Plane3 |
| | 175 | ClipAtts.center = (0, 0, 0) |
| | 176 | ClipAtts.radius = 0.06 + (i+1)*dx |
| | 177 | ClipAtts.sphereInverse = 1 |
| | 178 | SetOperatorOptions(ClipAtts, 1) |
| | 179 | DrawPlots() |
| | 180 | Query("Average Value") |
| | 181 | t2 = GetQueryOutputValue() |
| | 182 | str = "%25.15e %25.15e\n" %(ClipAtts.radius, t2) |
| | 183 | #Not sure how to differentiate clips..., would like the outer radius |
| | 184 | f.write(str) |
| | 185 | RemoveAllOperators(1) |
| | 186 | f.close() |
| | 187 | DeleteAllPlots() |
| | 188 | OpenDatabase(filename) |
| | 189 | AddPlot("Curve", "average_vrad") |