Repository navigation
constr_user: fixed DOFs and user constraints were not applied - #318
Open
mageaustralia wants to merge 1 commit into
Open
mageaustralia wants to merge 1 commit into
mageaustralia wants to merge 1 commit into
Conversation
constr_user should return the reduced basis R, one column per DOF left free by the node DOF flags and master-slave constraints, as CUFSM's constr_user.m does. - r_user_matrix started as np.eye(n_dof_m * len(m_a)), so identity columns beyond the assigned blocks restored the eliminated DOFs (and coupled the term blocks when there are several terms). R came back square and full rank, null_space(r_user.T) was empty, nu0 was 0, and strip solved the model with every DOF free. It now starts from zeros and is assembled block-diagonally, (4n * M) x (k * M). - The column selection started k at -1 and sliced [:, 0:k], dropping the last free DOF. It now keeps r_user_m_matrix[:, dof_reg == 1]. - Constraint node numbers were used as indices without int(); constraint arrays are float, so any user constraint raised IndexError. tests/test_constr_user.py covers the basis shape and free DOFs for one and two terms, block-diagonality, orthonormal columns, and a master-slave constraint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cfsm.constr_usershould return the reduced basisR(one column per DOF left free after the node DOF flags and the master-slave constraints), as CUFSM'sconstr_user.mdoes. Three things in the current version stop that:r_user_matrixstarts asnp.eye(n_dof_m * len(m_a))instead of zeros, so it keeps identity columns beyond the assigned blocks. They restore exactly the DOFs that were meant to be eliminated, and with several longitudinal terms they also couple the term blocks.kat -1 and then slices[:, 0:k], which drops the last free DOF.int(). Constraint arrays are float (asload_cufsm_matreturns them), so any user constraint raisesIndexError.Because of (1),
Rcomes back square and full rank.stripthen takesnull_space(r_user.T)as the constrained directions, finds none (nu0 = 0), and solves the model as if every DOF were free.Effect on results
On CUFSM's tutorial lipped channel (10 nodes, S-S, unit compression), compared with CUFSM:
IndexError(The reference values come from an independent port that is regression-tested against CUFSM
itself, run in Octave.)
Changes
solve/cfsm.py(constr_user):r_user_m_matrix[:, dof_reg == 1]);(4n * M) x (k * M)as inconstr_user.m;int.tests/test_constr_user.py: the basis shape and which DOFs it can move (one term and twoterms), block-diagonality, orthonormal columns, and a master-slave constraint.
Testing
IndexError)and pass with the fix.
by its unit tests, since end-to-end solves on master need PR 1 first.
A related observation, not changed here:
load_cufsm_matconverts constraints to 0-based onlywhen a row has more than 5 columns. A 5-column constraints block from a .mat file would keep
1-based node numbers. Happy to open a separate issue if useful.