Skip to content
Snippets Groups Projects
Commit 0f68e738 authored by Ilia Valian's avatar Ilia Valian
Browse files

initial commit

parent 8de98770
1 merge request!31Valian/linear elasticity
Pipeline #68905 failed with stages
in 6 minutes and 32 seconds
This diff is collapsed.
This diff is collapsed.
# HyTeG Operator Generator
# Copyright (C) 2024 HyTeG Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from hog.recipes.common import *
import sympy as sp
def integrand(
*,
jac_a_inv,
jac_a_abs_det,
jac_b_inv,
jac_b_abs_det,
grad_u,
grad_v,
k,
tabulate,
**_,
):
grad_u_chain = jac_b_inv.T * tabulate(jac_a_inv.T * grad_u)
grad_v_chain = jac_b_inv.T * tabulate(jac_a_inv.T * grad_v)
def symm_grad(w):
return 0.5 * (w + w.T)
symm_grad_u = symm_grad(grad_u_chain)
sigma_u = k["lambda"] * grad_u_chain.trace() * sp.eye(grad_u_chain.shape[0]) + k["mu"] * 2 * symm_grad_u
symm_grad_v = symm_grad(grad_v_chain)
return (
double_contraction(sigma_u, symm_grad_v)
* tabulate(jac_a_abs_det)
* jac_b_abs_det
)
# HyTeG Operator Generator
# Copyright (C) 2024 HyTeG Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from hog.recipes.common import *
import sympy as sp
def integrand(
*,
jac_a_inv,
jac_a_abs_det,
jac_b_inv,
jac_b_abs_det,
grad_u,
grad_v,
k,
tabulate,
**_,
):
grad_u_chain = jac_b_inv.T * tabulate(jac_a_inv.T * grad_u)
grad_v_chain = jac_b_inv.T * tabulate(jac_a_inv.T * grad_v)
def symm_grad(w):
return 0.5 * (w + w.T)
symm_grad_u = symm_grad(grad_u_chain)
sigma_u = k["lambda"] * grad_u_chain.trace() * sp.eye(grad_u_chain.shape[0]) + k["mu"] * 2 * symm_grad_u
symm_grad_v = symm_grad(grad_v_chain)
return (
double_contraction(sigma_u, symm_grad_v)
* tabulate(jac_a_abs_det)
* jac_b_abs_det
)
# HyTeG Operator Generator
# Copyright (C) 2024 HyTeG Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from hog.recipes.common import *
import sympy as sp
def integrand(
*,
jac_a_inv,
jac_a_abs_det,
grad_u,
grad_v,
k,
tabulate,
**_,
):
grad_u_chain = jac_a_inv.T * grad_u
grad_v_chain = jac_a_inv.T * grad_v
def symm_grad(w):
return 0.5 * (w + w.T)
symm_grad_u = symm_grad(grad_u_chain)
sigma_u = k["lambda"] * grad_u_chain.trace() * sp.eye(grad_u_chain.shape[0]) + k["mu"] * 2 * symm_grad_u
symm_grad_v = symm_grad(grad_v_chain)
return tabulate(
double_contraction(sigma_u, symm_grad_v) * jac_a_abs_det
)
# HyTeG Operator Generator
# Copyright (C) 2024 HyTeG Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from hog.recipes.common import *
import sympy as sp
def integrand(
*,
jac_a_inv,
jac_a_abs_det,
grad_u,
grad_v,
k,
tabulate,
**_,
):
grad_u_chain = jac_a_inv.T * grad_u
grad_v_chain = jac_a_inv.T * grad_v
def symm_grad(w):
return 0.5 * (w + w.T)
symm_grad_u = symm_grad(grad_u_chain)
sigma_u = k["lambda"] * grad_u_chain.trace() * sp.eye(grad_u_chain.shape[0]) + k["mu"] * 2 * symm_grad_u
symm_grad_v = symm_grad(grad_v_chain)
return tabulate(
double_contraction(sigma_u, symm_grad_v) * jac_a_abs_det
)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment