-
Notifications
You must be signed in to change notification settings - Fork 11
/
archiveMeshingSV2.html
1135 lines (875 loc) · 79.2 KB
/
archiveMeshingSV2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>SimVascular Docs</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="css/shop-item.css" rel="stylesheet" type="text/css" />
<link href="css/codestyle.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="font-awesome-4.1.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css">
<link rel="shortcut icon" href="img/favicon.ico">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse">
<i class="fa fa-bars" id="barIcon"></i>
</button>
<a class="navbar-brand" id="brandName" href="index.html">
<img src="img/svlogo/svLogoSmallText.png" alt="...">
</a>
<a class="navbar-brand page-scroll">
2.0
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-right navbar-main-collapse">
<ul class="nav navbar-nav">
<!-- USER GUIDES -->
<li>
<a href="#" id="dropdownMenu1" data-toggle="dropdown">
<b><span class="fa fa-user"></span> User Guides </b>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveInstallationSV2.html"><b><span class="fa fa-sign-in fa-rotate-90"></span> Installation</b></a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveQuickGuideSV2.html"><b><span class="icon ion-ios7-bolt"></span> Quick Guide</b></a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveImageGuideSV2.html"><b><span class="icon ion-settings"></span> Image Visualization</b></a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveModelGuideSV2.html"><b><span class="icon ion-settings"></span> Modeling</b></a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveMeshingSV2.html"><b><span class="icon ion-ios7-keypad"></span> Meshing</b></a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveFlowSolverSV2.html"><b><span class="icon ion-play"></span> Simulation</b></a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveCodeSnippetsSV2.html"><b><span class="icon ion-play"></span> Code Snippets</b></a></li>
</ul>
</li>
<!-- Latest version -->
<li>
<a href="docsQuickGuide.html" id="dropdownMenu1" >
<b>Back To Lastest Version</b>
</a>
</li>
<!-- <li><a href="docsQuickGuide.html" id="btnQuickGuide"><b><span class="icon ion-ios7-bolt"></span> Quick Guide</b></a></li>
<li><a href="docsModelGuide.html" id="btnModelGuide"><b><span class="icon ion-settings"></span> Modeling</b></a></li>
<li><a href="docsMeshing.html" id="btnMeshing"><b><span class="icon ion-ios7-keypad"></span> Meshing</b></a></li>
<li><a href="docsPresolver.html" id="btnPresolver"><b><span class="icon ion-log-in"></span> svPre</b></a></li>
<li><a href="docsFlowSolver.html" id="btnFlowSolver"><b><span class="icon ion-play"></span> svSolver</b></a></li>
<li><a href="docsRefs.html" id="btnRefs"><b><span class="icon ion-document-text"></span> References</b></a></li>
<li><a href="clinicalCase1.html" id="btnRefs"><b>Case Studies</b></a></li> -->
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Page Content -->
<!--Nav Bar -->
<div class="row">
<div class="col-xs-1 col-sm-1 hidden-md hidden-lg">
</div>
<!-- ONE COLUMN OF SPACE -->
<nav class="hidden-xs hidden-sm col-md-2 col-lg-2 bs-docs-sidebar">
<ul id="sidebar" class="nav nav-stacked fixed manMeshingSV2"> <p><h3>Meshing Guide</h3></p>
<li><a href="#meshSec1">Introduction</a></li>
<li><a href="#meshSec2">MeshSim Meshing</a>
<ul class="nav nav-stacked">
<li><a href="#meshSec2">MeshSim Overview</a></li>
<li><a href="#meshSec3">Isotropic Meshing</a></li>
<li><a href="#meshSec4">Local Mesh Refinement</a></li>
<li><a href="#meshSec5">Boundary Layer Meshing</a></li>
<li><a href="#meshSec6">Spherical and Cylindrical <br>Refinement</a></li>
</ul>
</li>
<li><a href="#meshSec7">TetGen Meshing</a>
<ul class="nav nav-stacked">
<li><a href="#meshSec7">TetGen Overview</a></li>
<li><a href="#meshSec8">Isotropic Meshing</a></li>
<li><a href="#meshSec9">Boundary Layer Meshing</a></li>
<li><a href="#meshSec10">Local Mesh Size Application</a></li>
<li><a href="#meshSec11">Spherical Refinement</a></li>
<li><a href="#meshSec12">Radius-Based Meshing</a></li>
<li><a href="#meshSec13">TetGen Errors</a></li>
</ul>
</li>
<li><a href="#meshSec14">Inspecting Meshes</a></li>
</ul>
</nav>
<!--Main Content -->
<div class="col-xs-10 col-sm-10 col-md-9 col-lg-9" id="manualContent">
<!-- ACTUAL CONTENT -->
<div class="manMeshingSV2"> <section id="meshSec1" class="group"><h2>Introduction</h2>
<h3>Mesh Generation</h3>
<p>Discretization, also known as grid or mesh generation, is defined as the process of breaking up a physical domain into smaller sub-domains (usually called elements). Discretization is necessary in order to facilitate the numerical solution of partial differential equations. In other words, there are few analytic solutions for geometries of engineering interest thus the geometry must be divided into an aggregate of simpler pieces for analysis. </p>
<p>Automatic mesh generation has been an area of intense research for decades, and a tremendous amount of literature and numerous algorithms have been developed. There are three fundamental challenges in the field: robustness, mesh quality, and computational efficiency in generating the mesh. A recent survey indicated there were over 80 commercial and academic meshing products available, of which 39 automatically generated tetrahedral (“tet”) elements compared to 20 that performed unstructured hexahedral (“brick”) mesh generation. The current dominance of tetrahedral meshing can be attributed most notably to its ability to robustly mesh arbitrary, complex geometries. In addition, the use of tetrahedral elements often simplifies the process of adapting the mesh during simulation.</p>
<p>Once we have a geometric (solid) model representing a device of interest, we need to discretize the flow domain into little pieces (called elements) for simulation. This process is known as mesh generation. </p>
<p>We will review several important concepts prior to discussing mesh generation:</p>
<ol>
<li><p>For the applications discussed herein, a geometric model representing each energy domain of interest (fluid, mechanical, thermal, etc.) must exist. That is, if you are simulating the mechanical forces of a balloon expandable stent deployed in air, you need a geometric model representing at a minimum the stent geometry. However, if you want to simulate flow around a stent deployed in a vessel, you need a geometric model of the flow lumen (i.e. flow domain) not of the stent itself.</p></li>
<li><p>There are multiple sources of geometric models. The most common source of geometry in the device community is likely from commercial CAD packages (SDRC I-deas, SolidEdge, SolidWorks, Pro-E, etc.). A second potential source of geometric models is digitized data (imaging data, etc.). Finally, a less common (but increasingly important) source of data is the results of a previous simulation. For example, if one simulated the deployment of a stent into a diseased artery, the results of this analysis (i.e. displacements) could be used for the initial geometry for a subsequent blood flow analysis around the deployed stent.</p></li>
<li><p>As will be shown using a beam example, a simple geometry allows for great flexibility in choice of element type (e.g. tetrahedral vs. hexahedral elements). However, for many geometries of engineering interest, the complex geometry motivates the need for automatic mesh generation and often restricts the user to tetrahedral or possibly hex-dominate meshing. Pure hexahedral mesh generation for complex geometries is an area of active research. </p></li>
</ol>
<p>In this manual, a finite-octree based tetrahedral mesh generator is used. The basic idea behind finite-octree methods is to decompose a complex geometry into simpler pieces and then mesh the individual pieces using a mesh generation technique (e.g. templates, Delaunay triangulation (see Figure 4.2), etc.). An example quadtree decomposition (the 2-D analog of finite-octree) is shown in Figure 4.3. A structured (i.e. tensor-product) quadtree grid that completely fills the space occupied by the geometric model (i.e. bounding box) is initially created based on a user-defined mesh density. Subdivision of the octants is then performed to reach a desired complexity of the geometry contained therein. Restricting the “level difference” or gradation between adjacent octants is essential to preserve mesh quality. After the geometry is decomposed, surface meshing is performed using projected 2-D Delaunay surface triangulation. Templates are used to create the interior volume mesh (i.e. octants contained completely inside of the geometric model), and 3-D Delaunay triangulation is used in the boundary octants (i.e. octants containing part of the geometric model boundary) to finish the meshing process.</p>
<p>Finally, we note that there are several techniques to evaluate the quality of a given discretization. For the exterior surface mesh, a visual inspection may provide useful information. However, it is impractical to visualize the individual tetrahedral elements for large meshes, so geometric-based mesh quality indicators are used. Specifically, three mesh quality indicators will be discussed (see Figure 4.4): </p>
<ul>
<li>Minimum solid angle</li>
<li>Radius ratio</li>
<li>Aspect ratio </li>
</ul>
<p>In the present work, a combination of these quality indicators is used by an iterative mesh optimization algorithm to improve the overall quality of the mesh. It should be noted that there is current research interest in generating error estimators that include both solution and geometric information that may lead to more accurate solutions while requiring ewer elements.</p>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/Delaunay_Criterion.png">
<figcaption class="svCaption" >
Delaunay criterion. The Delaunay criterion states that no other point in the triangulation can fall within the circumscribing sphere (circle in 2-D) of the points defining a simplex in the triangulation. Figure (a) shows a valid Delaunay triangulation of four points in $\mathbb{R}^2$ while (b) shows a non-Delaunay triangulation of the same four points. In 2-D, the Delaunay criterion minimizes the maximum interior angle producing an optimal triangulation for a given set of points.
</figcaption>
</figure>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/Quadtree.png">
<figcaption class="svCaption" >
Quadtree decomposition. The figure shows an example quadtree decomposition (directly analogous to octree decomposition in 3-D) that is used to divide the geometry into less complex individual pieces for automatic mesh generation.
</figcaption>
</figure>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/Quality_Measures.png">
<figcaption class="svCaption" >
Geometric mesh quality measures. Shown are 2-D geometric mesh quality measures with direct analogies in 3-D. The radius ratio (a) is the ratio of the radius of the maximum inscribed circle (sphere in 3-D) over the radius of the circumscribed circle (sphere in 3-D). The aspect ratio (b) is a ratio of the minimum height to the maximum base length. The maximum/minimum interior (dihedral in 3-D) angle is shown in ©. In this lab we will construct meshes automatically for two different geometries. The first example is that of an idealized vessel (i.e. cylinder). The second example will be an idealized stent, deployed in an idealized stenotic vessel with incomplete apposition.
</figcaption>
</figure>
<h3>SimVascular Meshers</h3>
<p>This document describes how to use the Meshing software for discrete and continuous solids. SimVascular meshing includes both open source and commercial options. The commercial mesher in SimVascular is MeshSim and provides boundary layer, mesh refinement, and isotropic/anisotropic adaptive meshing. MeshSim is a very powerful tool and can provide high quality meshes for irregular and complicated domains. The open source meshing includes the open source libraries of TetGen and the Vascular Modeling Tool Kit(VMTK). These tools are combined to provide boundary layer, mesh refinement, and isotropic adaptive meshing. </p>
<p>The following describes the file formats used by the meshers in SimVascular:</p>
<p>MeshSim:</p>
<ul>
<li>.xmt_txt</li>
<li>.dsm</li>
</ul>
<p>TetGen:</p>
<ul>
<li>.vtp</li>
<li>.vtk</li>
<li>.stl</li>
<li>.ply </li>
</ul>
<h3>Using this Manual</h3>
<p>Discretizing a domain can be a tricky process and this document attempts to make this process more understandable and less daunting. This document will teach you the following things:</p>
<ol>
<li>Preparing and running a surface remeshing</li>
<li>Preparing and running a volumetric mesh (with or without boundary layer and refinement)</li>
<li>Preparing and running an adaptive mesh<br></li>
</ol>
<p>Some conventions that will be helpful for you to know:</p>
<ol>
<li>Text in italics represents things that you type into the command window.</li>
<li>Buttons, window names, and other labels in a window in the SimVascular program will be in quotes.</li>
<li>Pull-down menu selections will be indicated with an arrow ->.</li>
</ol>
</section>
<section id="meshSec2" class="group"><h2>MeshSim Meshing for Parasolid(.xmt_txt) or Discrete(.dsm) Solids</h2>
<h3>About MeshSim</h3>
<p>MeshSim is a component mesher used to create high quality meshes from CAD Models. Meshing capabilities include surface and volumetric meshing, boundary layer meshing, and local meshing refinement. MeshSim is a Licensed SimVascular package and must be purchased in order to be used with the Software.</p>
<h3>MeshSim Interface</h3>
<p>The MeshSim tab includes all of the operations to run a mesh with the commercial component MeshSim. The interface for MeshSim includes five tabs:</p>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/MeshSim_Tabs.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<ol>
<li>Mesh: This is for basic meshing parameters involving surface and volumetric meshing.</li>
<li>Advanced Mesh Options: This is for advanced meshing techniques like local mesh refinement and boundary layer meshing.</li>
<li>Adapt: This is for anisotropic and isotropic adaptive meshing.</li>
<li>MeshSim Licenses: This is for checking and installing licenses in order to use the commerical package MeshSim.</li>
<li>DiscreteModel: This is for creating a Discrete Model (.dsm), which MeshSim can then be used to mesh when using the Discrete Kernel.</li>
</ol>
<h3>Mesh Tab</h3>
<p>The Mesh Options Tab has all the components to create a simple mesh.</p>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/MeshSim_MeshOptions.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>Button or Widget Functionality:</p>
<h4>Select Solid Model</h4>
<pre class="highlight plaintext"><code>* Type: Change the Solid Model Kernel. MeshSim has the ability to mesh either a Parasolid model (.xmt_txt) or a Discrete Model (.dsm).
* File: Load the solid model to be meshed. You can browse for the file and then the solid will be automatically loaded.
</code></pre>
<h4>Script File</h4>
<pre class="highlight plaintext"><code>* Meshsim script file: Load or save a script file (.mss). If you have run a previous mesh with the same parameters, you can just load the script file from the run. The script file saves the meshing parameters specified.
</code></pre>
<h4>Basic Options</h4>
<pre class="highlight plaintext"><code>* Global max edge size: Specify a global max edge size. This edge size will be targeted for all elements and no element will have a size larger than the specified number.
* Type: Specify to use absolute or relative edge size
Absolute - is used to specify a number based on the dimensions of the model.
Relative - is a number between 0 and 1. The actual mesh size will be calculated by multiplying the length of the largest edge of the coordinate-aligned bounding box of the entity by the given parameter.
</code></pre>
<h4>Load/Create Mesh</h4>
<pre class="highlight plaintext"><code>* Run Mesher: Once all the meshing parameters are specified, run MeshSim within SimVascular.
* Load Mesh: Load a previously created mesh for viewing in SimVascular.
</code></pre>
<h4>Write Files</h4>
<pre class="highlight plaintext"><code>* mesh complete dir: Select the directory in which to place all the mesh files to be written from the mesh. These files are described in the Written Mesh Files of the documentation.
</code></pre>
<h3>Advanced Mesh Options Tab</h3>
<p>The Advanced Mesh Options Tab has the componenets to create a more advanced mesh such as a boundary layer mesh or a mesh with local refinement.</p>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/MeshSim_AdvancedMeshOptions.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>Button or Widget Functionality:</p>
<h4>Meshing Specified by Face</h4>
<p>To add local size meshing and boundary layer meshing, select a face in the 3D viewing window by holding the cursor over the object and pressing “p”. Then follow the steps below to add the features.</p>
<h5>Local Size and Curvature</h5>
<pre class="highlight plaintext"><code>* Type: Select the mesh edge size type and apply it to the selected part of the model.
- Local Max Edge Size: Specify maximum edge size for selected part of the model. If this local edge size is coarser than the global edge size, the global edge size will be used.
- Local Max Curvature Size: Specify maximum curvature size for selected part of the model. See **Curvature** section below for description.
- Local Min Curvature Size: Specify minimum curvature size for selected patt of the model. If this local curvature size is larger than the global curvature minimum, the global minimum curvature will be used.
* Size Type: Select absolute or relative
- Absolute - is used to specify a number based on the dimensions of the model.
- Relative - is a number between 0 and 1. The actual mesh size will be calculated by multiplying the length of the largest edge of the coordinate-aligned bounding box of the entity by the given parameter.
* Size: Enter the desired global or local mesh edge size.
* Add Face Meshing: Create the macro for setting a local or global edge size (can be viewed by expanding the Meshing Parameters pane at the bottom of the tab).
</code></pre>
<h5>Boundary Layer Meshing</h5>
<p>There are found different types of boundary layer meshing and can be applied on selected parts of the model.</p>
<pre class="highlight plaintext"><code>* Type: Select one of the options from the dropdown menu
- Geometric Growth of Layer Thickness: Apply a gradation factor based on initial layer thickness and number of desired layers. In the **Params:** box, specify the following.
- Params: |First Layer Height| |Total Height|
- Relative Height Gradation (type 2): Prescribe the initial layer thickness and a gradation factor (i.e. to increase the next layer size by a factor of 2, apply a gradation factor of 0.5).
- Params: |First Layer Height| |Gradation Factor (0<g<1)|
- User Specified Heights: Specify the number of layers desired and apply a height for every individual layer. Each layer thickness is designated with the letter *t* and *n* is the number of layers.
- Params: |t<sub>0</sub>| |t<sub>1</sub>| ... |t<sub>n-1</sub>|
- Relative Height Gradation (specify gradation factor): Apply only a gradation factor. The initial layer height will then be the global or local max edge size multiplied by the gradation factor (i.e. To have an initial layer half the size of the mesh size, apply a factor of 0.5).
- Params: |Gradation Factor(0<g<1)|
* Direction: Specify the direction of the boundary layer. Both will cause the boundary layer to grow in both directions from the original geometry. Negative will cause the boundary layer to go inward, and positive will cause the boundary layer to go outward.
* num Layers: Specify the number of boundary layers. This needs to specified for every type of boundary layer meshing!
* Size: Currently, this entry box does not have any effect. Any number placed in this box will have no effect.
</code></pre>
<h4>Global Size and Curvature</h4>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/MeshSim_AdvancedGlobalSize.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<pre class="highlight plaintext"><code>* Type:
- Global Max Edge Size: Specify maximum edge size for the entire model.
- Global Max Curvature Size: Specify maximum curvature size for the entire model.
- Global Min Curvature Size: Specify minimum curvature size for the entire model.
* Size Type: Select absolute or relative.
- Absolute - is used to specify a number based on the dimensions of the model.
- Relative - is a number between 0 and 1. The actual mesh size will be calculated by multiplying the length of the largest edge of the coordinate-aligned bounding box of the entity by the given parameter.
* Size: Specify a global max edge size.
</code></pre>
<h4>Spatial Options</h4>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/MeshSim_AdvancedSpatialOptions.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<h5>Sphere Refinement</h5>
<pre class="highlight plaintext"><code>* size: Specify the mesh edge size of the spherically selected area. Can be smaller or larger than the global mesh size.
* radius: Specify the radius of the sphere bounding the elements to be refined.
* center pt: Specify the center of the sphere bounding the elements to be refined.
</code></pre>
<h5>Cylinder Refinement</h5>
<pre class="highlight plaintext"><code>* size: Specify the mesh edge size of the cylindrically selected area. Can be smaller or larger than the global mesh size.
* radius: Specify the radius of the circular ends of the cylinder.
* center pt: Specify the center of the cylinder. The center of the cylinder is located along the center line of the circular ends midway along the length of the cylinder.
* length: Specify the length of the cylinder. The center will be midway along this length.
* normal: Specify the direction from the center the cylinder is to be extruded (i.e. Along the x axis would be 1.0 0.0 0.0).
</code></pre>
<h4>Mesh Control Options</h4>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/MeshSim_AdvancedMeshControlOptions.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<h5>Surface Options</h5>
<pre class="highlight plaintext"><code>* Generate Surface Mesh: Generate a surface mesh if this optiion is selected (Default ON). If this option is not selected, it will not do a surface remeshing before created a volumetric mesh.
* Optimize Surface Mesh: Specify whether or not optimization is to be used (Default ON). Turning off optimization will result in a mesh that will not meet any specified shape metric for the mesh.
* Fix Surface Mesh: This currently has no functionality.
* Constrain Surface: This also has no functionality currently.
</code></pre>
<h5>Volume Options</h5>
<pre class="highlight plaintext"><code>* Generate Volume Mesh: Generate a volume mesh if this option is selected (Default ON). If this option is not selected, it will only do a surface remeshing.
* Optimize Volume Mesh: Specify whether or not optimization is to be used (Default ON).
* Smooth Volume Mesh: Specify whether or not smoothing is to be used (Default ON). The number of smoothing operations to be performed is specified by the **Num. Optimization Passes**.
</code></pre>
<h4>Miscellaneous Options</h4>
<pre class="highlight plaintext"><code>* Write Mesh Statistics: At the end of the meshing operations, display the meshing statistics in the terminal (Default OFF).
</code></pre>
<h4>Optimization Passes:</h4>
<pre class="highlight plaintext"><code>* Specify the number of optimization passes that the mesher will take on the solid. Mesh optimization consists of two operations: Optimization - changes the mesh connectivity. Smoothing - moves vertices to an optimal location. The number of optimization passes refers to the number of smoothing operations to perform (if smoothing is turned on).
</code></pre>
<h4>Meshing Parameters</h4>
<p>Displays the current macro for the specified meshing parameters. These parameters are written to the .mss script file when the mesh is run.</p>
<h4>Curvature</h4>
<p>Curvature refinement allows the mesh to be automatically refined to match the curvature of the entities in the geometric model. This allows MeshSim to automatically control the level of geometric approximation in the mesh. The value specified for curvature is a value relative to the element size. In the figure below, $<em>Curv Size</em>>d/h$. The value specified should always be less than 0.5, and typical values are in the range of 0.01 to 0.4. A smaller value corresponds to more refinement. </p>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/MeshSim_Curvature.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<h3>Adapt Tab</h3>
<p>The Adapt Tab is used to create an adaptive mesh based on a current solution. There are two steps identified in the GUI. First, create the error file (ybar) from the solution. Then, based on this error, run the adaptor to create a mesh optimized for this solution. </p>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/MeshSim_Adapt.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<h4>Filenames</h4>
<pre class="highlight plaintext"><code>* solid model file: Locate the file containing the Parasolid or Discrete Solid Model that was used to create the original mesh.
* mesh file: Locate the original mesh file created by MeshSim.
* adapted mesh file: Give a name for the adapted mesh to be saved.
* projected solution file: Give a name for the initial solution file for a new simulation.
* Solid Model Type: Specify whether to use Parasolid (.xmt_txt) or Discrete Solid (.dsm) for the adaptive meshing. This should be the same as when the original mesh was created.
</code></pre>
<h4>Create Error File</h4>
<pre class="highlight plaintext"><code>* Input and Output Directory: Select the directories where all the solution(restart) files are located. This must also be the same location where the files are output.
* Flow Solver File Format: Identify whether the solver files are binary or ASCII. Typically, the solver files are binary.
* step number: Identify the desired output step number. For example, if you would like to start a new simulation with the new mesh from step 0, input the number 0 (make sure to name the restart file in 6 correspondingly).
* solution file: Specify the solution file that contains the ybar information. Typically, this is saved every (n)?? steps and the last step of the simulation.
* error file: Specify the name of the ybar file to be written containing the error information.
* Create Error File: Create the error file from the provided solution file and written with the given name.
</code></pre>
<h4>Options</h4>
<pre class="highlight plaintext"><code>* Error Reduction Factor: Value multiplied by the average interpolation error in order to get a target uniform local error distribution. This should be a value between zero and one. A smaller factor will attempt to achieve a mesh with smaller error.
* Global Min Edge Size: Specify a minimum target edge size. No edge size will be smaller than this size, even if the adaptor identifies that solution needs a edge length smaller than this.
* Global Max Edge Size: Specify a maximum target edge size. No edge size will be larger than this size, even if the adaptor identifies that the solution does not require an edge length this small.
</code></pre>
<h4>Run Adaptor</h4>
<pre class="highlight plaintext"><code>* Adapt: Run the mesh Adaptor. In the end, a new mesh and new restart file will be written. Visualize the information output from the Adaptor with the file **run_adaptor.log**.
</code></pre>
<h4>Adaptive Mesh</h4>
<h3>MeshSim Licences Tab</h3>
<p>This tab is used to install or remove license information for the use of MeshSim (Only for Microsoft Windows).</p>
<pre class="highlight plaintext"><code>* Check License Keys: Check the status of the license currently.
* Remove License Keys: Remove the current license for MeshSim.
* Install License Keys: Install a license in order to use MeshSim for meshing.
</code></pre>
<h3>Discrete Model Tab</h3>
<p>This tab is used to create a Discrete Solid Model from a a VTK. This Discrete Solid Model can then be meshed with MeshSim.</p>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/MeshSim_DiscreteModel.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<h4>Model Faces</h4>
<pre class="highlight plaintext"><code>* Display the current surface model regions. When a region is selected with "p" in the viewing window, the selected surface will be highlighted in the list window.
</code></pre>
<h4>Load vtkPolyData</h4>
<pre class="highlight plaintext"><code>* Load: Browse and load a vtkPolyData surface
* Show PolyData Surface: After loading a surface, display the surface in the 3D Viewing Window.
</code></pre>
<h4>Create Solid</h4>
<pre class="highlight plaintext"><code>* angle (degrees): Define the angle of separation on which to define feature edges and separate regions. This angle defines the minimum angle between the normals of two adjacent cells. An angle larger than the specified angle will consider the two adjacent cells part of two separate regions.
* Create: Create the new Discrete Solid Model (.dsm) from the specified vtk file.
* Save: Save the newly created Discrete Solid Model.
</code></pre>
</section>
<section id="meshSec3" class="group"><h2>Isotropic Meshing</h2>
<p>To generate an isotropic mesh, we either need to specify a desired number of elements or some property (e.g. maximum edge length for each element) of the mesh. In our case, we will specify the maximum allowable edge length for a given element for the entire mesh. In the “Global Max Edge Size” field, type in the value of the max edge size desired. In this case, we an absolute mesh size of 0.1. Click on the “Run Mesher (Internal)” button. A pop-up window will ask you if you would like to continue; click “Yes”. Another Pop-up Window will ask, “Use currently selected meshing options? This will save/overwrite the meshing script file.” Click, “Yes.”</p>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/MeshSim_Iso_Generation.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>When your mesh has completed, a Mesh Statistics window will pop up. This tells you the number of nodes, elements, mesh edges, and meshes faces you have generated for your mesh. Click “OK”.</p>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/MeshSim_Mesh_Stats.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>If the mesh is not displayed, clear the window by selecting “Actor"→"Delete All Actors”. Then click on the “Display Options” drop-down menu, and select “Meshing” → “Exterior Surface Mesh”. A gold wireframe representation of your model should appear, and if you zoom in, you will be able to see the individual mesh elements.</p>
<figure>
<img class="svImg svImgMd" src="archives/sv2/meshing/img/MeshSim_Isotropic.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>Now try to change the “Global Max Edge Size” value to generate a mesh with more elements. Note that as you specify lower global max edge size values, SimVasxcular will take longer to generate the mesh. The software might appear as not responding, but should still be working. </p>
</section>
<section id="meshSec4" class="group"><h2>Local Mesh Refinement</h2>
<p>Often, a designer may have insight into locations of interest or regions of complex behavior and may want to locally increase the mesh density in those regions to improve the quality of the given finite element analysis results for a given number of nodes. In this example, we will assume the ends of a model are areas of interest and want to locally increase the mesh density near these faces. In SimVascular you can specify different mesh densities on a local geometric model face. First, let’s review the solid model.</p>
<p>Go to the “Model” tab. Click on the “File Input/Output” drop-down menu and select “Read model.” Select the same model that you previously selected for meshing. You should now see your solid model in the 3D window. Click on the first FaceId and continue down the list by clicking on subsequent Face Ids. Look at the “surf_name:” entry for each Face Id to remind yourself of the names that you gave each face. Once you have reviewed the model faces you can change the “Solid Model Object:” to “None” and return to the “Meshing” tab.</p>
<p>We will now specify increased mesh density on the inflow and outflow faces. Under the “Meshing” tab,</p>
<p>First, we will specify the mesh density for the inflow face:</p>
<ol>
<li> Under the “Global/Local Size and Curvature Mesh Parameters” header make sure that the “Size Type:” is set as “absolute” and the “Type:” is set as “Local Max Edge Size.” </li>
<li> Select the desired face in the 3D viewing window by pressing “p”. In this case, we use “Inflow”.</li>
<li> Set the desired size n the “Size” entry box. In this case, we apply a local edge size 0f “0.05”. </li>
<li> Click on the “Add Face Meshing” button. </li>
</ol>
<p>At the bottom of the “Advanced Mesh Options” tab check the “Display currently selected meshing parameters” box. The “Current List of Specified Meshing Parameters” should now appear. In this case, ours displays “size inflow absolute 0.05”. Note that you can edit the text in the “Current List of Specified meshing Parameters” box. This may be useful if you decide you don’t like the meshing you specified and want to delete the previous refinement text and generate a new one. You can also edit the refinement text directly on that box. </p>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/MeshSim_Local_Refinement_Options_1.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>We will now repeat this process for the outflow faces, specifying a different mesh density:</p>
<ol>
<li> Under the “local Size and Curvature Mesh Parameters” change the face name to another face name by selecting it in the viewing window with “p”.</li>
<li> Set the desired size for this face. </li>
<li> Click on the “Add Face Meshing” button. </li>
<li> The “Meshing Parameters” should now ALSO show the text “R<em>ext</em>iliac absolute 0.5” and “L<em>ext</em>iliac 0.5”.</li>
</ol>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/MeshSim_Local_Refinement_Options_2.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>Now we will generate the mesh for the model that includes the refined mesh specifications:</p>
<ol>
<li> Go back to the “Mesh Options” tab.</li>
<li> Make sure the model that you would like to mesh is selected as the “Solid model file:”</li>
<li> Enter a desired “Global Max Edge Size”. We use “0.2” for this case.</li>
<li> Press the “Run Mesher (Internal)” button.</li>
<li> Click “yes” button when the “Creating a mesh can take a long time. Continue Anyway?” dialog box appears.</li>
<li> Click “yes” button when the “Use currently selected meshing options? This will save/overwrite the meshSim script file” dialog box appears.</li>
<li> When the meshing is finished, a dialog box appears with mesh statistics. Once you have reviewed the meshing output, you can click on the “OK” button in the “Mesh Statistics” dialog box.</li>
</ol>
<p>It is important to note that you have generated a volumetric mesh. That is, the entire volume of the cylinder geometry has been filled with tetrahedral elements. It is difficult to visualize thousands of elements at one time, so often only the exterior surface mesh is visualized. In the case of a pure tetrahedral mesh, the exterior surface mesh will consist of a set of triangles. </p>
<p>If you don’t already see the exterior surface mesh you just created, in the 3D window go to Display Options -> Meshing and check “Exterior Surface Mesh.”
If you zoom in on the inflow face, you will see that the triangulation for that face is more refined than the rest of the vessel mesh as shown below: </p>
<figure>
<img class="svImg svImgMd" src="archives/sv2/meshing/img/MeshSim_LocalRefinement.png">
<figcaption class="svCaption" ></figcaption>
</figure>
</section>
<section id="meshSec5" class="group"><h2>Boundary Layer Meshing</h2>
<p>When simulating blood flow, interesting phenomenon can occur near the vessel walls. Under laminar flow, for example, boundary layers can form with large velocity and pressure gradients near the wall. It is advantageous to have increased mesh density in the areas of high gradients. If a preferential flow direction is known, you can often “elongate” elements in the direction of the flow without loss of accuracy to reduce computational costs. In the area of mesh generation applied to fluid flow, this is often referred to as boundary layer meshing.</p>
<p>We will now generate a boundary layer mesh from the “wall_aorta” model:</p>
<ol>
<li> Set the desired mesh edge size in the “Global Max Edge Size:” entry widget on the Mesh Options Tab. In this case, we use “0.4”.<br></li>
<li> Go to the “Advanced Mesh Options” tab.</li>
<li> Under the “Boundary Layer Meshing” header make sure that the “Type:” is set to “Relative Gradation (type 4)” and the “Growth Direction:” is set to “both.”</li>
<li> Go to the 3D viewing window and press “p” over the surface that you would like to apply the boundary layer to. This surface will be highlighted in the 3D viewing window and the Model Faces list.. </li>
<li> Set the desired number of layers in the “num Layers:”. In this case, we use “3”. </li>
<li> Set the gradation factor in the “Params:” entry widget. In this case, we use “0.5”<br></li>
<li> Click on the “Add Boundary Layer” button. </li>
<li> The “Current List of Specified Meshing Parameters” should now show the text for the desired boundary layer. Ours shows “boundaryLayer wall_aorta 4 both 3 0.5” underneath the two local refinement specifications from the previous section</li>
<li> Add the same boundary layer to the other surfaces that comprise the aorta wall. In our case, the other surface is “wall<em>R</em>ext_iliac”.</li>
</ol>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/MeshSim_BoundaryLayer_Options.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>Now we will generate the mesh for the model that includes the boundary layer mesh options:</p>
<ol>
<li> Go back to the “Mesh Options” tab.</li>
<li> Click on the “Run Mesher (Internal)” button.</li>
<li> Click “yes” button when the “Creating a mesh can take a long time. Continue Anyway?” dialog box appears.</li>
<li> Click “yes” button when the “Use currently selected meshing options? This will save/overwrite the meshSim script file” dialog box appears.</li>
<li> When the meshing is finished, a dialog box appears with mesh statistics. Once you have reviewed the meshing output, you can click on the “OK” button in the “Mesh Statistics” dialog box.</li>
</ol>
<p>The mesh generated will have the boundary layer mesh on the specified region. Zooming in, you can see that the number of layers in the volumetric mesh is three. This boundary layer extends all the way up the length of the aorta wall. </p>
<figure>
<img class="svImg svImgMd" src="archives/sv2/meshing/img/MeshSim_BoundaryLayer_Labelled.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>It is important to note, once again, that you have generated a volumetric mesh. That is, the entire volume of the geometry has been filled with tetrahedral elements. Thus, the boundary layer meshing pattern that you see on the outflow face (in the figure above) continues up the entire volume of the aorta. It is difficult to visualize thousands of elements at one time, so we only visualize this refinement on the exterior surface mesh. </p>
</section>
<section id="meshSec6" class="group"><h2>Spherical Refinement</h2>
<p>When simulating blood flow, interesting phenomenon can occur around the site of vessel bifurcations. It is advantageous to have increased mesh density at and around bifurcations. In this section we will refine the mesh at the abdominal aorta and common iliac artery bifurcation using sphere refinement:</p>
<ol>
<li> Go to the “Advanced Mesh Options” tab.</li>
<li> Under the “Sphere Refinement” header, set the desired size to in the “Size:” entry widget. We use “0.05”</li>
<li> Set the desired radius in the “Radius” entry widget. We used “3.0”. </li>
<li> Under the Main Display Options box make sure you are in the “Volume Properties” tab</li>
<li> Check the L/R, P/A, I/S slice plane boxes to turn on all slices (Make sure the image data set it loaded). </li>
<li> Position the slices so that they intersect at a point in the center of the bifurcation as shown in the figure below. In this case, we set them to:
<ul>
<li>L/R: 275</li>
<li>P/A: 42</li>
<li>I/S: 192</li>
</ul></li>
<li> The pixel locations of the splice planes are shown above the scale bars. Under the “Sphere Refinement” header, set the desired center point. Our center point is “1.088 3.290 -7.946”, and we put this in the “center pt” entry widget. Make sure you leave a space between each value. </li>
</ol>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/MeshSim_SRefinement_Options.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<ol>
<li> Click on the “Add Sphere Refinement” button. </li>
<li> The “Meshing Parameters” should now show the sphere refinement macro. Ours is “sphereRefinement 0.05 3.0 1.088 3.290 -7.946”.</li>
</ol>
<p>Now we will generate the mesh for the model that includes the sphere refinement specification:</p>
<ol>
<li> Go back to the “Mesh Options” tab.</li>
<li> Click on the “Run Mesher (Internal)” button.</li>
<li> Click “yes” button when the “Creating a mesh can take a long time. Continue Anyway?” dialog box appears.</li>
<li> Click “yes” button when the “Use currently selected meshing options? This will save/overwrite the meshSim script file” dialog box appears.</li>
<li> This mesh may take a couple seconds longer than the previous ones. When the meshing is finished, a dialog box appears with mesh statistics. Once you have reviewed the meshing output, you can click on the “OK” button in the “Mesh Statistics” dialog box.</li>
</ol>
<p>The mesh in the area around the bifurcation should now be refined as compared to the mesh for the rest of the vessel. </p>
<figure>
<img class="svImg svImgMd" src="archives/sv2/meshing/img/MeshSim_Sphere_Refinement.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<h2>Cylindrical Refinement</h2>
<p>In addition to the interesting phenomenon that may occur at the site of vessel bifurcations, we may be similarly interested in blood flow phenomenon at other sites of the model, such as the site of an aneurism. To refine the mesh of sites of interest along the vessel, we can use cylindrical refinement. Cylinder refinement is very similar to spherical refinement; however for cylinder refinement we will define a “length” and a “normal” direction in addition to radius and size. In this section we will refine the mesh near the outflow face of the left common iliac artery.</p>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/MeshSim_Cylinder_Refinement_Options.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<ol>
<li> Go to the “Advanced Mesh Options” tab</li>
<li> Under the “Cylinder Refinement” header, set the desired mesh size. In this case we use “0.05” in the “Size:” entry widget</li>
<li> Set the desired radius in the “Radius:” entry widget. We use “3.0”.<br></li>
<li> Set the desired length in the “Length” entry widget. We use “5.0”. </li>
<li> Set the normal to the desired direction. In this case, we use “0.0 0.0 1.0” . This defines the normal in the positive I/S direction.</li>
<li> Under the Main Display Options box make sure you are in the “Volume Properties” tab</li>
<li> Check the L/R, P/A, I/S slice plane boxes to turn on all slices. </li>
<li> Position the slices so that they intersect at a point in near the desired face as shown in the figure below. You can also set the image plane scale bars to:
<ul>
<li>L/R: 263</li>
<li>P/A: 38</li>
<li>I/S: 242</li>
</ul></li>
<li><p>The pixel locations of the splice planes are shown above the scale bars. Under the “Cylinder Refinement” header, set the desired center point in the “center pt.” entry widget. In our case, these slice plane locations correspond to “0.151 2.490 -4.040” Make sure you leave a space between each value. </p></li>
<li><p>Click on the “Create Cylinder Refinement Macro” button. </p></li>
</ol>
<p>The “Current List of Specified Meshing Parameters” should now show the macro for cylinder refinement. The text in our case is “cylinderRefinement 0.05 3.0 5.0 0.151 2.490 -4.040 0.0 0.0 1.0”.</p>
<p>Now we will generate the mesh for the model that includes the cylinder refinement specification:</p>
<ol>
<li> Go back to the “Mesh Options” tab.</li>
<li> Click on the “Run Mesher (Internal)” button.</li>
<li> Click “yes” button when the “Creating a mesh can take a long time. Continue Anyway?” dialog box appears.</li>
<li> Click “yes” button when the “Use currently selected meshing options? This will save/overwrite the meshSim script file” dialog box appears.</li>
<li> This mesh may take a couple seconds longer than the previous ones. When the meshing is finished, a dialog box appears with mesh statistics. Once you have reviewed the meshing output, you can click on the “OK” button in the “Mesh Statistics” dialog box.</li>
</ol>
<p>The mesh near the desired area should now be refined as desired as shown below:</p>
<figure>
<img class="svImg svImgMd" src="archives/sv2/meshing/img/MeshSim_Cylinder_Refinement.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>You can now go back and do a full mesh combining local mesh refinement, a boundary layer, and spherical or cylindrical refinment. </p>
</section>
<section id="meshSec7" class="group"><h2>TetGen Meshing for Discrete PolyDatas(.vtk,.vtp,.stl)</h2>
<h3>About TetGen</h3>
<p>TetGen is an open source mesh generation software developed by Hang Si through WIAS in Berlin. TetGen is a tetrahedral mesh generator that uses 3D Delaunay Triangulation.
Learn more about <a href="http://wias-berlin.de/software/tetgen/">TetGen</a> here.</p>
<h3>TetGen Interface</h3>
<p>The TetGen tab includes all of the the operations to run an open source meshing using a discrete polydata. The interface for TetGen includes three tabs:</p>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/TetGen_Tabs.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<ol>
<li>Mesh Options: This is for basic meshing parameters involving surface and volumetric meshing.</li>
<li>Advanced Mesh Options: This is for advanced meshing techniques like spherical refinement and boundary layer meshing.</li>
<li>Adapt: This is for isotropic adaptive meshing.</li>
</ol>
<h3>Mesh Options Tab</h3>
<p>The Mesh Options Tab has all the components to create a simple mesh.</p>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/TetGen_Mesh_Options.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>Button or Widget Functionality:</p>
<h4>Select Solid Model</h4>
<pre class="highlight plaintext"><code>* File: Load the solid model to be meshed. You can browse for the file and then the solid will be automatically loaded. Accepted file formats include .vtk(as a polydata),.vtp,.stl, and .ply.
</code></pre>
<h4>Script File</h4>
<pre class="highlight plaintext"><code>* TetGen script file: Load or save a script file (.tgs). If you have run a previous mesh with the same parameters, you can just load the script file from the run. The script file saves the meshing parameters specified.
</code></pre>
<h4>TetGen Flags</h4>
<pre class="highlight plaintext"><code>* Specify the TetGen meshing parameters. These parameters apply ONLY to the volumetric meshing operation.
- O: Specity the number of times to optomize the mesh. This moves nodes to reach a better quality mesh.
- q: Specify a quality measure for the mesh. This number corresponds to the ratio between the radius of the circumsphere of an element and the maximum edge size (See below for figure). This number can be anywhere from 2.0 to 1.1, and a lower number corresponds to a higher quality element. A mesh with a quality ratio 1.0 is not attainable and the mesher will run infinitely.
- T: Apply a tolerance to check whether a point lies on the surface or not (Default is $10^{-8}$).
- Y: Preserve the exact surface mesh. If this parameter is used without a surface remeshing, make sure a mesh size that corresponds to the surface mesh is applied.
- M: Do not merge facets that are coplanar or have very close vertices.
- d: Detect for intersecting facets. This can be helpful if there are regions with close facets.
- C: Check the consistency of the final mesh.
- Q: Output nothing to the terminal except for errors.
- V: Print out more detailed information from TetGen. This information is viewable in the terminal.
- Specify other mesh tags: The full TetGen documentation indicates other possible mesh flags. This is where those can be specified. TetGen documentation can be found here: **FILL THIS IN**
</code></pre>
<h4>Basic Options</h4>
<pre class="highlight plaintext"><code>* Estimate Global Edge Size: Based on the areas of the surfaces on your solid, SimVascular will calculate a reasonable mesh edge size. This size is slightly smaller than what may be necessary, but start with this size and slowly increase the size for a larger mesh edge size.
* Set maximum edge size for equilateral triangle - Apply a mesh size. TetGen applies a maximum tetrahedron volume constraint. The value here is an edge size (a). The volume is then computed from this as a tetrahedron with equilateral sides. Volume of an equilateral tetrahedron: $V = (a^3)/(6*sqrt(2))$
* Run Mesher: Once all the meshing parameters are specified, run TetGen within SimVascular.
</code></pre>
<h4>Write Files</h4>
<pre class="highlight plaintext"><code>* mesh complete dir: Select the directory in which to place all the mesh files to be written from the mesh. These files are described in the Written Mesh Files of the documentation.
</code></pre>
<h3>Advanced Mesh Options Tab</h3>
<p>The Advanced Mesh Options Tab has the componenets to create a more advanced mesh such as a boundary layer mesh or a mesh with spherical refinement.</p>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/TetGen_Advanced_Mesh_Options.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<h4>Boundary Layer Meshing</h4>
<pre class="highlight plaintext"><code>* Use Boundary Layer: In order to use a boundary layer, you must click "Select Boundary Layer Surfaces" and select all walls to be a part of the boundary layer. In addition, a boundary layer cannot be created without both the volume and surface mesh options selected in the Mesh Options Tab.
* Portion of Edge Size: Specify the portion of the edge size in the Mesh Options Tab to use as the size for the initial boundary layer (typically this is a value between zero and one.
* Num Layers: Input the number of layers desired. Too many layers can cause self intersections on smaller vessels, so be careful.
* Layer Decreasing Ratio: Specify the amount the decrease the size between successive boundary layers. This gradation factor is multiplied by the previous layer to get the thickness of the new layer. In order to decrease the layers by a factor of 2, apply a decreasing ratio of 0.5.
</code></pre>
<p><font color="red"><strong>HELPFUL HINT:</strong> </font> If you do not select all the walls for the boundary layer, your output mesh will only contain the domain of the wall that you selected.</p>
<h4>Local Size</h4>
<pre class="highlight plaintext"><code>* Select a Surface: In the 3-D Window, hover over a surface in which you would like to specify a local mesh edge size, and hit "p". After highlighting a surface enter a mesh edge size and hit "Add Local Mesh Size".
* Size: Enter a value to specify the mesh edge size on a specific surface.
* Add Local Mesh Size: This will update the Meshing Parameters and add the local mesh size to the surface. You can specify a different mesh edge size to each surface of the model; however, make sure that it is not too drastic of a different between surfaces as you will be left with poor quality elements at the interface. If you do not specify a local mesh size for a surface, the global mesh edge size will be used for that surface.
</code></pre>
<h4>Refinement</h4>
<pre class="highlight plaintext"><code>* Sphere Refinement: In order to do spherical refinement, this box must be checked. When you check this box, the meshing solid and a sphere will appear. The sphere must be moved to set the spherical refinement!
* Sphere Radius: Apply a radius for the refining sphere. Enter a number into the box and hit ENTER. The sphere size will not update unless the ENTER button is pressed! (After setting the radius, make sure to adjust the refinement sphere to the correct location. The radius is set when the sphere is moved.
* Refinement Factor: Specify the mesh edge within the desired spherical region. In this way, it is possible to specify a size larger or smaller than the edge size for the rest of the domain.
* Add Sphere Refinement: Once the sphere is set, select this button to update the Meshing Parameters and add the sphere refinement. You can add multiple sphere refinement regions; however, if spheres overlap, the mesh edge size in the latter sphere will be the edge size in the overlapping region.
</code></pre>
<h4>Radius-Based Meshing</h4>
<pre class="highlight plaintext"><code><font color="red">**IMPORTANT:** </font> You must have only one wall surface on your model to use this feature!!
* Use Centerline Radius: Select this check box to base your mesh edge size on the centerline radius. This will compute the centerlines and find the distance to these centerlines prior to meshing. These values will be normalized by the smallest value and then multiplied by the global max edge size given in the "Mesh Options" tab.
</code></pre>
<h3>Adapt Tab</h3>
<p>The Adapt Tab is used to create an adaptive mesh based on a current solution. There are two steps identified in the GUI. First, create the error file (ybar) from the solution. Then, based on this error, run the adaptor to create a mesh optimized for this solution. </p>
<figure>
<img class="svImg svImgLg" src="archives/sv2/meshing/img/TetGen_Adapt.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<h4>Filenames</h4>
<pre class="highlight plaintext"><code>* surface mesh file: Locate the original surface mesh file created by TetGen (.vtp).
* mesh file: Locate the original mesh file created by TetGen (.vtu).
* adapted surface mesh file: Give a name for the surface of the adapted mesh to be saved.
* adapted mesh file: Give a name for the adapted mesh to be saved.
* projected solution file: Give a name for the initial solution file for a new simulation.
</code></pre>
<h4>Create Error File</h4>
<pre class="highlight plaintext"><code>* Input and Output Directory: Select the directories where all the solution(restart) files are located. This must also be the same location where the files are output.
* Flow Solver File Format: Identify whether the solver files are binary or ASCII. Typically, the solver files are binary.
* step number: Identify the desired output step number. For example, if you would like to start a new simulation with the new mesh from step 0, input the number 0 (make sure to name the restart file in 6 correspondingly).
* solution file: Specify the solution file that contains the ybar information. Typically, this is saved every (n)?? steps and the last step of the simulation.
* error file: Specify the name of the ybar file to be written containing the error information.
* Create Error File: Create the error file from the provided solution file and written with the given name.
</code></pre>
<h4>Options</h4>
<pre class="highlight plaintext"><code>* Error Reduction Factor: Value multiplied by the average interpolation error in order to get a target uniform local error distribution. This should be a value between zero and one. A smaller factor will attempt to achieve a mesh with smaller error.
* Global Min Edge Size: Specify a minimum target edge size. No edge size will be smaller than this size, even if the adaptor identifies that solution needs a edge length smaller than this.
* Global Max Edge Size: Specify a maximum target edge size. No edge size will be larger than this size, even if the adaptor identifies that the solution does not require an edge length this small.
</code></pre>
<h4>Run Adaptor</h4>
<pre class="highlight plaintext"><code>* Adapt Mesh: Run the mesh Adaptor. In the end, a new mesh and new restart file will be written. Visualize the information output from the Adaptor with the file **run_adaptor.log**.
</code></pre>
</section>
<section id="meshSec8" class="group"><h2>Isotropic Meshing</h2>
<p>To generate an isotropic mesh, we either need to specify a desired number of elements or some property (e.g. maximum edge length for each element) of the mesh. In our case, we will specify the maximum allowable edge length for a given element for the entire mesh. We have the ability to specify our own mesh size or have SimVascular calculate a size for us. Click “Estimate Global Edge Size”. In this case, we get an absolute mesh size of “0.108”. Click on the “Run Mesher (Internal)” button. A pop-up window will ask you if you would like to continue; click “Yes”. Another Pop-up Window will ask, “Use currently selected meshing options? This will save/overwrite the meshing script file.” Click, “Yes.”</p>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/TetGen_Iso_Generation.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>When your mesh has completed, a Mesh Statistics window will pop up. This tells you the number of nodes, elements, mesh edges, and meshes faces you have generated for your mesh. Click “OK”.</p>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/TetGen_Mesh_Stats.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>If the mesh is not displayed, clear the window by selecting “Actor"→"Delete All Actors”. Then click on the “Display Options” drop-down menu, and select “Meshing” → “Exterior Surface Mesh”. A gold wireframe representation of your model should appear, and if you zoom in, you will be able to see the individual mesh elements.</p>
<figure>
<img class="svImg svImgMd" src="archives/sv2/meshing/img/TetGen_Isotropic.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>Now try to change the “edge size” value to generate a mesh with more elements. Note that as you specify lower global max edge size values, SimVasxcular will take longer to generate the mesh. The software might appear as not responding, but should still be working. </p>
</section>
<section id="meshSec9" class="group"><h2>Boundary Layer Meshing</h2>
<p>When simulating blood flow, interesting phenomenon can occur near the vessel walls. Under laminar flow, for example, boundary layers can form with large velocity and pressure gradients near the wall. It is advantageous to have increased mesh density in the areas of high gradients. If a preferential flow direction is known, you can often “elongate” elements in the direction of the flow without loss of accuracy to reduce computational costs. In the area of mesh generation applied to fluid flow, this is often referred to as boundary layer meshing.</p>
<p>We will now generate a boundary layer mesh from a model of an Aorta.</p>
<ol>
<li> In the “Mesh Options” tab, load in the desired polydata that already has regions that have been named (One of these faces must be named wall!) The region named wall will be the one given a boundary layer. </li>
<li> Set the desired mesh edge size in the “Edge Size:” entry widget on the Mesh Options Tab. In this case, we use “0.15”.<br></li>
<li> Go to the “Advanced Mesh Options” tab under the “TetGen” tab, and click “Select Boundary Layer Surfaces”. Select and move to the right side all walls of the model.</li>
<li> Set the desired size of the initial layer in the “Portion of Edge Size” entry box. In this case, we use 0.5. </li>
<li> Set the desired number of Layers in the “Num Layers” entry box. In this case, we use 4 layers.</li>
<li> Set the desired gradation factor in the “Layer Decreasing Ratio” entry box. In this case, we would like each layer to be 0.6 of the previous layer. </li>
</ol>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/TetGen_Load_BoundaryLayer.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>Now we will generate the mesh for the model that includes the boundary layer specifications:</p>
<ol>
<li> Go back to the “Mesh Options” tab.</li>
<li> Click on the “Run Mesher (Internal)” button.</li>
<li> Click “yes” button when the “Creating a mesh can take a long time. Continue Anyway?” dialog box appears.</li>
<li> Click “yes” button when the “Use currently selected meshing options? This will save/overwrite the meshSim script file” dialog box appears.</li>
<li> When the meshing is finished, a dialog box appears with mesh statistics. Once you have reviewed the meshing output, you can click on the “OK” button in the “Mesh Statistics” dialog box.</li>
</ol>
<p>The mesh generated will have the boundary layer mesh on the specified region. Zooming in, you can see that the number of layers in the volumetric mesh is four. The boundary layer extends all the way down the length of the surface named wall, and each layer is 0.8 of the previous layer.</p>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/TetGen_BoundaryLayer.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>It is important to note, once again, that you have generated a volumetric mesh. That is, the entire volume of the geometry has been filled with tetrahedral elements. Thus, the boundary layer meshing pattern that you see on the outflow face (in the figure above) continues up the entire volume of the aorta. It is difficult to visualize thousands of elements at one time, so we only visualize this refinement on the exterior surface mesh. </p>
</section>
<section id="meshSec10" class="group"><h2>Local Mesh Size Application</h2>
<p>Often, a designer may have insight into locations of interest or regions of complex behavior and may want to locally increase the mesh density in those regions to improve the quality of the given finite element analysis results for a given number of nodes. In this example, we will assume the ends of a model are areas of interest and want to locally increase the mesh density near these faces. In SimVascular you can specify different mesh densities on a local geometric model face. First, let’s review the solid model.</p>
<p>Go to the “Model” tab. Click on the “File Input/Output” drop-down menu and select “Read model.” Select the same model that you previously selected for meshing. You should now see your solid model in the 3D window. Click on the first FaceId and continue down the list by clicking on subsequent Face Ids. Look at the “surf_name:” entry for each Face Id to remind yourself of the names that you gave each face. Once you have reviewed the model faces you can change the “Solid Model Object:” to “None” and return to the “Meshing” tab.</p>
<pre class="highlight plaintext"><code>* Select a Surface: In the 3-D Window, hover over a surface in which you would like to specify a local mesh edge size, and hit "p". After highlighting a surface enter a mesh edge size and hit "Add Local Mesh Size".
* Size: Enter a value to specify the mesh edge size on a specific surface.
* Add Local Mesh Size: This will update the Meshing Parameters and add the local mesh size to the surface. You can specify a different mesh edge size to each surface of the model; however, make sure that it is not too drastic of a different between surfaces as you will be left with poor quality elements at the interface. If you do not specify a local mesh size for a surface, the global mesh edge size will be used for that surface.
</code></pre>
<p>In this example, we are interested more in the flow in the right iliac of this model. we specify a mesh edge size of 0.17 on the aorta wall, and a mesh edge size of 0.1 on the right_iliac wall. We leave the global edge size at 0.15 for the remainder of the surfaces.</p>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/TetGen_Local_Refinement.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>Now we will generate the mesh for the model that includes these local mesh sizes:</p>
<ol>
<li> Go back to the “Mesh Options” tab.</li>
<li> Click on the “Run Mesher (Internal)” button.</li>
<li> Click “yes” button when the “Creating a mesh can take a long time. Continue Anyway?” dialog box appears.</li>
<li> Click “yes” button when the “Use currently selected meshing options? This will save/overwrite the meshSim script file” dialog box appears.</li>
<li> When the meshing is finished, a dialog box appears with mesh statistics. Once you have reviewed the meshing output, you can click on the “OK” button in the “Mesh Statistics” dialog box.</li>
</ol>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/TetGen_Refinement_Mesh.png">
<figcaption class="svCaption" ></figcaption>
</figure>
</section>
<section id="meshSec11" class="group"><h2>Spherical Refinement</h2>
<p>When simulating blood flow, interesting phenomenon can occur around the site of vessel bifurcations. It is advantageous to have increased mesh density at and around bifurcations. In this section we will refine the mesh at the abdominal aorta and common iliac artery bifurcation using sphere refinement:</p>
<p>We will now refine a region with a sphere from a model of an Aorta.</p>
<ol>
<li> Set the desired mesh edge size in the “edge size:” entry widget on the Mesh Options Tab. In this case, we use “0.3”.<br></li>
<li> Go to the “Advanced Mesh Options” tab under the “TetGen” tab, and select “Sphere Refinement”.</li>
<li> Play around with the radius of the sphere in the “Sphere Radius” entry box. When you put in a new value for the radius, hit ENTER to apply the new size. Find a radius that works for your model. In our case, the sphere radius we use is “3”.</li>
<li> Move the radius to the desired location. We place ours right at the base of the aorta where is branch into the two iliac arteries, as this is an area of more complicated flow. </li>
<li> Enter a mesh size for the refined region into the “Refinement Factor” entry box. The refinement factor we used in this case is “0.5”. This means the elements in the refined region should be half the size of the rest of the elements.</li>
<li> To add this spherical reginement region to the Meshing Paramters, select “Add Sphere Refinement”</li>
</ol>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/TetGen_Load_Sphere_Refinement.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>Now we will generate the mesh for the model that includes the refined mesh specifications:</p>
<ol>
<li> Go back to the “Mesh Options” tab.</li>
<li> Click on the “Run Mesher (Internal)” button.</li>
<li> Click “yes” button when the “Creating a mesh can take a long time. Continue Anyway?” dialog box appears.</li>
<li> Click “yes” button when the “Use currently selected meshing options? This will save/overwrite the meshSim script file” dialog box appears.</li>
<li> When the meshing is finished, a dialog box appears with mesh statistics. Once you have reviewed the meshing output, you can click on the “OK” button in the “Mesh Statistics” dialog box.</li>
</ol>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/TetGen_Sphere_Refinement.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>You can now go back and do a full mesh combining a boundary layer and spherical refinment. </p>
</section>
<section id="meshSec12" class="group"><h2>Radius Based Meshing</h2>
<p>When models contain surfaces of very different size scales, it is often desirable to scale the size of the mesh with the size of the vessel of the model. The following instructions describe how to apply a radius-based mesh: </p>
<pre class="highlight plaintext"><code>IMPORTANT: You must have only one wall surface on your model to use this feature!!
* Use Centerline Radius: Select this check box to base your mesh edge size on the centerline radius. This will compute the centerlines and find the distance to these centerlines prior to meshing. These values will be normalized by the smallest value and then multiplied by the global max edge size given in the "Mesh Options" tab.
</code></pre>
<p>In this example, we leave the Global edge size at 0.15, but we used a redius-based mesh edge size. Note that we have editted our surfaces so that we have only one wall surface!! </p>
<figure>
<img class="svImg svImgXl" src="archives/sv2/meshing/img/TetGen_Set_Radius_Based_Mesh.png">
<figcaption class="svCaption" ></figcaption>
</figure>
<p>Now we will generate the mesh for the model that includes these local mesh sizes:</p>
<ol>
<li> Go back to the “Mesh Options” tab.</li>
<li> Click on the “Run Mesher (Internal)” button.</li>
<li> Click “yes” button when the “Creating a mesh can take a long time. Continue Anyway?” dialog box appears.</li>
<li> Click “yes” button when the “Use currently selected meshing options? This will save/overwrite the meshSim script file” dialog box appears.</li>