Giter Site home page Giter Site logo

jothurgood / simplecfd Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 6.0 49.95 MB

Simple (and not-so-simple) CFD solvers written in Fortran with Python plotting routines

License: MIT License

Fortran 88.34% Makefile 3.26% Python 7.42% Shell 0.35% CMake 0.64%
cfd euler-equations fluid-dynamics fluid-solver computational-fluid-dynamics burgers-equation finite-difference-schemes finite-volume-methods riemann-solvers incompressible-flow

simplecfd's People

Contributors

jothurgood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

simplecfd's Issues

CCAPS - use time centred rho in step 4's grav forcing

In step 4 should probabally calc a time centred rho (from 0.5 * (rho^n + rho^n+1 ) to use in calc of U*

Currently uses rho^n+1 (as advect_dens is called prior, which updates the rho array to the new time level).

Should test and then (if good) implement in CCAPS, CCAPS_vardens and CCAPS_atm_const

make relaxation step in CCAPS more modular

make relaxation step in CCAPS more modular instead of two calls to very similar subroutine. Then the simple projection tests can be built from the same makefile in a cleaner manner, and a future multigrid solver could just be parachuted in-line into the advance_module

enforce a column width of 72

mainly because I like to have a terminal vertically split on a small laptop with fairly large font, so this reads well and doesn't visually break lines

CCAPS_atm_const - possible correction bug

Not seen any bad behaviour but compiler debug warning

[ 50%] Building Fortran object CMakeFiles/CCAPS.dir/src/advance_module.f90.o
/Users/tflv6/Data/SimpleCFD/incompressible/CCAPS_atm_const/src/advance_module.f90:313:0:

         betay_r = 0.5_num * (betacc + p0(iy+1)**(1.0_num / gamma))

Warning: 'betacc' may be used uninitialized in this function [-Wmaybe-uninitialized]

Inspecting code, seems will in fact occur when evaluating the iy=0 slice for ix>0.

This might be causing problems, although you've not spotted anything so far.

MG - test3 - is it okay?

test 3 is test 2 but passed to var eta solver for eta = 1 everywhere

eta bcs are set to "fixed" but fixed eta for inhomo not implemented. I.e., I think it might be seeing eta=0 on the boundaries.

Why does it still work and not cause problems?

CCAPS - avoid overspecification of boundaries

The need to have vface bcs is just related to applying minmod at the very edge, otherwise the two ghosts for the sln vars should be enough to directly give you everything you need for the edge vars.

Add handling of the extreme case to minmod (just revert to a simple gradient there), and then change some of the loop sizes to capture the limits appropriately.

If you run with appropriate compiler flags, should check if OOB for you.

The simplification of boundary conditions should remove a number of possible sources of error/bugs and make the code easier to use.

CCAPS : noslip + grav issue

in grav case, you still get some bad divergence left across the "opposite" no slip boundary to the direction of gravity (e.g. grav_y < 0 => y_max (no_slip) having this issue).

CCAPS - possible missing rho bc application in step_2

In advance_module

336 if (use_vardens) call rho_bcs ! needed for any OOB in relax and correction

but rho_bc was updated to need arguments about whether cc, x_face, y_face, etc.

Is this call just not updating the boundary?

Could be a big source of error!!!

CCAPS - No Slip + Grav issue

Description

  • Set the RTI problem up with no density interface (e.g. rho = 1 throughout)
  • Will see divergence + edge-mode v velocity emanate from top boundary (boundary opposite to grav drn)
  • from printouts, correction to v is not correctly implemented near top boundary (at iy = ny-1 and iy = ny, but with the cells at iy=ny being a much larger error)

Cause

  • the smaller errors at iy = ny-1 are a consequence of the BC choice of extrapolation of pressure through the boundary. Different BC choices / higher order interpolation / not using centred differences for evaluation of pressure gradient near the edges might improve this (I suspect not using CD but "inward difference" near the edge is the way to go so gradp is never determined based on boundary?)

  • the larger error at iy = ny is mainly due to rho(ix,iy=ny) not remaining =1 at the boundary (although the choice of pressure bc also effects it somewhat)

  • this is an unexpected result from advect_dens

  • Tracing it back, it emanates from the evaluation of the right (full/transversal) rho state)

705         rhoyr(ix,iy) = rhohyr(ix,iy) &
706           & - 0.5_num * dt * rho(ix,iy+1) * (macv(ix,iy+1) - macv(ix,iy)) / dy &
707           & - 0.5_num * dt / dx * ( rhohx(ix,iy+1)*macu(ix,iy+1) - &
708                                     & rhohx(ix-1,iy+1)*macu(ix-1,iy+1) )  
  • Specifically the term at 706.

  • This is because you "expected" macv(ix,iy+1) - macv(ix,iy) to evaluate as 0 but no slip means that macv(iy+1) = - macv(iy), so you get a non zero term

  • So the boundary as is doesn't really make sense with the gravity? Could either implement a zero-gradient / inoutflow boundary at the top, or implement (after this step, gradp should correctly compensate the gravity and noslip on internal flows makes more sense?)

CCAPS IO - slow python startup times are a bottle neck

IO currently outputs simple .dat files and immediately calls a python script to plot them. This can lead to many calls to python (once for each dump). The python plotting script is substantially slower than the rest of the code.

Ideally

  • output sequentially numbered dat files at each dump
  • create a single post-processing script to do the simple visualisations at the end (or, perhaps at the start and have it wait on new dump files) to avoid multiple startup and exits of python
  • this also has benefit of paving the way towards keeping dat files for more complicated post-processing / analysis

Does the analytical solution in multigrid test 5 have a typo?

Think its possible (0.001_num / (time+0.001_num)) should be all square rooted, and its just worked out to be fine anyway because you only simulate for small time.

!the analytical solution
  do ix = 1,nx
  do iy = 1,ny
    xx = x(ix) - 0.5_num
    yy = y(iy) - 0.5_num
    r = sqrt(xx**2 + yy**2)
    phi_an(ix,iy) = (phi2-phi1) * (0.001_num / (time+0.001_num)) &
      & * exp(-0.25_num * r**2 / k / (0.001_num + time)) + phi1
  enddo
  enddo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.