Commit 297d9f79 authored by Michael Kuron's avatar Michael Kuron Committed by Markus Holzer
Browse files

codegen: fix some constant types for vectorization and correct field layout for FluctuatingMRT

parent 59b1775e
......@@ -157,7 +157,7 @@ with CodeGeneration() as ctx:
# getter & setter
setter_assignments = macroscopic_values_setter(lb_method, velocity=velocity_field.center_vector,
pdfs=pdfs.center_vector, density=1)
pdfs=pdfs.center_vector, density=1.0)
getter_assignments = macroscopic_values_getter(lb_method, velocity=velocity_field.center_vector,
pdfs=pdfs.center_vector, density=None)
generate_sweep(ctx, 'UniformGridGPU_MacroSetter', setter_assignments)
......
......@@ -106,7 +106,7 @@ with CodeGeneration() as ctx:
# getter & setter
setter_assignments = macroscopic_values_setter(lb_method, velocity=velocity_field.center_vector,
pdfs=pdfs.center_vector, density=1)
pdfs=pdfs.center_vector, density=1.0)
getter_assignments = macroscopic_values_getter(lb_method, velocity=velocity_field.center_vector,
pdfs=pdfs.center_vector, density=None)
generate_sweep(ctx, 'UniformGridGPU_AA_MacroSetter', setter_assignments)
......
......@@ -26,7 +26,7 @@ options_dict = {
'mrt': {
'method': 'mrt',
'stencil': 'D3Q19',
'relaxation_rates': [0, omega, 1.3, 1.4, omega, 1.2, 1.1, 1.15, 1.234, 1.4235, 1.242, 1.2567, 0.9, 0.7],
'relaxation_rates': [0.0, omega, 1.3, 1.4, omega, 1.2, 1.1, 1.15, 1.234, 1.4235, 1.242, 1.2567, 0.9, 0.7],
},
'mrt_full': {
'method': 'mrt',
......@@ -171,7 +171,7 @@ with CodeGeneration() as ctx:
cpu_openmp=openmp_enabled, ghost_layers=1)
setter_assignments = macroscopic_values_setter(update_rule_two_field.method, velocity=velocity_field.center_vector,
pdfs=pdfs.center_vector, density=1)
pdfs=pdfs.center_vector, density=1.0)
getter_assignments = macroscopic_values_getter(update_rule_two_field.method, velocity=velocity_field.center_vector,
pdfs=pdfs.center_vector, density=None)
generate_sweep(ctx, 'GenMacroSetter', setter_assignments, cpu_openmp=openmp_enabled)
......
......@@ -17,6 +17,7 @@ from lbmpy.phasefield_allen_cahn.force_model import MultiphaseForceModel
import numpy as np
import sympy as sp
import pystencils as ps
stencil_phase = get_stencil("D3Q19")
stencil_hydro = get_stencil("D3Q27")
......@@ -125,8 +126,9 @@ phase_field_LB_step = create_lb_update_rule(lb_method=method_phase,
kernel_type='stream_pull_collide')
phase_field_LB_step.set_main_assignments_from_dict({**phase_field_LB_step.main_assignments_dict, **{C.center: sum_h}})
subexp = [ps.Assignment(a.lhs, float(a.rhs)) if a.rhs == 0 else a for a in phase_field_LB_step.subexpressions]
phase_field_LB_step = AssignmentCollection(main_assignments=phase_field_LB_step.main_assignments,
subexpressions=phase_field_LB_step.subexpressions)
subexpressions=subexp)
phase_field_LB_step = sympy_cse(phase_field_LB_step)
# ---------------------------------------------------------------------------------------------------------
......
......@@ -68,10 +68,10 @@ int main( int argc, char ** argv )
const double remainingTimeLoggerFrequency = parameters.getParameter< double >( "remainingTimeLoggerFrequency", 3.0 ); // in seconds
// create fields
BlockDataID forceFieldId = field::addToStorage<VectorField_T>( blocks, "Force", real_t( 0.0 ));
BlockDataID forceFieldId = field::addToStorage<VectorField_T>( blocks, "Force", real_t( 0.0 ), field::fzyx);
LatticeModel_T latticeModel = LatticeModel_T( forceFieldId, omega, 0, omega, omega, seed, temperature, uint_t(0) );
BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, real_t(1) );
BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, real_t(1), uint_t(1), field::fzyx );
BlockDataID flagFieldId = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" );
// create and initialize flag field
......
......@@ -9,7 +9,7 @@ from lbmpy_walberla import generate_lattice_model
with CodeGeneration() as ctx:
omega_shear = sp.symbols("omega_shear")
temperature = sp.symbols("temperature")
force_field, vel_field = ps.fields("force(3), velocity(3): [3D]", layout='zyxf')
force_field, vel_field = ps.fields("force(3), velocity(3): [3D]", layout='fzyx')
def rr_getter(moment_group):
is_shear = [is_shear_moment(m, 3) for m in moment_group]
......@@ -49,4 +49,7 @@ with CodeGeneration() as ctx:
optimization={'cse_global': True}
)
generate_lattice_model(ctx, 'FluctuatingMRT_LatticeModel', collision_rule)
params = {}
if ctx.optimize_for_localhost:
params['cpu_vectorize_info'] = {'assume_inner_stride_one': True, 'assume_aligned': True}
generate_lattice_model(ctx, 'FluctuatingMRT_LatticeModel', collision_rule, field_layout='fzyx', **params)
......@@ -38,7 +38,7 @@ method = create_lb_method(**options)
# getter & setter
setter_assignments = macroscopic_values_setter(method, velocity=velocity_field.center_vector,
pdfs=pdfs, density=1)
pdfs=pdfs, density=1.0)
# opt = {'instruction_set': 'sse', 'assume_aligned': True, 'nontemporal': False, 'assume_inner_stride_one': True}
......
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