Looping through fractures in DFN

I’m having trouble with a function to loop through the fracture list and modify the dip/ddir based on a surface orientation. The function below works fine when working with zones, but I can’t figure out what is going wrong when applying to fractures.

I think it’s not working because the frac.list command points to the DFN, rather than the fractures within the DFN? I imagine I need to change to the dfn.fracturelist command but I can’t seem to get the syntax correct.

Any help will be greatly appreciated!

fish define ori_dfn
    loop foreach local frac frac.list
        local dxf = geom.set.find('surface')
        local fracpos = frac.pos(frac)
        local polyid = geom.poly.near(dxf,fracpos)
        local dip = math.dip.from.normal(geom.poly.normal(polyid))
        local ddir = math.ddir.from.normal(geom.poly.normal(polyid))
        local dipdeg = dip/math.degrad
        local ddirdeg = ddir/math.degrad*-1
        frac.prop(frac,'dip') = 180-dipdeg
        frac.prop(frac,'dip-direction') = (180-ddirdeg)%360

This works the way you have written it, more or less. Note that setting the dip property is not the same thing as setting the dip. The properties are essentially extra variables that can be used for plotting, etc. If you actually want to change the dip you need fracture.dip(frac) = … For dip direction you need fracture.ddir(frac) = …

You will also have to check for negative dips, and be careful of rotating fractures such that they stick outside of the domain.

Thanks Jim, I don’t know if you remember in the FISH course earlier in the year you gave me a few ideas on how to do this to recreate the Sainsbury paper, and I finally figured it out!

Thanks for your help!