boundary.c (31dc5d865475121074fe3baac54cb8ba7e9abd40) boundary.c (d642641faca99bf5c5aefc2eafdb8a0bc57fc341)
1// Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2// the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3// reserved. See files LICENSE and NOTICE for details.
4//
5// This file is part of CEED, a collection of benchmarks, miniapps, software
6// libraries and APIs for efficient high-order finite element and spectral
7// element discretizations for exascale applications. For more information and
8// source code availability see http://github.com/ceed.

--- 30 unchanged lines hidden (view full) ---

39
40 u[0] = exp(2*x)*sin(3*y)*cos(4*z) / 1e8 * loadIncrement;
41 u[1] = exp(3*y)*sin(4*z)*cos(2*x) / 1e8 * loadIncrement;
42 u[2] = exp(4*z)*sin(2*x)*cos(3*y) / 1e8 * loadIncrement;
43
44 PetscFunctionReturn(0);
45};
46
1// Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2// the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3// reserved. See files LICENSE and NOTICE for details.
4//
5// This file is part of CEED, a collection of benchmarks, miniapps, software
6// libraries and APIs for efficient high-order finite element and spectral
7// element discretizations for exascale applications. For more information and
8// source code availability see http://github.com/ceed.

--- 30 unchanged lines hidden (view full) ---

39
40 u[0] = exp(2*x)*sin(3*y)*cos(4*z) / 1e8 * loadIncrement;
41 u[1] = exp(3*y)*sin(4*z)*cos(2*x) / 1e8 * loadIncrement;
42 u[2] = exp(4*z)*sin(2*x)*cos(3*y) / 1e8 * loadIncrement;
43
44 PetscFunctionReturn(0);
45};
46
47// BCZero - fix boundary values at zero
48PetscErrorCode BCZero(PetscInt dim, PetscReal loadIncrement,
49 const PetscReal coords[], PetscInt ncompu,
50 PetscScalar *u, void *ctx) {
51 PetscFunctionBeginUser;
52
53 u[0] = 0;
54 u[1] = 0;
55 u[2] = 0;
56
57 PetscFunctionReturn(0);
58};
59
60// BCClampTranslate - translate boundary values at fraction of load increment
61PetscErrorCode BCClampTranslate(PetscInt dim, PetscReal loadIncrement,
62 const PetscReal coords[], PetscInt ncompu,
63 PetscScalar *u, void *ctx) {
64 PetscScalar (*clampMax) = (PetscScalar(*))ctx;
65
66 PetscFunctionBeginUser;
67
68 u[0] = clampMax[0]*loadIncrement;
69 u[1] = clampMax[1]*loadIncrement;
70 u[2] = clampMax[2]*loadIncrement;
71
72 PetscFunctionReturn(0);
73};
74
75#ifndef M_PI
76# define M_PI 3.14159265358979323846
77#endif
78
47#ifndef M_PI
48# define M_PI 3.14159265358979323846
49#endif
50
79// BCClampRotate - rotate boundary values at fraction of load increment
80PetscErrorCode BCClampRotate(PetscInt dim, PetscReal loadIncrement,
81 const PetscReal coords[], PetscInt ncompu,
82 PetscScalar *u, void *ctx) {
51// BCClamp - fix boundary values with affine transformation at fraction of load
52// increment
53PetscErrorCode BCClamp(PetscInt dim, PetscReal loadIncrement,
54 const PetscReal coords[], PetscInt ncompu,
55 PetscScalar *u, void *ctx) {
83 PetscScalar x = coords[0];
84 PetscScalar y = coords[1];
85 PetscScalar z = coords[2];
86 PetscScalar (*clampMax) = (PetscScalar(*))ctx;
87
88 PetscFunctionBeginUser;
89
56 PetscScalar x = coords[0];
57 PetscScalar y = coords[1];
58 PetscScalar z = coords[2];
59 PetscScalar (*clampMax) = (PetscScalar(*))ctx;
60
61 PetscFunctionBeginUser;
62
90 PetscScalar theta = clampMax[3]*M_PI*loadIncrement,
91 kx = clampMax[0], ky = clampMax[1], kz = clampMax[2];
63 PetscScalar lx = clampMax[0]*loadIncrement, ly = clampMax[1]*loadIncrement,
64 lz = clampMax[2]*loadIncrement,
65 theta = clampMax[6]*M_PI*loadIncrement,
66 kx = clampMax[3], ky = clampMax[4], kz = clampMax[5];
92 PetscScalar c = cos(theta), s = sin(theta);
93
67 PetscScalar c = cos(theta), s = sin(theta);
68
94 u[0] = s*(-kz*y + ky*z) + (1-c)*(-ky*ky+kz*kz*x + kx*ky*y + kx*kz*z);
95 u[1] = s*(kz*x + -kx*z) + (1-c)*(kx*ky*x - (kx*kx+kz*kz)*y + ky*kz*z);
96 u[2] = s*(-ky*x + kx*y) + (1-c)*(kx*kz*x + ky*kz*y - (kx*kx+ky*ky)*z);
69 u[0] = lx + s*(-kz*y + ky*z) + (1-c)*(-ky*ky+kz*kz*x + kx*ky*y + kx*kz*z);
70 u[1] = ly + s*(kz*x + -kx*z) + (1-c)*(kx*ky*x - (kx*kx+kz*kz)*y + ky*kz*z);
71 u[2] = lz + s*(-ky*x + kx*y) + (1-c)*(kx*kz*x + ky*kz*y - (kx*kx+ky*ky)*z);
97
98 PetscFunctionReturn(0);
99};
72
73 PetscFunctionReturn(0);
74};