Skip to content

Commit ef85e33

Browse files
committed
adding pre_stress hardcode patch
1 parent 939c639 commit ef85e33

File tree

2 files changed

+40
-17
lines changed

2 files changed

+40
-17
lines changed

src/pre_process/include/3dHardcodedIC.fpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
real(kind(0d0)) :: rhoH, rhoL, pRef, pInt, h, lam, wl, amp, intH, alph
55

66
real(kind(0d0)) :: eps
7+
8+
real(kind(0d0)) :: rcoord, theta, phi, xi_sph, x_bcen, y_bcen, z_bcen, Rinit
9+
real(kind(0d0)) :: x_ccs, y_ccs, z_ccs
10+
real(kind(0d0)), dimension(num_dims) :: xi_cart
11+
integer :: l
712

813
eps = 1e-9
914
#:enddef
@@ -56,6 +61,33 @@
5661
q_prim_vf(advxe)%sf(i, j, k) = patch_icpp(1)%alpha(2)
5762
end if
5863

64+
case (302) ! pre_stress for hyperelasticity, bubble in material
65+
R0ref = 30E-6 ! equilibrium radius
66+
Rinit = patch_icpp(3)%radius ! initial radius
67+
x_bcen = patch_icpp(3)%x_centroid
68+
y_bcen = patch_icpp(3)%y_centroid
69+
z_bcen = patch_icpp(3)%z_centroid
70+
x_ccs = x_cc(i) - x_bcen
71+
y_ccs = y_cc(j) - y_bcen
72+
z_ccs = z_cc(k) - z_bcen
73+
rcoord = sqrt(x_ccs**2 + y_ccs**2 + z_ccs**2)
74+
phi = atan2(y_ccs, x_ccs)
75+
theta = atan2(sqrt(x_ccs**2 + y_ccs**2), z_ccs)
76+
!spherical coord, assuming Rmax=1
77+
xi_sph = (rcoord**3 - R0ref**3 + Rinit**3)**(1d0/3d0)
78+
xi_cart(1) = xi_sph*sin(theta)*cos(phi)
79+
xi_cart(2) = xi_sph*sin(theta)*sin(phi)
80+
xi_cart(3) = xi_sph*cos(theta)
81+
! shift back
82+
xi_cart(1) = xi_cart(1) + x_bcen
83+
xi_cart(2) = xi_cart(2) + y_bcen
84+
xi_cart(3) = xi_cart(3) + z_bcen
85+
! print *, 'xi_cart(1) ::', xi_cart(1), 'xi_cart(2) ::', xi_cart(2), 'xi_cart(3) ::', xi_cart(3)
86+
! assigning the reference map to the q_prim vector field
87+
do l = 1, 3
88+
q_prim_vf(l + xibeg - 1)%sf(i, j, k) = xi_cart(l)
89+
end do
90+
5991
! Put your variable assignments here
6092
case default
6193
call s_int_to_str(patch_id, iStr)

src/pre_process/m_assign_variables.fpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -500,29 +500,20 @@ contains
500500
end if
501501
502502
! Elastic Shear Stress
503-
if (hyperelasticity) then
504-
505-
if (pre_stress) then ! pre stressed initial condition in spatial domain
506-
rcoord = sqrt((x_cc(j)**2 + y_cc(k)**2 + z_cc(l)**2))
507-
theta = atan2(y_cc(k), x_cc(j))
508-
phi = atan2(sqrt(x_cc(j)**2 + y_cc(k)**2), z_cc(l))
509-
!spherical coord, assuming Rmax=1
510-
xi_sph = (rcoord**3 - R0ref**3 + 1d0)**(1d0/3d0)
511-
xi_cart(1) = xi_sph*sin(phi)*cos(theta)
512-
xi_cart(2) = xi_sph*sin(phi)*sin(theta)
513-
xi_cart(3) = xi_sph*cos(phi)
514-
else
515-
xi_cart(1) = x_cc(j)
516-
xi_cart(2) = y_cc(k)
517-
xi_cart(3) = z_cc(l)
503+
if (hyperelasticity .and. .not. pre_stress) then
504+
xi_cart(1) = x_cc(j)
505+
if (p > 0) then
506+
xi_cart(2) = y_cc(k)
507+
xi_cart(3) = z_cc(l)
508+
elseif (n > 0) then
509+
xi_cart(2) = y_cc(k)
518510
end if
519511
520512
! assigning the reference map to the q_prim vector field
521513
do i = 1, num_dims
522-
q_prim_vf(i + xibeg - 1)%sf(j, k, l) = eta*xi_cart(i) + &
514+
q_prim_vf(i + xibeg - 1)%sf(j, k, l) = eta*xi_cart(i) + &
523515
(1d0 - eta)*orig_prim_vf(i + xibeg - 1)
524516
end do
525-
526517
end if
527518
528519
if (mpp_lim .and. bubbles) then

0 commit comments

Comments
 (0)