CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Monitor Points/Surfaces (https://www.cfd-online.com/Forums/fluent/225214-monitor-points-surfaces.html)

vinerm March 22, 2020 06:04

Good
 
That's good. Let me know if you need further help.

Mohinder Suresh March 24, 2020 01:11

Good morning vinerm,
thanks to your help, i was able to get the UDF working (at least in serial mode)! It is perfectly doing what it is supposed to be now and when I finnished the parallelization I will post the final solution here!
Now I am wondering if it is possible to also interpolate the q-criterion in these desired points! I've read some threads regarding custom field functions and user defined scalars, but i dont know what will be the most elegant solution as I not only need the values of Q in the cell centers, but also the derivatives for the final interpoaltion!
Do you have any suggestions how to approach this problem?

Thanks in advance!!


Mohinder

vinerm March 24, 2020 02:53

Q-Criterion
 
As far as defining a Custom Field Function is concerned, it is easy. You can refer the following

useful-les-tools-fluent

As far as UDF is concerned, though strain rate is directly available, vorticity is not. So, you have to use velocity gradients to define Q-criterion. You can fetch gradients or reconstruction gradients using C_DUDX(c, t), C_DUDY(c, t), etc. These can also be fetched using C_U_G(c, t)[0], where 0 implies x and so on.

You may have to issue the following command in your setup before the gradients become available because Fluent does not store those values.

solve set expert

And then Yes as a response to the question to keep the temporary memory from being freed. Then using these gradients, you can define q-criterion and write it to file.

Mohinder Suresh March 26, 2020 06:59

Thank you for your reply!
I think that both ways only give me the values of q at the node centers, but I also need the gradients of q to finally interpolate the value at the desired monitor points. Is there a way to also get access to the gradients of q?


Greets

Mohinder

vinerm March 26, 2020 07:05

Q gradients
 
As such, q-criterion is not defined as a primitive variable in Fluent. Therefore, its gradients are not available as well. So, the only way is to determine its gradient from its definition (using a pencil and paper) and then make use of that equation to determine its gradients within UDF. Do note that all values starting with C_ are cell center based. To fetch values at nodes, you have to loop over nodes.

Mohinder Suresh March 26, 2020 07:12

Yes, that would be a solution...
but I also found this example in the manual (example2)
Do you think that this would also be an option?

https://www.afs.enea.it/project/nept...udf/node20.htm

vinerm March 26, 2020 07:16

Uds
 
This will increase an equation in your case. Fluent solves full conservation equation for UDS. In my view, this would be an overkill just to fetch q-criterion at some points. Secondly, you have to ensure that despite UDS being solved, its values are determined on the basis of velocity gradients.

Mohinder Suresh March 26, 2020 07:17

Im referring o this post:
https://www.cfd-online.com/Forums/fl...-function.html

vinerm March 26, 2020 07:21

Cff
 
There are no options (nor is there any requirement) to determine gradients of CFF. Gradients are available only for field variables. CFF is a field variable but an algebraic one. So, only those fields for which conservation equation is solved need their gradients because flux need to be determined at the faces for solving the equation.

kont87 April 1, 2022 09:32

Quote:

Originally Posted by Mohinder Suresh (Post 762615)
Good morning vinerm,
thanks to your help, i was able to get the UDF working (at least in serial mode)! It is perfectly doing what it is supposed to be now and when I finnished the parallelization I will post the final solution here!
Now I am wondering if it is possible to also interpolate the q-criterion in these desired points! I've read some threads regarding custom field functions and user defined scalars, but i dont know what will be the most elegant solution as I not only need the values of Q in the cell centers, but also the derivatives for the final interpoaltion!
Do you have any suggestions how to approach this problem?

Thanks in advance!!


Mohinder

Hello Mohinder,

Did you manage to use the code in parallel?
I want to extract Cp and V from more than 2000 points, which are defined in a separate file(as was in your case)
I used your udf to test it, I appreciated, however, when I try to use it in parallel cores (160 cores) it gives me an error, and it seems that udf needs parallelization.
I am a newbie in udf usage, any help is welcome.
Regards

Sergen

AlexanderZ April 5, 2022 01:06

show your code and error log if you need help


All times are GMT -4. The time now is 17:10.