[PYTHON] vtkOpenFOAMReader Summary (Updated from time to time)

About vtkOpenFOAMReader

Class Reference https://vtk.org/doc/release/7.1/html/classvtkOpenFOAMReader.html

I will summarize the behavior when actually running with python little by little

environment

python 3.7 vtk 8.1.2

Confirmation method


import Vtk
print(vtk.vtkVersion.GetVTKSourceVersion())
>> vtk version 8.1.2

Initialization

import vtk
filename = "a.foam"

reader = vtk.vtkOpenFOAMReader()
reader.SetFileName(filename)
reader.Update()
print(reader)

print output example

vtkOpenFOAMReader (0x7fedd2c95be0)
  Debug: Off
  Modified Time: 105700
  Reference Count: 2
  Registered Events: (none)
  Executive: 0x7fedd2caf9b0
  ErrorCode: Undefined error: 0
  Information: 0x7fedd2cd3f90
  AbortExecute: Off
  Progress: 1
  Progress Text: (None)
  File Name: a.foam
  Refresh: 0
  CreateCellToPoint: 1
  CacheMesh: 1
  DecomposePolyhedra: 1
  PositionsIsIn13Format: 1
  ReadZones: 0
  SkipZeroTime: 0
  ListTimeStepsByControlDict: 0
  AddDimensionsToArrayNames: 0
  Reader instance 0x7fedd2cbeb70: 
    Debug: Off
    Modified Time: 106395
    Reference Count: 1
    Registered Events: (none)

DisableAllCellArrays() / EnableAllCellArrays()

CellArray on / off

GetNumberOfCellArrays()

Returns the number of physical variable types contained in the object Example: Include U, p in variable-> 2

reader.GetNumberOfCellArrays()
>> 2

GetCellArrayStatus(name:string) Returns whether ** CellArray ** corresponding to the specified string exists

reader.GetCellArrayStatus("hoge")
>> 0
reader.GetCellArrayStatus("p")
>> 1

GetCellArrayName(index:int)

Returns the name of the physical variable corresponding to the index number


reader.GetCellArrayName(0)
>> 'U'
reader.GetCellArrayName(1)
>> 'p'
reader.GetCellArrayName(1000)
>> None

Display a list of physical variables (** CellArray **) contained in the object

for index in range(reader.GetNumberOfCellArrays()):
    nname = reader.GetCellArrayName(index)
    print(nname)
>> U p ...

GetNumberOfPatchArrays()

Returns the number of OpenFOAM patches + 1 Because +1 contains ** internalMesh **

reader.GetNumberOfPatchArrays()
>> e.g. 5

GetPatchArrayName(index:int) Returns patch name and internalMesh

reader.GetPatchArrayName(0)
>> 'internalMesh'
reader.GetPatchArrayName(1)
>> e.g. 'walls'

Recommended Posts

vtkOpenFOAMReader Summary (Updated from time to time)
vtkXMLUnstructuredGridReader Summary (updated from time to time)
vtkClipPolyData / DataSet Summary (Updated from time to time)
Summary of vtkThreshold (updated from time to time)
Summary of gcc options (updated from time to time)
Engineer vocabulary (updated from time to time)
Machine learning python code summary (updated from time to time)
Tensorflow memo [updated from time to time]
[Updated from time to time] Summary of design patterns in Java
Private Python handbook (updated from time to time)
[Updated from time to time] PostmarketOS related notes
[Updated from time to time] LetCode algorithm and library
Notes on machine learning (updated from time to time)
OpenFOAM post-processing cheat sheet (updated from time to time)
progate Python learning memo (updated from time to time)
Useful help sites, etc. (updated from time to time)
Anaconda updated from 4.2.0 to 4.3.0 (python3.5 updated to python3.6)
Apache settings, log confirmation, etc. (* Updated from time to time)
[Updated from time to time] Review of Let Code NumPy
I read the Chainer reference (updated from time to time)
Python (from first time to execution)
[Notes / Updated from time to time] This and that of Azure Functions
[Note] AI / machine learning / python related websites [updated from time to time]
Easy conversion from UTC to local time
Updated to Python 2.7.9
Sum from 1 to 10
(Updated from time to time) Summary of machine learning APIs that allow you to quickly build apps by Team AI
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Transition from WSL1 to WSL2
[Updated from time to time] Python memos often used for data analysis [N division, etc.]
A memorandum of commands, packages, terms, etc. used in linux (updated from time to time)
From editing to execution
Updated Hospital_dashboard to ver.2.0
(Updated from time to time) Storage location of various VS Code configuration files Memorandum memo
List of my articles that may be useful in competition pros (updated from time to time)
Summary from building Python 3.4. * From source to building a scientific computing environment
[Introduction to matplotlib] Read the end time from COVID-19 data ♬
Post from Python to Slack
Cheating from PHP to Python
Porting from argparse to hydra
Migrating from Chainer v1 to Chainer v2
Migrated from Flask-RESTPlus to Flask-RESTX
Updated home watching camera: Summary
Update python-social-auth from 0.1.x to 0.2.x
Migrate from requirements.txt to pipenv
Switch from python2.7 to python3.6 (centos7)
Connect to sqlite from python
git / python> git log analysis (v0.1, v0.2)> Implementation to estimate work time from git log
Summary of advantages (disadvantages) when switching from CUnit to Google Test