1119 |
mopc1.translate(0.6,0,0) |
mopc1.translate(0.6,0,0) |
1120 |
\end{python} |
\end{python} |
1121 |
|
|
1122 |
|
\textsf{Reading Data Directly from Escript Objects} |
1123 |
|
|
1124 |
|
\begin{python} |
1125 |
|
# Import the necessary modules. |
1126 |
|
from esys.escript import * |
1127 |
|
from esys.escript.linearPDEs import LinearPDE |
1128 |
|
from esys.finley import Rectangle |
1129 |
|
from esys.pyvisi import Scene, DataCollector, Map, Camera |
1130 |
|
from esys.pyvisi.constant import * |
1131 |
|
import os |
1132 |
|
|
1133 |
|
PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images" |
1134 |
|
X_SIZE = 400 |
1135 |
|
Y_SIZE = 400 |
1136 |
|
JPG_RENDERER = Renderer.ONLINE_JPG |
1137 |
|
|
1138 |
|
#... Set some parameters ... |
1139 |
|
xc=[0.02,0.002] |
1140 |
|
r=0.001 |
1141 |
|
qc=50.e6 |
1142 |
|
Tref=0. |
1143 |
|
rhocp=2.6e6 |
1144 |
|
eta=75. |
1145 |
|
kappa=240. |
1146 |
|
tend=5. |
1147 |
|
# ... Time, time step size and counter ... |
1148 |
|
t=0 |
1149 |
|
h=0.1 |
1150 |
|
i=0 |
1151 |
|
|
1152 |
|
#... Generate domain ... |
1153 |
|
mydomain = Rectangle(l0=0.05,l1=0.01,n0=250, n1=50) |
1154 |
|
#... open PDE ... |
1155 |
|
mypde=LinearPDE(mydomain) |
1156 |
|
mypde.setSymmetryOn() |
1157 |
|
mypde.setValue(A=kappa*kronecker(mydomain),D=rhocp/h,d=eta,y=eta*Tref) |
1158 |
|
# ... Set heat source: .... |
1159 |
|
x=mydomain.getX() |
1160 |
|
qH=qc*whereNegative(length(x-xc)-r) |
1161 |
|
# ... set initial temperature .... |
1162 |
|
T=Tref |
1163 |
|
|
1164 |
|
# Create a Scene. |
1165 |
|
s = Scene(renderer = JPG_RENDERER, x_size = X_SIZE, y_size = Y_SIZE) |
1166 |
|
|
1167 |
|
# Create a DataCollector reading directly from escript objects. |
1168 |
|
dc = DataCollector(source = Source.ESCRIPT) |
1169 |
|
|
1170 |
|
# Create a Map. |
1171 |
|
m = Map(scene = s, data_collector = dc, \ |
1172 |
|
viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, \ |
1173 |
|
cell_to_point = False, outline = True) |
1174 |
|
|
1175 |
|
# Create a Camera. |
1176 |
|
c = Camera(scene = s, viewport = Viewport.SOUTH_WEST) |
1177 |
|
|
1178 |
|
# ... Start iteration: |
1179 |
|
while t<tend: |
1180 |
|
i+=1 |
1181 |
|
t+=h |
1182 |
|
mypde.setValue(Y=qH+rhocp/h*T) |
1183 |
|
T=mypde.getSolution() |
1184 |
|
|
1185 |
|
dc.setData(temp = T) |
1186 |
|
|
1187 |
|
# Render the object. |
1188 |
|
s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, \ |
1189 |
|
"diffusion%02d.jpg") % i) |
1190 |
|
\end{python} |
1191 |
|
|
1192 |
|
\newpage |
1193 |
|
|
1194 |
\section{Useful Keys} |
\section{Useful Keys} |
1195 |
This section shows some of the useful keys when interacting with the rendered |
This section shows some of the useful keys when interacting with the rendered |
1196 |
object. |
object. |
1197 |
|
|
1198 |
\begin{table}[h] |
\begin{table}[ht] |
1199 |
\begin{center} |
\begin{center} |
1200 |
\begin{tabular}{| c | p{13cm} |} |
\begin{tabular}{| c | p{13cm} |} |
1201 |
\hline |
\hline |
1220 |
Keypress 'w' & Modify the representation of the rendered object to wireframe. |
Keypress 'w' & Modify the representation of the rendered object to wireframe. |
1221 |
\\ \hline |
\\ \hline |
1222 |
\end{tabular} |
\end{tabular} |
1223 |
|
\caption{Useful keys} |
1224 |
\end{center} |
\end{center} |
1225 |
\end{table} |
\end{table} |
1226 |
|
|
1228 |
% ############################################################################ |
% ############################################################################ |
1229 |
|
|
1230 |
|
|
1231 |
|
\newpage |
1232 |
|
|
1233 |
\section{Sample Output} |
\section{Sample Output} |
1234 |
This section displays thumbnails of sample output. |
This section displays thumbnails of sample output. |
1235 |
|
|
1236 |
\begin{table}[h] |
\begin{table}[ht] |
1237 |
\begin{tabular}{c c c} |
\begin{tabular}{c c c} |
1238 |
\includegraphics[width=\thumbnailwidth]{figures/Map} & |
\includegraphics[width=\thumbnailwidth]{figures/Map} & |
1239 |
\includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneCut} & |
\includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneCut} & |