espresso icon indicating copy to clipboard operation
espresso copied to clipboard

Add EKIN to Walberla branch

Open RudolfWeeber opened this issue 4 years ago • 3 comments

Structure, LB coupling

  • EK and LB can each be used independently but also in combination
  • If used in combination, the LB velocity field is passed into EK, and EK adds to the LB force field
  • To allow for this, they should share the Walberla Blockforest (the data structure that handles the domain decomposition and field storage in Walberla)
  • To this end, a Lattice component is introduced:
    • Owns the Walberla-Blockforest
    • Parameters: number of cells per direction, number of blocks per direction per mpi rank, time step
    • Is passed as argument to the LB and EK upon their instanceiation
  • EK und LB get a shared pointer to the block forest from the lattice component

EK

Fields

$n$ = number of species, $r$ = number o reactions

  • $n$ densities
  • $n$ fluxes
  • 1 total charge
  • 1 electrostatic potential
  • reference to LB velocity and force fields (as BlockDataId)

Parameter:

  • $n$ * diffusion coefficients
  • $n$ charges (valencies)
  • kT
  • $r \times n$ * stoich. coefficients
  • $r \times n$ Reaction orders
  • $r$ * reactionrates

Kernel (in order of execution)

  • Calculate total charge from per species densities and valencies
  • FFT-Solver (from Walberla in combination with pfft)
  • Flux- and LB-force computation (executed for every species, can contain thermal fluctuations)
  • $r$ Reactions (adds source/sink terms to fluxes)
  • Boundary conditions
  • Continuity equation (for each species)

Sll kernels except the FFT solver for the Poisson eqn are generated using PyStencils/PyStenilcs_Walberla

Reaction kernels

  • Seperate kernels will be generated for the number of reactants.
  • Educts and Prudcuts will not have to be considerd separately. This is hanlded by the sign of the stoich. coeff.
  • There will be kernels from 1 to 5 reacting species.

Next steps

  • Write a Python script generating all necessary kernels
  • Implement the Lattice component holding the BlockForest and lattice, pull out the block forest from the LB base class (LBWalberlaImpl)
  • Create the Python interface for the Lattice component
  • Write the EK base class

RudolfWeeber avatar May 28 '21 14:05 RudolfWeeber

first ek kernel generator added here boundary and electrostatics kernels still to be done

itischler avatar Jul 06 '21 13:07 itischler

@reinaual's walberla_ekin_scriptinterface branch has been merged into the walberla branch.

  • ESPResSo 4.3-dev now has:
    • an EK class that can be used alone or together with the LB class
    • electrokinetic solvers, kernels for bulk and indexed reactions
    • density and flux boundaries that can be created from a shape or on a per-node basis
  • code duplication between LBWalberlaImpl and EKinWalberlaImpl has been factored out
  • the LB and EK classes for VTK writers have been merged into one common interface
  • the EK code (excluding generated kernels) is 98% covered by integration tests
  • the user guide chapter on ekin has been restored and updated accordingly

jngrad avatar Aug 04 '22 13:08 jngrad

Last remaining tasks:

  • [ ] EK coupling to LB with thermal fluctuations
    • blocked due to how the RNG is implemented in lbmpy
  • [x] EK unit conversions between python interface and C++ class
  • [x] EK unit conversions in VTK files
  • [x] C++ unit tests for EK
  • [x] checkpointing

jngrad avatar Aug 04 '22 14:08 jngrad