How to define the user-defined function in the C++ package of a new joint constitutive model as a pointer?

This looks like it should work. What is the value of $li_rfr?
I don’t understand what you mean by defining the user-defined function as a pointer. UDEC does not use pointers. It uses array indices.

Dear Mark:

Thanks for your quick reply.

Yes, using the notation $, I mean the arrays in the ’.fin’ library.

We have successfully developed a new joint constitutive model and implemented into UDEC via C++ programming by doing common direct shear tests where all the contacts own the same contact properties. Now we are trying to assign different joint properties to each individual contact via the following fish scripts but failed (the following code works for the embedded continuously yielding model).

\\\\\\

block contact group ‘joint’

block config cpp

block contact cmodel load “li”; load our user-defined model

block contact cmodel assign li

block contact property ucs 72 kn 3E4 ks 1E3 rfr 26.4 edis 1E-5 …

kw 30 wag 16.2 ww 6.6E-2 uag 12.9 uw 1.6E-2 range group ‘joint’

block contact cmodel default li ucs 72 kn 3E4 ks 1E3 rfr 26.4 edis 1E-5 …

kw 30 wag 16.2 ww 6.6E-2 uag 12.9 uw 1.6E-2 range group ‘joint’

call ‘contact.fin’

call ‘jmat.fin’

; The model has four contacts and Table 1 contains four values planned to assign to the four contacts

table ‘1’ add 30 1

table ‘1’ add 40 2

table ‘1’ add 45 3

table ‘1’ add 50 4

def sgn_p

whilestepping

cj = contact_head

loop while cj # 0

c_nm =c_nm+1

if c_group(cj) = ‘jg_1’; upper block

i_1 = i_1 + 1

p_ks1 = xtable(1,i_1)

fmem(c_jex(cj)+$li_rfr)=p_ks1; p_ks1 gets the value from table 1 containing different values and li_rfr represents the joint residual friction angle defined in our UDM li model

v_jks1 = fmem(c_jex(cj)+ $li_rfr); assign different residual angle to each contact

xtable(2,i_1)= v_jks1; using table 2 to print out the value

endif

cj = c_next(cj)

endloop

end

@sgn_p

\\\\\

Thanks for your help and looking forward to hearing from you soon.

Cheers

Jessie and Yingchun

Jessie,

Not that it matters, but I don’t see $li_rfr in jmat.fin or contact.fin. It would not be applicable to your case anyway. You cannot use the contact extension data array to store properties for your C++ contact model. This array is set up internally in UDEC for specific models and is not for general use. It is used to store information that is used to access the C++ model, but you shouldn’t change it.

You should use:
Block.contact.prop(cj,”rfr”) = value

Thanks, Mark. It seems works by following your suggestion.

Regards
Jessie