|
[Sponsors] |
July 12, 2010, 16:08 |
|
#21 |
Member
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 16 |
I really respect your time and appreciate it... after reading profile and setting the rp variables then I read the variables in a UDF with DEFINE_PROFILE to set the BC condition, after doing simulation for N time steps then how I can specify in EXECUTE_AT_END to reset the BC again and continue the simulation (assuming that I've done saving and reading the case in prior)?
In other words, how can I recall the DEFINE_PROFILE UDF again and again in the EXECUTE_AT_END and continue simulation after that? is that possible? |
|
July 13, 2010, 08:29 |
|
#22 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
Your questions are still confusing me, so please make a simple and clear list with your problem.
This is what I understood until now: 1. You want to read a fluent profile from a file. For this purpose you use a scheme script. You can add this scheme script in "Execute Commands", and automaticaly executed every time step or ...10 time steps. 2. You want to set some variables from the profile into rp variables. For this you use a scheme script (maybe the same as in step 1). 3. You want to access the rp variables from inside the solver. For this you use a udf DEFINE_PROFILE, and attach this udf to a surface as a boundary condition. This boundary condition will be used by the solver every iteration (wether you want it or not). 4. Every 10 time steps you want to change the values of the rp variables with a new profile. For this purpose, you try to use EXECUTE_AT_END? I suggest a simpler way: see step 1. |
|
July 13, 2010, 12:51 |
|
#23 |
Member
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 16 |
Here is a clarification to the first and 4th steps which I'm trying to figure out:
After running the simulation for 10 time steps I need to check if the new profile file is ready to be used or not (the profile is provided by another simulation which I don't know how much time it takes to be ready) so my simulation should be in standby mode till that file becomes ready. I was trying to do this waiting through DEFINE_EXECUTE_AT_END in which after 10 time steps check for that file and stands till that file becomes ready...After the file was provided the steps I need to read this new file and set it as new BC. It means I need to go back to step 1 and repeat the process again and again. 1. Is that possible to go back to step 1 (reading the scheme file again) and resetting the rp variables and BC again in DEFINE_EXECUTE_AT_END macro? how? 2. If the answer to question 1 is No then do I need to read the profile file in a UDF instead of a scheme? in order to just dealing with UDFs? Thank you in advance for your time and consideration, |
|
July 13, 2010, 16:35 |
|
#24 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
1. No it is not.
2. Yes, my choice for this case would be to do everything inside a udf. |
|
July 13, 2010, 18:32 |
|
#25 |
Member
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 16 |
Ok then, I need to input required BC variables through UDF...then it'd be better to use a simple data file not a profile file format so it can be easily read and written...to have a clue about the face centers of the problem on the intended boundary I tried writing out the BC face centroids using the exact same example as in UDF manual (second example in section 3.2.6) here is what I input as a UDF:
Code:
#include "udf.h" FILE *fout; void Print_Thread_Face_Centroids(Domain *domain, int id) { real FC[2]; face_t f; int n_faces,j; Thread *t = Lookup_Thread(domain, id); n_faces=THREAD_N_ELEMENTS_INT(t); fprintf(fout,"%d\n", n_faces); j=0; begin_f_loop(f,t) { F_CENTROID(FC,f,t); j++; fprintf(fout, "f%d %g %g %g %d\n", f, FC[0], FC[1], FC[2], j)); } end_f_loop(f,t) fprintf(fout, "\n"); } DEFINE_ON_DEMAND(get_coord) { Domain *domain; domain = Get_Domain(1); fout = fopen("BCData.txt", "w"); Print_Thread_Face_Centroids(domain, 7); fclose(fout); } Code:
2500 f1050120822 3.51252e-007 0 3.51252e-007 1 And if I use the same procedure but instead of DEFINE_ON_DEMAND use DEFINE_EXECUTE_AT_END the code will be trapped in f_loop forever?????!!!!!!!!!! Thanks, Last edited by gary7; July 14, 2010 at 12:04. |
|
July 14, 2010, 14:42 |
|
#26 |
Member
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 16 |
OK, After a long time on it I found the problem...it was because of the defining FC[2] in the 3D model...
|
|
July 15, 2010, 02:37 |
|
#27 |
Member
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 16 |
Ok, I'm doing all the things in a UDF now as you suggested. Now, the only thing is that when in DEFINE_EXECUTE_AT_END I read the new BC data file how can I reset the new BC from there and continue the simulation...
Any idea is highly appreciated. |
|
July 15, 2010, 03:23 |
|
#28 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
DEFINE_EXECUTE_AT_END cannot directly reset your boundary conditions, for this purpose fluent provides you with a macro called DEFINE_PROFILE. You have to present a bit more detailed what you do.
|
|
July 15, 2010, 11:18 |
|
#29 |
Member
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 16 |
I need to set a new BC in my simulation every time a new BC data which is provided from outside is ready, that is I first run the simulation with a specified BC for 10 time step then in EXECUTE_AT_END I check for the availability of the new BC data file upon its availability I need to reset the boundary condition with this new file and continue the simulation (if the BC data file is not still ready the simulation will be in standby mode in there checking continuously for the file till it becomes ready) ...
I know about setting boundary with DEFINE_PROFILE macro my problem is that I need to call this macro repeatedly after checking and approving the existence of the new BC data file in EXECUTE_AT_END. |
|
July 16, 2010, 05:16 |
|
#30 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
None of the DEFINE_* macros that fluent provides for you are designed to be called by you, but by fluent it self. Consequently, you cannot call any of them.
Here I think I see a missunderstanding. You don't need to call any of the DEFINE_* macros, they are called periodically by fluent, any way (excepting DEFINE_ON_DEMAND). The simplest way would be to do the checking and reading directly inside DEFINE_PROFILE (which is called by fluent at least every iteration). The input files are small and it doesn't take that much time to read it (when the check says you have to read it). If you insist to use DEFINE_EXECUTE_AT_END, then you need to use global defined arrays. You will use those arrays to access the data read within DEFINE_EXECUTE_AT_END from DEFINE_PROFILE. |
|
July 18, 2010, 02:32 |
|
#31 |
Member
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 16 |
Thanks Dmoroian, yeah it seems that DEFINE_PROFILE is called at beginning of every time step I thought it is just called once in the beginning of the simulation...
|
|
June 7, 2011, 08:44 |
UDF profile read question
|
#32 |
New Member
engin leblebici
Join Date: May 2011
Posts: 8
Rep Power: 15 |
Hi,
I am working with FLUENT 6.3.26 and I am having difficulties in reading a profile file into UDF later to be used as boundary conditions. My question is that can I assign values to a 1D array if I am working with interpreted UDF? Thanks in advance |
|
July 12, 2022, 02:17 |
|
#33 | |
New Member
Telangana
Join Date: Jul 2022
Posts: 8
Rep Power: 4 |
Quote:
how to directly extract and use the value in the fomula. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Gmsh] Compiling gmshFoam with OpenFOAM-1.5 | BlGene | OpenFOAM Meshing & Mesh Conversion | 10 | August 6, 2009 05:26 |
UDF to read data from a file for VOF model | Pablo | FLUENT | 0 | October 23, 2008 08:02 |
Phase locked average in run time | panara | OpenFOAM | 2 | February 20, 2008 15:37 |
Results saving in CFD | hawk | Main CFD Forum | 16 | July 21, 2005 21:51 |
Format file for visualisation | Ricardo Nunez | Main CFD Forum | 2 | July 30, 1998 05:12 |