Skip to content
Snippets Groups Projects
Select Git revision
  • suffa/Sparse
  • master default protected
  • cmake_cuda
  • bam_piping_erosion
  • ChargedParticles
  • RayleighBernardConvection
  • thoennes/fp16
  • kohl/fp16
  • thoennes/add-gcc12-to-ci-v2
  • thoennes/add-gcc12-to-ci
  • Antidunes_bugfix
  • plewinski/fix-Guo-force-model-TRT-MRT
  • 6-stable
  • thoennes/update-refactor-cmake-script
  • 146-cuda-gcc-config-warning
  • thoennes/add_sp_codegen_to_ci
  • use-correct-codegen-data-type
  • thoennes/change-ci-to-ninja
  • lbmpy-kernel-comparison
  • UpdateGPUBenchmark
  • v7.0dev
  • v6.1
  • v6.0dev
  • v5.1
  • v4.2
  • v5.0dev
  • v4.1
  • v3.3
  • v3.2
  • v4.0dev
  • v3.1
31 results

SweepTimeloop.h

Blame
  • Forked from waLBerla / waLBerla
    Source project has a limited visibility.
    test_force_on_boundary.py 1.15 KiB
    import numpy as np
    
    from lbmpy.boundaries import UBB, NoSlip
    from lbmpy.enums import ForceModel
    from lbmpy.scenarios import create_channel
    from pystencils import make_slice
    
    # try:
    #     import waLBerla as wLB
    # except ImportError:
    wLB = None
    
    
    def calculate_force(step, obstacle):
        bh = step.boundary_handling
        bh.set_boundary(obstacle, make_slice[0.3:0.4, 0:0.5])
        step.run(100)
        return bh.force_on_boundary(obstacle)
    
    
    def test_force_on_boundary():
        results = []
        domain_size = (80, 30)
    
        boundaries = [NoSlip('obstacle_noslip'),
                      UBB((0,) * len(domain_size), name='obstacle_UBB')]
    
        for parallel in (False, True) if wLB else (False,):
            for boundary_obj in boundaries:
                print(f"Testing parallel {parallel}, boundary {boundary_obj.name}")
                step = create_channel(domain_size, force=1e-5, relaxation_rate=1.5, parallel=parallel,
                                      force_model=ForceModel.BUICK)
                force = calculate_force(step, boundary_obj)
                print(f"  -> force = {force}")
                results.append(force)
    
        for res in results[1:]:
            np.testing.assert_almost_equal(results[0], res)