UDF to count DPM Hits on a wall


Client wants to count DPM particle hits on a wall
/***********************************************************************
UDF for extending post-processing of wall impacts
************************************************************************/
#include "udf.h"

int hits_on_thread = 0;

DEFINE_DPM_EROSION(dpm_accr, p, t, f, normal, alpha, Vmag, Mdot)
{

if (THREAD_ID(t) == RP_Get_Integer("my-thread"))
{
hits_on_thread ++;
}

}

DEFINE_ON_DEMAND(reset_hits)
{
hits_on_thread = 0;
}

DEFINE_ON_DEMAND(show_hits)
{
Message("On ID %d, hits = %dn", RP_Get_Integer("my-thread") , hits_on_thread);
}



/********** SCHEME FILE ********************/
;;
;; WARNING MESSAGE
(format "WARNING:n")
(format "This is a prototype version that has not yet been tested and validated.n")
(format "Fluent Inc. makes no commitment to resolve defects reported against thisn")
(format "prototype version. However, your feedback will help us improve the overalln")
(format "quality of the product.n")

;; DEFINE VARIABLE CREATION FUNCTION
(define (make-new-rpvar name default type)
(if (not (rp-var-object name))
(rp-var-define name default type #f)))

;; CREATE RPVARS
(make-new-rpvar 'my-thread 0 'integer)

;; INITIAL SETTINGS fo RPVARS
(rpsetvar 'my-thread 5)

;; NOTE... TO CHANGE "my-thread", type
;;
;; (rpsetvar 'my-thread ####) at the fluent GUI, where ### is the ID of the boundary thread





Show Form
No comments yet. Be the first to add a comment!