scieee AI-readable full text Open interactive document viewer

Introduction to the Numerical Solution of the Navier-Stokes equations. Module 5: Hands on session 2

Soria Guerrero, Manel

Full text

ENGINYERIA AEROESPACIAL Apunts Introduction to the Numerical Solution of the Navier-Stokes equations. Module 5: Hands on session 2 Manel Soria Assignatura: Aerodinàmica, Mecànica Orbital I Mecànica de Vol Titulació: Master d’Enginyeria Aeronàutica Curs: 1r Escola Superior d’Enginyeries Industrial, Aeroespacial i Audiovisual de Terrassa (ESEIAAT) Idioma: Anglès Novembre 2021 Introduction to the Numerical Solution of the Navier-Stokes equations Module 5. Hands on session 2 Manel Soria –[email protected] MÀSTER UNIVERSITARI EN ENGINYERIA AERONÀUTICA ESEIAAT Introduction to the Numerical Solution of the Navier-Stokes equations Module 5. Hands on session 2 Introduction to the Numerical Solution of the Navier-Stokes equations 5.1 Hands on session 3 Make sure you understand module 4 before you begin. In particular, check the following items: •Disposition of the fields and notation. •Periodic domains. •Halos and halo update. •Staggered mesh. Introduction to the Numerical Solution of the Navier-Stokes equations 5.1 Hands on session 4 Class questions: 1.Write the print_field function (you can use the code provided in the slides). Don't forget the documentation of the function (this also holds for the rest of the assignments from now on). Generate different fields and test the function with them. Make sure you understand the fprintf function and the format string. 2.Write the halo_update function. It should have one argument (the field not updated) and return one result (the field updated). Test it with some examples, using print_field. 3.Write a function that generates the u and v scalar fields with the analytic function 𝑢 = 𝑥, 𝑣 = 𝑥 in a square domain from 0 to 1 in x and y directions. Call it analytic1x. Check that the velocity values are correct with print_field . Recall that the mesh we are using is staggered. Repeat the assignment with 𝑢 = 𝑦, 𝑣 = 𝑦 and call it analytic1y. Introduction to the Numerical Solution of the Navier-Stokes equations 5.1 Hands on session 5 function [u,v]=analyticTaylor(u,v,L,t) % [u, v] = analyticTaylor(u, v, L, t) %given two fields u and v, of dimensions u(N+2,N+2) % v(N+2,N+2), the function fills then with the Taylor solution % of the Navier-Stokes equations at time t, for a domain size L. % A staggered mesh with halos is used, as described in module 4. % IMPORTANT: The fields returned are NOT halo updated ! %Written by: Manel Soria 2021 % Example of use: % N = 8; % 8x8 mesh % u = zeros(N+2,N+2); % v = zeros(N+2,N+2); % [u,v]=analyticTaylor(u,v,1,0) % u = halo_update(u); % v = halo_update(v); … 4.Write a function that implements the analytic solution of the Navier-Stokes (Eq. 2.2). Call it analyticTaylor : Notes: Inside the function code we will obtain the number of nodes per dimension (N) as follows: N=size(u,1)-2; % mesh size Once programmed, check that the example code works as expected. halo_update could have been called inside the function but in general we will prefer to do so at a higher level of the code, to be able to check that no halo_update‘s are missing. If some are inside the functions, it is easy to forget about the others.