Skip to content
Snippets Groups Projects

Feature/convergence test

Merged Cristian Lalescu requested to merge feature/convergence_test into develop

Add example Python script that runs convergence tests.

Currently a convergence test for fields is present.

TODO: add particle convergence test (draft status can be removed afterwards).

Edited by Cristian Lalescu

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
405 the particle velocity (i.e. the right-hand-side of the ODE) at previous
406 steps.
407 TurTLE accomplishes this by using the Euler integration scheme for "time
408 step 0", then using a 2nd order Adams-Bashforth, etc, until the desired
409 number of right-hand-side values is stored.
410 Thus the code first integrates trajectories for 8 iterations, and the
411 output will contain the additional information.
412 This happens because such information is crucial for checkpointing ---
413 i.e. stopping/restarting the simulation at arbitrary iterations without
414 affecting the numerical solution.
415
416 To put it simply, for the simulation "nsvep_base" the dataset
417 "tracers0/rhs/0" contains only zeros, and TurTLE ignores them.
418 However, the "tracers0/rhs/8" dataset for simulation "nsvep_1x" contains
419 meaningful values (that are used because we request that `iter0` is
420 different from 0).
  • 428 # number of OpenMP threads per MPI process to use
    429 nthreads_per_process = 2
    430
    431 # 1. Run NSVEparticles for resolution 1x, for a few iterations, to build up rhs values.
    432 factor = 1
    433 # create dns object
    434 cc = DNS()
    435 # launch simulation
    436 cc.launch([
    437 'NSVEparticles',
    438 '-n', '{0}'.format(factor*32),
    439 '--np', '{0}'.format(nprocesses),
    440 '--ntpp', '{0}'.format(nthreads_per_process),
    441 '--src-simname', 'base_{0}x'.format(factor),
    442 '--src-iteration', '{0}'.format(base_niterations),
    443 '--simname', 'nsvep_base'.format(factor),
  • 452 '--cpp_random_particles', '{0}'.format(particle_random_seed)])
    453
    454 # 2. Prepare initial conditions
    455 for factor in [1, 2, 4]:
    456 df = h5py.File('nsvep_{0}x_checkpoint_0.h5'.format(factor), 'w')
    457 # field
    458 df['vorticity/complex/{0}'.format(8*factor)] = h5py.ExternalLink(
    459 'base_{0}x_checkpoint_0.h5'.format(factor),
    460 'vorticity/complex/{0}'.format(base_niterations))
    461 # particles
    462 df['tracers0/state/{0}'.format(8*factor)] = h5py.ExternalLink(
    463 'nsvep_base_checkpoint_0.h5',
    464 'tracers0/state/8')
    465 df['tracers0/rhs/{0}'.format(8*factor)] = h5py.ExternalLink(
    466 'nsvep_base_checkpoint_0.h5',
    467 'tracers0/rhs/8')
  • 11 ----------------------
    12
    13 Since TurTLE contains solvers of the Navier Stokes equations in both
    14 velocity ("NSE") and vorticity formulation ("NSVE"), this allows for a direct
    15 convergence test: one should use both solvers with identical parameters, and
    16 compare solutions as the resolution is varied.
    17
    18 Notes:
    19
    20 * we are discussing a partial differential equation, therefore
    21 when we test for convergence we will increase both spatial and
    22 temporal resolution.
    23
    24 * we will test convergence properties for a "statistically
    25 stationary initial condition", since the smoothness properties of
    26 the field will influence convergence properties in general.
  • 1 Tutorial: convergence test
    2 ==========================
    3
    4 An essential property of numerical methods is their accuracy. With
    5 standard approaches to differential equations, one may use
    6 generic convergence tests to characterize algorithms and/or
    7 implementations.
    • This really doesn't make me want to read the tutorial. What about this:

      An essential property of numerical methods is their accuracy. Here we explain how the convergence of TurTLE's fluid and particle solvers can be tested in a simple Python script. This tutorial also serves to illustrate the use of the TurTLE interface for launching simulations and postprocessing, in particular converting vorticity and velocity fields into each other, changing their resolution, running new simulations on these fields and performing simple analysis of particle data.

    • Please register or sign in to reply
  • Cristian Lalescu added 25 commits

    added 25 commits

    • 75e09b1c...97e78f50 - 22 commits from branch develop
    • b01f83ba - updates convergence test
    • cb255269 - Merge branch 'feature/particle_integration_test' into feature/convergence_test
    • 7b7b7f39 - fixes intialization of runs with different interpolation

    Compare with previous version

  • Cristian Lalescu added 20 commits

    added 20 commits

    • 7b7b7f39...bd46f130 - 9 commits from branch develop
    • 9ea889b9 - tweaks PP file output
    • ea580741 - moves convergence example to proper folder
    • 041c5498 - adds text to discuss convergence test
    • 1c9eda4b - fixes initial condition check
    • 96f0c876 - adds convergence test for particles
    • c0f92d15 - adds option to control iter0 for DNS class
    • d113784b - finalizes convergence tutorial
    • 5294f665 - adds plots to tutorial
    • a3af978f - fixes axes label
    • 7bfc946f - updates convergence test
    • 696e7669 - fixes intialization of runs with different interpolation

    Compare with previous version

  • Cristian Lalescu marked this merge request as draft

    marked this merge request as draft

  • Cristian Lalescu added 3 commits

    added 3 commits

    • 6e30b66d - adds temporary alternate field convergence test
    • 642d9641 - adds error raise for kspace inconsistency
    • 76847edf - [wip] testing particle convergence

    Compare with previous version

  • Cristian Lalescu added 56 commits

    added 56 commits

    • 76847edf...2fcd8d4e - 42 commits from branch develop
    • 2167e2ff - tweaks PP file output
    • 87ea3e16 - moves convergence example to proper folder
    • 233f62b3 - adds text to discuss convergence test
    • efacb81b - fixes initial condition check
    • 2ebb1c88 - adds convergence test for particles
    • 7715c5ec - adds option to control iter0 for DNS class
    • 67aad83c - finalizes convergence tutorial
    • 843f24ce - adds plots to tutorial
    • f88d2066 - fixes axes label
    • 7b257a9e - updates convergence test
    • 4203f097 - fixes intialization of runs with different interpolation
    • 1b450924 - adds temporary alternate field convergence test
    • 0ec2f584 - adds error raise for kspace inconsistency
    • fffef06f - [wip] testing particle convergence

    Compare with previous version

  • added 1 commit

    • fea49e0d - bugfix: fixes forcing call for NSE

    Compare with previous version

  • Cristian Lalescu added 3 commits

    added 3 commits

    • 95019c4a - adds cleaner field solver convergence check
    • 7e6fe17b - fixes viscosity value for decaying case
    • 1c51da3d - tweaks field error analysis

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 41309bce - fixes particle convergence test

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading