xref: /libCEED/examples/solids/problems/linear.c (revision a61c78d6a6d5ea69db49949746e6dc59b544c365)
15754ecacSJeremy L Thompson #include <ceed.h>
25754ecacSJeremy L Thompson #include "../include/structs.h"
35754ecacSJeremy L Thompson #include "../include/setup-libceed.h"
45754ecacSJeremy L Thompson #include "../problems/problems.h"
55754ecacSJeremy L Thompson #include "../problems/neo-hookean.h"
65754ecacSJeremy L Thompson #include "../qfunctions/common.h"
75754ecacSJeremy L Thompson #include "../qfunctions/linear.h"
85754ecacSJeremy L Thompson #include "../qfunctions/manufactured-true.h"
95754ecacSJeremy L Thompson 
105754ecacSJeremy L Thompson ProblemData linear_elasticity = {
115754ecacSJeremy L Thompson   .setup_geo = SetupGeo,
125754ecacSJeremy L Thompson   .setup_geo_loc = SetupGeo_loc,
13*a61c78d6SJeremy L Thompson   .q_data_size = 10,
145754ecacSJeremy L Thompson   .quadrature_mode = CEED_GAUSS,
155754ecacSJeremy L Thompson   .residual = ElasLinearF,
165754ecacSJeremy L Thompson   .residual_loc = ElasLinearF_loc,
175754ecacSJeremy L Thompson   .number_fields_stored = 0,
185754ecacSJeremy L Thompson   .jacobian = ElasLineardF,
195754ecacSJeremy L Thompson   .jacobian_loc = ElasLineardF_loc,
205754ecacSJeremy L Thompson   .energy = ElasLinearEnergy,
215754ecacSJeremy L Thompson   .energy_loc = ElasLinearEnergy_loc,
225754ecacSJeremy L Thompson   .diagnostic = ElasLinearDiagnostic,
235754ecacSJeremy L Thompson   .diagnostic_loc = ElasLinearDiagnostic_loc,
245754ecacSJeremy L Thompson   .true_soln = MMSTrueSoln,
255754ecacSJeremy L Thompson   .true_soln_loc = MMSTrueSoln_loc,
265754ecacSJeremy L Thompson };
275754ecacSJeremy L Thompson 
285754ecacSJeremy L Thompson PetscErrorCode SetupLibceedFineLevel_ElasLinear(DM dm, DM dm_energy,
295754ecacSJeremy L Thompson     DM dm_diagnostic, Ceed ceed, AppCtx app_ctx, CeedQFunctionContext phys_ctx,
305754ecacSJeremy L Thompson     PetscInt fine_level, PetscInt num_comp_u, PetscInt U_g_size,
315754ecacSJeremy L Thompson     PetscInt U_loc_size, CeedVector force_ceed, CeedVector neumann_ceed,
325754ecacSJeremy L Thompson     CeedData *data) {
335754ecacSJeremy L Thompson   PetscErrorCode ierr;
345754ecacSJeremy L Thompson 
355754ecacSJeremy L Thompson   PetscFunctionBegin;
365754ecacSJeremy L Thompson 
375754ecacSJeremy L Thompson   ierr = SetupLibceedFineLevel(dm, dm_energy, dm_diagnostic, ceed, app_ctx,
385754ecacSJeremy L Thompson                                phys_ctx, linear_elasticity,
395754ecacSJeremy L Thompson                                fine_level, num_comp_u, U_g_size, U_loc_size,
405754ecacSJeremy L Thompson                                force_ceed, neumann_ceed, data); CHKERRQ(ierr);
415754ecacSJeremy L Thompson 
425754ecacSJeremy L Thompson   PetscFunctionReturn(0);
435754ecacSJeremy L Thompson };
445754ecacSJeremy L Thompson 
455754ecacSJeremy L Thompson PetscErrorCode SetupLibceedLevel_ElasLinear(DM dm, Ceed ceed, AppCtx app_ctx,
465754ecacSJeremy L Thompson     PetscInt level, PetscInt num_comp_u, PetscInt U_g_size, PetscInt U_loc_size,
475754ecacSJeremy L Thompson     CeedVector fine_mult, CeedData *data) {
485754ecacSJeremy L Thompson   PetscErrorCode ierr;
495754ecacSJeremy L Thompson 
505754ecacSJeremy L Thompson   PetscFunctionBegin;
515754ecacSJeremy L Thompson 
525754ecacSJeremy L Thompson   ierr = SetupLibceedLevel(dm, ceed, app_ctx, linear_elasticity,
535754ecacSJeremy L Thompson                            level, num_comp_u, U_g_size, U_loc_size, fine_mult, data);
545754ecacSJeremy L Thompson   CHKERRQ(ierr);
555754ecacSJeremy L Thompson 
565754ecacSJeremy L Thompson   PetscFunctionReturn(0);
575754ecacSJeremy L Thompson };
58