-
Notifications
You must be signed in to change notification settings - Fork 95
Adding pygeosx integrated test #3174
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
Open
cssherman
wants to merge
11
commits into
develop
Choose a base branch
from
feature/sherman/addPygeosTests
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
085663a
Resolving merge conflict
cssherman 3f901c9
Attempting to enable CI pygeosx tests
cssherman 6329751
Updating pygeosx ci instructions
cssherman 19f092c
Updating pygeosx ci instructions
cssherman 1520c72
Updating pygeosx ci instructions
cssherman 7bb7cf7
Updating pygeosx ci instructions
cssherman 447f085
Updating pygeosx ci instructions
cssherman b4bd24b
Updating pygeosx ci instructions
cssherman d2cb848
Limiting CI build of PYGEOSX
cssherman f394efb
Attempting to fix pygeosx ci config
cssherman 3585576
Attempting to fix pygeosx ci config
cssherman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?xml version="1.0" ?> | ||
|
||
<Problem> | ||
|
||
<Included> | ||
<File | ||
name="../solidMechanics/sedov_base.xml"/> | ||
</Included> | ||
|
||
<Mesh> | ||
<InternalMesh | ||
name="mesh1" | ||
elementTypes="{ C3D8 }" | ||
xCoords="{ 0, 10 }" | ||
yCoords="{ 0, 10 }" | ||
zCoords="{ 0, 10 }" | ||
nx="{ 10 }" | ||
ny="{ 10 }" | ||
nz="{ 10 }" | ||
cellBlockNames="{ cb1 }"/> | ||
</Mesh> | ||
|
||
<Solvers> | ||
<SolidMechanics_LagrangianFEM | ||
name="lagsolve" | ||
strainTheory="1" | ||
cflFactor="0.25" | ||
discretization="FE1" | ||
targetRegions="{ Region2 }" | ||
/> | ||
</Solvers> | ||
|
||
<Events | ||
maxTime="1.0e-3"> | ||
<!-- This event is applied every cycle, and overrides the | ||
solver time-step request --> | ||
<PeriodicEvent | ||
name="solverApplications" | ||
forceDt="1.0e-5" | ||
target="/Solvers/lagsolve"/> | ||
|
||
<PeriodicEvent | ||
name="timeHistoryCollection" | ||
target="/Tasks/velocityCollection"/> | ||
|
||
<PeriodicEvent | ||
name="timeHistoryOutput" | ||
timeFrequency="5.0e-4" | ||
targetExactTimestep="0" | ||
target="/Outputs/timeHistoryOutput"/> | ||
|
||
<PeriodicEvent | ||
name="restarts" | ||
timeFrequency="5.0e-4" | ||
targetExactTimestep="0" | ||
target="/Outputs/restartOutput"/> | ||
|
||
<PeriodicEvent | ||
name="python" | ||
cycleFrequency="5" | ||
target="/Outputs/pythonOutput"/> | ||
</Events> | ||
|
||
</Problem> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Integrated Test Docs Begin Parameters | ||
import geos_ats | ||
from geos_ats.test_builder import generate_geos_tests, RestartcheckParameters, TestDeck, CurveCheckParameters | ||
|
||
restartcheck_params = {} | ||
restartcheck_params["atol"] = 2.0E-10 | ||
restartcheck_params["rtol"] = 2.0E-13 | ||
|
||
curvecheck_params = {} | ||
curvecheck_params['filename'] = 'veloc_history.hdf5' | ||
curvecheck_params['tolerance'] = 1e-10 | ||
curvecheck_params['time_units'] = 'milliseconds' | ||
curvecheck_params['curves'] = [['velocity', 'source']] | ||
# Integrated Test Docs End Parameters | ||
|
||
# Integrated Test Docs Begin Test Loop | ||
partitions = ((1, 1, 1), (2, 2, 2), (3, 3, 3)) | ||
|
||
decks = [ | ||
TestDeck( | ||
name="modified_sedov", | ||
pygeos_script="run_sedov_problem.py", | ||
description="Sedov problem with initial conditions modified using pygeos", | ||
partitions=partitions, | ||
restart_step=50, | ||
check_step=100, | ||
restartcheck_params=RestartcheckParameters(**restartcheck_params), | ||
curvecheck_params=CurveCheckParameters(**curvecheck_params)) | ||
] | ||
|
||
generate_geos_tests(decks) | ||
# Integrated Test Docs End Test Loop |
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,80 @@ | ||||||
|
||||||
import numpy as np | ||||||
from mpi4py import MPI | ||||||
import pygeosx | ||||||
from pygeosx_tools import wrapper | ||||||
from geosx_xml_tools.main import preprocess_parallel | ||||||
|
||||||
|
||||||
# PYGEOSX_STRESS_FN | ||||||
def stress_fn(x): | ||||||
""" | ||||||
Function to set stress values | ||||||
|
||||||
Args: | ||||||
x (np.ndarray) the element centers | ||||||
|
||||||
Returns: | ||||||
np.ndarray: stress values | ||||||
""" | ||||||
R = x[:, 0]**2 + x[:, 1]**2 + x[:, 2]**2 | ||||||
return np.sin(2.0 * np.pi * R / np.amax(R)) | ||||||
# PYGEOSX_STRESS_FN_END | ||||||
|
||||||
|
||||||
def run_problem(): | ||||||
""" | ||||||
Run the GEOSX problem | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
""" | ||||||
# PYGEOSX_INITIALIZATION | ||||||
# Get the MPI rank | ||||||
comm = MPI.COMM_WORLD | ||||||
rank = comm.Get_rank() | ||||||
|
||||||
# Initialize the code and set initial conditions | ||||||
problem = pygeosx.initialize(rank, args) | ||||||
pygeosx.apply_initial_conditions() | ||||||
|
||||||
# Rather than specifying the wrapper paths explicitly, | ||||||
# search for them using a set of filters | ||||||
location_key = wrapper.get_matching_wrapper_path(problem, ['Level0', 'Region2', 'elementCenter']) | ||||||
stress_key = wrapper.get_matching_wrapper_path(problem, ['Level0', 'Region2', 'shale', 'stress']) | ||||||
ghost_key = wrapper.get_matching_wrapper_path(problem, ['Level0', 'Region2', 'cb1', 'ghostRank']) | ||||||
# PYGEOSX_INITIALIZATION_END | ||||||
|
||||||
# PYGEOSX_STRESS_IC | ||||||
# Print initial stress | ||||||
wrapper.print_global_value_range(problem, stress_key, 'stress') | ||||||
|
||||||
# Zero out stress | ||||||
wrapper.set_wrapper_to_value(problem, stress_key, 0.0) | ||||||
wrapper.print_global_value_range(problem, stress_key, 'stress') | ||||||
|
||||||
# Set stress via a function | ||||||
wrapper.set_wrapper_with_function(problem, stress_key, location_key, stress_fn, target_index=0) | ||||||
wrapper.set_wrapper_with_function(problem, stress_key, location_key, stress_fn, target_index=1) | ||||||
wrapper.set_wrapper_with_function(problem, stress_key, location_key, stress_fn, target_index=2) | ||||||
wrapper.print_global_value_range(problem, stress_key, 'stress') | ||||||
# PYGEOSX_STRESS_IC_END | ||||||
|
||||||
# PYGEOSX_MAIN_LOOP | ||||||
# Run the code | ||||||
while pygeosx.run() != pygeosx.COMPLETED: | ||||||
wrapper.print_global_value_range(problem, stress_key, 'stress') | ||||||
|
||||||
# Gather/allgather tests | ||||||
tmp = wrapper.gather_wrapper(problem, stress_key) | ||||||
print(wrapper.rank, 'gather', np.shape(tmp), flush=True) | ||||||
|
||||||
tmp = wrapper.allgather_wrapper(problem, stress_key) | ||||||
print(wrapper.rank, 'allgather', np.shape(tmp), flush=True) | ||||||
|
||||||
tmp = wrapper.allgather_wrapper(problem, stress_key, ghost_key=ghost_key) | ||||||
print(wrapper.rank, 'allgather_ghost_filtered', np.shape(tmp), flush=True) | ||||||
# PYGEOSX_MAIN_LOOP_END | ||||||
|
||||||
|
||||||
if __name__ == '__main__': | ||||||
run_problem() | ||||||
|
||||||
|
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
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
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
Oops, something went wrong.
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.
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 need this? It does not seem to be used.
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, I missed cleaning up the import list when I removed the pre-processor from this example