underworld2 icon indicating copy to clipboard operation
underworld2 copied to clipboard

Surface processes

Open PatriceFRey opened this issue 3 years ago • 12 comments

Hello all, Is there the 3D equivalent to following 2D functions: GEO.surfaceProcesses.velocitySurface_2D GEO.surfaceProcesses.diffusiveSurface_2D ? Thanks

PatriceFRey avatar Nov 25 '22 02:11 PatriceFRey

Hey @patrice-rey,

I wrote these functions and also implemented a 3D velocity surface too. Let me know if you'd like the functions, I have two, one with a constant erosional and sedimentation rate and another that varies laterally. I think I can implement the diffusive surface in 3D but I haven't got round to it yet. Let me know what you need.

Cheers

bknight1 avatar Nov 26 '22 21:11 bknight1

G'day Ben, Great, any 3D function would do really, though I like the idea where the sedimentation rate varies laterally. In a rift environment, this would allow the partitioning of sedimentation along the margins. Although tracking the position of the margins through time may not be that easy. Thanks Ben

PatriceFRey avatar Nov 27 '22 01:11 PatriceFRey

All good Patrice, let me see what I can do in the next couple of days to make both situations feasible. If you'd like something ASAP I can upload my original implementation.

Cheers, Ben

bknight1 avatar Nov 28 '22 00:11 bknight1

No rush Ben, I can wait a few days or weeks. Thanks

PatriceFRey avatar Nov 28 '22 01:11 PatriceFRey

Okay great, let me see what I can do and I'll get back to you.

Cheers

bknight1 avatar Nov 28 '22 07:11 bknight1

Hey @patrice-rey,

I've managed to put something together, just got to run a final couple of tests on the HPC to make sure it works. I'll share it once completed.

Thanks

bknight1 avatar Dec 02 '22 03:12 bknight1

Thanks for the update Ben. I am on annual leave until next Wednesday 7th December, so no rush. Cheers

PatriceFRey avatar Dec 02 '22 10:12 PatriceFRey

Hey @PatriceFRey sorry it's taken so long to get back to you. I've implemented a 3D surface processes module for you to use, for now you'll have to have the file attached in the same directory as the running script to use the sub module, it'll also need to be renamed so it has a .py extension. You'll then need to set up the surface processes as following in your script:

from UW3DsurfaceProcesses import *

coords = None

if uw.mpi.rank == 0:
    ### set up the x and y coords of the surface
    x = np.linspace(Model.minCoord[0].m, Model.maxCoord[0].m, int((Model.maxCoord[0].m/2)+1))
    y = np.linspace(Model.minCoord[1].m, Model.maxCoord[1].m, int((Model.maxCoord[1].m/2)+1)) 

    xi, yi = np.meshgrid(x, y)
    
    ### this strips units, so units have to be reasigned after creating the array
    coords = np.zeros(shape=(xi.flatten().shape[0], 3))
    coords[:,0] = xi.flatten()
    coords[:,1] = yi.flatten()
    coords[:,2] = np.zeros_like(coords[:,0])+air.bottom.m

uw.mpi.barrier()

coords = uw.mpi.comm.bcast(coords, root=0)

## add dim after bcast, fails if done before
coords = (coords * u.kilometer)


### set ve by the y  coord (lateral position)

ve_conditions = fn.branching.conditional([((Model.y >= GEO.nd(Model.maxCoord[1]/2.)) , GEO.nd(1. * u.millimeter/u.year)),
                                          (True, GEO.nd(0.01 * u.millimeter/u.year))])

# ### constant vs across the model
vs_conditions = fn.branching.conditional([(True, GEO.nd(0.05 * u.millimeter/u.year))])


Model.surfaceProcesses = velocitySurface3D(airIndex=air.index,
                        sedimentIndex= sediment.index,
                        surfaceArray = coords,                ### coords for the surface
                        vs_condition = vs_conditions,         ### branching condition for erosion rate
                        ve_condition = ve_conditions,         ### branching condition for sedimentation rate
                        surfaceElevation=air.bottom,
                        method='linear'
                    )

Let me know if you run into any issues.

Cheers

UW3DsurfaceProcesses.py.txt

bknight1 avatar Mar 01 '23 01:03 bknight1

Hello Ben, thanks a lot for your time doing this. I'll run a test over the next few days and keep you posted. Cheers

PatriceFRey avatar Mar 01 '23 01:03 PatriceFRey

All good Patrice, looking forward to getting updates! Cheers

bknight1 avatar Mar 01 '23 04:03 bknight1

@bknight1 - should I add the above method to UW2. Are there any tests for it?

julesghub avatar Mar 31 '23 04:03 julesghub

Hey @PatriceFRey, how did the code work for you?

bknight1 avatar Apr 11 '23 01:04 bknight1