Skip to content

Commit

Permalink
Switch LB to pull scheme (un-optimized)
Browse files Browse the repository at this point in the history
The integraiotn loop consist of the following sweeps:
* pull (stream)
* collide
* update velocity field from pdfs
* ghost communicatoin
  • Loading branch information
RudolfWeeber committed Aug 8, 2023
1 parent c0a3b74 commit e8ca1d6
Show file tree
Hide file tree
Showing 114 changed files with 2,165 additions and 2,062 deletions.
10 changes: 9 additions & 1 deletion maintainer/walberla_kernels/generate_lb_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
target = ps.Target.CPU

# Make sure we have the correct versions of the required dependencies
for module, requirement in [(ps, "==1.2"), (lbmpy, "==1.2")]:
for module, requirement in [(ps, "==1.2"), (lbmpy, "==1.3.1")]:
assert pkg_resources.packaging.specifiers.SpecifierSet(requirement).contains(module.__version__), \
f"{module.__name__} version {module.__version__} doesn't match requirement {requirement}"

Expand Down Expand Up @@ -121,6 +121,14 @@ def paramlist(parameters, keys):
pystencils_espresso.generate_setters(ctx, method, params),
**params)

# generate velocity field update kernel
for params, target_suffix in paramlist(parameters, (default_key,)):
pystencils_walberla.codegen.generate_sweep(
ctx,
f"VelFieldUpdate{precision_prefix}{target_suffix}",
pystencils_espresso.generate_vel_field_update(ctx, method, params),
**params)

# generate unthermalized Lees-Edwards collision rule
le_config = lbmpy.LBMConfig(stencil=stencil,
method=lbmpy.Method.TRT,
Expand Down
12 changes: 12 additions & 0 deletions maintainer/walberla_kernels/pystencils_espresso.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,15 @@ def generate_setters(ctx, lb_method, params):
fields['velocity'].center_vector,
fields['pdfs'].center_vector)
return pdfs_setter


def generate_vel_field_update(ctx, lb_method, params):
config = generate_config(ctx, params)
fields = generate_fields(config, lb_method.stencil)

vel_updater = lbmpy.macroscopic_value_kernels.macroscopic_values_getter(
lb_method,
None, # denisty
fields['velocity'].center_vector,
fields['pdfs'].center_vector)
return vel_updater
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//! \\author lbmpy
//======================================================================================================================

// kernel generated with pystencils v1.2, lbmpy v1.2, lbmpy_walberla/pystencils_walberla from waLBerla commit ref: a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1, lbmpy_walberla/pystencils_walberla from waLBerla commit 065ce5f311850371a97ac4766f47dbb5ca8424ba

#include <cmath>

Expand Down Expand Up @@ -1625,9 +1625,9 @@ static FUNC_PREFIX void advectivefluxkernel_double_precision_advectivefluxkernel
} // namespace internal_5255e1c780a944d646f270232511968b

void AdvectiveFluxKernel_double_precision::run(IBlock *block) {
auto u = block->getData<field::GhostLayerField<double, 3>>(uID);
auto rho = block->getData<field::GhostLayerField<double, 1>>(rhoID);
auto j = block->getData<field::GhostLayerField<double, 13>>(jID);
auto rho = block->getData<field::GhostLayerField<double, 1>>(rhoID);
auto u = block->getData<field::GhostLayerField<double, 3>>(uID);

WALBERLA_ASSERT_GREATER_EQUAL(-1, -int_c(j->nrOfGhostLayers()));
double *RESTRICT const _data_j = j->dataAt(-1, -1, -1, 0);
Expand Down Expand Up @@ -1664,9 +1664,9 @@ void AdvectiveFluxKernel_double_precision::runOnCellInterval(const shared_ptr<St
if (ci.empty())
return;

auto u = block->getData<field::GhostLayerField<double, 3>>(uID);
auto rho = block->getData<field::GhostLayerField<double, 1>>(rhoID);
auto j = block->getData<field::GhostLayerField<double, 13>>(jID);
auto rho = block->getData<field::GhostLayerField<double, 1>>(rhoID);
auto u = block->getData<field::GhostLayerField<double, 3>>(uID);

WALBERLA_ASSERT_GREATER_EQUAL(ci.xMin() - 1, -int_c(j->nrOfGhostLayers()));
WALBERLA_ASSERT_GREATER_EQUAL(ci.yMin() - 1, -int_c(j->nrOfGhostLayers()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! \\author pystencils
//======================================================================================================================

// kernel generated with pystencils v1.2, lbmpy v1.2,
// lbmpy_walberla/pystencils_walberla from waLBerla commit ref:
// a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1,
// lbmpy_walberla/pystencils_walberla from waLBerla commit
// 065ce5f311850371a97ac4766f47dbb5ca8424ba

#pragma once
#include "core/DataTypes.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//! \\author lbmpy
//======================================================================================================================

// kernel generated with pystencils v1.2, lbmpy v1.2, lbmpy_walberla/pystencils_walberla from waLBerla commit ref: a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1, lbmpy_walberla/pystencils_walberla from waLBerla commit 065ce5f311850371a97ac4766f47dbb5ca8424ba

#include <cmath>

Expand Down Expand Up @@ -1626,8 +1626,8 @@ static FUNC_PREFIX void advectivefluxkernel_single_precision_advectivefluxkernel

void AdvectiveFluxKernel_single_precision::run(IBlock *block) {
auto u = block->getData<field::GhostLayerField<float, 3>>(uID);
auto j = block->getData<field::GhostLayerField<float, 13>>(jID);
auto rho = block->getData<field::GhostLayerField<float, 1>>(rhoID);
auto j = block->getData<field::GhostLayerField<float, 13>>(jID);

WALBERLA_ASSERT_GREATER_EQUAL(-1, -int_c(j->nrOfGhostLayers()));
float *RESTRICT const _data_j = j->dataAt(-1, -1, -1, 0);
Expand Down Expand Up @@ -1665,8 +1665,8 @@ void AdvectiveFluxKernel_single_precision::runOnCellInterval(const shared_ptr<St
return;

auto u = block->getData<field::GhostLayerField<float, 3>>(uID);
auto j = block->getData<field::GhostLayerField<float, 13>>(jID);
auto rho = block->getData<field::GhostLayerField<float, 1>>(rhoID);
auto j = block->getData<field::GhostLayerField<float, 13>>(jID);

WALBERLA_ASSERT_GREATER_EQUAL(ci.xMin() - 1, -int_c(j->nrOfGhostLayers()));
WALBERLA_ASSERT_GREATER_EQUAL(ci.yMin() - 1, -int_c(j->nrOfGhostLayers()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! \\author pystencils
//======================================================================================================================

// kernel generated with pystencils v1.2, lbmpy v1.2,
// lbmpy_walberla/pystencils_walberla from waLBerla commit ref:
// a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1,
// lbmpy_walberla/pystencils_walberla from waLBerla commit
// 065ce5f311850371a97ac4766f47dbb5ca8424ba

#pragma once
#include "core/DataTypes.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//! \\author lbmpy
//======================================================================================================================

// kernel generated with pystencils v1.2, lbmpy v1.2, lbmpy_walberla/pystencils_walberla from waLBerla commit ref: a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1, lbmpy_walberla/pystencils_walberla from waLBerla commit 065ce5f311850371a97ac4766f47dbb5ca8424ba

#include <cmath>

Expand Down Expand Up @@ -108,8 +108,8 @@ static FUNC_PREFIX void continuitykernel_double_precision_continuitykernel_doubl
} // namespace internal_5c5e903f8ea7925cf790d7c2318b2c56

void ContinuityKernel_double_precision::run(IBlock *block) {
auto rho = block->getData<field::GhostLayerField<double, 1>>(rhoID);
auto j = block->getData<field::GhostLayerField<double, 13>>(jID);
auto rho = block->getData<field::GhostLayerField<double, 1>>(rhoID);

WALBERLA_ASSERT_GREATER_EQUAL(-1, -int_c(j->nrOfGhostLayers()));
double *RESTRICT const _data_j = j->dataAt(-1, -1, -1, 0);
Expand Down Expand Up @@ -140,8 +140,8 @@ void ContinuityKernel_double_precision::runOnCellInterval(const shared_ptr<Struc
if (ci.empty())
return;

auto rho = block->getData<field::GhostLayerField<double, 1>>(rhoID);
auto j = block->getData<field::GhostLayerField<double, 13>>(jID);
auto rho = block->getData<field::GhostLayerField<double, 1>>(rhoID);

WALBERLA_ASSERT_GREATER_EQUAL(ci.xMin() - 1, -int_c(j->nrOfGhostLayers()));
WALBERLA_ASSERT_GREATER_EQUAL(ci.yMin() - 1, -int_c(j->nrOfGhostLayers()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! \\author pystencils
//======================================================================================================================

// kernel generated with pystencils v1.2, lbmpy v1.2,
// lbmpy_walberla/pystencils_walberla from waLBerla commit ref:
// a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1,
// lbmpy_walberla/pystencils_walberla from waLBerla commit
// 065ce5f311850371a97ac4766f47dbb5ca8424ba

#pragma once
#include "core/DataTypes.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//! \\author lbmpy
//======================================================================================================================

// kernel generated with pystencils v1.2, lbmpy v1.2, lbmpy_walberla/pystencils_walberla from waLBerla commit ref: a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1, lbmpy_walberla/pystencils_walberla from waLBerla commit 065ce5f311850371a97ac4766f47dbb5ca8424ba

#include <cmath>

Expand Down Expand Up @@ -108,8 +108,8 @@ static FUNC_PREFIX void continuitykernel_single_precision_continuitykernel_singl
} // namespace internal_990034b4e4dd57d2802b4bcb5f716e46

void ContinuityKernel_single_precision::run(IBlock *block) {
auto j = block->getData<field::GhostLayerField<float, 13>>(jID);
auto rho = block->getData<field::GhostLayerField<float, 1>>(rhoID);
auto j = block->getData<field::GhostLayerField<float, 13>>(jID);

WALBERLA_ASSERT_GREATER_EQUAL(-1, -int_c(j->nrOfGhostLayers()));
float *RESTRICT const _data_j = j->dataAt(-1, -1, -1, 0);
Expand Down Expand Up @@ -140,8 +140,8 @@ void ContinuityKernel_single_precision::runOnCellInterval(const shared_ptr<Struc
if (ci.empty())
return;

auto j = block->getData<field::GhostLayerField<float, 13>>(jID);
auto rho = block->getData<field::GhostLayerField<float, 1>>(rhoID);
auto j = block->getData<field::GhostLayerField<float, 13>>(jID);

WALBERLA_ASSERT_GREATER_EQUAL(ci.xMin() - 1, -int_c(j->nrOfGhostLayers()));
WALBERLA_ASSERT_GREATER_EQUAL(ci.yMin() - 1, -int_c(j->nrOfGhostLayers()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! \\author pystencils
//======================================================================================================================

// kernel generated with pystencils v1.2, lbmpy v1.2,
// lbmpy_walberla/pystencils_walberla from waLBerla commit ref:
// a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1,
// lbmpy_walberla/pystencils_walberla from waLBerla commit
// 065ce5f311850371a97ac4766f47dbb5ca8424ba

#pragma once
#include "core/DataTypes.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// kernel generated with pystencils v1.2, lbmpy v1.2, lbmpy_walberla/pystencils_walberla from waLBerla commit ref: a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1, lbmpy_walberla/pystencils_walberla from waLBerla commit 065ce5f311850371a97ac4766f47dbb5ca8424ba

#include "DensityPackInfo_double_precision.h"
#include "core/DataTypes.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

// kernel generated with pystencils v1.2, lbmpy v1.2,
// lbmpy_walberla/pystencils_walberla from waLBerla commit ref:
// a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1,
// lbmpy_walberla/pystencils_walberla from waLBerla commit
// 065ce5f311850371a97ac4766f47dbb5ca8424ba

#pragma once
#include "communication/UniformPackInfo.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// kernel generated with pystencils v1.2, lbmpy v1.2, lbmpy_walberla/pystencils_walberla from waLBerla commit ref: a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1, lbmpy_walberla/pystencils_walberla from waLBerla commit 065ce5f311850371a97ac4766f47dbb5ca8424ba

#include "DensityPackInfo_single_precision.h"
#include "core/DataTypes.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

// kernel generated with pystencils v1.2, lbmpy v1.2,
// lbmpy_walberla/pystencils_walberla from waLBerla commit ref:
// a839fac6ef7d0c58e7710e4d50490e9dd7146b4a
// kernel generated with pystencils v1.2, lbmpy v1.3.1,
// lbmpy_walberla/pystencils_walberla from waLBerla commit
// 065ce5f311850371a97ac4766f47dbb5ca8424ba

#pragma once
#include "communication/UniformPackInfo.h"
Expand Down
Loading

0 comments on commit e8ca1d6

Please sign in to comment.