Spatio-temporal modeling of incompressible random vector field with 0 mean velocity #245
Replies: 4 comments 1 reply
-
Hi joshua-benabou, that's a really interesting application you're trying to set up there! I don't have too much time today, but I'll try to get you on the right track and come back to you in a few days. Here is a minimal working example of how you can access the generator (and all of its attributes, like the mean velocity in x-direction). import numpy as np
import gstools as gs
x = np.arange(100)
y = np.arange(100)
model = gs.Gaussian(dim=2, var=1, len_scale=10)
srf = gs.SRF(model, generator='VectorField', seed=19841203)
srf.generator.mean_u Regarding your second problem, take a look at the way the The incompressible field generator was actually the first one I created many years ago and at that time, I was only interested in 2d and 3d fields. Only recently have we started using spatio-temporal fields. I will have to look at the generator algorithm again to see, if it is easily expandable to higher dimensions. That would mean we would have to modify the heavy lifting Cython- and/or Rust code. I'm very interested in that and it would be great, if we could get that up and running! As I already wrote, I will come back to you soon and I will fix the problem with not being able to use own generator classes in the |
Beta Was this translation helpful? Give feedback.
-
Dear LSchueler, thanks for your prompt reply. I am more than happy in the coming days to help extend the incompressible field generator to spatio-temporal fields. Based on my quick reading of the code, it seems the only special thing about the incompressible field generator is the application of a projector when summing the Fourier modes in the One thing is that the The covariance matrix in the model might also have to be modified, I did not read that part of the code yet. For a regular NxNxN grid in 3D space, and N_t time points, there are random variables at 3*N^3 * N_t points, so that should be the column size of the covariance matrix. Otherwise, the correlation function is still separable between time and space. When naively setting the generator to the It seems at a glance that the incompressibility and the covariance model are decoupled, so this could be as simple as changing the vector size, but I have not looked in detail yet. |
Beta Was this translation helpful? Give feedback.
-
Dear Lennart,
to confirm, yes I am looking to simulate a 4d field (3 space + 1 time) of
3d incompressible vectors, and this field should have a given correlation
length and correlation timescale.
thanks.
…On Sat, Aug 6, 2022, 6:39 AM Lennart Schüler ***@***.***> wrote:
Hi again,
first of all, I created the PR #250
<#250> to give better
support for modified generators again. If you want to, please have a look
at it and I'd be happy about comments.
Based on my quick reading of the code, it seems the only special thing
about the incompressible field generator is the application of a projector
when summing the Fourier modes in the gstools.field.summator function
summate_incompr, to ensure incompressibility. For a time-varying
incompressible field in 3 dimensions, this won't change.
I think so too.
So I imagine somewhere in the code, the size of the covariance matrix is
chosen based on whether we are using vectors or scalars, and if vectors,
based on the length of the vector.
Exactly, the relevant variable is RandMeth._value_type, which is either
"scalar" or "vector".
Just to summarize your ultimate goal for myself: You want to have a 4d
field (3 spatial + 1 temporal) of incompressible 3d vectors, right? Thanks
for already digging so deep into this topic and the relevant code. I think
you are right, that this would not be too much of a problem.
I'll have a look at the equations and the code and come back to you soon.
—
Reply to this email directly, view it on GitHub
<#245 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMSCDYKZ75AS3QYQHTGGT6LVXZTKDANCNFSM55RUMBCA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Hi Joshua, have a look at PR #251. I'd be happy, if you would clone that branch and test it for your self and play around with it. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am curious if GSTools has the ability to generate an incompressible 3D vector field of zero mean velocity, with a given correlation length in space, and a given correlation time-scale. I see that GSTools can do spatio-temporal modeling of random scalar fields as in this example
https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/09_spatio_temporal/02_precip_2d.html#sphx-glr-examples-09-spatio-temporal-02-precip-2d-py
which allows one to specify correlation scales in space and in time. I also see that generating random incompressible vector fields is also possible, as in this example:
https://geostat-framework.readthedocs.io/projects/gstools/en/stable/index.html#incompressible-vector-field-generation
To combine these capabilities, I encountered two issues:
One is that the
gs.SRF
does not seem to have a setter method for the generator, so I am unsure how to modify the generatorIncomprRandMeth
to my liking (to set 0 mean velocity in the x-direction instead of the default of 1). Edit: it appears passingmean =(-1,0)
corrects the default x-velocity of 1 such that it now becomes 0. Still, I would like to know if the generator can be modified via a setter.More importantly, adding e.g ,
generator='VectorField'
in the first example linked above, simulates a sequence of vector fields which have 3D vectors at each point in (2+1)D space-time, instead of 2D vectors at each point in (2+1)D space-time (and the incompressibility condition applies to the (2+1)D vectors). I am interested in the second possibility, generalized to (3+1)D space-time, with the vector field incompressible at each time-step. Is there a simple way around this? Here again I don't see how to modify the generator to do what I want?Forgetting about incompressibility, are there functions to generate a vector field other than 'IncomprRandMeth'?
Edit: looking a bit into the source code, it seems IncomprRandMeth could be modified to generate vectors with p components where p is not necessarily the dimensionality d of the specified covariance model, but some user-inputted parameter. For my case: p=3 and d = 3+1.
Beta Was this translation helpful? Give feedback.
All reactions