From 16a284a6c7b90dc0e7e533e1d0c38d4a08bc2267 Mon Sep 17 00:00:00 2001 From: Martin Bauer <martin.bauer@fau.de> Date: Fri, 1 Feb 2019 13:00:45 +0100 Subject: [PATCH] SerialDataHandling now also supports arbitrary tensor fields --- boundaries/boundaryconditions.py | 32 ++++++++++++++++++-------------- phasefield/kerneleqs.py | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/boundaries/boundaryconditions.py b/boundaries/boundaryconditions.py index f451371f..3ea7f127 100644 --- a/boundaries/boundaryconditions.py +++ b/boundaries/boundaryconditions.py @@ -20,15 +20,19 @@ class Boundary: """ This function defines the boundary behavior and must therefore be implemented by all boundaries. Here the boundary is defined as a list of sympy equations, from which a boundary kernel is generated. - :param pdf_field: pystencils field describing the pdf. The current cell is cell next to the boundary, - which is influenced by the boundary cell i.e. has a link from the boundary cell to - itself. - :param direction_symbol: a sympy symbol that can be used as index to the pdf_field. It describes - the direction pointing from the fluid to the boundary cell - :param lb_method: an instance of the LB method used. Use this to adapt the boundary to the method - (e.g. compressibility) - :param index_field: the boundary index field that can be used to retrieve and update boundary data - :return: list of sympy equations + + Args: + pdf_field: pystencils field describing the pdf. The current cell is cell next to the boundary, + which is influenced by the boundary cell i.e. has a link from the boundary cell to + itself. + direction_symbol: a sympy symbol that can be used as index to the pdf_field. It describes + the direction pointing from the fluid to the boundary cell + lb_method: an instance of the LB method used. Use this to adapt the boundary to the method + (e.g. compressibility) + index_field: the boundary index field that can be used to retrieve and update boundary data + + Returns: + :return: list of sympy equations """ raise NotImplementedError("Boundary class has to overwrite __call__") @@ -84,11 +88,11 @@ class UBB(Boundary): def __init__(self, velocity, adapt_velocity_to_force=False, dim=None, name=None): """ - - :param velocity: can either be a constant, an access into a field, or a callback function. - The callback functions gets a numpy record array with members, 'x','y','z', 'dir' (direction) - and 'velocity' which has to be set to the desired velocity of the corresponding link - :param adapt_velocity_to_force: + Args: + velocity: can either be a constant, an access into a field, or a callback function. + The callback functions gets a numpy record array with members, 'x','y','z', 'dir' (direction) + and 'velocity' which has to be set to the desired velocity of the corresponding link + adapt_velocity_to_force: """ super(UBB, self).__init__(name) self._velocity = velocity diff --git a/phasefield/kerneleqs.py b/phasefield/kerneleqs.py index 87bc9cf0..8141b0cc 100644 --- a/phasefield/kerneleqs.py +++ b/phasefield/kerneleqs.py @@ -99,7 +99,7 @@ class CahnHilliardFDStep: self.phi_field = self.data_handling.fields[phi_field_name] self.tmp_field = self.data_handling.add_array_like(name + '_tmp', phi_field_name, latex_name='tmp') - num_phases = self.data_handling.values_per_cell(phi_field_name) + num_phases = self.phi_field.index_shape[0] if not hasattr(mobilities, '__len__'): mobilities = [mobilities] * num_phases -- GitLab