OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
spinih.F
Go to the documentation of this file.
1Copyright> OpenRadioss
2Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3Copyright>
4Copyright> This program is free software: you can redistribute it and/or modify
5Copyright> it under the terms of the GNU Affero General Public License as published by
6Copyright> the Free Software Foundation, either version 3 of the License, or
7Copyright> (at your option) any later version.
8Copyright>
9Copyright> This program is distributed in the hope that it will be useful,
10Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12Copyright> GNU Affero General Public License for more details.
13Copyright>
14Copyright> You should have received a copy of the GNU Affero General Public License
15Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16Copyright>
17Copyright>
18Copyright> Commercial Alternative: Altair Radioss Software
19Copyright>
20Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21Copyright> software under a commercial license. Contact Altair to discuss further if the
22Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23!||====================================================================
24!|| spinih ../starter/source/elements/sph/spinih.F
25!||--- called by ------------------------------------------------------
26!|| lectur ../starter/source/starter/lectur.F
27!||--- calls -----------------------------------------------------
28!|| get_u_geo ../starter/source/user_interface/uaccess.F
29!|| sptri ../starter/source/elements/sph/sptri.F
30!||--- uses -----------------------------------------------------
31!||====================================================================
32 SUBROUTINE spinih(KXSP,IPART,IPARTSP,SPBUF,PM,
33 . IXSP ,NOD2SP ,X ,LPRTSPH,LONFSPH,
34 . SNOD2SP ,SLONFSPH,NUMNOD,NPART,ITAB)
35C-----------------------------------------------
36C M o d u l e s
37C-----------------------------------------------
38 USE my_alloc_mod
39C-----------------------------------------------
40C I m p l i c i t T y p e s
41C-----------------------------------------------
42#include "implicit_f.inc"
43C-----------------------------------------------
44C G l o b a l P a r a m e t e r s
45C-----------------------------------------------
46#include "param_c.inc"
47#include "sphcom.inc"
48#include "scr17_c.inc"
49C-----------------------------------------------
50C D u m m y A r g u m e n t s
51C-----------------------------------------------
52 INTEGER KXSP(NISP,*), IPART(LIPART1,*), IPARTSP(*),ITAB(*)
53 INTEGER ,INTENT(IN) :: SNOD2SP,SLONFSPH,NUMNOD,NPART
54 INTEGER ,INTENT(INOUT) :: IXSP(KVOISPH,NUMSPH),NOD2SP(SNOD2SP),LPRTSPH(2,0:NPART),
55 . lonfsph(slonfsph)
57 . spbuf(nspbuf,*),pm(npropm,*)
58 my_real ,INTENT(IN) :: x(3,numnod)
59C-----------------------------------------------
60C L o c a l V a r i a b l e s
61C-----------------------------------------------
62 INTEGER N, IPRT, I0, IMAT, PRE_SEARCH, FLG_H, J, NBNOD(NPART), SZ_INTP_DIST
63 my_real, DIMENSION(:), ALLOCATABLE :: MAX_INTP_DIST_PART ! Max of interparticle distance per part
64 my_real
65 . dist, mp, rho, vol, sq2
66C-----------------------------------------------
67 my_real
68 . get_u_geo,h_scal,vol_tot
69 my_real
70 . xmin(npart),xmax(npart),ymin(npart),ymax(npart),zmin(npart),
71 . zmax(npart),volp_prt(npart)
72C-----------------------------------------------
73 pre_search = 0
74 sq2 = sqrt(two)
75C
76 volp_prt(1:npart)=zero
77 nbnod(1:npart)=0
78 xmin(1:npart)=ep30
79 xmax(1:npart)=-ep30
80 ymin(1:npart)=ep30
81 ymax(1:npart)=-ep30
82 zmin(1:npart)=ep30
83 zmax(1:npart)=-ep30
84C
85 DO n = 1, numsph
86 iprt=ipartsp(n)
87 imat=ipart(1,iprt)
88 i0 =ipart(2,iprt)
89 dist=get_u_geo(6,i0)
90 IF (nint(spbuf(13,n))==1) THEN
91C-- type = 1 - particle with mass input
92 mp = spbuf(12,n)
93 rho=pm(1,imat)
94 vol=mp/rho
95 dist=(sq2*vol)**third
96 ELSEIF (nint(spbuf(13,n))==2) THEN
97C-- type = 2 - particle with volume input
98 vol=spbuf(12,n)
99 dist=(sq2*vol)**third
100 ELSE
101C-- type = 0 - particle without mass/vol input
102 IF(dist==zero) THEN
103 mp =get_u_geo(1,i0)
104 rho=pm(1,imat)
105 vol=mp/rho
106 dist=(sq2*vol)**third
107 END IF
108 ENDIF
109 spbuf(1,n)=dist
110C
111 flg_h=nint(get_u_geo(9,i0))
112 IF (flg_h==3) THEN
113C-- FLG_H=3 - computation of H from interparticle distance - presearch of neigbours needed
114 pre_search = 1
115C-- Approximation of H
116 j=kxsp(3,n)
117 nbnod(iprt)=nbnod(iprt)+1
118 xmin(iprt)= min(xmin(iprt),x(1,j))
119 ymin(iprt)= min(ymin(iprt),x(2,j))
120 zmin(iprt)= min(zmin(iprt),x(3,j))
121 xmax(iprt)= max(xmax(iprt),x(1,j))
122 ymax(iprt)= max(ymax(iprt),x(2,j))
123 zmax(iprt)= max(zmax(iprt),x(3,j))
124 ENDIF
125C
126 END DO
127C
128 IF (pre_search == 1) THEN
129C Rough approxiamtion of H per part - only used for presearch (important for SOL2SPH because MP not defined)
130 DO iprt = 1, npart
131 IF (nbnod(iprt) > 0) THEN
132 vol_tot = abs(xmin(iprt)-xmax(iprt))*abs(ymin(iprt)-ymax(iprt))*abs(zmin(iprt)-zmax(iprt))
133 volp_prt(iprt) = vol_tot/nbnod(iprt)
134 ENDIF
135 END DO
136 DO n=1,numsph
137 iprt=ipartsp(n)
138 i0 =ipart(2,iprt)
139 flg_h=nint(get_u_geo(9,i0))
140 IF (flg_h==3) THEN
141 dist = volp_prt(iprt)**third
142 spbuf(1,n) = min(dist,spbuf(1,n))
143 ENDIF
144 END DO
145C
146 CALL my_alloc(max_intp_dist_part,npart)
147 max_intp_dist_part(1:npart) = zero
148 sz_intp_dist = npart
149c
150C Pre-search of neigbours to define interparticular distance
151 CALL sptri(kxsp ,ixsp ,nod2sp ,x ,spbuf ,
152 . lprtsph ,lonfsph ,ipartsp ,sz_intp_dist,max_intp_dist_part,
153 . pre_search)
154C
155 DO n = 1, numsph
156 iprt=ipartsp(n)
157 i0 =ipart(2,iprt)
158 flg_h=nint(get_u_geo(9,i0))
159C KXSP(9,N) = FLG_H
160 IF (flg_h==3) THEN
161 h_scal=get_u_geo(12,i0)
162 spbuf(1,n)=h_scal*max_intp_dist_part(iprt) ! DIamter of the particle
163 spbuf(14,n)=h_scal*max_intp_dist_part(iprt) ! Diameter of the particle at time zero
164 ENDIF
165 END DO
166C
167 DEALLOCATE(max_intp_dist_part)
168C
169 ENDIF
170C
171 RETURN
172 END
#define my_real
Definition cppsort.cpp:32
subroutine ymax(idn, fac, npc, pld, stiffmin, stiffmax, stiffini, stiffavg)
Definition law100_upd.F:274
#define min(a, b)
Definition macros.h:20
#define max(a, b)
Definition macros.h:21
subroutine spinih(kxsp, ipart, ipartsp, spbuf, pm, ixsp, nod2sp, x, lprtsph, lonfsph, snod2sp, slonfsph, numnod, npart, itab)
Definition spinih.F:35
subroutine sptri(kxsp, ixsp, nod2sp, x, spbuf, lprtsph, lonfsph, ipartsp, sz_intp_dist, max_intp_dist_part, pre_search)
Definition sptri.F:51