OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
gradient_reconstruction2.F File Reference
#include "implicit_f.inc"
#include "vect01_c.inc"
#include "com04_c.inc"

Go to the source code of this file.

Functions/Subroutines

subroutine gradient_reconstruction2 (ixq, x, ale_connect, nv46, itrimat, segvar)

Function/Subroutine Documentation

◆ gradient_reconstruction2()

subroutine gradient_reconstruction2 ( integer, dimension(nixq, numelq), intent(in) ixq,
dimension(3, numnod), intent(in) x,
type(t_ale_connectivity), intent(in) ale_connect,
integer, intent(in) nv46,
integer, intent(in) itrimat,
type(t_segvar) segvar )

Definition at line 32 of file gradient_reconstruction2.F.

33C-----------------------------------------------
34C D e s c r i p t i o n
35C This subroutine computes a gradient of the scalar field value in each
36C element:
37C mean square approximation of the gradient in the face related
38C neighborhood of the element
39C-----------------------------------------------
40C M o d u l e s
41C-----------------------------------------------
42 USE alemuscl_mod
43 USE segvar_mod
45C-----------------------------------------------
46C I m p l i c i t T y p e s
47C-----------------------------------------------
48#include "implicit_f.inc"
49C-----------------------------------------------
50C C o m m o n B l o c k s
51C-----------------------------------------------
52#include "vect01_c.inc"
53#include "com04_c.inc"
54C-----------------------------------------------
55C D u m m y A r g u m e n t s
56C-----------------------------------------------
57 INTEGER, INTENT(IN) :: NV46
58 INTEGER, INTENT(IN) :: IXQ(NIXQ, NUMELQ)
59 my_real, INTENT(IN) :: x(3, numnod)
60 INTEGER, INTENT(IN) :: ITRIMAT
61 TYPE(t_segvar) :: SEGVAR
62 TYPE(t_ale_connectivity), INTENT(IN) :: ALE_CONNECT
63C-----------------------------------------------
64C L o c a l V a r i a b l e s
65C-----------------------------------------------
66 INTEGER :: I, II, KK, IAD2, LGTH
67 my_real :: yk, zk, yl, zl,yf, zf
68 my_real :: valk, vall
69 my_real :: mat(2, 2), rhs(2), sol(2)
70 INTEGER :: VOIS_ID
71 INTEGER :: FACE_TO_NODE_LOCAL_ID(4, 2), NODEID1, NODEID2
72 my_real :: det, undet
73C-----------------------------------------------
74C S o u r c e L i n e s
75C-----------------------------------------------
76!!! Once for all, associate node local id to a face number
77!!! Face 1
78 face_to_node_local_id(1, 1) = 1 ; face_to_node_local_id(1, 2) = 2
79!!! Face 2
80 face_to_node_local_id(2, 1) = 2 ; face_to_node_local_id(2, 2) = 3
81!!! Face 3
82 face_to_node_local_id(3, 1) = 3 ; face_to_node_local_id(3, 2) = 4
83!!! Face 4
84 face_to_node_local_id(4, 1) = 4 ; face_to_node_local_id(4, 2) = 1
85
86 DO i = lft, llt
87 ii = i + nft
88 !!! Reset mat, rhs
89 mat(1:2, 1:2) = zero ; rhs(1:2) = zero
90 !!! Value of the target function in the element
91 valk = alemuscl_buffer%VOLUME_FRACTION(ii,itrimat)
92 yk = alemuscl_buffer%ELCENTER(ii,2) ;
93 zk = alemuscl_buffer%ELCENTER(ii,3)
94 !!! IXS(2:9, II) : Node global ID
95 iad2 = ale_connect%ee_connect%iad_connect(ii)
96 lgth = ale_connect%ee_connect%iad_connect(ii+1)-iad2
97 DO kk = 1, nv46
98 vois_id = ale_connect%ee_connect%connected(iad2 + kk - 1)
99 IF (vois_id > 0) THEN
100 !!! Value of the target function in the current neighbor
101 vall = alemuscl_buffer%VOLUME_FRACTION(vois_id,itrimat)
102 yl = alemuscl_buffer%ELCENTER(vois_id,2) ;
103 zl = alemuscl_buffer%ELCENTER(vois_id,3) ;
104 ELSE
105 IF(vois_id == 0) THEN
106 vall = valk
107 ELSE
108 !vois_id<0 : means EBCS), -vois_id is seg_id
109 vall = segvar%PHASE_ALPHA(itrimat,-vois_id)
110 ENDIF
111
112 nodeid1 = ixq(1 + face_to_node_local_id(kk, 1), ii)
113 nodeid2 = ixq(1 + face_to_node_local_id(kk, 2), ii)
114
115 yf = half * (x(2, nodeid1) + x(2, nodeid2))
116 zf = half * (x(3, nodeid1) + x(3, nodeid2))
117
118 yl = two * yf - alemuscl_buffer%ELCENTER(ii,2)
119 zl = two * zf - alemuscl_buffer%ELCENTER(ii,3)
120 ENDIF
121
122 !!! Incrementing mat and rhs
123 rhs(1) = rhs(1) + (valk - vall) * (yl - yk)
124 rhs(2) = rhs(2) + (valk - vall) * (zl - zk)
125 mat(1, 1) = mat(1, 1) + (yl - yk) * (yl - yk)
126 mat(1, 2) = mat(1, 2) + (yl - yk) * (zl - zk)
127 mat(2, 1) = mat(2, 1) + (zl - zk) * (yl - yk)
128 mat(2, 2) = mat(2, 2) + (zl - zk) * (zl - zk)
129 ENDDO
130
131 det = mat(1, 1) * mat(2, 2) - mat(2, 1) * mat(1, 2)
132 IF (det == 0) THEN
133 print*, "OUPS"
134 ENDIF
135 undet = one / det
136 sol(1) = undet * (rhs(1) * mat(2,2) - rhs(2) * mat(1,2))
137 sol(2) = undet * (- mat(2,1) * rhs(1) + mat(1, 1) * rhs(2))
138 !!! Solution goes to the gradient
139 alemuscl_buffer%GRAD(ii,2,itrimat) = -sol(1)
140 alemuscl_buffer%GRAD(ii,3,itrimat) = -sol(2)
141 ENDDO ! I = LFT, LLT
142C-----------------------------------------------
#define my_real
Definition cppsort.cpp:32
type(alemuscl_buffer_) alemuscl_buffer