Permalink
Browse files

fixed meshgen for Resistance element, wip

  • Loading branch information...
1 parent 766e330 commit f7d4336e8eba273f623535ac484a0937cb68c149 Simone Manini committed May 14, 2012
Showing with 66 additions and 34 deletions.
  1. +2 −0 Elements.py
  2. +23 −21 MeshGenerator.py
  3. +41 −13 XML/TEST/CircularStraightTube/vascular_network_v3.0_TUBE.xml
View
@@ -1233,6 +1233,7 @@ def __init__(self, elId, nodeIds, elementParameters, side=None, name=None):
Constructor
'''
Element.__init__(self)
+ print "ok"
self.Type = "Resistance"
self.Side = side
self.Id = elId
@@ -1256,6 +1257,7 @@ def SetResistance(self, resistance):
This method sets Resistance.
'''
self.R = resistance
+ print self.R
def InputParameters(self, evaluator=None):
'''
View
@@ -114,7 +114,7 @@ def ParsingEdgeProperties(self, edge):
meshradius = {}
s_list = []
for s in edge.Radius['array'].iterkeys():
- s_list.append(s)
+ s_list.append(s)
s_list.sort()
if meshradius.has_key(s):
meshradius[s].append(edge.Radius['array'][s])
@@ -372,26 +372,28 @@ def MaxLengthMeshing(self, maxLength):
elementParameters['s1'] = 0.0
elementParameters['s2'] = 1.0
- elementParameters['length'] = edgeProperties['length']
- if edgeProperties['radius'] is not None:
- if type(edgeProperties['radius'][0]) is str or type(edgeProperties['radius'][1]) is str:
-
- elementParameters['radiusAtRest'] = edgeProperties['ScalarRadius']
- elementParameters['radius'] = edgeProperties['radius']
- else:
- elementParameters['radius'] = edgeProperties['radius']
- else:
- elementParameters['radius'] = {elementParameters['s1']:edgeProperties['xradius'][elementParameters['s1']]*edgeProperties['yradius'][elementParameters['s1']]**0.5, elementParameters['s2']:edgeProperties['xradius'][elementParameters['s2']]*edgeProperties['yradius'][elementParameters['s2']]**0.5}
- elementParameters['wall_thickness'] = edgeProperties['wallthickness']
- elementParameters['young_modulus'] = edgeProperties['youngmodulus']
- if edgeProperties['xradius'][0.0] is not None:
- elementParameters['xradius'] = edgeProperties['xradius']
- else:
- elementParameters['xradius'] = None
- if edgeProperties['yradius'][0.0] is not None:
- elementParameters['yradius'] = edgeProperties['yradius']
- else:
- elementParameters['yradius'] = None
+ elementParameters['length'] = edgeProperties['length']
+ if self.MeshType.get(edgeId,None) == "Resistance":
+ pass
+ else:
+ if edgeProperties['radius'] is not None:
+ if type(edgeProperties['radius'][0]) is str or type(edgeProperties['radius'][1]) is str:
+ elementParameters['radiusAtRest'] = edgeProperties['ScalarRadius']
+ elementParameters['radius'] = edgeProperties['radius']
+ else:
+ elementParameters['radius'] = edgeProperties['radius']
+ else:
+ elementParameters['radius'] = {elementParameters['s1']:edgeProperties['xradius'][elementParameters['s1']]*edgeProperties['yradius'][elementParameters['s1']]**0.5, elementParameters['s2']:edgeProperties['xradius'][elementParameters['s2']]*edgeProperties['yradius'][elementParameters['s2']]**0.5}
+ elementParameters['wall_thickness'] = edgeProperties['wallthickness']
+ elementParameters['young_modulus'] = edgeProperties['youngmodulus']
+ if edgeProperties['xradius'][0.0] is not None:
+ elementParameters['xradius'] = edgeProperties['xradius']
+ else:
+ elementParameters['xradius'] = None
+ if edgeProperties['yradius'][0.0] is not None:
+ elementParameters['yradius'] = edgeProperties['yradius']
+ else:
+ elementParameters['yradius'] = None
elementParameters["resistance"] = edge.Resistance
@@ -9,34 +9,62 @@
</case>
<nodes>
<node id="1" type="inflow" name="heart"/>
- <node id="2" type="downstream network" name="end_tube">
- <properties>
- <windkessel>
- <expression>$WindkesselRel[end_tube] = (($mean_pressure[])/($cardiac_output[]))*(133.3223684211*6.0e7)</expression>
- </windkessel>
- </properties>
- </node>
- </nodes>
+ <node id="2"/>
+ <node id="3"/>
+ <node id="4"/>
+ </nodes>
<superedges>
<superedge id="1" name="tube">
<edgesIds>
<edgeIds edge_id="1"/>
- </edgesIds>
+ <edgeIds edge_id="2"/>
+ <edgeIds edge_id="3"/>
+ </edgesIds>
</superedge>
</superedges>
<edges>
- <edge id="1" node1_id="1" node2_id="2" side="arterial" name="tube">
+ <edge id="1" node1_id="1" node2_id="2" side="arterial" name="first">
+ <geometry>
+ <length unit="m" accuracy="10%" source="US">
+ <scalar>5e-2</scalar>
+ </length>
+ </geometry>
+ <properties>
+ <radius unit="m" accuracy="10%" source="US">
+ <scalar>4e-3</scalar>
+ </radius>
+ <wall_thickness unit="m" accuracy="10%" source="US">
+ <scalar>4e-4</scalar>
+ </wall_thickness>
+ <young_modulus unit="Pa" accuracy="10%" source="US">
+ <scalar>2.67e6</scalar>
+ </young_modulus>
+ </properties>
+ </edge>
+ <edge id="2" node1_id="2" node2_id="3" side="arterial" name="res" type="Resistance">
+ <geometry>
+ <length unit="m" accuracy="10%" source="US">
+ <scalar>5e-2</scalar>
+ </length>
+ </geometry>
+ <properties>
+ <resistance unit="Pa">
+ <scalar>10e9</scalar>
+ </resistance>
+ </properties>
+ </edge>
+ <edge id="3" node1_id="3" node2_id="4" side="venous" name="second">
<geometry>
<length unit="m" accuracy="10%" source="US">
- <scalar>0.414</scalar>
+ <scalar>5e-2</scalar>
</length>
</geometry>
<properties>
<radius unit="m" accuracy="10%" source="US">
- <scalar>1.5e-2</scalar>
+ <scalar>4e-3</scalar>
</radius>
<wall_thickness unit="m" accuracy="10%" source="US">
- <scalar>1.5e-3</scalar>
+ <scalar>4e-4</scalar>
</wall_thickness>
<young_modulus unit="Pa" accuracy="10%" source="US">
<scalar>2.67e6</scalar>

0 comments on commit f7d4336

Please sign in to comment.