4

I have a grid that I plan to discretize in 1D. It extends from 0 to L using N nodes, and I need to refine it at each end. I plan to have something that looks as follows:

enter image description here

I have tried the to specify these two parameters:

  1. growth rate (r)
  2. initial node spacing (dx1)

Then the x points are calculated in a series such as the following:

x(i) = dx1 * r ^ x(i-1)

This works fine if I know N, and specify r and dx1. But ideally, I would need r and dx1 to be functions of N to properly scale the grid when N increases. I.e. with N = 10, r should be about 1.7 but when N = 100, r should be about 1.1 to have the same "shape". Similar problem with dx1. Anyone know how to make those two parameters functions of N that will scale with it?

teepee
  • 141
  • 2

2 Answers2

1

I'm assuming that your equation is only used to define the spacing from an end to the middle, after which you mirror it.

Instead of dx1, write L / N, where L is the total length. Now you have

x(i) = (L / N) * r ^ x(i-1)

...and when you change N, your x(i)s will also scale. I don't think you want r to be a function of N.

Let me know if this helps!

elliot svensson
  • 249
  • 1
  • 5
0

Since 1D would likely not be too computationally intensive even for very large sets, you could just sum all the lengths for a given N, then divide all the distances in that mesh array by that value. It would not be computationally efficient like an explicit function, but will do exactly what you need without too much experimentation. If you need the computational efficiency and dont get any derrivations here, you may want to repost in mathamatics.

ericnutsch
  • 8,305
  • 1
  • 16
  • 32