CFD Online Logo CFD Online URL
Home > Forums > General Forums > Main CFD Forum

Orthogonal decompositions using the modred module in python

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   February 28, 2018, 17:56
Smile Orthogonal decompositions using the modred module in python
New Member
Join Date: Feb 2018
Posts: 1
Rep Power: 0
sin123 is on a distinguished road
I am trying to write a code for orthogonal decompositions using the modred module in python. My custom vector class is defined as:

class CustomVector(mr.Vector):
def __init__(self, data_array):
self.data_array = data_array
def inner_product(self, other):
return, other.data_array)

Another class definition is given as:

class CustomVecHandle(mr.VecHandle):
def __init__(self, vec_path, base_handle=None, scale=None):
mr.VecHandle.__init__(self, base_handle, scale)
self.vec_path = vec_path self.res_path = result_root
def _get(self):
# read in the values
print ("reading data from {}".format(self.vec_path))
reader = vtk.vtkPolyDataReader()
reader.Update() data = dsa.WrapDataObject(reader.GetOutput()).PointData['U']
return CustomVector(data)

And another function is defined outside all classes as:

def inner_product(v1, v2):
return v1.inner_product(v2)

I have created a list object as:

vec_handles = [CustomVecHandle(os.path.join(data_root, d, "{}_0.vtk".format(d)))for d in dirs]

This vec_handles is given as the input for a function in the modred module, and the following operations are done in the main modred code:

test_vec = vec_handles
IP_burn = self.inner_product(test_vec, test_vec)

But when I run the following code I am getting the error that:
File "/home/sindhuja/.local/lib/python2.7/site-packages/modred/", line 495,
in compute_symmetric_inner_product_mat
IP_burn = self.inner_product(test_vec, test_vec)
File "", line 58,
in inner_product return v1.inner_product(v2)
AttributeError: 'list' object has no attribute 'inner_product'

I understand that the created vec_handles is a list of objects for the class CustomVecHandle. And trying to get the method using .innerproduct(test_vec) is not possible but since it's the code of the modred module, I don't think that's wrong. So how do I solve this error?
sin123 is offline   Reply With Quote


modred, orthogonal decomposition, pod, python

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Paraview.simple python module and loading legacy vtk file timeseries awa5114 ParaView 2 July 17, 2017 08:40
[] Module file foam-extend 3.2 CentOS cluster KarthickRajkumar OpenFOAM Installation 2 March 26, 2017 13:52
[OpenFOAM] Python and paraview.simple libprotobuf error Private Mandella ParaView 1 October 26, 2016 13:25
[OpenFOAM] paraview v4 - building with python - OF2.3.0, PVv4, Python 2.7 aylalisa ParaView 4 June 13, 2014 08:52
Can someone PLEASE document the development version installation bernd OpenFOAM Installation 76 November 14, 2008 21:51

All times are GMT -4. The time now is 12:59.