|
[Sponsors] |
February 8, 2021, 05:58 |
Global node coordinates values FSI-UDF
|
#1 |
New Member
Marcelo Ruiz
Join Date: Feb 2021
Location: Italy
Posts: 17
Rep Power: 5 |
Hello everybody,
I am traying to reproduce the motion of a fish in 2D. I am using the Macro DEFINE_GRID_MOTION(). I want to extract the initial coordinates of the fish, so that I can use it over all simulation. I other words, motion is defined by the initial position f(x_0,y_0,t). I have tried to code it in the same macro. Nevertheless, I have not succeed. Could you please provide me any advice? Which macro I can use to extract the Initial values and store it in a global variable matrix/array? In the next code I try to extract the minimum and maximum coordinates before the deformation. However it did not work properly: Code:
DEFINE_GRID_MOTION(motion, domain, dt, time, dtime) { Thread* tf = DT_THREAD(dt); face_t f; Node* v; double xprev, yprev, hprev, d, h; int n; double x_max, x_min; x_max = -0.99e38; x_min = 0.99e38; begin_f_loop(f, tf) // I used this loop to find the maximum and minimum and maximum but it did not work { f_node_loop(f, tf,n) { v = F_NODE(f,tf, n); x_max = MAX(x_max, NODE_X(v)); x_min = MIN(x_min, NODE_X(v)); } }end_f_loop(f, tf) #if RP_NODE x_max = PRF_GRHIGH1(x_max); x_min = PRF_GRHIGH1(x_min); #endif SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); begin_f_loop(f, tf) { f_node_loop(f, tf, n) { v = F_NODE(f, tf, n); if (NODE_POS_NEED_UPDATE(v)) { NODE_POS_UPDATED(v); if (CURRENT_TIME > 0.0) { xprev = NODE_X(v); yprev = NODE_Y(v); hprev = kinematics(xprev, PREVIOUS_TIME,x_max,x_min); //Function for the kinematics of fish d = yprev; h = kinematics(xprev, CURRENT_TIME, x_max, x_min); //Function for the kinematics of fish NODE_Y(v) = d+hprev-h; } } } } end_f_loop(f,tf) } Thank you for the advice, |
|
February 27, 2021, 09:36 |
|
#2 | |
Member
Join Date: Jan 2020
Posts: 31
Rep Power: 6 |
Quote:
after this code use N_UDMI(v,0) & N_UDMI(v,1) as the initial condition nodes for x and y. please search about DEFINE_ON_DEMAND macro. Don't forget that you must "Execute on Demand" it in fluent after Initialization. DEFINE_ON_DEMAND(NODE_FIRST) { Domain *d= Get_Domain(1); Thread *t=Lookup_Thread(d,ID); face_t f; Node *v; int n; FILE *fout; real time=CURRENT_TIME; thread_loop_f (t,d) { begin_f_loop(f,t) { f_node_loop(f,t,n) { v = F_NODE(f,t,n); N_UDMI(v,0) = NODE_X(v); N_UDMI(v,1) = NODE_Y(v); } } } end_f_loop (f,t) } |
||
October 26, 2021, 23:49 |
|
#3 |
New Member
Thomas Sprengeler
Join Date: Oct 2020
Posts: 3
Rep Power: 6 |
Were you able to store the initial coordinates and make this work?
|
|
October 27, 2021, 10:25 |
|
#4 |
New Member
Marcelo Ruiz
Join Date: Feb 2021
Location: Italy
Posts: 17
Rep Power: 5 |
||
October 27, 2021, 12:27 |
|
#5 |
New Member
Thomas Sprengeler
Join Date: Oct 2020
Posts: 3
Rep Power: 6 |
||
Tags |
define_grid_motion(), fluid-solid, fsi, global variables |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
courant number increases to rather large values | 6863523 | OpenFOAM Running, Solving & CFD | 22 | July 6, 2023 00:48 |
pimpleDyMFoam computation randomly stops | babapeti | OpenFOAM Running, Solving & CFD | 5 | January 24, 2018 06:28 |
Help for the small implementation in turbulence model | shipman | OpenFOAM Programming & Development | 25 | March 19, 2014 11:08 |
How to obtain node values in UDF? | Maciej | FLUENT | 0 | October 23, 2006 09:10 |
Help: how to get node values with UDF? | Dazhi Guo | FLUENT | 0 | February 4, 2001 01:59 |