Skip to content

Commit bf5dad4

Browse files
author
cassiope
committed
Docs: updating docs (cassiope bot)
1 parent 2c7037b commit bf5dad4

File tree

6 files changed

+104
-30
lines changed

6 files changed

+104
-30
lines changed

docs/doc/Examples/OCC/driver4.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,61 @@
44
import Generator
55
import Converter
66

7-
# Create parameter
7+
# Create a parameter
88
epaisseur = D.Scalar(12., name='epaisseur')
99
epaisseur.range = [10,15]
1010

1111
# discrete profile
1212
naca = Geom.naca(12, N=51)
1313
bbox = Generator.bbox(naca)
1414

15-
# Create grid
15+
# Create parameter grid
1616
grid1 = D.Grid(bbox[0:3], bbox[3:], N=(3,3,1))
17-
grid1.P[1][2][0].y.range = [0, 5]
17+
grid1.P[1][2][0].y.range = [0, 5, 0.1]
1818
D.Eq(epaisseur.s, grid1.P[1][2][0].x.s)
1919

20-
# Create profile
20+
# Create parametric profile
2121
spline1 = D.Spline3( grid1, mesh=naca, name='spline1' )
2222

23-
# Create sketch
23+
# Create parametric sketch
2424
sketch1 = D.Sketch([spline1], name='sketch1')
2525

26-
# test
26+
# solve for free parameters
2727
D.DRIVER.solve2()
28-
2928
#grid1.P[1][2][0].y.print()
3029

30+
# instantiate a CAD from free parameters
31+
# then mesh and get sensibilities
3132
D.DRIVER.instantiate({'P.1.2.0.y': 0.8})
32-
3333
sketch1.writeCAD('out.step')
34-
3534
mesh = sketch1.mesh(0.01, 0.01, 0.01)
3635
D.DRIVER._diff(sketch1, mesh)
3736
Converter.convertArrays2File(mesh, 'out.plt')
3837

39-
D.DRIVER.setDOE({'P.1.2.0.y': 0.1})
38+
# Build DOE
39+
#D.DRIVER.setDOE({'P.1.2.0.y': 0.1})
40+
D.DRIVER.setDOE()
4041
D.DRIVER.createDOE('doe.hdf')
4142
D.DRIVER.walkDOE(sketch1, 0.01, 0.01, 0.01)
42-
# reread from doe file
43+
44+
# reread one snapshot from DOE file
4345
m = D.DRIVER.readSnaphot(0)
4446
Converter.convertArrays2File(m, 'reread.plt')
45-
full = D.DRIVER.readAllSnapshots()
46-
print(full.shape)
47-
#print(full)
48-
D.DRIVER.fullSvd(full)
4947

50-
import sys; sys.exit()
48+
# read snapshots as matrix
49+
F = D.DRIVER.readAllSnapshots()
50+
# Create a ROM limited to K modes
51+
Phi,S,Vt = D.DRIVER.createROM(F, K=20)
52+
D.DRIVER.writeROM('rom.hdf')
53+
# add to file the coordinates of snapshots on POD vectors
54+
D.DRIVER.addAllCoefs()
55+
56+
# reread and build a snapshot from ROM
57+
coords = D.DRIVER.readCoefs(0)
58+
m = D.DRIVER.evalROM(coords)
59+
Converter.convertArrays2File(m, 'reread2.plt')
5160

61+
# instantiate CADs, mesh and display
5262
import CPlot, time
5363
for i in range(20):
5464
D.DRIVER.instantiate({'P.1.2.0.y': 0.3+i/50.})

docs/doc/Examples/OCC/driver5.py

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,52 @@
1-
# driver: parametric circle (derivatives)
1+
# driver: parametric circle (with derivatives)
22
import OCC.Driver as D
33
import Converter
44

5-
# Create parameter
5+
# Create a parameter
66
radius = D.Scalar(1., name='radius')
7-
radius.range = [0.1,10]
7+
radius.range = [0.1, 10, 0.3]
88

9-
# Create circle
9+
# Create parametric circle
1010
circle1 = D.Circle( (0,0,0), radius, name='circle1' )
1111

12-
# Create sketch
12+
# Create parametric sketch
1313
sketch1 = D.Sketch([circle1], name='sketch1')
1414

15-
# test
15+
# solve for free parameters
1616
D.DRIVER.solve2()
1717

18+
# instantiate a CAD
1819
D.DRIVER.instantiate({'radius': 1.5})
19-
2020
sketch1.writeCAD('out.step')
21-
2221
mesh = sketch1.mesh(0.01, 0.01, 0.01)
2322
D.DRIVER._diff(sketch1, mesh)
2423
Converter.convertArrays2File(mesh, 'out.plt')
2524

26-
#import CPlot, time
27-
#for i in range(50):
28-
# D.DRIVER.instantiate({'radius': 10-i/10.})
29-
# mesh = sketch1.mesh(0.01, 0.01, 0.01)
30-
# CPlot.display(mesh)
31-
# time.sleep(0.5)
25+
# Build DOE
26+
D.DRIVER.setDOE()
27+
D.DRIVER.createDOE('doe.hdf')
28+
D.DRIVER.walkDOE(sketch1, 0.01, 0.01, 0.01)
29+
30+
# reread one snaphsot from DOE file
31+
m = D.DRIVER.readSnaphot(0)
32+
Converter.convertArrays2File(m, 'reread.plt')
33+
34+
# read snapshots as matrix
35+
F = D.DRIVER.readAllSnapshots()
36+
D.DRIVER.createROM(F, K=-1)
37+
D.DRIVER.writeROM('rom.hdf')
38+
# add to file the coordinates of snapshots on POD vectors
39+
D.DRIVER.addAllCoefs()
40+
41+
# reread and build a snapshot from ROM
42+
coords = D.DRIVER.readCoefs(0)
43+
m = D.DRIVER.evalROM(coords)
44+
Converter.convertArrays2File(m, 'reread2.plt')
45+
46+
# instantiate CADs, mesh and display
47+
import CPlot, time
48+
for i in range(50):
49+
D.DRIVER.instantiate({'radius': 10-i/10.})
50+
mesh = sketch1.mesh(0.01, 0.01, 0.01)
51+
CPlot.display(mesh)
52+
time.sleep(0.5)

docs/doc/Examples/OCC/driver8.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# driver: parametric profile in parallel
2+
import OCC.Driver as D
3+
import Geom
4+
import Generator
5+
import Converter
6+
7+
# Create a parameter
8+
epaisseur = D.Scalar(12., name='epaisseur')
9+
epaisseur.range = [10,15]
10+
11+
# discrete profile
12+
naca = Geom.naca(12, N=51)
13+
bbox = Generator.bbox(naca)
14+
15+
# Create parameter grid
16+
grid1 = D.Grid(bbox[0:3], bbox[3:], N=(3,3,1))
17+
grid1.P[1][2][0].y.range = [0, 5, 0.1]
18+
D.Eq(epaisseur.s, grid1.P[1][2][0].x.s)
19+
20+
# Create parametric profile
21+
spline1 = D.Spline3( grid1, mesh=naca, name='spline1' )
22+
23+
# Create parametric sketch
24+
sketch1 = D.Sketch([spline1], name='sketch1')
25+
26+
# solve for free parameters
27+
D.DRIVER.solve2()
28+
29+
# Build DOE
30+
D.DRIVER.setDOE()
31+
D.DRIVER.createDOE('doe.hdf')
32+
D.DRIVER.walkDOE(sketch1, 0.01, 0.01, 0.01)
33+
34+
# read snapshots as matrix
35+
#F = D.DRIVER.readAllSnapshots()
36+
# Create a ROM limited to K modes
37+
#Phi,S,Vt = D.DRIVER.createROM(F, K=20)
38+
#D.DRIVER.writeROM('rom.hdf')
39+
# add to file the coordinates of snapshots on POD vectors
40+
#D.DRIVER.addAllCoefs()

docs/doc/Examples/Post/integMomentNormPT_t1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import Generator.PyTree as G
55
import Post.PyTree as P
66
import KCore.test as test
7+
test.TOLERANCE = 1.e-10
78

89
ni = 11; nj = 11
910
def f1(x,y): return 2*x + y

docs/doc/Examples/Post/integMomentPT_t1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import Generator.PyTree as G
44
import Post.PyTree as P
55
import KCore.test as test
6+
test.TOLERANCE = 1.e-10
67

78
ni = 11; nj = 11
89
def f1(x,y): return 2*x + y

docs/doc/Examples/Post/integNormPT_m1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import Post.Mpi as Pmpi
77
import Converter.Mpi as Cmpi
88
import KCore.test as test
9+
test.TOLERANCE = 1.e-10
910

1011
def f1(x,y): return 2*x + y
1112
def f2(x,y): return 3*x*y + 4

0 commit comments

Comments
 (0)