abarret / multiphase-stokes

Solver a mixture of fluids based on IBAMR
1 stars 0 forks source link

Allow for second order time stepping. #53

Closed abarret closed 1 year ago

abarret commented 1 year ago

Closes #52. This fixes some options to allow for second order time stepping. In particular, using ADAMS_BASHFORTH for evolving the volume fraction and TRAPEZOIDAL_RULE for the viscous solve results in second order accuracy for target time_stepping_thn.

bindi-nagda commented 1 year ago

Is there a reason to set end time to 2.0?

I tested this branch with end time = 1.0 and I still get 1st order accuracy on both uniform and refined grids.

P.S: I'm using CFL=0.1, ETA_N = 4.0, ETA_S = 0.4.

abarret commented 1 year ago

Is there a reason to set end time to 2.0?

No

I tested this branch with end time = 1.0 and I still get 1st order accuracy on both uniform and refined grids.

Are you using ADAMS_BASHFORTH for the advective time stepping type?

abarret commented 1 year ago
Branch Default Network     Solvent     Pressure     Volume Fraction    
N L1 L2 max L1 L2 max L1 L2 max L1 L2 max
16 0.0162303 0.0155087 0.0300727 0.014652 0.0132035 0.0299714 0.138886 0.161163 0.342062 0.00880797 0.0107416 0.0238525
32 4.19E-03 4.02E-03 8.70E-03 3.91E-03 3.59E-03 8.08E-03 4.20E-02 5.17E-02 1.38E-01 2.43E-03 2.76E-03 4.96E-03
64 0.00105672 0.00102363 0.00231882 0.00101473 0.000931202 0.00195183 1.13E-02 1.50E-02 4.74E-02 6.30E-04 7.04E-04 1.29E-03
128                        
  1.954339095 1.94935436 1.788823286 1.906266715 1.878029026 1.891359269 1.724320575 1.6412949 1.312456905 1.857639524 1.961912149 2.264673001
  1.986685511 1.971957159 1.908168377 1.945663081 1.947653419 2.049327899 1.893144618 1.788564439 1.538820668 1.947057174 1.969737369 1.947641372
  #DIV/0! #DIV/0! #DIV/0! #DIV/0! #DIV/0! #DIV/0! #DIV/0! #DIV/0! #DIV/0! #DIV/0! #DIV/0! #DIV/0!
                         
Bindi's params Network     Solvent     Pressure     Volume Fraction    
N L1 L2 max L1 L2 max L1 L2 max L1 L2 max
16 0.0103198 0.0102521 0.0286642 0.0353465 0.0362404 0.103772 0.139201 0.256926 1.7073 0.00990633 0.0164907 0.0767109
32 4.34E-03 4.00E-03 8.49E-03 1.30E-02 1.35E-02 3.61E-02 5.58E-02 1.11E-01 8.45E-01 3.63E-03 6.34E-03 3.09E-02
64 0.00143846 0.00134884 0.00314459 0.00409871 0.00425781 0.0117182 1.79E-02 3.65E-02 2.82E-01 1.13E-03 2.00E-03 1.08E-02
128 0.000395786 0.000372031 0.000919282 0.00109325 0.00113726 0.0032089 0.00479044 0.00984253 0.0776147 0.000299904 0.000533849 0.00307619
  1.248973412 1.359197102 1.755693966 1.439519928 1.422546411 1.525053949 1.320050821 1.205344672 1.014321189 1.44948643 1.380213342 1.313656126
  1.59384459 1.566931224 1.432612217 1.668805616 1.66686899 1.621540392 1.642670236 1.608736087 1.583040116 1.683090573 1.665143 1.518382186
  1.861732617 1.858224479 1.77429253 1.906546569 1.904549452 1.868600242 1.898146535 1.892099119 1.86188155 1.913201008 1.903720757 1.808176756
abarret commented 1 year ago

These are asymptotic convergence rates, meaning they are only true for h small enough. "Small enough" is different for different problems.

bindi-nagda commented 1 year ago

Ok, so it sounds like I need to make my h smaller. In the first table, the order of accuracy doesn't look 2nd order, except for certain columns where it's close to 2nd order.

bindi-nagda commented 1 year ago

Are you using ADAMS_BASHFORTH for the advective time stepping type?

Yes

abarret commented 1 year ago

Ok, so it sounds like I need to make my h smaller. In the first table, the order of accuracy doesn't look 2nd order, except for certain columns where it's close to 2nd order.

What are you looking at? I see second order rates for everything, or things that are trending towards second order.

bindi-nagda commented 1 year ago

For certain columns I'm seeing ratios like 3.2 or 3.6 or even less than 3. For example, if we get ratios for grids N=32 and N=16 for pressure L2, Thn L1, pressure max.

In my tests, I do get some ratios that are in the range 3.0-3.7. I guess it's better than 1st order accuracy but still not 2nd order, right? Are ratios like that sufficient to report?

bindi-nagda commented 1 year ago

I tested this branch with end time = 1.0 and I still get 1st order accuracy on both uniform and refined grids.

I should've said "1.5th" order

abarret commented 1 year ago

For certain columns I'm seeing ratios like 3.2 or 3.6 or even less than 3. For example, if we get ratios for grids N=32 and N=16 for pressure L2, Thn L1, pressure max.

That's the point of my previous comment. The only relevant convergence rates are the ones at the finest grid, because convergence rates are only valid for h small enough. We don't see a clear second order rate for pointwise pressure at N=32 and N=64, but it's tending towards second order. If you run the 128x128 grid case, it should show a convergence rate even closer to 2.

abarret commented 1 year ago

I should've said "1.5th" order

If you see 1.5 order and you have no reason to expect 1.5 order, you should probably run a finer case.

bindi-nagda commented 1 year ago

That's the point of my previous comment. The only relevant convergence rates are the ones at the finest grid, because convergence rates are only valid for h small enough. We don't see a clear second order rate for pointwise pressure at N=32 and N=64, but it's tending towards second order. If you run the 128x128 grid case, it should show a convergence rate even closer to 2.

Oh sorry, this makes sense. I kept thinking of time step size (t) rather than grid size (h). I'll look at 128 x 128. I was concerned that it wasn't showing 2nd order for 16 and 32, but your comment is now clear.

abarret commented 1 year ago

I kept thinking of time step size (t) rather than grid size (h).

This is why we choose the time step size dt to be proportional to the spatial step size h. If we didn't do that, we would have to do something different with the convergence tests.

bindi-nagda commented 1 year ago

I've approved this PR. I'm getting convergence that's asymptotically approaching 2nd order.

abarret commented 1 year ago

This seems to implement correct behavior, so I'll go ahead and merge.