ppymech

Descriptions of the contents of the Probes class.

Module that wraps the parallel IO calls and put data in the pymech format

pysemtools.io.ppymech.neksuite.preadnek(filename, comm, data_dtype=<class 'numpy.float64'>)

Read and fld file and return a pymech hexadata object (Parallel).

Main function for readinf nek type fld filed.

Parameters:
filenamestr

The filename of the fld file.

commComm

MPI communicator.

data_dtypestr

The data type of the data in the file. (Default value = “float64”).

Returns:
HexaData

The data read from the file in a pymech hexadata object.

Examples

>>> from mpi4py import MPI
>>> from pysemtools.io.ppymech.neksuite import preadnek
>>> comm = MPI.COMM_WORLD
>>> data = preadnek('field00001.fld', comm)
pysemtools.io.ppymech.neksuite.pwritenek(filename, data, comm)

Write and fld file and from a pymech hexadata object (Parallel).

Main function to write fld files.

Parameters:
filenamestr

The filename of the fld file.

dataHexaData

The data to write to the file.

commComm

MPI communicator.

Examples

Assuming you have a hexadata object already:

>>> from pysemtools.io.ppymech.neksuite import pwritenek
>>> pwritenek('field00001.fld', data, comm)
pysemtools.io.ppymech.neksuite.pynekread(filename, comm, data_dtype=<class 'numpy.float64'>, msh=None, fld=None)

Read nek file and returs a pynekobject (Parallel).

Main function for readinf nek type fld filed.

Parameters:
filenamestr

The filename of the fld file.

commComm

MPI communicator.

data_dtypestr

The data type of the data in the file. (Default value = “float64”).

mshMesh

The mesh object to put the data in. (Default value = None).

fldField

The field object to put the data in. (Default value = None).

Returns:
None

Nothing is returned, the attributes are set in the object.

Examples

>>> from mpi4py import MPI
>>> from pysemtools.io.ppymech.neksuite import pynekread
>>> comm = MPI.COMM_WORLD
>>> msh = msh_c(comm)
>>> fld = field_c(comm)
>>> pynekread(fname, comm, msh = msh, fld=fld)
pysemtools.io.ppymech.neksuite.pynekread_field(filename, comm, data_dtype=<class 'numpy.float64'>, key='')

Read nek file and returs a pynekobject (Parallel).

Main function for readinf nek type fld filed.

Parameters:
filenamestr

The filename of the fld file.

commComm

MPI communicator.

data_dtypestr

The data type of the data in the file. (Default value = “float64”).

keystr

The key of the field to read. Typically “vel”, “pres”, “temp” or “scal_1”, “scal_2”, etc.

Returns:
list

The data read from the file in a list.

pysemtools.io.ppymech.neksuite.pynekwrite(filename, comm, msh=None, fld=None, wdsz=4, istep=0, write_mesh=True)

Write and fld file and from pynekdatatypes (Parallel).

Main function to write fld files.

Parameters:
filenamestr

The filename of the fld file.

commComm

MPI communicator.

mshMesh

The mesh object to write to the file. (Default value = None).

fldField

The field object to write to the file. (Default value = None).

wdszint

The word size of the data in the file. (Default value = 4).

istepint

The time step of the data. (Default value = 0).

write_meshbool

If True, write the mesh data. (Default value = True).

Examples

Assuming a mesh object and field object are already present in the namespace:

>>> from pysemtools.io.ppymech.neksuite import pwritenek
>>> pynekwrite('field00001.fld', comm, msh = msh, fld=fld)