#.. warning:: # Analytic solution is available in Bump for 1D steady state, single layer St Venant only # ################################################################################ # # Layers: #-------------------- # #Number of layers is set to one for comparison with analytical solutions. # #.. note:: Topography defined in ``fk.Bump`` is shared with ``fk.Layer`` # NL = 1 layer = fk.Layer(NL, triangular_mesh, topography=bump_analytic.topography) ################################################################################ # # Primitives: #-------------------- primitives = fk.Primitive(triangular_mesh, layer, free_surface=FREE_SURFACE_0, QXinit=Q_IN, QYinit=0.) ################################################################################ # # Boundary conditions:
dir_path = os.path.abspath(os.path.dirname(sys.argv[0])) triangular_mesh = fk.TriangularMesh.from_msh_file(dir_path + '/inputs/raceway.msh') NC = triangular_mesh.NV if WITH_PARTICLES: triangular_mesh.set_neighbours() if not args.nographics: fk_plt.plot_mesh(triangular_mesh, plot_labels=False) ################################################################################ # # Layers: #-------------------- layer = fk.Layer(NL, triangular_mesh, topography=ZB) ################################################################################ # # Primitives: #-------------------- primitives = fk.Primitive(triangular_mesh, layer, height=H0) ################################################################################ # # Tracer: #-------------------- if WITH_TRACER: T_0 = np.zeros((NC, NL))
################################################################################ # #.. warning:: # Analytic solution is available in DamBreak for single layer, 1D St Venant only # ################################################################################ # # Layers: #-------------------- # #Number of layers is set to one for comparison with analytical solutions. # NL = 1 layer = fk.Layer(NL, triangular_mesh, topography=dambreak_analytic.topography) ################################################################################ # # Primitives: #-------------------- def h_0(x, y): h = H_R if x < X_D: h = H_L return h if not args.nographics: fk_plt.plot_init_1d(triangular_mesh, h_0, 'x', '$H_0$')
# Restart can be performed several times in the same simulation. In our case, # simulation time is splitted in 4 sections, and 3 iterative restarts are performed. # ################################################################################ # # Case set-up: #-------------------- # simutime = fk.SimuTime(final_time=4., time_iteration_max=20000, second_order=True) create_figure_scheduler = fk.schedules(times=[0., 1., 2., 3., 4., 5.]) triangular_mesh = fk.TriangularMesh.from_msh_file( '../simulations/inputs/square2.mesh') layer = fk.Layer(1, triangular_mesh, topography=0.) def H_0(x, y): h = 2.4 * (1.0 + np.exp(-0.25 * ((x - 10.05)**2 + (y - 10.05)**2))) return h primitives = fk.Primitive(triangular_mesh, layer, height_funct=H_0) tracers = [fk.Tracer(triangular_mesh, layer, primitives, Tinit=1.0)] slides = [fk.Slide(ref=r) for r in [1, 2, 3, 4]] vtk_writer = fk.VTKWriter(triangular_mesh, scheduler=fk.schedules(count=10), scale_h=1.) problem = fk.Problem(simutime,
'vertical_viscosity': 0.01 } simutime_l = [] layer_l = [] primitives_l = [] wind_effect_l = [] external_effects_l = [] problem_l = [] for C, law in enumerate(cases): simutime_l.append( fk.SimuTime(final_time=5., time_iteration_max=10000, second_order=False)) layer_l.append(fk.Layer(NL, triangular_mesh, topography=0.)) primitives_l.append( fk.Primitive(triangular_mesh, layer_l[C], free_surface=2.0)) if law == 'Custom': wind_effect_l.append( fk.WindEffect(velocity=[20, 20, 20, 20], orientation=[270., 270., 270., 270.], times=[0., 3., 4., 5.], friction_law_funct=custom_friction_law)) else: wind_effect_l.append( fk.WindEffect(velocity=[20, 20, 20, 20], orientation=[270., 270., 270., 270.], times=[0., 3., 4., 5.], friction_law=law))
#.. math:: \omega = \sqrt{2g h_0}/a \quad \text{and} \quad \eta = 0.5 ################################################################################ # #.. warning:: # Analytic solution is available in Thacker2d for single layer St Venant only ################################################################################ # # Layers: #-------------------- # #.. note:: Topography defined in thacker2d is shared with layer # layer = fk.Layer(NL, triangular_mesh, topography=thacker2d_analytic.topography) ################################################################################ # # Primitives: #-------------------- # #.. note:: H, U and V are initialized with analytic initial solution # primitives = fk.Primitive(triangular_mesh, layer, height=thacker2d_analytic.H, Uinit=thacker2d_analytic.U, Vinit=thacker2d_analytic.V)
# Topography: #-------------------- def Topography(x, y): topo = -H * (1 - x**2 / A**2) return topo ################################################################################ # # Layers: #-------------------- NL = 1 layer = fk.Layer(NL, triangular_mesh, topography_funct=Topography) ################################################################################ # # Primitives: #-------------------- def eta_0(x, y): h = -0.5 * x + 4.0 return h def T_0(x, y): if x < -1.5: t = 35.0