Skip to content

Commit

Permalink
Merge pull request #214 from TDycores-Project/jeff-cohere/dm_setup
Browse files Browse the repository at this point in the history
TDycore polymorphism, part 2: changing the DM lifecycle
  • Loading branch information
jeff-cohere authored Oct 25, 2021
2 parents 836f01b + 8ccbf05 commit b97463a
Show file tree
Hide file tree
Showing 30 changed files with 874 additions and 841 deletions.
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

0 comments on commit b97463a

Please sign in to comment.