Skip to content
Permalink
Browse files

updating notebooks to pyhton3

  • Loading branch information...
cekees committed Jun 6, 2019
1 parent cf47b32 commit 3c7921e25524dd9749a144a4a0140f30da48d103
@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"- [adr-complete-parallel](notebooks/Tutorials/Tutorial_2/adr-complete-parallel.ipynb)\n",
"- [adr-complete-parallel](notebooks/Tutorials/Tutorial_3/adr-complete-parallel.ipynb)\n",
"- [adr-complete-serial](notebooks/Tutorials/Tutorial_2/adr-complete-serial.ipynb)\n",
"- [Flume](notebooks/Applications/wavetank2d/Flume.ipynb)\n",
"- [Introduction](notebooks/Tutorials/Tutorial_1/Introduction.ipynb)\n",
@@ -13,6 +13,13 @@
"- [Proteus_Notebooks_Home](notebooks/Proteus_Notebooks_Home.ipynb)\n",
"- [Proteus_Tutorials](notebooks/Tutorials/Proteus_Tutorials.ipynb)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
@@ -36,21 +36,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11"
"pygments_lexer": "ipython3",
"version": "3.7.2"
}
},
"nbformat": 4,
@@ -129,7 +129,20 @@
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "SyntaxError",
"evalue": "Missing parentheses in call to 'print'. Did you mean print(\"INVALID: spaceOrder\" + spaceOrder)? (dambreak.py, line 30)",
"output_type": "error",
"traceback": [
"Traceback \u001b[0;36m(most recent call last)\u001b[0m:\n",
" File \u001b[1;32m\"/home/cekees/proteus/linux/lib/python3.7/site-packages/IPython/core/interactiveshell.py\"\u001b[0m, line \u001b[1;32m3296\u001b[0m, in \u001b[1;35mrun_code\u001b[0m\n exec(code_obj, self.user_global_ns, self.user_ns)\n",
" File \u001b[1;32m\"<ipython-input-3-350cb3494451>\"\u001b[0m, line \u001b[1;32m1\u001b[0m, in \u001b[1;35m<module>\u001b[0m\n import dambreak_so\n",
"\u001b[0;36m File \u001b[0;32m\"./dambreak_so.py\"\u001b[0;36m, line \u001b[0;32m2\u001b[0;36m, in \u001b[0;35m<module>\u001b[0;36m\u001b[0m\n\u001b[0;31m import dambreak\u001b[0m\n",
"\u001b[0;36m File \u001b[0;32m\"./dambreak.py\"\u001b[0;36m, line \u001b[0;32m30\u001b[0m\n\u001b[0;31m print \"INVALID: spaceOrder\" + spaceOrder\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m Missing parentheses in call to 'print'. Did you mean print(\"INVALID: spaceOrder\" + spaceOrder)?\n"
]
}
],
"source": [
"import dambreak_so\n",
"from proteus import Comm\n",
@@ -283,21 +296,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11"
"pygments_lexer": "ipython3",
"version": "3.7.2"
}
},
"nbformat": 4,
@@ -29,4 +29,4 @@
targetError=target_error,
targetElementCount=target_element_count)

domain.PUMIMesh.loadModelAndMesh("Dambreak.null","Dambreak.msh")
domain.PUMIMesh.loadModelAndMesh("Dambreak.null","Dambreak.msh")

Large diffs are not rendered by default.

@@ -23,37 +23,37 @@
# 2 -- K-Omega
# Input checks
if spaceOrder not in [1,2]:
print "INVALID: spaceOrder" + spaceOrder
logEvent("INVALID: spaceOrder" + spaceOrder)
sys.exit()

if useRBLES not in [0.0, 1.0]:
print "INVALID: useRBLES" + useRBLES
logEvent("INVALID: useRBLES" + useRBLES)
sys.exit()

if useMetrics not in [0.0, 1.0]:
print "INVALID: useMetrics"
logEvent("INVALID: useMetrics")
sys.exit()

# Discretization
nd = 2
if spaceOrder == 1:
hFactor=1.0
if useHex:
basis=C0_AffineLinearOnCubeWithNodalBasis
elementQuadrature = CubeGaussQuadrature(nd,2)
elementBoundaryQuadrature = CubeGaussQuadrature(nd-1,2)
basis=C0_AffineLinearOnCubeWithNodalBasis
elementQuadrature = CubeGaussQuadrature(nd,2)
elementBoundaryQuadrature = CubeGaussQuadrature(nd-1,2)
else:
basis=C0_AffineLinearOnSimplexWithNodalBasis
elementQuadrature = SimplexGaussQuadrature(nd,3)
elementBoundaryQuadrature = SimplexGaussQuadrature(nd-1,3)
basis=C0_AffineLinearOnSimplexWithNodalBasis
elementQuadrature = SimplexGaussQuadrature(nd,3)
elementBoundaryQuadrature = SimplexGaussQuadrature(nd-1,3)
elif spaceOrder == 2:
hFactor=0.5
if useHex:
basis=C0_AffineLagrangeOnCubeWithNodalBasis
basis=C0_AffineLagrangeOnCubeWithNodalBasis
elementQuadrature = CubeGaussQuadrature(nd,4)
elementBoundaryQuadrature = CubeGaussQuadrature(nd-1,4)
else:
basis=C0_AffineQuadraticOnSimplexWithNodalBasis
basis=C0_AffineQuadraticOnSimplexWithNodalBasis
elementQuadrature = SimplexGaussQuadrature(nd,4)
elementBoundaryQuadrature = SimplexGaussQuadrature(nd-1,4)

@@ -85,7 +85,7 @@ def __init__(self,gaugeLocations={'pressure_1':(0.5,0.5,0.0)}):
self.flags={}
self.files={}#will be opened later
pointFlag=100
for name,point in self.locations.iteritems():
for name,point in self.locations.items():
self.flags[name] = pointFlag
pointFlag += 1
def attachModel(self,model,ar):
@@ -100,7 +100,7 @@ def attachAuxiliaryVariables(self,avDict):
return self
def calculate(self):
import numpy as np
for name,flag in self.flags.iteritems():
for name,flag in self.flags.items():
vnMask = self.vertexFlags == flag
if vnMask.any():
if not self.files.has_key(name):
@@ -116,7 +116,7 @@ def __init__(self,gaugeEndpoints={'pressure_1':((0.5,0.5,0.0),(0.5,1.8,0.0))},l
self.linepoints={}
self.files={}#while open later
pointFlag=1000
for name,(pStart,pEnd) in self.endpoints.iteritems():
for name,(pStart,pEnd) in self.endpoints.items():
self.flags[name] = pointFlag
p0 = np.array(pStart)
direction = np.array(pEnd) - p0
@@ -136,7 +136,7 @@ def attachAuxiliaryVariables(self,avDict):
return self
def calculate(self):
import numpy as np
for name,flag in self.flags.iteritems():
for name,flag in self.flags.items():
vnMask = self.vertexFlags == flag
if vnMask.any():
if not self.files.has_key(name):
@@ -153,7 +153,7 @@ def __init__(self,gaugeEndpoints={'pressure_1':((0.5,0.5,0.0),(0.5,1.8,0.0))},l
self.linepoints={}
self.files={}#while open later
pointFlag=1000
for name,(pStart,pEnd) in self.endpoints.iteritems():
for name,(pStart,pEnd) in self.endpoints.items():
self.flags[name] = pointFlag
p0 = np.array(pStart)
direction = np.array(pEnd) - p0
@@ -171,7 +171,7 @@ def attachAuxiliaryVariables(self,avDict):
return self
def calculate(self):
import numpy as np
for name,flag in self.flags.iteritems():
for name,flag in self.flags.items():
vnMask = self.vertexFlags == flag
if vnMask.any():
if not self.files.has_key(name):
@@ -241,10 +241,10 @@ def calculate(self):

regions=[[0.1*L[0] ,0.5*L[1]]]
regionFlags=[1]
#for gaugeName,gaugeCoordinates in pointGauges.locations.iteritems():
#for gaugeName,gaugeCoordinates in pointGauges.locations.items():
# vertices.append(gaugeCoordinates)
# vertexFlags.append(pointGauges.flags[gaugeName])
#for gaugeName,gaugeLines in lineGauges.linepoints.iteritems():
#for gaugeName,gaugeLines in lineGauges.linepoints.items():
# for gaugeCoordinates in gaugeLines:
# vertices.append(gaugeCoordinates)
# vertexFlags.append(lineGauges.flags[gaugeName])
@@ -64,21 +64,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11"
"pygments_lexer": "ipython3",
"version": "3.7.2"
}
},
"nbformat": 4,

0 comments on commit 3c7921e

Please sign in to comment.
You can’t perform that action at this time.