How to write speed expressions

Hello,

I designed a mid-ocean ridge model. The coordinate of the ridge axis is 0. At the ridge axis itself, the velocity is zero, and at a distance of 10 kilometers from the ridge. axis or more, the rigid plate uniformly moves away from the ridge with a constant speed, and close to the ridge we interpolate between these two conditions. The interpolation formula is (1 - ((x/x0 - 1) * (x/x0 - 1))) * u0. The expression I wrote is as follows, but it keeps giving errors and I can’t figure out the reason. The screenshot of the error I mentioned is also provided below. Please help me. Thank you all.

Hi sxj,

The error that you are receiving is because the Function model in Boundary velocity expects to receive two values in 2-D models (vx, vy), and three values if 3-D models (vx, vy, vz). The way ASPECT parses these different components is by looking for semicolons in the Function expression, so in 2-D this would look something like:


set Function expression = vx; vy

and you can see that in your case you have 4 different statements, which is why ASPECT is saying that the number of components (2, in a 2D model) does not equal the number of expressions (4, in you function expression). To achieve what you want in your model, you would need to do something like:

set Function expression = if(x>x0, vx, if(x < x0 && x > 0, linear_function), 0); vy

Where vx is the x velocity and vy is the y velocity. I hope this helps!

Cheers,

Daniel