Hello,
I am working on a 3 phase cahn-hilliard and I need to prescribe an initial condition for 2 of these variables. This is what I am doing:
u.x.array[:] = 0.0
rng_1 = np.random.default_rng(42)
u.sub(0).interpolate(lambda x: 0.3 + 0.02 * (0.5 - rng_1.random(x.shape[1])))
rng_2 = np.random.default_rng(2)
u.sub(2).interpolate(lambda x: 0.3 + 0.02 * (0.5 - rng_2.random(x.shape[1])))
u.x.scatter_forward()
Despite using different seeds, I am getting the same distribution of the 2 variables. What is the correct way of doing this? What changes need to be done if I want to do this in parallel?
Thanks in advance,
Raghunandan.