Closed maceligueta closed 5 years ago
I though that multiphysics problems had one parameters file for each problem, or just one which clearly separation between problems
Clone in the main analysis may be a solution, but as you said, is kind of weird
I think @maceligueta means multi-stage analysis (not multi-physics).
Exactly, @rubenzorrilla . One run where I call StructuralAnalysis several times, with the same Parameters.
The specific problem is a reduced order model analysis where you have to "train" a geometry of interest while varying the applied load and/or the restrictions. To do this we set up many different simulations and we run them in chunks on different CPUs and then we use the results. Each of these simulations receives a set of parameters and we were getting an error that the solver_type was missing. After digging a bit we found this solver_settings.RemoveValue in the python_solvers_wrapper_structural.py and in the structural_mechanics_solver.py there is another one:
if custom_settings.Has("solver_type"): custom_settings.RemoveValue("solver_type") warning = '\n::[MechanicalSolver]:: W-A-R-N-I-N-G: You have specified "solver_type", ' warning += 'which is only needed if you use the "python_solvers_wrapper_structural". \nPlease remove it ' warning += 'from the "solver settings" if you dont use this wrapper, this check will be removed soon!\n' KratosMultiphysics.Logger.PrintWarning("Solver type", warning)
In order to be the less intrusive possible I would clone the Parameters at the beginning
Since I am the one to blame here, let me try to answer (I also discussed this with @RiccardoRossi some time ago):
I will revert this again, PR coming up
Since I am the one to blame here, let me try to answer (I also discussed this with @RiccardoRossi some time ago):
* My reasoning for initially removing those values was that they are no longer needed afterwards (in the solver) and I wanted to keep things clean * However this leads to problems that I did not foresee at the time (e.g as described in this PR) * Generally, we should **NOT** remove or clone parameters (This I discussed with riccardo (@RiccardoRossi please correct me if I am wrong)), besides possible errors we also want to be able to print the entire set of settings AFTER the validation was done. This way the user will get all settings
I will revert this again, PR coming up
I that case I would need to apply the same changes, as I followed what was done at the time in the StructuralMechanicsApplication
Just a philosophical question about whether it is correct to apply RemoveValue to the Parameters that are provided to an AnalysisStage. Like it is done here: https://github.com/KratosMultiphysics/Kratos/blob/448dac3784ed96095300694f572cc437fad19ead/applications/StructuralMechanicsApplication/python_scripts/python_solvers_wrapper_structural.py#L70 We came accross this question when we were launching multiple Stages with the same parameters, and all of a sudden some fields were missing beacause they were being removed automatically. We could bypass the problem by keeping a copy of the original Parameters, but we found it weird. I thought it was worth mentioning it. How do you run multiple Analyses in the same run at @KratosMultiphysics/structural-mechanics team? Do you keep a copy as we did? @philbucher @lgratiela @RiccardoRossi @loumalouomega