TAGGED: boundary-conditions, fluent, periodic-flow, udf, uds
-
-
August 13, 2020 at 4:29 pm
schwaral
SubscriberHello, nis it possibble to change the type of UDS Boundary by using a UDF? I have a periodic FLow and when the flow is reversed, I want to have a UDS Flux instead of a UDS Value at the Boundary.Or is there any way to transform a UDS Value into a UDS Flux and the other way around?n -
August 17, 2020 at 3:12 pm
DrAmine
Ansys EmployeeYes you can use UDF to change the boundary for UDS.nYou require however scheme to change the type of input.nSo you require both.nAlternative is what you are mentioning: perhaps you use single UDF which accommodate your input either into Flux or fixed value (solving a sort of equation).n -
August 25, 2020 at 11:51 am
schwaral
SubscriberThanks for the reply!nCould you give me some advise on the alternative approach? nI noticed when I use a certain Flux at Inlet and a Flux=0 at Outlet my Scalar Value becomes larger with each timestep. But I don't want this behavior. So I use a UDS Value at Inlet. nif I want to transfer a UDS Value into a Flux without this behavior of a rising Scalar in my domain with each timestep i think I need to consider time effect . But I am not to sure how. Should I store the Values of previous timesteps in the UDM and subtract them or is there a way ti work with time derivative?nI could only find in the userguide that flux is (density*velocity*cellface*Scalar) so basically [kg/s]*Scalar.nI am a little bit confused with the mathematics here :/ -
August 25, 2020 at 1:51 pm
Rob
Forum ModeratorRemember scalars don't have a material so don't have a density, otherwise they're modelled in exactly the same way. n -
August 26, 2020 at 4:15 pm
schwaral
SubscriberI will try this as again. In the meantime I worked on the approach with TUI and UDF.nI followed this thread:/forum/discussion/7062/changing-boundary-condition/p1nIt seems that it almost works fine. The first timestep works fine but with the start of the 2nd timestep I face this error below. When I initialze the solution again, the error happens already in the first timestep. Do you have any suggestion why this happens? I simply copy and pasted the scheme code into the execute commands line. I hope that is correct. n(condn((=(rpgetvar 'veldirect) 0)n(ti-menu-load-string define/boundary-conditions/velocity-inlet/9 yes yes no 5 no 0 no 1 no 0 no 300 no yes no 0.5)n)n((=(rpgetvar 'veldirect) 1)n(ti-menu-load-string define/boundary-conditions/velocity-inlet/9 yes yes no 5 no 0 no 1 no 0 no 300 yes no 0)n)n)nError:GENERAL-CAR-CDR:invalid argument [1]:improper listnError Object: The hooked UDF:DEFINE_ADJUST(adjust_UDS_bc, d)n{ntint zone_ID = 9;ntThread* t = Lookup_Thread(d, zone_ID);ntint r;ntr = RP_Get_Integer(veldirect);ntif (fnew >= 0)nt{nttRP_Set_Integer(veldirect, 0);nttprintf( veldirect:%d
, r);nt}ntelsent{nttRP_Set_Integer(veldirect, 1);nttprintf( veldirect:%d
, r);nt}n}n -
August 26, 2020 at 4:24 pm
schwaral
SubscriberThanks I will try it again. In the meantime I worked on the approach with UDF and TUI. I followed this thread: /forum/discussion/7062/changing-boundary-condition/p1. The first Timestep works fine but with the start of the second timestep I face an error. When I initialize the case again, the error happens rigth away. I simplay copy and pasted the code below into the execute commands line. Do you have any suggestion wheter the problem is because of the code or a diffrent reason? This is the output: nnnThe hooked UDF: n
n
-
August 26, 2020 at 4:33 pm
DrAmine
Ansys EmployeeYou might use %rpgetvar instead of rpgetva (like in /forum/discussion/7062/changing-boundary-condition/p1)n -
August 26, 2020 at 6:29 pm
schwaral
SubscriberI had it like this already, checked it now again but the same error appears.nnLike you can see in the output above, the variable r is not printed. When I use the UDF without the execute command, then the value is printed occasionally, but not at every timestep. Maybe this has something to do with that? I compiled my UDF as well and did not interpret it. Hooked it properly as well. Everything in the Internet I can find regarding this error sounds like it is caused because of system compatibility?I also tried now to setup the whole case again but it did not help unfortunally. n -
August 26, 2020 at 7:02 pm
DrAmine
Ansys EmployeeUse Message0 instead of printing. That is a buffer issue.n -
August 26, 2020 at 7:34 pm
schwaral
Subscribergreat now it is printing every timestep but the error is obviously still existentn -
August 26, 2020 at 7:38 pm
DrAmine
Ansys EmployeeCheck if the TUI commands to change Boundary condition are working fine by just only executing them.nI would rather rely on Fluent expression if you are just changing the parameter of the same boundary condition and not change its kind.n -
August 26, 2020 at 8:03 pm
schwaral
SubscriberYes they work fine. I am constantly checking if the yes no yes yes yes.... is correct.nThat is exactly the problem, that I want to change the kind of boundary conditions since I am not able to transfer a UDS Value into a UDS Flux without summing up my Scalar with every timestep. nI want: non one side UDS Scalar gradient = 0 --> so I use UDS_Flux = 0. non the other side UDS Value = x (or please tell me how to write the same as UDS Flux).I do not understand how the flux works. Everything I can find in the UserGuide is nFrom what I can see during the calculation with Flux = x at Inlet and Flux =0 at outet, that witch each timestep another x is added. So I end up having infinite number of x in my domain. n
-
August 26, 2020 at 10:38 pm
schwaral
SubscriberI figured out, that you cannot just copy and paste the scheme code into the line under execute commands. First you have to write your code in one single line and then copy and paste it.The last problem I have now: nhow to write as a string. I think in the TUI, if I want to use an UDF, I have to call it with (nameofmyUDF). But you can't type in questionmarks in scheme. n(cond((%rpgetvar 'veldirect) 0)(ti-menu-load-string define/boundary-conditions/velocity-inlet/9 yes yes yes yes udf unsteady_x_velocity_Mund::libudf no 0 no 1 no 0 no yes no 0.8)nnSo the error appears for udf and unsteady_x_velocity_Mund::libudf. Let me know if this is not possible. Because then it would not be possible to select a UDF with scheme?.best regardsn
-
August 27, 2020 at 12:22 pm
DrAmine
Ansys EmployeeYou might put everything in a journal file and under the execute command you request reading that as journal file.n -
August 27, 2020 at 12:30 pm
DrAmine
Ansys EmployeeOkay the pint is pure Scheme programming. You can escape the via \ like innn(ti-menu-load-string /define/user-defined/compiled-functions load \libudfexec\)nnor using format.n -
August 27, 2020 at 1:38 pm
schwaral
Subscriberthanks again everything is working. It is only not changing the BC. printing my variable, that is used for the if statement (veldirect) changes from 0 to 1 but the scheme code treats it as 0 all the time.nnthanks for your help n -
August 27, 2020 at 2:35 pm
schwaral
Subscriberwhen i check with (rpgetvar 'var_name) the value is always 0. But my UDF is pretty simple and calculates the value correct. So the UDF is used not rigth before the journal file is adressed. But how can I change that. I tried to call the udf from the journal file but then everything is messed up. Are you sure that the order of my procedure is correct? nn
-
August 27, 2020 at 5:49 pm
DrAmine
Ansys EmployeeWhich UDF?n -
August 28, 2020 at 10:34 am
schwaral
SubscriberIt is the UDF from above. My Workflow: Define RP-Variable --> Set RP Variable with UDF --> USE RP Variable with scheme. I had a closer look and scheme is not using the value that I set with the UDF but always the initialized rp Value from defining the rp variable at the beginning. Somehow this workflow can't be right. UDF itself is working fine. Define RP Variable is working fine. Scheme itself is working fine. When I interrupt the simulation and check by hand rpvalue it is always the initialized value and not the one calculated by the udf. nWhat I noticed as well: When I execute the UDF on demand in the output is written: veldir=1 (that is what my UDF calculates for my rpvar named veldir. When I check with (rpgetvar 'veldir) rigth after that, the value = 0 (that is the initialized value of the rpvar). So the UDF and scheme is somhow not talking about the same variable.nn
-
August 28, 2020 at 11:41 am
-
August 28, 2020 at 1:25 pm
schwaral
SubscriberIs this maybe a problem?.** WARNING: Automatically switched to run in parallel -t1 mode. **n** Detected non-parallelized UDF usage, enabling parallel usage. **n** If you encounter any issues, please re-run with -t0 flag. **n****************************************************************************n -
August 31, 2020 at 2:39 pm
schwaral
SubscriberIf someone has the same problem. I think I solved it by using #if !RP_NODEso the UDF looks like this now: nI am still not sure if I should use the node_to_host_int_1. But it works without it just fine.Something I noticed as well is a huge reduction in performance due to the execute on demmand. Would be interesting to know how to optimise that.nn
-
August 31, 2020 at 2:43 pm
DrAmine
Ansys EmployeeRight after executing the on demand to modify the rpvar in the udf can you check the value of that rp variable?n -
August 31, 2020 at 2:56 pm
DrAmine
Ansys EmployeeAnd one would need to set rp variables at host. All nodes will get that value after one iteration. Actually it should work without any compiler directive for node or host in the recent versions I am using. You can learn here by adding in the messaging %d for myid to check the values on corresponding nodes and hosts.n
-
Viewing 23 reply threads
- The topic ‘Fluent UDS Interchange “Inlet UDS Value” to “Inlet UDS Flux” by using UDF???’ is closed to new replies.
Ansys Innovation Space
Trending discussions
Top Contributors
-
3767
-
1333
-
1173
-
1090
-
1014
Top Rated Tags
© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.