CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Journal file for Dynamic mesh update

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By obscureed
  • 1 Post By obscureed

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 3, 2018, 09:38
Default Journal file for Dynamic mesh update
  #1
New Member
 
Shaheen Akhtar Wahab
Join Date: Aug 2018
Location: Germany/Belgium
Posts: 6
Rep Power: 8
shaheen wahab is on a distinguished road
Hello Everyone,

I am trying to do a Dynamic Mesh that reads a CSV file with coordinates and Wall shear X and Wall shear Y. I want to write a Journal File that makes Fluent read the CSV file (with the help of UDF) and adjusts the mesh (Dynamic Mesh).

The steps I did:

1. Open .cas file from the previous simulation.

2. Compile the UDF

3. Turn ON Dynamic Mesh and select "Smoothing"

4. Initialize?? (Not sure)

5. Read the Journal file

"/file/start-transcript Log_02.txt

/file/read-case HumpMesh7_200m_ofd_v3-1-00350.cas

/solve/initialize/initialize-flow ***Not Sure if I have to put it in here or do it in GUI Itself***

/solve/iterate 10

/file/write-case-data HumpMesh7_200m_ofd_v3-output

exit

yes

"

With the help of this Journal File, I want Fluent to read the CSV (through the UDF) and adjust the new coordinates so that I can see in the dynamic mesh.

How can I see/do the change in the mesh? (With the help of a Journal File) (Probably do a few iterations maybe??)

I couldn't find much help in the Manual. I would be really grateful if anyone could help me in this regard.

Thank you

With regards

Shaheen
shaheen wahab is offline   Reply With Quote

Old   October 4, 2018, 20:10
Default
  #2
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 12
obscureed is on a distinguished road
Hi Shaheen,


It sounds to me that what you are asking for is very difficult.


First, what is this CSV file of coordinates? -- if it contains coordinates of a list of points, how do these points correspond to the mesh? Is there a set of CSV files, one for each timestep? If there is any interpolation required from the CSV file(s) to a grid point at a specific location and time, then it will be your job to do it. If you can do those interpolations, then I guess you are ready to feed them in via a UDF of type DEFINE_GRID_MOTION.


A UDF of type DEFINE_GRID_MOTION can be applied only to boundary mesh zones. The interior zones have to respond to this by smoothing or whatever.


Good luck!
Ed
shaheen wahab likes this.
obscureed is offline   Reply With Quote

Old   October 5, 2018, 07:07
Default
  #3
New Member
 
Shaheen Akhtar Wahab
Join Date: Aug 2018
Location: Germany/Belgium
Posts: 6
Rep Power: 8
shaheen wahab is on a distinguished road
Dear Ed,
The CSV File contains the XYZ Coordinates (the Z coordinates are different from the original ones, which I edited manually just to see the difference) and the wall shear. I have a UDF that writes new CSV files (which I am not hooking at the moment as it works fine). I have another UDF (Grid motion) that should read this particular CSV file and then adjust the new nodes (w.r.t. the CSV file). This would actually take place 200 times. As of now, I want to test it just by using one CSV file to make sure that the UDF actually reads the CSV file and adjusts to the new nodes. And for that, I want to write a Journal file that would do the steps.
I am using a steady state case.
Thank you
Regards
Shaheen
shaheen wahab is offline   Reply With Quote

Old   October 5, 2018, 14:11
Default
  #4
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 12
obscureed is on a distinguished road
OK, so now you have to work out how to relate the CSV file's coordinates to the coordinates of each vertex, which you might visit by the usual loops for DEFINE_GRID_MOTION.


Maybe you can trust that the vertices will be visited in the same order every time. So, you export a list of vertices by those loops, edit the values in the list, and then import the list, line by line, and apply them in the UDF. This method means you have to start again every time you handle a new mesh, but maybe that's OK for you. This method will definitely turn very confusing if you run in parallel, but it might work in serial. It would be a good idea to export and import the vertex ID number as well as the coordinates, so that you get some warning if it starts to go wrong.


There are no guarantees that this reliance on ordered lists will work. Fluent is allowed to renumber the vertices whenever it likes -- for example, if you save and reopen the model, or if remeshing changes some boundary-adjacent cells. (If remeshing changes the face/vertex listing, then you might not notice for the first few timesteps, so this could be a tricky one to debug.)



If it does not work, I guess you have to move to reading in the entire CSV file, storing it in memory somewhere, and looking up the relevant values for each vertex as it arrives. If each vertex keeps the same x and y values over time, and these are different from other vertices' values, then you can use these for lookup. For a really small case, you could use a crude search: loop through all the stored vertices until you find a matching one. For a larger case, you might want to look into a hash table. For something in between, you could collect data into bins and search through the relevant bin. None of these methods is rocket science, but they will take some time to get working. Running in parallel will again be significantly more difficult.



You will have similar issues with importing wall-shear data, except slightly different -- presumably the values apply to faces, rather than vertices. I think it makes sense to tackle this problem by an entirely different set of files, rather than trying to lump everything into one CSV file.


Also, it sounds to me like a bad idea to repeatedly over-write the CSV file for each new timestep. If you have 200 timesteps, then set up 200 files, and name them consistently, so that you can open up the relevant one when needed.


Good luck!
Ed
shaheen wahab likes this.
obscureed is offline   Reply With Quote

Old   October 26, 2018, 08:03
Default
  #5
New Member
 
Shaheen Akhtar Wahab
Join Date: Aug 2018
Location: Germany/Belgium
Posts: 6
Rep Power: 8
shaheen wahab is on a distinguished road
Update:

This is what I did.

1. Read .cas & dat file that already has already converged.

2. Compile the UDF that reads the csv file.

3. Update the dynamic mesh.

4. Check the contours.

There are two ways to write the Journal file.

1. From GUI (Start Journal -> Stop Journal)

2. In TUI

/file/start-transcript Log_01.txt

/file/read-case TestReadWrite.cas

/file/read-data TestReadWrite.dat

/solve/initialize/initialize-flow

/solve/iterate 2

/file/write-case-data DM-output

/file/auto-save/root-name /mnt/data/swa/fluent

exit

yes

And it worked!

Thank you

With regards

Shaheen
shaheen wahab is offline   Reply With Quote

Reply


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
how to calculate mass flow rate on patches and summation of that during the run? immortality OpenFOAM Post-Processing 104 February 16, 2021 09:46
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 02:22
[swak4Foam] Problem installing swak_2.x for OpenFoam-2.4.0 towanda OpenFOAM Community Contributions 6 September 5, 2015 22:03
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 02:41
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 12:44


All times are GMT -4. The time now is 14:00.