biodynamo icon indicating copy to clipboard operation
biodynamo copied to clipboard

Closed diffusion fix + Depletion

Open nicogno opened this issue 3 years ago • 3 comments

nicogno avatar Mar 25 '22 17:03 nicogno

This PR will contain 3 major contributions. The tasks are sorted by contributions

  1. Resolution
  • [x] resturcture functions to avoide repetitive code
  • [x] add assert
  • [x] change missleading discription in comment
  1. Depletion
  • [x] Don't change DiffusionGrid
  • [x] Don't change EulerGrid
  • [x] Add DepletedEulerGrid subclass (should hanlde multiple substances depleting it)
  • [x] Use OpenMP and SIMD instructions to optimize update
  • [x] Add unit test to compare against analytic solution
  1. Boundary Conditions
  • [x] Introduce NeumandBoundary
  • [x] Introduce DirichletBoundary
  • [x] Deprecate previous boundaries
  • [x] Document boundaries
  • [x] ~Ideally find analytic solutions to Neuman and Dirichlet Problem and come up with tests~

TobiasDuswald avatar Apr 04 '22 10:04 TobiasDuswald

ToDo

Benchmark to see if BoundaryCondition::Evaluate(size_t,size_t,size_t,size_t) introduces a big overhead compared to simply using a constant.

Benchmark setup

  • Simulation with one cell without behaviors
  • DiffusionGrid with resolution 100 and 2000 sim steps
  • Simulate 50 times for each BC, measure each time, compute the average and standard deviation

Results

BC "as is" const
Dirichlet 3.72 +/- 0.11 [s] 3.69 +/- 0.24 [s]
Neumann 3.95 +/- 0.12 [s] 5.74 +/- 0.16 [s]
open 3.12 +/- 0.09 [s] -
closed 3.16 +/- 0.17 [s] -

While this is a bit of a miracle to me, replacing class with a real_t data member rather increases the runtime.

benchmark.zip

TobiasDuswald avatar Jan 19 '23 19:01 TobiasDuswald

Thanks @nicogno , that's a great (and absolutely necessary) feature! Great Job!

TobiasDuswald avatar Feb 03 '23 14:02 TobiasDuswald

@TobiasDuswald thank you for your huge help!

nicogno avatar Feb 03 '23 14:02 nicogno