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

TDycore polymorphism, part 2: changing the DM lifecycle #214

Merged
merged 23 commits into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f2667fb
Simplifying some things. Not getting rid of TDySetDM after all.
jeff-cohere Sep 30, 2021
7dd3814
Interim commit -- in the middle of wrapping TDyDefineDefaultDM.
jeff-cohere Oct 14, 2021
fe47ecc
Got rid of TDySetDM in favor of TDySetDMConstructor.
jeff-cohere Oct 14, 2021
cfa5fa2
Changed TDySetDiscretizationMethod -> TDySetDiscretization.
jeff-cohere Oct 14, 2021
dff8509
Missed a few spots for TDySetDiscretization rename.
jeff-cohere Oct 14, 2021
755633a
Made way for polymorphic setup function.
jeff-cohere Oct 14, 2021
c59b60d
Renaming "method" to "discretization" for clarity.
jeff-cohere Oct 15, 2021
09f3706
Factored out setup functions.
jeff-cohere Oct 15, 2021
7d50c90
Forgot to add a couple of files.
jeff-cohere Oct 15, 2021
5db4d16
Managed to get the steady demo working without TDySetDM.
jeff-cohere Oct 15, 2021
faba44d
Adjustments to comments.
jeff-cohere Oct 15, 2021
bad0066
Changed -tdy_disc -> -tdy_discretization
jeff-cohere Oct 15, 2021
15c22de
Worked through the transient demo (and fixed a few bugs).
jeff-cohere Oct 15, 2021
f743f30
Worked through transient Fortran demo and fixed up some issues with D…
jeff-cohere Oct 15, 2021
2feb082
Converted transient SNES demo.
jeff-cohere Oct 15, 2021
bb5ef46
Removed TPF.
jeff-cohere Oct 15, 2021
904d872
Fixing minor glitches and cleaning things up.
jeff-cohere Oct 16, 2021
2791c3d
Fixed a bug caused by removing TPF discretization.
jeff-cohere Oct 18, 2021
7a6e9fe
Updated richards and th drivers.
jeff-cohere Oct 18, 2021
18bd8be
Fixed a couple of bugs in TH and Richards demos.
jeff-cohere Oct 18, 2021
fcca22b
Using a proper communicator in TDyDriver.
jeff-cohere Oct 18, 2021
7413c42
Discovered some differences in the way TDyDriver sets things up.
jeff-cohere Oct 18, 2021
8ccbf05
Fixed a spelling error in the timer report.
jeff-cohere Oct 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions demo/richards/richards.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ standard_parallel=
pressure = 1.0e-12 relative

[richards-driver-snes-prob1]
input_arguments=-tdy_generate_mesh -dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 2,2,2 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 2 -tdy_regression_test_filename richards-driver-snes-prob1 -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_timers -tdy_init_file richards_driver_snes_prob1_3x3x3_random.vec -tdy_time_integration_method SNES
input_arguments=-dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 2,2,2 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 2 -tdy_regression_test_filename richards-driver-snes-prob1 -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_timers -tdy_init_file richards_driver_snes_prob1_3x3x3_random.vec -tdy_time_integration_method SNES

[richards-driver-ts-prob1]
input_arguments=-tdy_generate_mesh -dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 3,3,3 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 2 -tdy_regression_test_filename richards-driver-ts-prob1 -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_init_with_random_field -tdy_time_integration_method TS
input_arguments=-dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 3,3,3 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 2 -tdy_regression_test_filename richards-driver-ts-prob1 -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_init_with_random_field -tdy_time_integration_method TS

[richards-driver-snes-prob1-np4]
np=4
input_arguments=-tdy_generate_mesh -dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 2,2,2 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 1 -tdy_regression_test_filename richards-driver-snes-prob1-np4 -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_init_with_random_field -tdy_time_integration_method SNES
input_arguments=-dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 2,2,2 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 1 -tdy_regression_test_filename richards-driver-snes-prob1-np4 -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_init_with_random_field -tdy_time_integration_method SNES

[richards-driver-ts-prob1-np4]
np=4
timeout=300.
input_arguments=-tdy_generate_mesh -dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 3,3,3 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 1 -tdy_regression_test_filename richards-driver-ts-prob1-np4 -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_timers -tdy_init_with_random_field -tdy_time_integration_method TS
input_arguments=-dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 3,3,3 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 1 -tdy_regression_test_filename richards-driver-ts-prob1-np4 -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_timers -tdy_init_with_random_field -tdy_time_integration_method TS

[richards-driver-snes-initial-cond-isotropic-k]
input_arguments=-tdy_generate_mesh -dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 5,4,3 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 1 -tdy_regression_test_filename richards-driver-snes-initial-cond-isotropic-k -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_time_integration_method SNES -init_permeability_file initial.h5 -ic_file initial.h5
input_arguments=-dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 5,4,3 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 1 -tdy_regression_test_filename richards-driver-snes-initial-cond-isotropic-k -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_time_integration_method SNES -init_permeability_file initial.h5 -ic_file initial.h5

[richards-driver-snes-initial-cond-anisotropic-k]
input_arguments=-tdy_generate_mesh -dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 5,4,3 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 1 -tdy_regression_test_filename richards-driver-snes-initial-cond-anisotropic-k -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_time_integration_method SNES -init_porosity_file initial.h5 -init_permeability_file initial.h5 -anisotropic_perm -ic_file initial.h5 -ic_dataset fields/IC
input_arguments=-dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 5,4,3 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 1 -tdy_regression_test_filename richards-driver-snes-initial-cond-anisotropic-k -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_time_integration_method SNES -init_porosity_file initial.h5 -init_permeability_file initial.h5 -anisotropic_perm -ic_file initial.h5 -ic_dataset fields/IC

[richards-driver-64xy-3z-wedge]
input_arguments=-problem 4 -dm_plex_simplex 0 -tdy_regression_test -tdy_regression_test_num_cells_per_process 2 -tdy_regression_test_filename richards-driver-64xy-3z-wedge -dm_plex_filename ../../share/meshes/64xy_3z_wedge.exo
Expand All @@ -48,7 +48,7 @@ input_arguments=-snes_linesearch_basic -ts_dt 100 -ts_type beuler -ts_max_time 1
input_arguments=-snes_linesearch_type basic -ts_dt 100 -ts_type bdf -ts_adapt_type none -ts_max_time 1000 -ts_max_steps 10 -tdy_regression_test -tdy_regression_test_num_cells_per_process 2 -tdy_regression_test_filename richards-driver-transientvar -tdy_method MPFA_O_TRANSIENTVAR -pc_type lu

[richards-driver-snes-checkpoint-write]
input_arguments=-tdy_generate_mesh -dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 2,2,2 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 2 -tdy_regression_test_filename richards-driver-snes-checkpoint-write -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_timers -tdy_init_file richards_driver_snes_prob1_3x3x3_random.vec -tdy_time_integration_method SNES -enable_checkpoint
input_arguments=-dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 2,2,2 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 2 -tdy_regression_test_filename richards-driver-snes-checkpoint-write -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_timers -tdy_init_file richards_driver_snes_prob1_3x3x3_random.vec -tdy_time_integration_method SNES -enable_checkpoint

[richards-driver-snes-checkpoint-read]
input_arguments=-tdy_generate_mesh -dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 2,2,2 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 2 -tdy_regression_test_filename richards-driver-snes-checkpoint-read -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_timers -tdy_init_file richards_driver_snes_prob1_3x3x3_random.vec -tdy_time_integration_method SNES -ic_file 3.15360e+03_chk.h5 -ic_dataset fields/IC
input_arguments=-dm_plex_simplex 0 -dm_plex_dim 3 -dm_plex_box_faces 2,2,2 -dm_plex_box_lower 0,0,0 -dm_plex_box_upper 1,1,1 -tdy_water_density exponential -tdy_regression_test -tdy_regression_test_num_cells_per_process 2 -tdy_regression_test_filename richards-driver-snes-checkpoint-read -tdy_final_time 3.1536e3 -tdy_dt_max 600. -tdy_dt_growth_factor 1.5 -tdy_timers -tdy_init_file richards_driver_snes_prob1_3x3x3_random.vec -tdy_time_integration_method SNES -ic_file 3.15360e+03_chk.h5 -ic_dataset fields/IC
19 changes: 10 additions & 9 deletions demo/richards/richards_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ int main(int argc, char **argv) {
TDyIOFormat format = HDF5Format;

ierr = TDyInit(argc, argv); CHKERRQ(ierr);
ierr = TDyCreate(&tdy); CHKERRQ(ierr);
MPI_Comm comm = PETSC_COMM_WORLD;
ierr = TDyCreate(comm, &tdy); CHKERRQ(ierr);
ierr = TDySetMode(tdy,RICHARDS); CHKERRQ(ierr);
ierr = TDySetDiscretizationMethod(tdy,MPFA_O); CHKERRQ(ierr);
ierr = TDySetDiscretization(tdy,MPFA_O); CHKERRQ(ierr);

ierr = MPI_Comm_rank(PETSC_COMM_WORLD,&rank); CHKERRQ(ierr);
ierr = MPI_Comm_size(PETSC_COMM_WORLD,&size); CHKERRQ(ierr);
PetscPrintf(PETSC_COMM_WORLD,"Beginning Richards Driver simulation.\n");
ierr = PetscOptionsBegin(PETSC_COMM_WORLD,NULL,"Sample Options","");
ierr = MPI_Comm_rank(comm,&rank); CHKERRQ(ierr);
ierr = MPI_Comm_size(comm,&size); CHKERRQ(ierr);
PetscPrintf(comm,"Beginning Richards Driver simulation.\n");
ierr = PetscOptionsBegin(comm,NULL,"Sample Options","");
CHKERRQ(ierr);
ierr = PetscOptionsInt("-successful_exit_code",
"Code passed on successful completion","",
Expand All @@ -33,7 +34,7 @@ int main(int argc, char **argv) {
if (!rank) {
ierr = TDyIOSetIOProcess(tdy->io, PETSC_TRUE); CHKERRQ(ierr);
}
PetscPrintf(PETSC_COMM_WORLD,"--\n");
PetscPrintf(comm,"--\n");
if (size == 1) {
ierr = TDyIOSetMode(tdy,format);CHKERRQ(ierr);
ierr = TDyIOWriteVec(tdy); CHKERRQ(ierr);
Expand All @@ -44,8 +45,8 @@ int main(int argc, char **argv) {
ierr = TDyOutputRegression(tdy,tdy->solution); CHKERRQ(ierr);
ierr = TDyDestroy(&tdy); CHKERRQ(ierr);

PetscPrintf(PETSC_COMM_WORLD,"--\n");
PetscPrintf(PETSC_COMM_WORLD,"Simulation complete.\n");
PetscPrintf(comm,"--\n");
PetscPrintf(comm,"Simulation complete.\n");
ierr = TDyFinalize(); CHKERRQ(ierr);
return(successful_exit_code);
}
Loading