xref: /libCEED/examples/solids/problems/linear.c (revision ee4ca9cbfe2be39196684117442f3ce8d00b6506)
13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, 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,
255754ecacSJeremy L Thompson     .residual             = ElasLinearF,
265754ecacSJeremy L Thompson     .residual_loc         = ElasLinearF_loc,
275754ecacSJeremy L Thompson     .number_fields_stored = 0,
285754ecacSJeremy L Thompson     .jacobian             = ElasLineardF,
295754ecacSJeremy L Thompson     .jacobian_loc         = ElasLineardF_loc,
305754ecacSJeremy L Thompson     .energy               = ElasLinearEnergy,
315754ecacSJeremy L Thompson     .energy_loc           = ElasLinearEnergy_loc,
325754ecacSJeremy L Thompson     .diagnostic           = ElasLinearDiagnostic,
335754ecacSJeremy L Thompson     .diagnostic_loc       = ElasLinearDiagnostic_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 
46*ee4ca9cbSJames 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 
55*ee4ca9cbSJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
565754ecacSJeremy L Thompson };
57