CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Deffining New Patch Field Type (https://www.cfd-online.com/Forums/openfoam/88121-deffining-new-patch-field-type.html)

dandalf May 9, 2011 10:10

Deffining New Patch Field Type
 
Hi All
I have been trying to define a new velocity patch field type, based on timeVaryingInletOutlet under openFoam 1.7.0 for use with pimpleDyMFoam

I copied and pasted the files, replaced all instances of "timeVaryingInletOutlet" with "myTimeVaryingInletOutlet"

Then altered the code slightly so that instead of taking the refValue from a time data series, it takes it from a ".dat" file.

The code compiled and my new patch field appeared in the list headed
Valid patchField types are :
However when I attempted to run it I got the following error,
Code:

Reading field U

pimpleDyMFoam: symbol lookup error: /home/droper1/OpenFOAM/droper1-1.7.0/lib/linux64GccDPOpt/libmytvfriv.so: undefined symbol: _ZN4Foam43myTimeVaryingUniformInletOutletFvPatchFieldINS_6VectorIdEEEC1ERKNS_7fvPatchERKNS_16DimensionedFieldIS2_NS_7volMeshEEERKNS_10dictionaryE

Then it spat me back into the terminal.

Can anybody help shed some light on what I'm doing wrong?
Any help would be greatly appreciated.

Daniel

dandalf May 10, 2011 06:11

Its Ok... I fixed it.. still not sure how?

mturcios777 May 10, 2011 13:20

I may be doing something similar in the future, so it would be interesting as to how you fixed it. Between getting this problem and having it work, what steps did you take. List as many as you can remember, it could be something as simple as the command you typed to compile being slightly different

dandalf May 11, 2011 07:35

1 Attachment(s)
After my first failed attempt I started from scratch, but I will go through my successful attempt

Ok Here goes.

The first thing I did was copy and paste the whole source file into my openFoam user directory, I then created the make folder, ensuring that the library that the original was located in was included in the options file. And in this case the files folder listed only the file ending in ..."s.C".

I then renamed each file and used search and replace function in my text editor to change all instances of "timeVaryingUniformInputOutput" to "myTimeVaryingUniformInputOutput"

Then it was a case of deleting the time series variable from the header file, and replacing it with a fileNameVariable, and in my case a scalar.

In the .C source file I then included "IFstream.H"

and instigated my two new variables in each of the constructors, following the pattern of the time series variables, i.e replacing timeSeries_() with DataFile_("0.dat");
and timeSeries_(ptf.timeSeries_) with DataFile_(ptf.DataFile_) etc..

in updateCoeffs()
it took me some time to realize that refValue() is a vector field not a vector so I copied and pasted the dictionary constructor from the InputOutput parch class, and changed it so that the dictionary comes from the IFstream, I used the scalar from earlier to store the size of the vector field needed.

Finally I altered the write function to write the data file name instead of the time series.

it was then just a case of getting my runtime function to output a file with the desired velocity at each time iteration, then link my boundary patch to outputted file.

It seems to work as long as I create an the velocity file before starting.

There is probably a much more elegant way of doing all this. I hope this helps..


All times are GMT -4. The time now is 05:22.