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!|| reset_u_geo ../starter/source/user_interface/uaccess.F
30!|| sptri ../starter/source/elements/sph/sptri.F
31!||--- uses -----------------------------------------------------
32!||====================================================================
33 SUBROUTINE spinih(KXSP,IPART,IPARTSP,SPBUF,PM,
34 . IXSP ,NOD2SP ,X ,LPRTSPH,LONFSPH,
35 . SNOD2SP ,SLONFSPH,NUMNOD,NPART,ITAB)
36C-----------------------------------------------
37C M o d u l e s
38C-----------------------------------------------
39 USE my_alloc_mod
40C-----------------------------------------------
41C I m p l i c i t T y p e s
42C-----------------------------------------------
43#include "implicit_f.inc"
44C-----------------------------------------------
45C G l o b a l P a r a m e t e r s
46C-----------------------------------------------
47#include "param_c.inc"
48#include "sphcom.inc"
49#include "scr17_c.inc"
50C-----------------------------------------------
51C D u m m y A r g u m e n t s
52C-----------------------------------------------
53 INTEGER KXSP(NISP,*), IPART(LIPART1,*), IPARTSP(*),ITAB(*)
54 INTEGER ,INTENT(IN) :: SNOD2SP,SLONFSPH,NUMNOD,NPART
55 INTEGER ,INTENT(INOUT) :: IXSP(KVOISPH,NUMSPH),NOD2SP(SNOD2SP),LPRTSPH(2,0:NPART),
56 . lonfsph(slonfsph)
58 . spbuf(nspbuf,*),pm(npropm,*)
59 my_real ,INTENT(IN) :: x(3,numnod)
60C-----------------------------------------------
61C L o c a l V a r i a b l e s
62C-----------------------------------------------
63 INTEGER N,IPRT,I0,IMAT,PRE_SEARCH,FLG_H,J,NS,NBNOD(NPART),SZ_INTP_DIST
64 my_real, DIMENSION(:), ALLOCATABLE :: MAX_INTP_DIST_PART ! Max of interparticle distance per part
65 my_real
66 . dist, mp, rho, vol, sq2
67C-----------------------------------------------
68 my_real
69 . get_u_geo,h_scal,vol_tot,reset_u_geo
70 my_real
71 . xmin(npart),xmax(npart),ymin(npart),ymax(npart),zmin(npart),
72 . zmax(npart),volp_prt(npart)
73C-----------------------------------------------
74 pre_search = 0
75 sq2 = sqrt(two)
76C
77 volp_prt(1:npart)=zero
78 nbnod(1:npart)=0
79 xmin(1:npart)=ep30
80 xmax(1:npart)=-ep30
81 ymin(1:npart)=ep30
82 ymax(1:npart)=-ep30
83 zmin(1:npart)=ep30
84 zmax(1:npart)=-ep30
85C
86 DO n = 1, numsph
87 iprt=ipartsp(n)
88 imat=ipart(1,iprt)
89 i0 =ipart(2,iprt)
90 dist=get_u_geo(6,i0)
91 IF (nint(spbuf(13,n))==1) THEN
92C-- type = 1 - particle with mass input
93 mp = spbuf(12,n)
94 rho=pm(1,imat)
95 vol=mp/rho
96 dist=(sq2*vol)**third
97 ELSEIF (nint(spbuf(13,n))==2) THEN
98C-- type = 2 - particle with volume input
99 vol=spbuf(12,n)
100 dist=(sq2*vol)**third
101 ELSE
102C-- type = 0 - particle without mass/vol input
103 IF(dist==zero) THEN
104 mp =get_u_geo(1,i0)
105 rho=pm(1,imat)
106 vol=mp/rho
107 dist=(sq2*vol)**third
108 END IF
109 ENDIF
110 spbuf(1,n)=dist
111C
112 flg_h=nint(get_u_geo(9,i0))
113 IF (flg_h==3) THEN
114C-- FLG_H=3 - computation of H from interparticle distance - presearch of neigbours needed
115 pre_search = 1
116C-- Approximation of H
117 j=kxsp(3,n)
118 nbnod(iprt)=nbnod(iprt)+1
119 xmin(iprt)= min(xmin(iprt),x(1,j))
120 ymin(iprt)= min(ymin(iprt),x(2,j))
121 zmin(iprt)= min(zmin(iprt),x(3,j))
122 xmax(iprt)= max(xmax(iprt),x(1,j))
123 ymax(iprt)= max(ymax(iprt),x(2,j))
124 zmax(iprt)= max(zmax(iprt),x(3,j))
125 ENDIF
126C
127 END DO
128C
129 IF (pre_search == 1) THEN
130C Rough approxiamtion of H per part - only used for presearch (important for SOL2SPH because MP not defined)
131 DO iprt = 1, npart
132 IF (nbnod(iprt) > 0) THEN
133 vol_tot = abs(xmin(iprt)-xmax(iprt))*abs(ymin(iprt)-ymax(iprt))*abs(zmin(iprt)-zmax(iprt))
134 volp_prt(iprt) = vol_tot/nbnod(iprt)
135 ENDIF
136 END DO
137 DO n=1,numsph
138 iprt=ipartsp(n)
139 i0 =ipart(2,iprt)
140 flg_h=nint(get_u_geo(9,i0))
141 IF (flg_h==3) THEN
142 dist = volp_prt(iprt)**third
143 spbuf(1,n) = min(dist,spbuf(1,n))
144 ENDIF
145 END DO
146C
147 CALL my_alloc(max_intp_dist_part,npart)
148 max_intp_dist_part(1:npart) = zero
149 sz_intp_dist = npart
150c
151C Pre-search of neigbours to define interparticular distance
152 CALL sptri(kxsp ,ixsp ,nod2sp ,x ,spbuf ,
153 . lprtsph ,lonfsph ,ipartsp ,sz_intp_dist,max_intp_dist_part,
154 . pre_search)
155C
156 DO n = 1, numsph
157 iprt=ipartsp(n)
158 i0 =ipart(2,iprt)
159 flg_h=nint(get_u_geo(9,i0))
160C KXSP(9,N) = FLG_H
161 IF (flg_h==3) THEN
162 h_scal=get_u_geo(12,i0)
163 spbuf(1,n)=h_scal*max_intp_dist_part(iprt) ! DIamter of the particle
164 spbuf(14,n)=h_scal*max_intp_dist_part(iprt) ! Diameter of the particle at time zero
165 ENDIF
166 END DO
167C
168 DEALLOCATE(max_intp_dist_part)
169C
170 ENDIF
171C
172 RETURN
173 END
#define my_real
Definition cppsort.cpp:32
subroutine ymax(idn, fac, npc, pld, stiffmin, stiffmax, stiffini, stiffavg)
Definition law100_upd.F:272
#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:36
subroutine sptri(kxsp, ixsp, nod2sp, x, spbuf, lprtsph, lonfsph, ipartsp, sz_intp_dist, max_intp_dist_part, pre_search)
Definition sptri.F:51
integer function reset_u_geo(ivar, ip, a)
Definition uaccess.F:396