diff --git a/README.md b/README.md index 9f22cae..cd0d7be 100644 --- a/README.md +++ b/README.md @@ -212,13 +212,13 @@ in the terminal. Remote execution on Berkeley HPC (Savio) requires running sbatch saviojob.sh ``` -The data will be saved as VTK files. The file named as ```_.vtk``` stores potential, field (RF only), and field square (RF only). The file named as ```__mesh.vtk``` stores the charge distribution, and the final mesh after adaptive mesh during simulation. +The data will be saved as VTK files. The file named as ```_.vtk``` stores potential, field (RF only), and field square (RF only). The file named as ```__mesh.vtk``` stores the charge distribution, and the final mesh after adaptive mesh during simulation. ### 4. Result analysis
Lastly, after we get the results, we can visualize the result by simply calling ``` -Result.view(prefix, '') +Result.view(prefix, '') ``` For example, if we want to visualize the field square of the SimpleTrap's RF electrode, we can simply call ```Result.view(prefix, 'RF')``` in the same folder as the result VTK files. Here is the visualization example diff --git a/bem/area_constraints.py b/bem/area_constraints.py index a97dbb0..45ad0ff 100644 --- a/bem/area_constraints.py +++ b/bem/area_constraints.py @@ -34,14 +34,12 @@ def __init__(self, start, end, radius, *a, **k): def lookup(self, x): # http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html - print((self.start-x).shape) d = np.linalg.norm(np.cross(self.start-x, self.end-x), axis=1)/np.linalg.norm(self.end-self.start) dmax = np.sqrt(np.linalg.norm(self.start-self.end)**2 + self.radius**2) dx1 = np.linalg.norm(self.start - x, axis=1) dx2 = np.linalg.norm(self.end - x, axis=1) # return np.where((d\n" + "Starting 16 engines with \n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "INFO:ipyparallel.cluster.cluster.1666855509-orme:Starting 8 engines with \n" + "INFO:ipyparallel.cluster.cluster.1666995915-liwq:Starting 16 engines with \n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "5a24adaf80f940d6ab0c1bbd6ee51211", + "model_id": "e2c2a6cecbd8427c9f0c9746e6608f4d", "version_major": 2, "version_minor": 0 }, "text/plain": [ - " 0%| | 0/8 [00:00_.vtk``` and ```__mesh.vtk```, are in the same directory as the code. Also don't remember to put the base mesh ```_mesh.vtk``` in the same folder.\n", + "\n", + "Result view inlcudes charge distribution, potential/field_square contours." ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 10, "id": "8b0925f3-61b3-42b9-8028-c84abb6cb33d", "metadata": {}, "outputs": [], @@ -419,7 +591,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 11, "id": "c8e64059-24dc-4a9c-8d50-27b4f388ca88", "metadata": {}, "outputs": [], @@ -437,7 +609,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "9f837b51-4b0f-4ba0-b6e5-9b894c5ccadc", "metadata": {}, "outputs": [], @@ -450,17 +622,118 @@ "id": "9275120d-072b-46da-b8c6-76043a1cf716", "metadata": {}, "source": [ - "# Load result" + "# `IV. Load result for analysis`\n", + "\n", + "All analysis are intended to be done outside of the simulation file. Here shows how to access the simulated data, such as potential (DC and RF), field (RF only), field square (RF only), for each electrode." ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 13, "id": "4da591e3-db45-4090-98a3-25ce564e2034", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "array([[[0.29602049, 0.20908952, 0.15270445, ..., 0.0081563 ,\n", + " 0.0076957 , 0.00727314],\n", + " [0.32986564, 0.22669958, 0.16191063, ..., 0.00824515,\n", + " 0.00779002, 0.00737097],\n", + " [0.35066552, 0.23678475, 0.16634174, ..., 0.0083209 ,\n", + " 0.00787349, 0.0074599 ],\n", + " ...,\n", + " [0.33296267, 0.22118485, 0.15304576, ..., 0.01101531,\n", + " 0.01051962, 0.01004972],\n", + " [0.33107613, 0.22497251, 0.15900469, ..., 0.01126803,\n", + " 0.01074391, 0.01025011],\n", + " [0.31920493, 0.22244071, 0.16108435, ..., 0.01151763,\n", + " 0.01096633, 0.01044903]],\n", + "\n", + " [[0.29501693, 0.20868764, 0.15255272, ..., 0.00815696,\n", + " 0.0076965 , 0.00727403],\n", + " [0.32900035, 0.22638087, 0.16180271, ..., 0.00824572,\n", + " 0.00779075, 0.00737185],\n", + " [0.35000655, 0.23655553, 0.16628435, ..., 0.00832137,\n", + " 0.00787412, 0.00746071],\n", + " ...,\n", + " [0.3331624 , 0.22127416, 0.15309373, ..., 0.0110143 ,\n", + " 0.01051858, 0.01004873],\n", + " [0.33125041, 0.22505041, 0.15903744, ..., 0.0112667 ,\n", + " 0.0107429 , 0.01024916],\n", + " [0.31427077, 0.22021981, 0.15966461, ..., 0.01151651,\n", + " 0.01096513, 0.01044803]],\n", + "\n", + " [[0.29407397, 0.20839777, 0.15247447, ..., 0.00815764,\n", + " 0.00769728, 0.00727487],\n", + " [0.32819762, 0.22616496, 0.16176069, ..., 0.00824634,\n", + " 0.00779146, 0.00737263],\n", + " [0.34938998, 0.23641893, 0.16627903, ..., 0.00832193,\n", + " 0.00787476, 0.0074614 ],\n", + " ...,\n", + " [0.33332176, 0.22137719, 0.15314227, ..., 0.01101316,\n", + " 0.01051769, 0.01004783],\n", + " [0.41564396, 0.25487628, 0.16711187, ..., 0.01126544,\n", + " 0.01074176, 0.01024829],\n", + " [0.31438244, 0.22028103, 0.15969845, ..., 0.01151513,\n", + " 0.01096388, 0.01044699]],\n", + "\n", + " ...,\n", + "\n", + " [[0.29440461, 0.20857692, 0.15258303, ..., 0.00815963,\n", + " 0.00769907, 0.00727646],\n", + " [0.32833701, 0.22624301, 0.16181158, ..., 0.00824828,\n", + " 0.00779298, 0.007374 ],\n", + " [0.34931039, 0.23637803, 0.16626518, ..., 0.00832358,\n", + " 0.00787623, 0.00746282],\n", + " ...,\n", + " [0.33392138, 0.22171341, 0.15329234, ..., 0.01100632,\n", + " 0.0105118 , 0.01004296],\n", + " [0.44516375, 0.28576752, 0.19368984, ..., 0.01125869,\n", + " 0.01073611, 0.0102435 ],\n", + " [0.31578175, 0.22088898, 0.15995597, ..., 0.01150834,\n", + " 0.01095829, 0.01044228]],\n", + "\n", + " [[0.29569508, 0.20907355, 0.15278628, ..., 0.00815929,\n", + " 0.00769859, 0.00727585],\n", + " [0.32947095, 0.22667806, 0.16198554, ..., 0.00824799,\n", + " 0.00779259, 0.00737343],\n", + " [0.35019621, 0.23671306, 0.16639166, ..., 0.00832335,\n", + " 0.00787583, 0.00746237],\n", + " ...,\n", + " [0.33379646, 0.22163655, 0.15325252, ..., 0.01100715,\n", + " 0.01051263, 0.01004353],\n", + " [0.33234261, 0.22555919, 0.15924789, ..., 0.01125968,\n", + " 0.01073693, 0.01024417],\n", + " [0.31573034, 0.22084966, 0.15993239, ..., 0.01150997,\n", + " 0.01095922, 0.01044303]],\n", + "\n", + " [[0.29705451, 0.20967617, 0.15306292, ..., 0.00815894,\n", + " 0.00769799, 0.00727509],\n", + " [0.33070113, 0.22720135, 0.16222113, ..., 0.00824761,\n", + " 0.00779215, 0.0073729 ],\n", + " [0.35118854, 0.23713188, 0.16657457, ..., 0.00832315,\n", + " 0.00787545, 0.0074617 ],\n", + " ...,\n", + " [0.33356024, 0.22153048, 0.15318983, ..., 0.01100786,\n", + " 0.01051346, 0.01004436],\n", + " [0.40250648, 0.26222798, 0.17994094, ..., 0.01126098,\n", + " 0.01073781, 0.01024487],\n", + " [0.31553337, 0.22076307, 0.15989186, ..., 0.01151104,\n", + " 0.01096048, 0.0104439 ]]])" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "rf_result = Result.from_vtk(prefix, 'RF')" + "rf_result = Result.from_vtk(prefix, 'RF')\n", + "rf_result.grid.to_xyz() # access the (x, y, z) coordinates\n", + "rf_result.potential # access the simulated potential data\n", + "rf_result.field # access the simulated field data\n", + "rf_result.field_square # access the simulated field_square data" ] }, { diff --git a/examples/SimpleTrap/SimpleTrap_DC1.vtk b/examples/SimpleTrap/SimpleTrap_DC1.vtk index e5d6acb..14b9c58 100644 Binary files a/examples/SimpleTrap/SimpleTrap_DC1.vtk and b/examples/SimpleTrap/SimpleTrap_DC1.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_DC1_mesh.vtk b/examples/SimpleTrap/SimpleTrap_DC1_mesh.vtk index e1ffcc5..211c62f 100644 Binary files a/examples/SimpleTrap/SimpleTrap_DC1_mesh.vtk and b/examples/SimpleTrap/SimpleTrap_DC1_mesh.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_DC2.vtk b/examples/SimpleTrap/SimpleTrap_DC2.vtk index 1a5dbab..2b80082 100644 Binary files a/examples/SimpleTrap/SimpleTrap_DC2.vtk and b/examples/SimpleTrap/SimpleTrap_DC2.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_DC2_mesh.vtk b/examples/SimpleTrap/SimpleTrap_DC2_mesh.vtk index 9123ae9..444391a 100644 Binary files a/examples/SimpleTrap/SimpleTrap_DC2_mesh.vtk and b/examples/SimpleTrap/SimpleTrap_DC2_mesh.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_DC3.vtk b/examples/SimpleTrap/SimpleTrap_DC3.vtk index 1d792d3..3b4b9f7 100644 Binary files a/examples/SimpleTrap/SimpleTrap_DC3.vtk and b/examples/SimpleTrap/SimpleTrap_DC3.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_DC3_mesh.vtk b/examples/SimpleTrap/SimpleTrap_DC3_mesh.vtk index be6b69f..16050f5 100644 Binary files a/examples/SimpleTrap/SimpleTrap_DC3_mesh.vtk and b/examples/SimpleTrap/SimpleTrap_DC3_mesh.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_DC4.vtk b/examples/SimpleTrap/SimpleTrap_DC4.vtk index 5b56ae4..9060919 100644 Binary files a/examples/SimpleTrap/SimpleTrap_DC4.vtk and b/examples/SimpleTrap/SimpleTrap_DC4.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_DC4_mesh.vtk b/examples/SimpleTrap/SimpleTrap_DC4_mesh.vtk index 14d221e..50f1f80 100644 Binary files a/examples/SimpleTrap/SimpleTrap_DC4_mesh.vtk and b/examples/SimpleTrap/SimpleTrap_DC4_mesh.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_DC5.vtk b/examples/SimpleTrap/SimpleTrap_DC5.vtk index c5e1478..61fc137 100644 Binary files a/examples/SimpleTrap/SimpleTrap_DC5.vtk and b/examples/SimpleTrap/SimpleTrap_DC5.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_DC5_mesh.vtk b/examples/SimpleTrap/SimpleTrap_DC5_mesh.vtk index 998132c..605fffc 100644 Binary files a/examples/SimpleTrap/SimpleTrap_DC5_mesh.vtk and b/examples/SimpleTrap/SimpleTrap_DC5_mesh.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_RF.vtk b/examples/SimpleTrap/SimpleTrap_RF.vtk index 9c09a53..04761e7 100644 Binary files a/examples/SimpleTrap/SimpleTrap_RF.vtk and b/examples/SimpleTrap/SimpleTrap_RF.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_RF_mesh.vtk b/examples/SimpleTrap/SimpleTrap_RF_mesh.vtk index 2607fc9..809112c 100644 Binary files a/examples/SimpleTrap/SimpleTrap_RF_mesh.vtk and b/examples/SimpleTrap/SimpleTrap_RF_mesh.vtk differ diff --git a/examples/SimpleTrap/SimpleTrap_mesh.vtk b/examples/SimpleTrap/SimpleTrap_mesh.vtk index 6f1f33c..4ded886 100644 Binary files a/examples/SimpleTrap/SimpleTrap_mesh.vtk and b/examples/SimpleTrap/SimpleTrap_mesh.vtk differ