CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF to modify coordinates in Moment Monitor (https://www.cfd-online.com/Forums/fluent/154001-udf-modify-coordinates-moment-monitor.html)

Alex9090 June 8, 2015 12:09

UDF to modify coordinates in Moment Monitor
 
Hi all,

I have to modify the moment centre and the moment axis in the "moment Monitor" with a function of time. It's possible at every time-step change these values?

For the mesh motion in the cell zone condition I did with a "DEFINE_ZONE_MOTION".

It's a simulation with a dynamic mesh and I was able to do.


Thank you very much

Alessandro

Kokemoor June 9, 2015 10:46

This might be a job for a scheme macro rather than a UDF. If your moment center varies with time in a complex way, you could do that in a UDF and write it to a scheme variable with RP_Set_Real. If its simpler, you could calculate it in scheme. Then, create a macro that changes the moment monitor, something like:

Code:

(cx-macro-define '(
(moment-update . "
(ti-menu-load-string \"solve/monitors/force/set-moment-monitor monitorname y 123 , y y moment-history.txt n n (rpgetvar 'xc) (rpgetvar 'yc) (rpgetvar 'zc) 0 0 0\")
")))

where xc, yc, and zc are the scheme variables containing the moment center components. You'll have to change the details to match your setup, but that's the gist of the approach I would use. Then you simply set up a Calculation Activity that runs your macro every iteration.

Alex9090 June 11, 2015 10:47

Thank you very much Kookemoor!

It's working on my computer but not in the cluster.

At the end I used wrote this command directly in the command line of "Calculation Activities --> Execute commands"

Code:

(Define t (rpgetvar'flow-time)) solve/monitors/force/set-moment-monitor cm-p y 53 55 57 61 58 59 56 60 , y y mom-tot.txt n n 0 0 -6 (sin (* 0.0872 (sin (* 25 t)))) 0 (cos (* 0.0872 (sin (* 25 t))))
It's strange that after the first iteration it stopped but if I run again the simulation it works perfect.
The error is:
" Error: GENERAL-CAR-CDR: invalid argument [1]: improper list
Error Object: () "


The problem is that I want to run the simulation in the cluster of my University but in the HPC fluent read the command but doesn't write the file.txt.

Do you have any idea?

Thank you again.

Kokemoor June 11, 2015 11:13

It might be a rights issue? You could try writing to a network location. Instead of "mom-tot.txt" have "\\computername\folder\mom-tot.txt".


All times are GMT -4. The time now is 23:24.