Commit cb632b10 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Merge branch 'master' into fix_macroscopic_value_kernels

parents 84ce16ba e7823f08
Pipeline #35452 passed with stages
in 47 minutes and 49 seconds
......@@ -47,11 +47,11 @@
```
%% Cell type:code id: tags:
``` python
dh = create_data_handling(domain_size, periodicity=True, default_target='gpu')
dh = create_data_handling(domain_size, periodicity=True, default_target=ps.Target.GPU)
c = dh.add_array('c', values_per_cell=n)
c_tmp = dh.add_array_like('c_tmp', 'c')
μ = dh.add_array('mu', values_per_cell=n)
......@@ -121,12 +121,15 @@
``` python
μ_sync = dh.synchronization_function(μ.name)
c_sync = dh.synchronization_function(c.name)
optimization = {'cpu_openmp': 4, 'cpu_vectorize_info': None}
μ_kernel = create_kernel(μ_assignments, target=dh.default_target, **optimization).compile()
c_kernel = create_kernel(c_assignments, target=dh.default_target, **optimization).compile()
config = ps.CreateKernelConfig(cpu_openmp=4, target=dh.default_target)
μ_kernel = create_kernel(μ_assignments, config=config).compile()
c_kernel = create_kernel(c_assignments, config=config).compile()
def set_c(slice_obj, values):
for block in dh.iterate(slice_obj):
arr = block[c.name]
arr[..., : ] = values
......
import os
import warnings
from tempfile import TemporaryDirectory
import numpy as np
import sympy as sp
from lbmpy.boundaries import NoSlip
from lbmpy.phasefield.analytical import free_energy_functional_n_phases_penalty_term
from lbmpy.phasefield.experiments2D import (
create_two_drops_between_phases, write_phase_field_picture_sequence,
write_phase_velocity_picture_sequence)
from lbmpy.phasefield.phasefieldstep import PhaseFieldStep
from lbmpy.phasefield.scenarios import *
from pystencils import make_slice
......@@ -55,11 +49,11 @@ def test_setup():
scenarios = [
create_three_phase_model(domain_size=domain_size, include_rho=True),
#create_three_phase_model(domain_size=domain_size, include_rho=False),
# create_three_phase_model(domain_size=domain_size, include_rho=False),
create_n_phase_model_penalty_term(domain_size=domain_size, num_phases=4),
]
for i, sc in enumerate(scenarios):
print("Testing scenario", i)
print(f"Testing scenario {i}")
sc.set_concentration(make_slice[:, :0.5], [1, 0, 0])
sc.set_concentration(make_slice[:, 0.5:], [0, 1, 0])
sc.set_concentration(make_slice[0.4:0.6, 0.4:0.6], [0, 0, 1])
......
......@@ -14,6 +14,7 @@ from lbmpy.phasefield.experiments2D import liquid_lens_setup
from lbmpy.phasefield.contact_angle_circle_fitting import liquid_lens_neumann_angles
from lbmpy.phasefield.post_processing import analytic_neumann_angles
def test_analytic_interface_solution():
"""Ensures that the tanh is an analytical solution for the prescribed free energy / chemical potential
"""
......
......@@ -6,7 +6,6 @@ from lbmpy.phasefield_allen_cahn.parameter_calculation import calculate_dimensio
from lbmpy.phasefield_allen_cahn.analytical import analytic_rising_speed
def test_analytical():
parameters = calculate_dimensionless_rising_bubble(reference_time=18000,
density_heavy=1.0,
......@@ -30,8 +29,9 @@ def test_analytical():
viscosity_ratio=3)
np.isclose(parameters["density_light"], 1/3, rtol=1e-05, atol=1e-08, equal_nan=False)
np.isclose(parameters["gravitational_acceleration"], -3.9506172839506174e-07, rtol=1e-05, atol=1e-08, equal_nan=False)
np.isclose(parameters["gravitational_acceleration"], -3.9506172839506174e-07,
rtol=1e-05, atol=1e-08, equal_nan=False)
np.isclose(parameters["mobility"], 0.0012234169653524492, rtol=1e-05, atol=1e-08, equal_nan=False)
rs = analytic_rising_speed(1-6, 20, 0.01)
np.isclose(rs, 16666.666666666668, rtol=1e-05, atol=1e-08, equal_nan=False)
\ No newline at end of file
np.isclose(rs, 16666.666666666668, rtol=1e-05, atol=1e-08, equal_nan=False)
import math
import pystencils as ps
from pystencils.boundaries.boundaryconditions import Neumann
from pystencils.boundaries.boundaryhandling import BoundaryHandling
from lbmpy.enums import Stencil
from lbmpy.phasefield_allen_cahn.contact_angle import ContactAngle
from lbmpy.stencils import get_stencil
from lbmpy.stencils import LBStencil
import numpy as np
def test_contact_angle():
stencil = get_stencil("D2Q9")
stencil = LBStencil(Stencil.D2Q9)
contact_angle = 45
phase_value = 0.5
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment