PyFR boundary conditions for turbomachinery

You can try inspecting the reference snapshot solution files and seeing if there is a configuration file stack (as in previous configurations that had been used as part of the start up procedure). These may have the information you are looking for.

Regards, Freddie.

Hi @fdw,

in the snapshots unfortunately there was not such value.

One question: is it feasible (even if not in the current version of pyFR) to copy just a part of the soln from the GPU memory?

Best regards

It depends what parts. Requesting scattered values will be very inefficient (and may be slower than requesting the entire solution) since it requires a large number of small copies. Requesting small contiguous parts can be efficient, but elements are not contiguous (so asking for an element with 64 solution points requires 64 copy operations). None of these interfaces are wired up in PyFR at the moment, however.

Regards, Freddie.

Hi @fdw,

thanks for the answer.
And what about view matrices to access all the elements on a given boundary for a given partition at once? How can these be setted up, if possible?

Best regards

Use an XchgView to pack the data (on the GPU) into a contiguous matrix and then copy this matrix back to the host. This is exactly how PyFR handles communication between MPI ranks (pack the scattered data into a buffer and then send it over the network).

Regards, Freddie.

Hi @fdw,

the issue is that this in my understading does not fall into any of the categories:

        self._scal_lhs = self._scal_xchg_view(lhs, 'get_scal_fpts_for_inter')
        self._scal_rhs = be.xchg_matrix_for_view(self._scal_lhs)

or

        self._vect_lhs = self._vect_xchg_view(lhs, 'get_vect_fpts_for_inter')
        self._vect_rhs = be.xchg_matrix_for_view(self._vect_lhs)

otherwise kernel will see a scalar or a vector, am I right?

I should introduce a modified view to achieve that and then use xchg_matrix_for_view on this “new” view?

Best regards

Your case falls exactly into get_scal_fpts_for_inter. Vector is if you want to access gradient quantities. However, you have indicated that you want the solution at the boundary points.

Regards, Freddie.

Hi @fdw,

However, you have indicated that you want the solution at the boundary points.

you’re right but I was going by easier steps and I was satisfied with the boundary state ur for now and later I was planning in doing something similar to the fluid force plugin but even in that case in the actual code I don’t see any predefined way to reference only those elements that have a given boundary, am I right? If so how can this be accomplished?

Best regards

The fluid force plugin does exactly this. See:

Regards, Freddie.

I was speaking of the kernel side, not the plugin side

Best regards

On the kernel side you need to create a view as I showed in my above post.

Regards, Freddie.

Which one?

Best regards

As I said in my above post this is the view you want:

Regards, Freddie.

Hi @fdw,

I’ve introduced this lines in the BaseAdvectionBCInters

        self._scal_lhs_pi = self._scal_xchg_view(lhs, 'get_scal_fpts_for_inter')
        self.kernels['scal_fpts_pack_pi'] = lambda: be.kernel(
        'pack', self._scal_lhs_pi
        )
        bc_fpts_tag = next(self._mpi_tag_counter)
        lhsrank = 0 # Mesh is not partitioned
        self.mpireqs['bc_fpts_send_pi'] = lambda: self._scal_lhs_pi.sendreq(
            lhsrank, bc_fpts_tag
        )

then in the

        g2.add_all(k['bcint/scal_fpts_pack_pi'])
        for send, pack in zip(m['bc_fpts_send_pi'], k['bcint/scal_fpts_pack_pi']):
            g2.add_mpi_req(send, deps=[pack])
        g2.add_all(k['bcint/controller'], deps=k['bcint/comm_flux'] + k['bcint/scal_fpts_pack_pi'])
        g2.add_all(k['bcint/scal_fpts_unpack_pi'])

just before

g2.commit()

the values to the bcint/controller are passed as:

            self.kernels['controller'] = lambda: self._be.kernel(
                'controller', tplargs=self._tplargs, dims=[self.ninterfpts],
                extrns=self._external_args, ul=self._scal_lhs_pi, nl=self._pnorm_lhs,
                **self._external_vals
            )

In this way the controller kernel should see al the boundary fpts at once?

Best regards