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

Fixing initial state values in MPhys #321

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5a36918
Adding info print control when setting the aeroproblem for ADflow and…
lamkina Aug 19, 2023
177c020
Reverting import ordering
lamkina Aug 19, 2023
4fff8c6
Adding surface coordinate fix
lamkina Aug 22, 2023
c580310
Turning on printing in the ADflow solver comp
lamkina Aug 24, 2023
8b68ffc
Merge branch 'main' of github.com:mdolab/adflow into mphys_fix
lamkina Aug 24, 2023
1130ab8
Updated the logic to only print when the aeroproblem actually changes
lamkina Aug 24, 2023
6a17ec4
Updated the logic to only print when the aeroproblem actually changes
lamkina Aug 24, 2023
aff3806
Merge branch 'main' into mphys_fix
lamkina Aug 24, 2023
35962fb
Merge branch 'main' into mphys_fix_2
A-CGray Aug 24, 2023
146eaa9
Merge branch 'main' into mphys_fix
A-CGray Sep 6, 2023
2c4405a
Merge branch 'main' into mphys_fix_2
A-CGray Sep 6, 2023
fed1c61
Merge branch 'main' into mphys_fix_2
A-CGray Sep 11, 2023
63773ca
Merge branch 'main' into mphys_fix
A-CGray Sep 12, 2023
2b74de3
Adding info print control when setting the aeroproblem for ADflow and…
lamkina Aug 19, 2023
22d9783
Reverting import ordering
lamkina Aug 19, 2023
574b184
Adding surface coordinate fix
lamkina Aug 22, 2023
bcce60b
Updated the logic to only print when the aeroproblem actually changes
lamkina Aug 24, 2023
767105f
Merge branch 'mphys_fix_2' of github.com:lamkina/adflow into mphys_fix_2
lamkina Sep 14, 2023
3e750a7
Revert "Updated the logic to only print when the aeroproblem actually…
lamkina Sep 14, 2023
432c7b6
Revert "Adding info print control when setting the aeroproblem for AD…
lamkina Sep 14, 2023
736a62c
Merge branch 'main' of github.com:mdolab/adflow into mphys_fix
lamkina Sep 14, 2023
b529803
Switched from passing arguments to using options and module variables
lamkina Sep 14, 2023
169e69a
Forgot to run black
lamkina Sep 14, 2023
76eae9b
Added extra flag for printing info in setAeroProblem
lamkina Sep 14, 2023
c1ff161
Removed hacky fix for setting initial states in ADflow
lamkina Sep 22, 2023
3f73f1c
Merge branch 'main' of github.com:mdolab/adflow into mphys_fix
lamkina Sep 22, 2023
b8f11da
Re-ran fprettify
lamkina Sep 22, 2023
6edb1db
Removed unnecessary print logic
lamkina Sep 22, 2023
7322d05
Merge branch 'mphys_fix_2' of github.com:lamkina/adflow into mphys_in…
lamkina Sep 22, 2023
483865b
Fixed updatebcdataalllevels calls
lamkina Sep 22, 2023
cbb68d3
Free stream states are working using _set_vectors()
lamkina Sep 22, 2023
d26c838
Need to turn printing back on after setting the AP
lamkina Sep 22, 2023
530ad9e
Merge branch 'mphys_fix' of github.com:lamkina/adflow into mphys_init…
lamkina Sep 22, 2023
267b7b7
Ran black again
lamkina Sep 22, 2023
ed0c6fd
Removing typo
lamkina Sep 26, 2023
947282e
Merge branch 'main' into mphys_init_guess_fix
lamkina Sep 26, 2023
e0b0d5a
Merge branch 'main' into mphys_init_guess_fix
A-CGray Sep 28, 2023
261172d
Merge branch 'main' of github.com:mdolab/adflow into mphys_init_guess…
lamkina Oct 24, 2023
b45bab5
Merge branch 'main' of github.com:mdolab/adflow into mphys_init_guess…
lamkina Nov 4, 2023
4d5ecf6
Merge branch 'main' of github.com:mdolab/adflow into mphys_init_guess…
lamkina Nov 10, 2023
d26295d
Cleaning up missed output printing
lamkina Nov 10, 2023
78b8cc0
Merge branch 'main' into mphys_init_guess_fix
A-CGray Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions adflow/mphys/mphys_adflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,23 @@
def _set_states(self, outputs):
self.solver.setStates(outputs["adflow_states"])

def _setup_vectors(self, root_vectors):
super()._setup_vectors(root_vectors)

Check warning on line 443 in adflow/mphys/mphys_adflow.py

View check run for this annotation

Codecov / codecov/patch

adflow/mphys/mphys_adflow.py#L442-L443

Added lines #L442 - L443 were not covered by tests

# Turn off extra printouts
self.solver.setOption("printIterations", False)
self.solver.adflow.inputiteration.printbcwarnings = False

Check warning on line 447 in adflow/mphys/mphys_adflow.py

View check run for this annotation

Codecov / codecov/patch

adflow/mphys/mphys_adflow.py#L446-L447

Added lines #L446 - L447 were not covered by tests

# Set the AP
self.solver.setAeroProblem(self.ap)

Check warning on line 450 in adflow/mphys/mphys_adflow.py

View check run for this annotation

Codecov / codecov/patch

adflow/mphys/mphys_adflow.py#L450

Added line #L450 was not covered by tests

# Turn printing back on
self.solver.setOption("printIterations", True)
self.solver.adflow.inputiteration.printbcwarnings = True

Check warning on line 454 in adflow/mphys/mphys_adflow.py

View check run for this annotation

Codecov / codecov/patch

adflow/mphys/mphys_adflow.py#L453-L454

Added lines #L453 - L454 were not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that this was retained after merging (same for above). I think you probably want to restore the previous state as done in PR #307. See here for original comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I'm not sure how I did this, but nonetheless I'll get it fixed.


# Set the OM states to be equal to the free stream
self.set_val("adflow_states", self.solver.getStates())

Check warning on line 457 in adflow/mphys/mphys_adflow.py

View check run for this annotation

Codecov / codecov/patch

adflow/mphys/mphys_adflow.py#L457

Added line #L457 was not covered by tests

def apply_nonlinear(self, inputs, outputs, residuals):
solver = self.solver
ap = self.ap
Expand All @@ -450,6 +467,7 @@
def solve_nonlinear(self, inputs, outputs):
solver = self.solver
ap = self.ap

if self._do_solve:
setAeroProblem(solver, ap, self.ap_vars, inputs=inputs, outputs=outputs, print_dict=False)
ap.solveFailed = False # might need to clear this out?
Expand Down
6 changes: 6 additions & 0 deletions adflow/pyADflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ def __init__(self, comm=None, options=None, debug=False, dtype="d"):
curDir = os.path.basename(os.path.dirname(os.path.realpath(__file__)))
self.adflow = MExt.MExt("libadflow", curDir, debug=debug)._module

# This is a flag not exposed to the user as an option that controls
# printing the boundary condition warnings. This should only
# be used in the MPhys layer when we make multiple calls to
# updateBCAllLevels.
self.adflow.inputiteration.printbcwarnings = True

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this should not be here, like in PR #307. See here for original comment.

libLoadTime = time.time()

# Information for base class:
Expand Down