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

Same set of parameters for different locations #355

Open
luAndre00 opened this issue Oct 2, 2024 · 2 comments
Open

Same set of parameters for different locations #355

luAndre00 opened this issue Oct 2, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@luAndre00
Copy link
Contributor

luAndre00 commented Oct 2, 2024

Hi! When I do the discretisation of a problem in general for every location the discretisation is independent from the other locations one's. Sometimes it could be reasonable to have the same set of points for different location. For example in a parametric problem I would like to have the same set of parameters for the domain of the problem and for the boundary conditions. I tested some ways of getting this but I could not do it, I wonder if there is an efficient way of doing this, or if there is not, maybe it could a new feature to be inserted.

The only solution to this that i could find is setting the same seed before every discretization, but it is quite "heavy" to see:

torch.manual_seed(seed); opc.discretise_domain(n=50, mode=args.sampling, variables=['mu1', 'mu2'], locations=['D']) torch.manual_seed(seed); opc.discretise_domain(n=50, mode=args.sampling, variables=['mu1', 'mu2'], locations=['gamma1']) torch.manual_seed(seed); opc.discretise_domain(n=50, mode=args.sampling, variables=['mu1', 'mu2'], locations=['gamma2']) torch.manual_seed(seed); opc.discretise_domain(n=50, mode=args.sampling, variables=['mu1', 'mu2'], locations=['gamma3']) torch.manual_seed(seed); opc.discretise_domain(n=50, mode=args.sampling, variables=['mu1', 'mu2'], locations=['gamma4'])

Thank you for your attention!

@luAndre00 luAndre00 added the enhancement New feature or request label Oct 2, 2024
@dario-coscia
Copy link
Collaborator

Hi @luAndre00 ! Yes, I agree with you that sometimes it could be reasonable to have the same set of points for different locations, I think you can achieve this easily if your use mode='grid' or mode='chebyshev' in discretise_domain.

The situation is different for random points, and there isn't an easier way than the one you found. The problem is that we iterate over the locations to sample, and if we fix the seed before the for loop we will not obtain the same samples (see here)...

@dario-coscia
Copy link
Collaborator

@luAndre00 Can I close the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants