-
Notifications
You must be signed in to change notification settings - Fork 133
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
PyDMD based DMD ROMs #2342
base: devel
Are you sure you want to change the base?
PyDMD based DMD ROMs #2342
Conversation
Job Test CentOS 8 on 7470d51 : invalidated by @alfoa |
2 similar comments
Job Test CentOS 8 on 7470d51 : invalidated by @alfoa |
Job Test CentOS 8 on 7470d51 : invalidated by @alfoa |
Job Test Ubuntu 18 PIP on 7470d51 : invalidated by @alfoa |
Job Mingw Test on 7470d51 : invalidated by @alfoa |
@wangcj05 @joshua-cogliati-inl @Jimmy-INL FY: if you can send feedbacks within tomorrow I can try to address them before leaving on Friday. Otherwise it will need to wait till September. |
I will leave today. So this MR will need to wait to September. |
Job Test Ubuntu 18 PIP on 7470d51 : invalidated by @Jimmy-INL |
Job Test CentOS 8 on 7470d51 : invalidated by @Jimmy-INL |
Job Test Ubuntu 18 PIP on 7470d51 : invalidated by @Jimmy-INL |
1 similar comment
Job Test Ubuntu 18 PIP on 7470d51 : invalidated by @Jimmy-INL |
Job Test CentOS 8 on 7470d51 : invalidated by @joshua-cogliati-inl Cleaned up files on test machine. |
Job Test Ubuntu 18 PIP on 7470d51 : invalidated by @joshua-cogliati-inl Cleaned up files on test machine. |
1 similar comment
Job Test Ubuntu 18 PIP on 7470d51 : invalidated by @joshua-cogliati-inl Cleaned up files on test machine. |
@wangcj05 @Jimmy-INL can anyone review this? I will fly back on Saturday and I would like to close this if possible. |
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.
@alfoa I have a couple of comments for you to consider.
self._dynamicHandling = True | ||
self.settings = None # initial settings for the ROM | ||
self.dmdParams = {} | ||
# parametric model | ||
self.model = None # ParametericDMD | ||
# local models | ||
## POD | ||
self._DRrom = None | ||
## RBF | ||
self._interpolator = None | ||
## base specific DMD estimator/model (Set by derived classes) | ||
self._dmdBase = None | ||
## DMD fit arguments (overloaded by derived classes (if needed)) | ||
self.fitArguments = {} | ||
# flag to indicate that the model has a single target (in addition to the pivot parameter) | ||
# This flag is needed because the DMD based model has an issue with single target (space dimension == 1) and | ||
# a counter mesurament (concatenation of snapshots) is required | ||
self.singleTarget = False | ||
# target indeces | ||
self.targetIndeces = None |
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.
please provide some comments for the self variables
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.
the comments are above the variables
self.model = None # ParametericDMD | ||
# local models | ||
## POD | ||
self._DRrom = None |
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.
camelBack here?
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.
changed name
# a counter mesurament (concatenation of snapshots) is required | ||
self.singleTarget = False | ||
# target indeces | ||
self.targetIndeces = None |
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.
Do you mean indices here?
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.
fixed
""" | ||
specs = super().getInputSpecification() | ||
specs.addSub(InputData.parameterInputFactory("light", contentType=InputTypes.BoolType, | ||
descr=r"""TWhether this instance should be light or not. A light instance uses |
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.
change TWhether to Whether?
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.
fixed
settings, notFound = paramInput.findNodesAndExtractValues(['pivotParameter','light', 'reductionRank', 'reductionMethod']) | ||
# notFound must be empty | ||
assert(not notFound) | ||
self.settings = {} |
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 variable is set to None in the init method, do you have specific reason for that? Should the default to dict?
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.
it is (line 50)
Created on July 21, 2024 | ||
|
||
@author: Andrea Alfonsi | ||
Kernalized Dynamic Mode Decomposition |
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.
typo, change 'Kernalized' to Kernelized
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.
done
#for target in set(self.target) - set(self.pivotID): | ||
# self._dmdBase[target] = EDMD |
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.
remove?
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.
done
np = importModuleLazy("numpy") | ||
pydmd = importModuleLazy("pydmd") | ||
ezyrb = importModuleLazy("ezyrb") |
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.
same here?
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.
removed
super().__init__() | ||
|
||
# local model | ||
self._dmdBase = None #{} # FbDMD |
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.
may not need it here?
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.
removed
# if 0.0 < float < 1.0, computed rank is the number of the biggest sv needed to reach the energy identified by this float value | ||
self.dmdParams['svd_rank'] = settings.get('svd_rank') | ||
# truncation rank for total least square | ||
self.dmdParams['tlsq_rank'] = settings.get('tlsq_rank') | ||
# True if the exact modes need to be computed (eigs and eigvs), otherwise the projected ones (using the left-singular matrix) | ||
self.dmdParams['exact' ] = settings.get('exact') | ||
# amplitudes computed minimizing the error between the mods and all the timesteps (True) or 1st timestep only (False) | ||
self.dmdParams['opt'] = settings.get('opt') | ||
# Rescale mode | ||
self.dmdParams['rescale_mode'] = settings.get('rescale_mode') | ||
if self.dmdParams["rescale_mode"] == 'None': | ||
self.dmdParams["rescale_mode"] = None | ||
# Sorted eigs | ||
self.dmdParams['sorted_eigs'] = settings.get('sorted_eigs') | ||
if self.dmdParams["sorted_eigs"] == 'False': | ||
self.dmdParams["sorted_eigs"] = False | ||
# Forward Backward method (see FbDMD) | ||
self.dmdParams['forward_backward'] = settings.get('forward_backward') | ||
# Sorted eigs | ||
self.dmdParams['d'] = settings.get('d') | ||
# Reconstruction method | ||
self.dmdParams['reconstruction_method'] = settings.get('reconstruction_method') | ||
# svd_rank_extra | ||
self.dmdParams['svd_rank_extra'] = settings.get('svd_rank_extra') | ||
|
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.
I think you can use a for loop here to update self.dmdParams here. This suggestion will apply to other classes as well.
@@ -90,6 +90,8 @@ Note all install methods after "main" take | |||
<!-- source="mamba" are the ones installed when mamba is installed --> | |||
<mamba source="mamba" skip_check='True'/> | |||
<serpentTools optional='True' source="pip"/> | |||
<pydmd source="pip"/> |
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.
are the license of these dependencies being checked out?
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.
yes. MIT license. Compatible with APACHE-2
@@ -2314,6 +2325,60 @@ \subsubsection{SyntheticHistory} | |||
Specifies the degree polynomial to fit the data with. | |||
\end{itemize} | |||
|
|||
\item \xmlNode{autoarma}: |
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 is not part of this PR right?
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.
no. it is generated by the automatic documentation script. It seems that that parameter has been added in the SyntheticHistory object but the manual never got updated.
@ In, paramInput, ParameterInput, the already parsed input. | ||
@ Out, None | ||
""" | ||
import pydmd |
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.
should this be move at the beginning of the file?
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 is done here so we can keep the "lazy import" on the top of the file (to avoid to import the library if an object depending on it is not used in the input file)....it should accelerate the initialization of the framework (for cases where the dmd is not used)
@ In, paramInput, ParameterInput, the already parsed input. | ||
@ Out, None | ||
""" | ||
import pydmd |
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.
same as above
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.
same as above
# amplitudes computed minimizing the error between the mods and all the timesteps (True) or 1st timestep only (False) | ||
self.dmdParams['opt'] = settings.get('opt') | ||
# seed | ||
import numpy as np |
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.
same as above
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.
same as above
# intialize the model | ||
self.initializeModel(settings) | ||
|
||
def _preFitModifications(self): |
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 method is not present in other classes, is there a reason for it?
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.
yes. This is only implemented for classes that require a direct access to the independent variable (i.e. time).
The method is needed only for few classes.
0.075,55.2114371811,0.000184038120394 | ||
0.1,23.7800706056,7.92669004928e-05 | ||
0.2,10.2422937507,3.41409785118e-05 | ||
0.3,4.41144952912,1.47048314807e-05 |
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.
gold file looks fairly different, any comment here?
# amplitudes computed minimizing the error between the mods and all the timesteps (True) or 1st timestep only (False) | ||
self.dmdParams['opt'] = settings.get('opt') | ||
# seed | ||
import numpy as np |
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.
same as above
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.
same as above
super().__init__() | ||
|
||
# local model | ||
self._dmdBase = None #{} # DMD |
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.
should it be an empty dict?
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.
removed
from ...utils import InputData, InputTypes | ||
#Internal Modules End-------------------------------------------------------------------------------- | ||
|
||
class DMD(DMDBase): |
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.
I am not sure what is the scope of this DMD class
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.
it is the base DMD. (original formulation of the DMD method)
Pull Request Description
What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)
Closes #2343
What are the significant changes in functionality due to this change request?
Addition of pydmd library for the importing of several DMD based algorithms
Created interface with RAVEN ROMs
And automatic documentation
And associated tests
For Change Control Board: Change Request Review
The following review must be completed by an authorized member of the Change Control Board.
<internalParallel>
to True.raven/tests/framework/user_guide
andraven/docs/workshop
) have been changed, the associated documentation must be reviewed and assured the text matches the example.