<commit_before>/*********************************************************
 Simulation of the Duncan experiment
 
 A foil at angle of attack below a recirculating channel with free surface. 
 
 Example code:
 
  Duncan test;

  void settings() {
    size(1200, 600);
  }
  
  void setup() {
    int n = 128, m=64;
    float xstart = 2, ystart=0.5, AoA=15, Re=500, Fr=0.5; 
    test = new Duncan( n,  m,  xstart,  ystart,  AoA,  Re,  Fr);
  }
  
  void draw() {
    test.update();
    test.display();
  }
 ***********************/

class Duncan {
  float t=0, U=1, ratio=0.001;
  NACA wing;
  TwoPhase flow;
  PVector state;
  float L;

  Duncan( int n, int m, float xstart, float ystart, float AoA, float Re, float Fr) {
    // set up wing
    L = n/8; 
    state = new PVector(xstart*L, (m/2/L + ystart)*L, radians(AoA));
    wing = new NACA(0, 0, L, 0.16, new Window(n, m));
    wing.follow(state, new PVector());
    wing.bodyColor=color(255);

    // set up two phase fluid
    float g = pow(U, 2)/pow(Fr, 2)/L;
    float nu = U*L/Re;
    flow = new TwoPhase(n, m, 0, wing, nu, true, g, ratio); // define fluid
    flow.f.eq(0, 0, n+2, 0, m/2);                           // define initial water region
  }

  void update() {
    t += flow.dt;                  // update the time
    flow.update(); flow.update2(); // 2-step fluid update
  }
  
  void display() {
    flow.f.display();      // display free surface
    flow.u.display(2, 2);  // display velocity vectors
    wing.display();        // display the geometry
  }
}<commit_msg>Update Duncan.pde<commit_after>/*********************************************************
 Simulation of the Duncan experiment
 
 A foil at angle of attack below a recirculating channel with free surface. 
 
 Example code:
 
  Duncan test;

  void settings() {
    size(1200, 600);
  }
  
  void setup() {
    int n = 128, m=64;
    float xstart = 2, ystart=0.5, AoA=15, Re=500, Fr=0.5; 
    test = new Duncan( n,  m,  xstart,  ystart,  AoA,  Re,  Fr);
  }
  
  void draw() {
    test.update();
    test.display();
  }
 ***********************/

class Duncan {
  float t=0, U=1, ratio=0.001, fill=.4;
  NACA wing;
  TwoPhase flow;
  PVector state;
  float L;

  Duncan( int n, int m, float xstart, float ystart, float AoA, float Re, float Fr) {
    // set up wing
    L = n/8; 
    state = new PVector(xstart*L, fill*m + ystart*L, radians(AoA));
    wing = new NACA(0, 0, L, 0.16, new Window(n, m));
    wing.follow(state, new PVector());
    wing.bodyColor=color(255);

    // set up two phase fluid
    float g = pow(U, 2)/pow(Fr, 2)/L;
    float nu = U*L/Re;
    flow = new TwoPhase(n, m, 0, wing, nu, true, g, ratio); // define fluid
    flow.f.eq(0, 0, n+2, 0, int(fill*m));                           // define initial water region
  }

  void update() {
    t += flow.dt;                  // update the time
    flow.update(); flow.update2(); // 2-step fluid update
  }
  
  void display() {
    flow.f.display();      // display free surface
    flow.u.display(2, 2);  // display velocity vectors
    wing.display();        // display the geometry
  }
}
{'fraction_non_alphanumeric': 0.19, 'fraction_numerical': 0.03193548387096774, 'mean_word_length': 2.3488120950323976, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6392347', 'n_tokens_mistral': 1169, 'n_tokens_neox': 1076, 'n_words': 338}