-
Notifications
You must be signed in to change notification settings - Fork 8
Test Cases ucvm2mesh mpi
There mpi versions of mesh building utilities. ucvm2mesh_mpi and ucvm2mesh_mpi_layer utilities are advanced features of ucvm and the documentation is limited. In this section, we describe several details that may help these advanced users get useful results from these codes.
- there a manual pages for many of the codes https://github.com/SCECcode/UCVMC/wiki/Manual-Pages
- there are working examples in the UCMC src codes https://github.com/SCECcode/UCVMC/examples/programs/mesh
- there is a compiled in 10000 node limit
- mesh format ijk32 includes qp, and qs values based on this formula /* Qp/Qs via Kim Olsen */
qs = 50.0 * (vs / 1000.0); qp = 2.0 * qs;
- If the mesh types is invalid (e.g. missing dash), it runs, but never returns a mesh.
- output file creates a useful summary about the mesh which includes:
[0] Max Vp: 8530.947266 at [0] i,j,k : 237, 53, 14 [0] Max Vs: 5225.743652 at [0] i,j,k : 237, 54, 13 [0] Max Rho: 3174.164062 at [0] i,j,k : 119, 60, 15 [0] Min Vp: 500.000000 at [0] i,j,k : 127, 58, 0 [0] Min Vs: 500.000000 at [0] i,j,k : 127, 58, 0 [0] Min Rho: 1909.786255 at [0] i,j,k : 204, 110, 0 [0] Min Ratio: 1.000000 at [0] i,j,k : 127, 58, 0
- If none of velocity model had data for a query point, ucvm2mesh_mpi exited with an error. For this reason, when querying cvms5 (aka cvm-s4.26 which has no background model) we needed to add a background model in our model list, to build our example meshes.
Confirm that the ucvm2mesh and ucvm2mesh-mpi produce the same results. Then print the mesh point using dumpgrid.py and compare the media files using diff.
Config: small region, no rotation, x=40,y=20,z=10 ,vertex center, 8000 pts, 1km spacing
The dumpgrid.py files are compared and there are no differences. The *.media files are compared and there are no differences.
Determine impact of center, and vertex settings. The Vertex setting sets the origin at exactly the given point, while Center setting moves the lat/lon point to the center of the cell and queries properties there. Show that the query point changes slightly depending in this setting
Config A: small region, no rotation, x=40,y=20,z=10 ,vertex center, 1km spacing with origin at 34, -118.0
The number of mesh points is the same for Center or Vertex. The dumpgrid.py shows that the mesh points are slightly different. The results also show the indices order in the output file with fast x, y, z
Center result:
0, 0 : -117.994639, 34.004553 1, 0 : -117.983811, 34.004640 2, 0 : -117.972984, 34.004726
Vertex result:
0, 0 : -118.000000, 34.000000 1, 0 : -117.989173, 34.000088 2, 0 : -117.978346, 34.000174
Establish the the x, y directions, with and without rotation. Run two small meshes, one rotation negative 90, and another rotation postive 90 degrees with Config A.
no rotation end points:
0, 0 : -117.994639, 34.004553 39, 19 : -117.573488, 34.178591
negative 90 rotation end points:
0, 0 : -117.994534, 33.995535 39, 19 : -117.785601, 33.64531
postive 90 rotation end points:
0, 0 : -118.005467, 34.004465 39, 19 : -118.216216, 34.354259
As expected, the three end points form right angles, but they do not look east/west or north/south as expected. Possibly the projection is making these look like they are not east/west, but this is what we got.
Negative rotation is clockwise, which is consistent with the source code comments that say “ proj rotation angle in degrees, (+ is counter-clockwise)”
Determine the impact of the ijk12, ijk32 options testing either IJK-12, IJK-20, IJK-32, or SORD format. Compare size of grid files from ijk-12 and ijk-32 to start and then SORD format
On completion output file sizes are:
-rw-r--r-- 1 maechlin scec 19K Mar 29 22:00 mesh_cvms5_ijk12_1000m_mpi.grid -rw-r--r-- 1 maechlin scec 94K Mar 29 22:00 mesh_cvms5_ijk12_1000m_mpi.media -rw-r--r-- 1 maechlin scec 19K Mar 29 22:02 mesh_cvms5_ijk32_1000m_mpi.grid -rw-r--r-- 1 maechlin scec 250K Mar 29 22:02 mesh_cvms5_ijk32_1000m_mpi.media -rw-r--r-- 1 maechlin scec 19K Mar 29 22:04 mesh_cvms5_sord_1000m_mpi.grid -rw-r--r-- 1 maechlin scec 32K Mar 29 22:05 mesh_cvms5_sord_1000m_mpi.media_rho -rw-r--r-- 1 maechlin scec 32K Mar 29 22:05 mesh_cvms5_sord_1000m_mpi.media_vp -rw-r--r-- 1 maechlin scec 32K Mar 29 22:05 mesh_cvms5_sord_1000m_mpi.media_vs
Determine what happens if the mesh requests material properties from an undefined region. Indications are mesh extraction exits Extract a mesh, with and without a background model. The background model test completes successfully.
Extract from cvms5 and then from cvms5,1d. The first extraction exits after building the grid file. The second extraction, the one with 1D background model completes successfully.
Confirm that a model with a background model extracts without existing. Use cvmsi as models. Extraction completed without error, so models with background model complete without errors.
Check the impact of setting min Vp and min Vs values. Run a model, with low VS values, with the min VS in ucvm2mesh.conf to 0, which should turn off min Vs then use the minVs report in the ucvm2mesh output file to identify the min VS in the mesh.
With MinVS and MinVS to to 0 (updated ucvm2mesh.conf to set min vp and min vs to 0) [0] Max Vp: 8530.947266 at [0] i,j,k : 237, 53, 14 [0] Max Vs: 5225.743652 at [0] i,j,k : 237, 54, 13 [0] Max Rho: 3174.164062 at [0] i,j,k : 119, 60, 15 [0] Min Vp: 283.636932 at [0] i,j,k : 204, 110, 0 [0] Min Vs: 138.720001 at [0] i,j,k : 194, 82, 0 [0] Min Rho: 1909.786255 at [0] i,j,k : 204, 110, 0 [0] Min Ratio: 1.414214 at [0] i,j,k : 125, 62, 0
With MinVS and MinVP set to 200 (This result re-used from test case 6)
[0] Max Vp: 8530.947266 at [0] i,j,k : 237, 53, 14 [0] Max Vs: 5225.743652 at [0] i,j,k : 237, 54, 13 [0] Max Rho: 3174.164062 at [0] i,j,k : 119, 60, 15 [0] Min Vp: 200.000000 at [0] i,j,k : 127, 58, 0 [0] Min Vs: 200.000000 at [0] i,j,k : 127, 58, 0 [0] Min Rho: 1909.786255 at [0] i,j,k : 204, 110, 0 [0] Min Ratio: 1.000000 at [0] i,j,k : 127, 58, 0
For the top case, it looks like the min Vp is above 200m/s. the min Vs is 194 which should be removed if min Vs is set to 200.
In the second case, the min Vs is set to 200. However the min Vp is also set to 200. So, this shows there are rules in ucvm min Vs processing that maintains a reasonable Vp, Vs ratio, which is: /* Apply min Vs */
if (vs < vs_min) { vs = vs_min; vp = vp_min; }
Describe the differences between the data formats IJK12, IJK20, IJK32, and SORD
#define MAX_MESH_FORMATS 5 typedef enum mesh_format_t { MESH_FORMAT_UNKNOWN = 0, MESH_FORMAT_IJK12, MESH_FORMAT_IJK20, MESH_FORMAT_IJK32, MESH_FORMAT_SORD} mesh_format_t; extern const int MESH_FORMAT_LENS[MAX_MESH_FORMATS]; extern const char* MESH_FORMAT_NAMES[MAX_MESH_FORMATS];
typedef struct mesh_ijk32_t { int i; int j; int k; float vp; float vs; float rho; float qp; float qs; } mesh_ijk32_t;
typedef struct mesh_ijk20_t { float vp; float vs; float rho; float qp; float qs; } mesh_ijk20_t;
typedef struct mesh_ijk12_t { float vp; float vs; float rho; } mesh_ijk12_t;
typedef struct mesh_sord_t { float val; } mesh_sord_t;
Then the write statements are:
case MESH_FORMAT_IJK12: ptr1_ijk12 = (mesh_ijk12_t *)node_buf_serial1; for (i = 0; i < node_count; i++) { ptr1_ijk12[i].vp = nodes[i].vp; ptr1_ijk12[i].vs = nodes[i].vs; ptr1_ijk12[i].rho = nodes[i].rho; } if (fwrite(node_buf_serial1, meshrecsize_serial, node_count, meshfp1) != node_count) { fprintf(stderr, "Failed to write to mesh file\n"); return(1); } break; case MESH_FORMAT_IJK20: ptr1_ijk20 = (mesh_ijk20_t *)node_buf_serial1; for (i = 0; i < node_count; i++) { ptr1_ijk20[i].vp = nodes[i].vp; ptr1_ijk20[i].vs = nodes[i].vs; ptr1_ijk20[i].rho = nodes[i].rho; ptr1_ijk20[i].qp = nodes[i].qp; ptr1_ijk20[i].qs = nodes[i].qs; } if (fwrite(node_buf_serial1, meshrecsize_serial, node_count, meshfp1) != node_count) { fprintf(stderr, "Failed to write to mesh file\n"); return(1); } break; case MESH_FORMAT_IJK32: ptr1_ijk32 = (mesh_ijk32_t *)node_buf_serial1; for (i = 0; i < node_count; i++) { ptr1_ijk32[i].i = nodes[i].i; ptr1_ijk32[i].j = nodes[i].j; ptr1_ijk32[i].k = nodes[i].k; ptr1_ijk32[i].vp = nodes[i].vp; ptr1_ijk32[i].vs = nodes[i].vs; ptr1_ijk32[i].rho = nodes[i].rho; ptr1_ijk32[i].qp = nodes[i].qp; ptr1_ijk32[i].qs = nodes[i].qs; } if (fwrite(node_buf_serial1, meshrecsize_serial, node_count, meshfp1) != node_count) { fprintf(stderr, "Failed to write to mesh file\n"); return(1); } break; case MESH_FORMAT_SORD: ptr1_sord = (mesh_sord_t *)node_buf_serial1; ptr2_sord = (mesh_sord_t *)node_buf_serial2; ptr3_sord = (mesh_sord_t *)node_buf_serial3; for (i = 0; i < node_count; i++) { ptr1_sord[i].val = nodes[i].vp; ptr2_sord[i].val = nodes[i].vs; ptr3_sord[i].val = nodes[i].rho; }
We tested whether changing the UTM project from Zone 11 to Zone 10 would generate a different set of Lat/Lons in a ucvm mesh. Using ucvm2mesh-mpi, we setup a small problem and ran identical meshes, changing only the utm zone in the projection specification. Using the dumpgrid.py utility and the output *.grid file, we see that the lat/lon points do differ. See points below:
-bash-4.2$ more dump_utm11_small.txt 0, 0 : -117.994639, 34.004553 1, 0 : -117.983811, 34.004640 2, 0 : -117.972984, 34.004726 3, 0 : -117.962156, 34.004811 4, 0 : -117.951328, 34.004895 5, 0 : -117.940501, 34.004979 6, 0 : -117.929673, 34.005061 7, 0 : -117.918845, 34.005142 8, 0 : -117.908017, 34.005223 9, 0 : -117.897189, 34.005302 10, 0 : -117.886361, 34.005381 11, 0 : -117.875533, 34.005458 12, 0 : -117.864705, 34.005535 13, 0 : -117.853877, 34.005610 14, 0 : -117.843049, 34.005685 15, 0 : -117.832221, 34.005759 16, 0 : -117.821392, 34.005832 17, 0 : -117.810564, 34.005903 18, 0 : -117.799736, 34.005974 19, 0 : -117.788907, 34.006044 20, 0 : -117.778079, 34.006113 21, 0 : -117.767251, 34.006181 22, 0 : -117.756422, 34.006248 23, 0 : -117.745594, 34.006314 24, 0 : -117.734765, 34.006380 25, 0 : -117.723937, 34.006444 26, 0 : -117.713108, 34.006507 27, 0 : -117.702279, 34.006569 28, 0 : -117.691451, 34.006631 29, 0 : -117.680622, 34.006691 30, 0 : -117.669793, 34.006751 31, 0 : -117.658965, 34.006809 32, 0 : -117.648136, 34.006867 33, 0 : -117.637307, 34.00692 -bash-4.2$ more dump_utm10_small.txt 0, 0 : -117.994342, 34.004272 1, 0 : -117.983555, 34.003832 2, 0 : -117.972767, 34.003390 3, 0 : -117.961980, 34.002948 4, 0 : -117.951193, 34.002504 5, 0 : -117.940406, 34.002060 6, 0 : -117.929620, 34.001615 7, 0 : -117.918834, 34.001169 8, 0 : -117.908048, 34.000721 9, 0 : -117.897262, 34.000273 10, 0 : -117.886477, 33.999824 11, 0 : -117.875691, 33.999374 12, 0 : -117.864906, 33.998923 13, 0 : -117.854122, 33.998471 14, 0 : -117.843337, 33.998019 15, 0 : -117.832553, 33.997565 16, 0 : -117.821769, 33.997110 17, 0 : -117.810985, 33.996655 18, 0 : -117.800201, 33.996198 19, 0 : -117.789418, 33.995741 20, 0 : -117.778635, 33.995282 21, 0 : -117.767852, 33.994823 22, 0 : -117.757070, 33.994362 23, 0 : -117.746287, 33.993901 24, 0 : -117.735505, 33.993439 25, 0 : -117.724723, 33.992976 26, 0 : -117.713942, 33.992512 27, 0 : -117.703160, 33.992047 28, 0 : -117.692379, 33.991581 29, 0 : -117.681598, 33.991114 30, 0 : -117.670818, 33.990646 31, 0 : -117.660037, 33.990177 32, 0 : -117.649257, 33.989708 33, 0 : -117.638477, 33.989237
Test mesh_check. It checks to make sure that each record in the file is of the correct size. Furthermore, it checks to make sure that each value is not NaN, infinity, or negative.
printf("Usage: %s input format\n\n",arg); printf("input: path to the input file\n"); printf("format: format of file, IJK-12, IJK-20, IJK-32\n\n");
We generated a mesh and ran mesh_check and it returned:
-bash-4.2$ ../ucvmc/bin/mesh-check mesh_cvmsi_ijk32_2000m_mpi.media IJK-32 Record size is 32 bytes Opening input file mesh_cvmsi_ijk32_2000m_mpi.media Checked 2380800 vals total
This correctly matches the number of nodes product (384 * 248 * 25) = 2380800
Meshing utilities in UCVM include
- mesh_strip field from ijk32 to make an ijk12 output file.
- mesh_op seems to combine (or difference) two meshes
- mesh_check will look for negative values and other problems
This wiki is licensed by University of Southern California (USC) to the public under a Creative Commons Attribution 4.0 license.