Skip to content

Commit a06a9ec

Browse files
committed
Add arbitrary system test for spatially varying vessel (it only verifies that the output matches the current output -- I have not checked that the result values match an analytic solution for the spatially varying vessel or otherwise). Also roll back the changes to the VTK postprocess. Now, the VTK postprocess will continue to use the endpoint values and will not attemp to utilize the spatial variations. But I've left notes in where we're expecting to update them
1 parent 9d2410c commit a06a9ec

4 files changed

Lines changed: 267 additions & 64 deletions

File tree

Code/Source/cvOneDBFSolver.cxx

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,17 @@ void cvOneDBFSolver::postprocess_VTK_XML3D_ONEFILE(){
491491
currCentre[2] = nodeList[inletSegJoint][2] + loopEl*lengthByNodes/double(currSeg->getNumElements())*segVers[2][0];
492492

493493
// Get initial radius at current location
494-
495-
// TODO: verify this is the correct "z" location we want
496-
// to interpolate at. These loops and myriad variables make
497-
// something super simple super confusing.
498-
auto const [inletZ, outletZ] = currSeg->getSpatialCharacteristics().inletAndOutletZCoordinates();
499-
double const zAxial = linearEstimate(loopEl, 0, inletZ, currSeg->getNumElements(), outletZ);
500-
currIniRad = currSeg->getSpatialCharacteristics().getInterpolatedRadius(zAxial);
494+
//
495+
// TODO: This should be updated to utilize the spatial characteristics.
496+
// Right now, this won't use the interior points of a spatially varying vessel.
497+
// Instead, it uses the legacy values of the input and output areas.
498+
// Why?
499+
// We're planning to update the VTK files in an independent change. When that's
500+
// done, we can verify that we are using the spatially varying areas correctly
501+
// when building the VTK output.
502+
auto const [inletArea, outletArea] = currSeg->getSpatialCharacteristics().inletAndOutletAreas();
503+
currIniArea = inletArea + (loopEl/double(currSeg->getNumElements()))*(outletArea - inletArea);
504+
currIniRad = sqrt(currIniArea/M_PI);
501505

502506
// Loop on the subdivisions
503507
for(int loopSubdiv=0;loopSubdiv<circSubdiv;loopSubdiv++){
@@ -571,14 +575,16 @@ void cvOneDBFSolver::postprocess_VTK_XML3D_ONEFILE(){
571575
for(int j=startOut;j<finishOut;j+=2){
572576

573577
// Evaluate Initial Area at current location
574-
575-
// TODO: verify this is the correct "z" location we want
576-
// to interpolate at. These loops and myriad variables make
577-
// something super simple super confusing.
578-
auto const [inletZ, outletZ] = currSeg->getSpatialCharacteristics().inletAndOutletZCoordinates();
579-
double const zAxial = linearEstimate((j-startOut)/2.0,
580-
startOut, inletZ, finishOut,outletZ);
581-
iniArea = currSeg->getSpatialCharacteristics().getInterpolatedArea(zAxial);
578+
//
579+
// TODO: This should be updated to utilize the spatial characteristics.
580+
// Right now, this won't use the interior points of a spatially varying vessel.
581+
// Instead, it uses the legacy values of the input and output areas.
582+
// Why?
583+
// We're planning to update the VTK files in an independent change. When that's
584+
// done, we can verify that we are using the spatially varying areas correctly
585+
// when building the VTK output.
586+
auto const [inletArea, outletArea] = currSeg->getSpatialCharacteristics().inletAndOutletAreas();
587+
iniArea = inletArea + (((j-startOut)/2)/double(currSeg->getNumElements()))*(outletArea - inletArea);
582588

583589
// Eval Current Area at current location
584590
newArea = TotalSolution[loopTime][j];
@@ -844,13 +850,17 @@ void cvOneDBFSolver::postprocess_VTK_XML3D_MULTIPLEFILES(){
844850
currCentre[2] = nodeList[inletSegJoint][2] + loopEl*lengthByNodes/double(currSeg->getNumElements())*segVers[2][0];
845851

846852
// Get initial radius at current location
847-
848-
// TODO: verify this is the correct "z" location we want
849-
// to interpolate at. These loops and myriad variables make
850-
// something super simple super confusing.
851-
auto const [inletZ, outletZ] = currSeg->getSpatialCharacteristics().inletAndOutletZCoordinates();
852-
double const zAxial = linearEstimate(loopEl, 0, inletZ, currSeg->getNumElements(), outletZ);
853-
currIniRad = currSeg->getSpatialCharacteristics().getInterpolatedRadius(zAxial);
853+
//
854+
// TODO: This should be updated to utilize the spatial characteristics.
855+
// Right now, this won't use the interior points of a spatially varying vessel.
856+
// Instead, it uses the legacy values of the input and output areas.
857+
// Why?
858+
// We're planning to update the VTK files in an independent change. When that's
859+
// done, we can verify that we are using the spatially varying areas correctly
860+
// when building the VTK output.
861+
auto const [inletArea, outletArea] = currSeg->getSpatialCharacteristics().inletAndOutletAreas();
862+
currIniArea = inletArea + (loopEl/double(currSeg->getNumElements()))*(outletArea - inletArea);
863+
currIniRad = sqrt(currIniArea/M_PI);
854864

855865
// Loop on the subdivisions
856866
for(int loopSubdiv=0;loopSubdiv<circSubdiv;loopSubdiv++){
@@ -922,14 +932,16 @@ void cvOneDBFSolver::postprocess_VTK_XML3D_MULTIPLEFILES(){
922932
for(int j=startOut;j<finishOut;j+=2){
923933

924934
// Evaluate Initial Area at current location
925-
926-
// TODO: verify this is the correct "z" location we want
927-
// to interpolate at. These loops and myriad variables make
928-
// something super simple super confusing.
929-
auto const [inletZ, outletZ] = currSeg->getSpatialCharacteristics().inletAndOutletZCoordinates();
930-
double const zAxial = linearEstimate((j-startOut)/2.0,
931-
startOut, inletZ, finishOut, outletZ);
932-
iniArea = currSeg->getSpatialCharacteristics().getInterpolatedArea(zAxial);
935+
//
936+
// TODO: This should be updated to utilize the spatial characteristics.
937+
// Right now, this won't use the interior points of a spatially varying vessel.
938+
// Instead, it uses the legacy values of the input and output areas.
939+
// Why?
940+
// We're planning to update the VTK files in an independent change. When that's
941+
// done, we can verify that we are using the spatially varying areas correctly
942+
// when building the VTK output.
943+
auto const [inletArea, outletArea] = currSeg->getSpatialCharacteristics().inletAndOutletAreas();
944+
iniArea = inletArea + (((j-startOut)/2)/double(currSeg->getNumElements()))*(outletArea - inletArea);
933945

934946
// Eval Current Area at current location
935947
newArea = TotalSolution[loopTime][j];
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
{
2+
"modelName": "results_SpatiallyVaryingAreaTube_",
3+
"solverOptions": {
4+
"timeStep": 0.001,
5+
"stepSize": 1000,
6+
"maxStep": 1000,
7+
"quadPoints": 20,
8+
"inletDataTableName": "INLETDATA",
9+
"boundaryType": "FLOW",
10+
"convergenceTolerance": 1e-08,
11+
"useIV": 1,
12+
"useStab": 1,
13+
"outputType": "TEXT"
14+
},
15+
"materials": [
16+
{
17+
"name": "MAT1",
18+
"type": "OLUFSEN",
19+
"density": 1.06,
20+
"viscosity": 0.04,
21+
"pRef": 0.0,
22+
"exponent": 2.0,
23+
"param1": 1e+15,
24+
"param2": -20.0,
25+
"param3": 1000000000.0
26+
}
27+
],
28+
"nodes": [
29+
{
30+
"name": "0",
31+
"x": 0.0,
32+
"y": 0.0,
33+
"z": 0.0
34+
},
35+
{
36+
"name": "1",
37+
"x": 0.0,
38+
"y": 0.0,
39+
"z": 1.0
40+
},
41+
{
42+
"name": "2",
43+
"x": 0.0,
44+
"y": 0.0,
45+
"z": 2.0
46+
},
47+
{
48+
"name": "3",
49+
"x": 0.0,
50+
"y": 0.0,
51+
"z": 3.0
52+
},
53+
{
54+
"name": "4",
55+
"x": 0.0,
56+
"y": 0.0,
57+
"z": 4.0
58+
},
59+
{
60+
"name": "5",
61+
"x": 0.0,
62+
"y": 0.0,
63+
"z": 5.0
64+
},
65+
{
66+
"name": "6",
67+
"x": 0.0,
68+
"y": 0.0,
69+
"z": 6.0
70+
},
71+
{
72+
"name": "7",
73+
"x": 0.0,
74+
"y": 0.0,
75+
"z": 7.0
76+
},
77+
{
78+
"name": "8",
79+
"x": 0.0,
80+
"y": 0.0,
81+
"z": 8.0
82+
},
83+
{
84+
"name": "9",
85+
"x": 0.0,
86+
"y": 0.0,
87+
"z": 9.0
88+
}
89+
],
90+
"joints": [],
91+
"segments": [
92+
{
93+
"name": "seg0",
94+
"id": 0,
95+
"spatialCharacteristics": {
96+
"z": [
97+
0.0,
98+
3.0,
99+
7.0,
100+
10.0
101+
],
102+
"area": [
103+
1.0,
104+
0.5,
105+
2.0,
106+
1.5
107+
]
108+
},
109+
"totalElements": 50,
110+
"inNode": 0,
111+
"outNode": 1,
112+
"flow": 0.0,
113+
"materialName": "MAT1",
114+
"lossType": "NONE",
115+
"branchAngle": 0.0,
116+
"upstreamSegment": 0,
117+
"branchSegment": 0,
118+
"boundaryType": "RESISTANCE",
119+
"dataTableName": "OUTLETDATA"
120+
}
121+
],
122+
"dataTables": [
123+
{
124+
"name": "INLETDATA",
125+
"type": "LIST",
126+
"values": [
127+
0.0,
128+
100.0,
129+
10.0,
130+
100.0
131+
]
132+
},
133+
{
134+
"name": "OUTLETDATA",
135+
"type": "LIST",
136+
"values": [
137+
0.0,
138+
100.0
139+
]
140+
}
141+
]
142+
}

0 commit comments

Comments
 (0)