xref: /libCEED/examples/solids/problems/linear.c (revision 3d8e882215d238700cdceb37404f76ca7fa24eaa)
1*3d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2*3d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3*3d8e8822SJeremy L Thompson //
4*3d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5*3d8e8822SJeremy L Thompson //
6*3d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7*3d8e8822SJeremy L Thompson 
85754ecacSJeremy L Thompson #include <ceed.h>
95754ecacSJeremy L Thompson #include "../include/structs.h"
105754ecacSJeremy L Thompson #include "../include/setup-libceed.h"
115754ecacSJeremy L Thompson #include "../problems/problems.h"
125754ecacSJeremy L Thompson #include "../problems/neo-hookean.h"
135754ecacSJeremy L Thompson #include "../qfunctions/common.h"
145754ecacSJeremy L Thompson #include "../qfunctions/linear.h"
155754ecacSJeremy L Thompson #include "../qfunctions/manufactured-true.h"
165754ecacSJeremy L Thompson 
175754ecacSJeremy L Thompson ProblemData linear_elasticity = {
185754ecacSJeremy L Thompson   .setup_geo = SetupGeo,
195754ecacSJeremy L Thompson   .setup_geo_loc = SetupGeo_loc,
20a61c78d6SJeremy L Thompson   .q_data_size = 10,
215754ecacSJeremy L Thompson   .quadrature_mode = CEED_GAUSS,
225754ecacSJeremy L Thompson   .residual = ElasLinearF,
235754ecacSJeremy L Thompson   .residual_loc = ElasLinearF_loc,
245754ecacSJeremy L Thompson   .number_fields_stored = 0,
255754ecacSJeremy L Thompson   .jacobian = ElasLineardF,
265754ecacSJeremy L Thompson   .jacobian_loc = ElasLineardF_loc,
275754ecacSJeremy L Thompson   .energy = ElasLinearEnergy,
285754ecacSJeremy L Thompson   .energy_loc = ElasLinearEnergy_loc,
295754ecacSJeremy L Thompson   .diagnostic = ElasLinearDiagnostic,
305754ecacSJeremy L Thompson   .diagnostic_loc = ElasLinearDiagnostic_loc,
315754ecacSJeremy L Thompson   .true_soln = MMSTrueSoln,
325754ecacSJeremy L Thompson   .true_soln_loc = MMSTrueSoln_loc,
335754ecacSJeremy L Thompson };
345754ecacSJeremy L Thompson 
355754ecacSJeremy L Thompson PetscErrorCode SetupLibceedFineLevel_ElasLinear(DM dm, DM dm_energy,
365754ecacSJeremy L Thompson     DM dm_diagnostic, Ceed ceed, AppCtx app_ctx, CeedQFunctionContext phys_ctx,
375754ecacSJeremy L Thompson     PetscInt fine_level, PetscInt num_comp_u, PetscInt U_g_size,
385754ecacSJeremy L Thompson     PetscInt U_loc_size, CeedVector force_ceed, CeedVector neumann_ceed,
395754ecacSJeremy L Thompson     CeedData *data) {
405754ecacSJeremy L Thompson   PetscErrorCode ierr;
415754ecacSJeremy L Thompson 
425754ecacSJeremy L Thompson   PetscFunctionBegin;
435754ecacSJeremy L Thompson 
445754ecacSJeremy L Thompson   ierr = SetupLibceedFineLevel(dm, dm_energy, dm_diagnostic, ceed, app_ctx,
455754ecacSJeremy L Thompson                                phys_ctx, linear_elasticity,
465754ecacSJeremy L Thompson                                fine_level, num_comp_u, U_g_size, U_loc_size,
475754ecacSJeremy L Thompson                                force_ceed, neumann_ceed, data); CHKERRQ(ierr);
485754ecacSJeremy L Thompson 
495754ecacSJeremy L Thompson   PetscFunctionReturn(0);
505754ecacSJeremy L Thompson };
515754ecacSJeremy L Thompson 
525754ecacSJeremy L Thompson PetscErrorCode SetupLibceedLevel_ElasLinear(DM dm, Ceed ceed, AppCtx app_ctx,
535754ecacSJeremy L Thompson     PetscInt level, PetscInt num_comp_u, PetscInt U_g_size, PetscInt U_loc_size,
545754ecacSJeremy L Thompson     CeedVector fine_mult, CeedData *data) {
555754ecacSJeremy L Thompson   PetscErrorCode ierr;
565754ecacSJeremy L Thompson 
575754ecacSJeremy L Thompson   PetscFunctionBegin;
585754ecacSJeremy L Thompson 
595754ecacSJeremy L Thompson   ierr = SetupLibceedLevel(dm, ceed, app_ctx, linear_elasticity,
605754ecacSJeremy L Thompson                            level, num_comp_u, U_g_size, U_loc_size, fine_mult, data);
615754ecacSJeremy L Thompson   CHKERRQ(ierr);
625754ecacSJeremy L Thompson 
635754ecacSJeremy L Thompson   PetscFunctionReturn(0);
645754ecacSJeremy L Thompson };
65