@@ -27,7 +27,9 @@ def main(inflow=10., viscosity=1., density=1., theta=.5, timestepsize=.01):
27
27
topo [18 :20 , :10 ].withboundary (flap = 'left,right,top' )
28
28
29
29
couplinginterface = domain .boundary ['flap' ]
30
- couplingsample = couplinginterface .sample ('gauss' , degree = 2 ) # mesh located at Gauss points
30
+ couplingsample = couplinginterface .sample ('uniform' , degree = npoints_per_elem )
31
+
32
+ bezier = domain .sample ('bezier' , 2 )
31
33
32
34
# time approximations
33
35
t0 = lambda f : function .replace_arguments (f , {arg : function .Argument (arg + '0' , shape = shape , dtype = dtype )
@@ -54,30 +56,6 @@ def main(inflow=10., viscosity=1., density=1., theta=.5, timestepsize=.01):
54
56
ns .p = 'pbasis_n ?lhs_n' # pressure
55
57
ns .qw = couplingsample .asfunction (numpy .concatenate ([p .weights for p in couplingsample .points ]))
56
58
57
- # for visualization
58
- bezier = domain .sample ('bezier' , 2 )
59
-
60
- # preCICE setup
61
- configFileName = "../precice-config.xml"
62
- participantName = "Fluid"
63
- solverProcessIndex = 0
64
- solverProcessSize = 1
65
- interface = precice .Interface (participantName , configFileName , solverProcessIndex , solverProcessSize )
66
-
67
- # define coupling meshes
68
- meshName = "Fluid-Mesh"
69
- meshID = interface .get_mesh_id (meshName )
70
- dataIndices = interface .set_mesh_vertices (meshID , couplingsample .eval (ns .x0 ))
71
-
72
- # coupling data
73
- writeData = "Force"
74
- readData = "Displacement"
75
- writedataID = interface .get_data_id (writeData , meshID )
76
- readdataID = interface .get_data_id (readData , meshID )
77
-
78
- # initialize preCICE
79
- precice_dt = interface .initialize ()
80
-
81
59
# boundary conditions for fluid equations
82
60
sqr = domain .boundary ['wall,flap' ].integral ('urel_k urel_k d:x0' @ ns , degree = 4 )
83
61
cons = solver .optimize ('lhs' , sqr , droptol = 1e-15 )
@@ -107,6 +85,18 @@ def main(inflow=10., viscosity=1., density=1., theta=.5, timestepsize=.01):
107
85
#res_stokes = domain.integral('(ubasis_ni,j ((u_i,j + u_j,i) rho nu - p δ_ij) + pbasis_n u_k,k) d:x' @ ns, degree=4)
108
86
#lhs0 = solver.solve_linear('lhs', res_stokes, constrain=cons, arguments=dict(meshdofs=meshdofs, meshdofs0=meshdofs0, meshdofs00=meshdofs00, meshdofs000=meshdofs000, dt=dt))
109
87
88
+ # preCICE setup
89
+ solverProcessIndex = 0
90
+ solverProcessSize = 1
91
+ interface = precice .Interface ("Fluid" , "../precice-config.xml" , solverProcessIndex , solverProcessSize )
92
+ meshID = interface .get_mesh_id ("Fluid-Mesh" )
93
+ dataIndices = interface .set_mesh_vertices (meshID , couplingsample .eval (ns .x0 ))
94
+ writedataID = interface .get_data_id ("Force" , meshID )
95
+ readdataID = interface .get_data_id ("Displacement" , meshID )
96
+
97
+ # initialize preCICE
98
+ precice_dt = interface .initialize ()
99
+
110
100
timestep = 0
111
101
arguments = dict (lhs = numpy .zeros (len (ns .ubasis )), meshdofs = numpy .zeros (len (ns .dbasis )), dt = timestepsize )
112
102
0 commit comments