Lines Matching refs:app_ctx
20 PetscErrorCode ProcessCommandLineOptions(MPI_Comm comm, AppCtx app_ctx) { in ProcessCommandLineOptions() argument
27 …PetscOptionsString("-ceed", "CEED resource specifier", NULL, app_ctx->ceed_resource, app_ctx->ceed… in ProcessCommandLineOptions()
28 sizeof(app_ctx->ceed_resource), &ceed_flag)); in ProcessCommandLineOptions()
30 PetscCall(PetscStrncpy(app_ctx->output_dir, ".", 2)); // Default - current directory in ProcessCommandLineOptions()
31 …String("-output_dir", "Output directory", NULL, app_ctx->output_dir, app_ctx->output_dir, sizeof(a… in ProcessCommandLineOptions()
33 app_ctx->degree = 3; in ProcessCommandLineOptions()
34 …t("-degree", "Polynomial degree of tensor product basis", NULL, app_ctx->degree, &app_ctx->degree,… in ProcessCommandLineOptions()
36 app_ctx->q_extra = 0; in ProcessCommandLineOptions()
37 …ionsInt("-q_extra", "Number of extra quadrature points", NULL, app_ctx->q_extra, &app_ctx->q_extra… in ProcessCommandLineOptions()
39 …ionsString("-mesh", "Read mesh from file", NULL, app_ctx->mesh_file, app_ctx->mesh_file, sizeof(ap… in ProcessCommandLineOptions()
41 app_ctx->problem_choice = ELAS_LINEAR; // Default - Linear Elasticity in ProcessCommandLineOptions()
42 …ves Elasticity & Hyperelasticity Problems", NULL, problemTypes, (PetscEnum)app_ctx->problem_choice, in ProcessCommandLineOptions()
43 (PetscEnum *)&app_ctx->problem_choice, NULL)); in ProcessCommandLineOptions()
44 app_ctx->name = problemTypes[app_ctx->problem_choice]; in ProcessCommandLineOptions()
45 app_ctx->name_for_disp = problemTypesForDisp[app_ctx->problem_choice]; in ProcessCommandLineOptions()
47 app_ctx->num_increments = app_ctx->problem_choice == ELAS_LINEAR ? 1 : 10; in ProcessCommandLineOptions()
48 …tionsInt("-num_steps", "Number of pseudo-time steps", NULL, app_ctx->num_increments, &app_ctx->num… in ProcessCommandLineOptions()
50 app_ctx->forcing_choice = FORCE_NONE; // Default - no forcing term in ProcessCommandLineOptions()
51 …"-forcing", "Set forcing function option", NULL, forcing_types, (PetscEnum)app_ctx->forcing_choice, in ProcessCommandLineOptions()
52 (PetscEnum *)&app_ctx->forcing_choice, NULL)); in ProcessCommandLineOptions()
55 app_ctx->forcing_vector[0] = 0; in ProcessCommandLineOptions()
56 app_ctx->forcing_vector[1] = -1; in ProcessCommandLineOptions()
57 app_ctx->forcing_vector[2] = 0; in ProcessCommandLineOptions()
58 …nsScalarArray("-forcing_vec", "Direction to apply constant force", NULL, app_ctx->forcing_vector, … in ProcessCommandLineOptions()
60 …if ((app_ctx->problem_choice == ELAS_FS_NH || app_ctx->problem_choice == ELAS_FS_MR) && app_ctx->f… in ProcessCommandLineOptions()
67 app_ctx->bc_clamp_count = 16; in ProcessCommandLineOptions()
68 …clamp", "Face IDs to apply incremental Dirichlet BC", NULL, app_ctx->bc_clamp_faces, &app_ctx->bc_… in ProcessCommandLineOptions()
71 for (PetscInt i = 0; i < app_ctx->bc_clamp_count; i++) { in ProcessCommandLineOptions()
74 …const size_t nclamp_params = sizeof(app_ctx->bc_clamp_max[0]) / sizeof(app_ctx->bc_clamp_max[0][0]… in ProcessCommandLineOptions()
75 for (PetscInt j = 0; j < nclamp_params; j++) app_ctx->bc_clamp_max[i][j] = 0.; in ProcessCommandLineOptions()
77 …snprintf(option_name, sizeof option_name, "-bc_clamp_%" PetscInt_FMT "_translate", app_ctx->bc_cla… in ProcessCommandLineOptions()
79 …ionsScalarArray(option_name, "Vector to translate clamped end by", NULL, app_ctx->bc_clamp_max[i],… in ProcessCommandLineOptions()
83 …snprintf(option_name, sizeof option_name, "-bc_clamp_%" PetscInt_FMT "_rotate", app_ctx->bc_clamp_… in ProcessCommandLineOptions()
84 …on_name, "Vector with axis of rotation and rotation, in radians", NULL, &app_ctx->bc_clamp_max[i][… in ProcessCommandLineOptions()
88 …PetscScalar norm = sqrt(app_ctx->bc_clamp_max[i][3] * app_ctx->bc_clamp_max[i][3] + app_ctx->bc_cl… in ProcessCommandLineOptions()
89 app_ctx->bc_clamp_max[i][5] * app_ctx->bc_clamp_max[i][5]); in ProcessCommandLineOptions()
91 for (PetscInt j = 0; j < 3; j++) app_ctx->bc_clamp_max[i][3 + j] /= norm; in ProcessCommandLineOptions()
95 app_ctx->bc_traction_count = 16; in ProcessCommandLineOptions()
96 …ntArray("-bc_traction", "Face IDs to apply traction (Neumann) BC", NULL, app_ctx->bc_traction_face… in ProcessCommandLineOptions()
97 &app_ctx->bc_traction_count, NULL)); in ProcessCommandLineOptions()
99 for (PetscInt i = 0; i < app_ctx->bc_traction_count; i++) { in ProcessCommandLineOptions()
102 for (PetscInt j = 0; j < 3; j++) app_ctx->bc_traction_vector[i][j] = 0.; in ProcessCommandLineOptions()
104 …snprintf(option_name, sizeof option_name, "-bc_traction_%" PetscInt_FMT, app_ctx->bc_traction_face… in ProcessCommandLineOptions()
107 …nsScalarArray(option_name, "Traction vector for constrained face", NULL, app_ctx->bc_traction_vect… in ProcessCommandLineOptions()
112 app_ctx->multigrid_choice = MULTIGRID_LOGARITHMIC; in ProcessCommandLineOptions()
113 …ltigrid", "Set multigrid type option", NULL, multigrid_types, (PetscEnum)app_ctx->multigrid_choice, in ProcessCommandLineOptions()
114 (PetscEnum *)&app_ctx->multigrid_choice, NULL)); in ProcessCommandLineOptions()
116 app_ctx->test_mode = PETSC_FALSE; in ProcessCommandLineOptions()
117 …", "Testing mode (do not print unless error is large)", NULL, app_ctx->test_mode, &(app_ctx->test_… in ProcessCommandLineOptions()
119 app_ctx->expect_final_strain = -1.; in ProcessCommandLineOptions()
120 …strain_energy", "Expect final strain energy close to this value.", NULL, app_ctx->expect_final_str… in ProcessCommandLineOptions()
121 &app_ctx->expect_final_strain, NULL)); in ProcessCommandLineOptions()
123 app_ctx->test_tol = 1e-8; in ProcessCommandLineOptions()
124 …pect_final_state_rtol", "Relative tolerance for final strain energy test", NULL, app_ctx->test_tol, in ProcessCommandLineOptions()
125 &app_ctx->test_tol, NULL)); in ProcessCommandLineOptions()
127 app_ctx->view_soln = PETSC_FALSE; in ProcessCommandLineOptions()
128 …("-view_soln", "Write out solution vector for viewing", NULL, app_ctx->view_soln, &(app_ctx->view_… in ProcessCommandLineOptions()
130 app_ctx->view_final_soln = PETSC_FALSE; in ProcessCommandLineOptions()
131 …("-view_final_soln", "Write out final solution vector for viewing", NULL, app_ctx->view_final_soln, in ProcessCommandLineOptions()
132 &(app_ctx->view_final_soln), NULL)); in ProcessCommandLineOptions()
139 PetscCall(PetscViewerASCIIOpen(comm, energy_viewer_filename, &app_ctx->energy_viewer)); in ProcessCommandLineOptions()
140 PetscCall(PetscViewerASCIIPrintf(app_ctx->energy_viewer, "increment,energy\n")); in ProcessCommandLineOptions()
143 PetscCall(PetscViewerASCIIPrintf(app_ctx->energy_viewer, "%f,%e\n", 0., 0.)); in ProcessCommandLineOptions()
148 if (app_ctx->test_mode) { in ProcessCommandLineOptions()
149 …if (app_ctx->forcing_choice == FORCE_NONE && !app_ctx->bc_clamp_count) app_ctx->forcing_choice = F… in ProcessCommandLineOptions()
151 if (!app_ctx->bc_clamp_count && app_ctx->forcing_choice != FORCE_MMS) { in ProcessCommandLineOptions()
158 strncpy(app_ctx->ceed_resource, ceed_resource, 10); in ProcessCommandLineOptions()
162 switch (app_ctx->multigrid_choice) { in ProcessCommandLineOptions()
164 app_ctx->num_levels = ceil(log(app_ctx->degree) / log(2)) + 1; in ProcessCommandLineOptions()
167 app_ctx->num_levels = app_ctx->degree; in ProcessCommandLineOptions()
170 app_ctx->num_levels = 1; in ProcessCommandLineOptions()
175 PetscCall(PetscMalloc1(app_ctx->num_levels, &(app_ctx->level_degrees))); in ProcessCommandLineOptions()
177 switch (app_ctx->multigrid_choice) { in ProcessCommandLineOptions()
179 for (int i = 0; i < app_ctx->num_levels - 1; i++) app_ctx->level_degrees[i] = pow(2, i); in ProcessCommandLineOptions()
180 app_ctx->level_degrees[app_ctx->num_levels - 1] = app_ctx->degree; in ProcessCommandLineOptions()
183 for (int i = 0; i < app_ctx->num_levels; i++) app_ctx->level_degrees[i] = i + 1; in ProcessCommandLineOptions()
186 app_ctx->level_degrees[0] = app_ctx->degree; in ProcessCommandLineOptions()