-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
79 add random field feature #109
base: main
Are you sure you want to change the base?
Conversation
self.cov_name = cov_name # name of covariance function to use | ||
self.cov = getattr(self, "cov_" + cov_name) # select the right function | ||
self.mean = mean # mean of random field | ||
# self.rho = rho # correlation length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a way of indicate the dimensionality of the GRF
return str(self) | ||
|
||
def cov_exp(self, r): | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be more convenient to use scikit-learn native kernels instead of implementing ours?
return self.sigma2 * np.exp(-1 / self.rho * r) | ||
|
||
def cov_squared_exp(self, r1, r2): | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be either available for 1-2-3D or accept the dimension as a parameter
self.pv_nugrf_file = Path(pv_path) / (pv_name + "nugrf.xdmf") | ||
|
||
def setup(self) -> None: | ||
self.field_function_space = df.fem.FunctionSpace(self.experiment.mesh, ("CG", 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the degree 1 compulsory or should it accept any?
I needed the Gaussian Random Field implementation for my project, so I generated some minimum working code translated from @div-tyg implementation. Currently only 2D GRFs for E and nu in a linear elastic problem are possible, as some parts of the code need work to properly handle any case. It supposes that #108 has been implemented, as I needed it for my use cases. I make some comments on things that I noticed that should be adapted. Additionally I did not prepare any new tests or really considered where the GRF generator should be located, this is supposed to be just a starting point for the final implementation.