|
[Sponsors] |
August 23, 2015, 16:35 |
Reading data from node file in UDF
|
#1 |
New Member
Join Date: May 2015
Posts: 29
Rep Power: 11 |
Hi,
I'm looking to write a UDF for mesh motion, for which I need to read the nodal positions of each node in the mesh. I have exported the data in an ascii format from Export->Solution Data in FLUENT. In this case the file contains the nodal positions of a wall zone, which is to move sinusoidally. However, there is something wrong in the way the udf reads the data. The mesh develops some form of extension and is generally deformed. I'm attaching the udf I wrote, the mesh file I'm trying to read and the screenshot of what happens to the mesh when I apply the udf to it. I suspect that there's something wrong in the way the udf is reading the data but I do not know what. I did try writing a program that reads the data from the file and writes it out again. As can guess, the written data was completely different from what I was expecting. Any insights will be appreciated. P.S It appears that the mesh data file exceeds the forum's maximum size, so I'll be including a dropbox link for that here. https://www.dropbox.com/s/ki7wb0cuuh..._115k.out?dl=0 Last edited by avd28; August 23, 2015 at 16:35. Reason: Adding tags |
|
August 24, 2015, 12:30 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
I think your method is much too complex, but maybe I don't understand fully what you are doing.
What I think you are doing: 1. Save positions to a file. 2. Read positions from that file. 3. Calculation displacement. 4. Make the new coordinate equal to the position read from the file plus the calculated displacement. The big risk is that the order in which the data is saved, should be exactly the same as the order in which the nodes are read during the calculation, and although that might seem logical, Fluent does not have to do that. But as far as I can see, you can get the same effect much easier: 1. Calculate additional displacement. 2. Make the new coordinate equal to the old coordinate plus the additional displacement. So, dx becomes additional displacement: Code:
waveform= sin (2 * time) - sin (2 * previous_time); dx[0]=amplitude*(A[0]/NV_MAG(A)*waveform); dx[1]=amplitude*(A[1]/NV_MAG(A)*waveform); dx[2]=amplitude*(A[2]/NV_MAG(A)*waveform); Code:
NODE_COORD(v)[0]+=dx[0]; NODE_COORD(v)[1]+=dx[1]; NODE_COORD(v)[2]+=dx[2]; |
|
August 24, 2015, 17:49 |
|
#3 |
New Member
Join Date: May 2015
Posts: 29
Rep Power: 11 |
I actually tried that, but it does not generate the correct mesh motion. If I decrease the timestep, the amplitude increases beyond specified limits and actually causes negative volumes to be generated.
However, I'm glad to say I did solve the problem in question. It was related to an indexing problem in the array that stored the data read from the file. I have attached the udf as it works as present. It references mesh coordinate data from a file which can be exported by Fluent. File -> Export -> Solution Data |
|
Tags |
dynamic mesh, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] groovyBC in openFOAM-2.0 for parabolic velocity bc | ofslcm | OpenFOAM Community Contributions | 25 | March 6, 2017 11:03 |
SparceImage v1.7.x Issue on MAC OS X | rcarmi | OpenFOAM Installation | 4 | August 14, 2014 07:42 |
Problem compiling a custom Lagrangian library | brbbhatti | OpenFOAM Programming & Development | 2 | July 7, 2014 12:32 |
"parabolicVelocity" in OpenFoam 2.1.0 ? | sawyer86 | OpenFOAM Running, Solving & CFD | 21 | February 7, 2012 12:44 |
pisoFoam compiling error with OF 1.7.1 on MAC OSX | Greg Givogue | OpenFOAM Programming & Development | 3 | March 4, 2011 18:18 |