xref: /libCEED/examples/solids/problems/linear.c (revision 9ba83ac0e4b1fca39d6fa6737a318a9f0cbc172d)
1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
33d8e8822SJeremy L Thompson //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
53d8e8822SJeremy L Thompson //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
73d8e8822SJeremy L Thompson 
85754ecacSJeremy L Thompson #include "../qfunctions/linear.h"
92b730f8bSJeremy L Thompson 
102b730f8bSJeremy L Thompson #include <ceed.h>
1149aac155SJeremy L Thompson #include <petscsys.h>
122b730f8bSJeremy L Thompson 
132b730f8bSJeremy L Thompson #include "../include/setup-libceed.h"
142b730f8bSJeremy L Thompson #include "../include/structs.h"
152b730f8bSJeremy L Thompson #include "../problems/neo-hookean.h"
162b730f8bSJeremy L Thompson #include "../problems/problems.h"
172b730f8bSJeremy L Thompson #include "../qfunctions/common.h"
185754ecacSJeremy L Thompson #include "../qfunctions/manufactured-true.h"
195754ecacSJeremy L Thompson 
205754ecacSJeremy L Thompson ProblemData linear_elasticity = {
215754ecacSJeremy L Thompson     .setup_geo            = SetupGeo,
225754ecacSJeremy L Thompson     .setup_geo_loc        = SetupGeo_loc,
23a61c78d6SJeremy L Thompson     .q_data_size          = 10,
245754ecacSJeremy L Thompson     .quadrature_mode      = CEED_GAUSS,
25c8565611SJeremy L Thompson     .residual             = ElasResidual_Linear,
26c8565611SJeremy L Thompson     .residual_loc         = ElasResidual_Linear_loc,
275754ecacSJeremy L Thompson     .number_fields_stored = 0,
28c8565611SJeremy L Thompson     .jacobian             = ElasJacobian_Linear,
29c8565611SJeremy L Thompson     .jacobian_loc         = ElasJacobian_Linear_loc,
30c8565611SJeremy L Thompson     .energy               = ElasEnergy_Linear,
31c8565611SJeremy L Thompson     .energy_loc           = ElasEnergy_Linear_loc,
32c8565611SJeremy L Thompson     .diagnostic           = ElasDiagnostic_Linear,
33c8565611SJeremy L Thompson     .diagnostic_loc       = ElasDiagnostic_Linear_loc,
345754ecacSJeremy L Thompson     .true_soln            = MMSTrueSoln,
355754ecacSJeremy L Thompson     .true_soln_loc        = MMSTrueSoln_loc,
365754ecacSJeremy L Thompson };
375754ecacSJeremy L Thompson 
382b730f8bSJeremy L Thompson PetscErrorCode SetupLibceedFineLevel_ElasLinear(DM dm, DM dm_energy, DM dm_diagnostic, Ceed ceed, AppCtx app_ctx, CeedQFunctionContext phys_ctx,
392b730f8bSJeremy L Thompson                                                 PetscInt fine_level, PetscInt num_comp_u, PetscInt U_g_size, PetscInt U_loc_size,
402b730f8bSJeremy L Thompson                                                 CeedVector force_ceed, CeedVector neumann_ceed, CeedData *data) {
415754ecacSJeremy L Thompson   PetscFunctionBegin;
425754ecacSJeremy L Thompson 
432b730f8bSJeremy L Thompson   PetscCall(SetupLibceedFineLevel(dm, dm_energy, dm_diagnostic, ceed, app_ctx, phys_ctx, linear_elasticity, fine_level, num_comp_u, U_g_size,
442b730f8bSJeremy L Thompson                                   U_loc_size, force_ceed, neumann_ceed, data));
455754ecacSJeremy L Thompson 
46ee4ca9cbSJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
475754ecacSJeremy L Thompson };
485754ecacSJeremy L Thompson 
492b730f8bSJeremy L Thompson PetscErrorCode SetupLibceedLevel_ElasLinear(DM dm, Ceed ceed, AppCtx app_ctx, PetscInt level, PetscInt num_comp_u, PetscInt U_g_size,
502b730f8bSJeremy L Thompson                                             PetscInt U_loc_size, CeedVector fine_mult, CeedData *data) {
515754ecacSJeremy L Thompson   PetscFunctionBegin;
525754ecacSJeremy L Thompson 
532b730f8bSJeremy L Thompson   PetscCall(SetupLibceedLevel(dm, ceed, app_ctx, linear_elasticity, level, num_comp_u, U_g_size, U_loc_size, fine_mult, data));
545754ecacSJeremy L Thompson 
55ee4ca9cbSJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
565754ecacSJeremy L Thompson };
57