Skip to content
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

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

danielandresarcones
Copy link
Collaborator

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.

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
Copy link
Collaborator Author

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):
"""
Copy link
Collaborator Author

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):
"""
Copy link
Collaborator Author

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))
Copy link
Collaborator Author

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?

Base automatically changed from 104-report-sensor-metadata to main June 1, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants