@@ -36,6 +36,9 @@ def main(inflow: 'inflow velocity' = 10,
3636 domain = topo .withboundary (inflow = 'left' , wall = 'top,bottom' , outflow = 'right' ) - \
3737 topo [18 :20 , :10 ].withboundary (flap = 'left,right,top' )
3838
39+ couplinginterface = domain .boundary ['flap' ]
40+ couplingsample = couplinginterface .sample ('gauss' , degree = 2 ) # mesh located at Gauss points
41+
3942 # time approximations
4043 t0 = lambda f : function .replace_arguments (f , {arg : function .Argument (arg + '0' , shape = shape , dtype = dtype )
4144 for arg , (shape , dtype ) in f .arguments .items ()})
@@ -63,6 +66,7 @@ def main(inflow: 'inflow velocity' = 10,
6366 ns .urel_i = 'ubasis_ni ?lhs_n' # relative velocity
6467 ns .u_i = 'umesh_i + urel_i' # total velocity
6568 ns .p = 'pbasis_n ?lhs_n' # pressure
69+ ns .qw = couplingsample .asfunction (numpy .concatenate ([p .weights for p in couplingsample .points ]))
6670
6771 # for visualization
6872 bezier = domain .sample ('bezier' , 2 )
@@ -77,9 +81,6 @@ def main(inflow: 'inflow velocity' = 10,
7781 # define coupling meshes
7882 meshName = "Fluid-Mesh"
7983 meshID = interface .get_mesh_id (meshName )
80-
81- couplinginterface = domain .boundary ['flap' ]
82- couplingsample = couplinginterface .sample ('gauss' , degree = 2 ) # mesh located at Gauss points
8384 dataIndices = interface .set_mesh_vertices (meshID , couplingsample .eval (ns .x0 ))
8485
8586 # coupling data
@@ -158,8 +159,7 @@ def main(inflow: 'inflow velocity' = 10,
158159
159160 # write forces to interface
160161 if interface .is_write_data_required (dt ):
161- writedata = couplingsample .eval ('F_i d:x' @ ns , ** arguments ) * \
162- numpy .concatenate ([p .weights for p in couplingsample .points ])[:, numpy .newaxis ]
162+ writedata = couplingsample .eval ('F_i qw d:x' @ ns , ** arguments )
163163 interface .write_block_vector_data (writedataID , dataIndices , writedata )
164164
165165 # do the coupling
0 commit comments