OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
diffusion_mod Module Reference

Data Types

type  t_diffusion

Functions/Subroutines

subroutine init_diffusion (this, linsol, nrhs, iparg, ale_connect)
subroutine solve_diffusion (this)
subroutine get_solution (this, sol, glob_dim)
subroutine terminate_diffusion (this)

Function/Subroutine Documentation

◆ get_solution()

subroutine diffusion_mod::get_solution ( class(t_diffusion), intent(inout), target this,
double precision, dimension(:), intent(inout), pointer sol,
integer, intent(out) glob_dim )

Definition at line 208 of file diffusion_mod.F.

209C-----------------------------------------------
210C I m p l i c i t T y p e s
211C-----------------------------------------------
212 USE spmd_comm_world_mod, ONLY : spmd_comm_world
213#include "implicit_f.inc"
214 CLASS(T_DIFFUSION), INTENT(INOUT), TARGET :: this
215 INTEGER, INTENT(OUT) :: GLOB_DIM
216
217 DOUBLE PRECISION, DIMENSION(:), INTENT(INOUT), POINTER :: SOL
218 sol => this%SOL
219 glob_dim = this%LINEAR_SOLVER%GET_GLOBAL_DIM()

◆ init_diffusion()

subroutine diffusion_mod::init_diffusion ( class(t_diffusion) this,
class(t_linear_solver), intent(in), target linsol,
integer, intent(in) nrhs,
integer, dimension(nparg, ngroup), intent(in) iparg,
type(t_ale_connectivity), intent(in) ale_connect )

Definition at line 81 of file diffusion_mod.F.

84C-----------------------------------------------
85C I m p l i c i t T y p e s
86C-----------------------------------------------
87 USE spmd_comm_world_mod, ONLY : spmd_comm_world
88#include "implicit_f.inc"
89C-----------------------------------------------
90C C o m m o n B l o c k s
91C-----------------------------------------------
92! NSPMD
93#include "com01_c.inc"
94! NPARG
95#include "param_c.inc"
96! NUMELS
97#include "com04_c.inc"
98! NSVOIS
99#include "spmd_c.inc"
100C-----------------------------------------------
101C M e s s a g e P a s s i n g
102C-----------------------------------------------
103#include "spmd.inc"
104C-----------------------------------------------
105C D u m m y A r g u m e n t s
106C-----------------------------------------------
107 CLASS(T_DIFFUSION) :: this
108 CLASS(T_LINEAR_SOLVER), INTENT(IN), TARGET :: LINSOL
109 INTEGER, DIMENSION(NPARG, NGROUP), INTENT(IN) :: IPARG
110 INTEGER, INTENT(IN) :: NRHS
111 TYPE(T_ALE_CONNECTIVITY), INTENT(IN) :: ALE_CONNECT
112C-----------------------------------------------
113C L o c a l V a r i a b l e s
114C-----------------------------------------------
115 INTEGER :: MAT_NZ, NG, II, NEL, ITY, MATLAW, NFT, I, JJ, KK
116 INTEGER :: GLOB_DIM, MAX_ID, IAD, LGTH
117#ifdef MPI
118 INTEGER IERR
119#endif
120
121 this%NRHS = nrhs
122! number of non zero values for the diffusion matrix elem <-> elem matrix
123 mat_nz = 0
124 DO ng = 1, ngroup
125 matlaw = iparg(1, ng)
126 IF (matlaw == 151) THEN
127 nel = iparg(2, ng)
128 nft = iparg(3, ng)
129 ity = iparg(5, ng)
130 DO ii = 1, nel
131 i = ii + nft
132 mat_nz = mat_nz + 1
133 iad = ale_connect%EE_CONNECT%IAD_CONNECT(i)
134 lgth = ale_connect%EE_CONNECT%IAD_CONNECT(i+1)-ale_connect%EE_CONNECT%IAD_CONNECT(i)
135 DO jj = 1, lgth
136 kk = ale_connect%EE_CONNECT%CONNECTED(iad + jj - 1)
137 IF (kk > 0) THEN
138 mat_nz = mat_nz + 1
139 ENDIF
140 ENDDO
141 ENDDO
142 ENDIF
143 ENDDO
144! create matrix
145 CALL this%MAT%MATRIX_CREATE(mat_nz)
146! create rhs
147 CALL this%RHS%CREATE(nrhs * numels)
148! global system size
149 glob_dim = numels
150 max_id = maxval(ale_connect%IDGLOB%ID(1:numels + nsvois))
151#ifdef MPI
152 IF (nspmd > 1) THEN
153 CALL mpi_allreduce(max_id, glob_dim, 1, mpi_int, mpi_max, spmd_comm_world, ierr)
154 ENDIF
155#endif
156! solution
157 ALLOCATE(this%SOL(3 * glob_dim))
158! init solver
159 this%LINEAR_SOLVER => linsol
160 CALL this%LINEAR_SOLVER%INIT_SOLVER(glob_dim)
161! set rhs and matrix
162 CALL this%LINEAR_SOLVER%SET_RHS(3, this%RHS)
163 CALL this%LINEAR_SOLVER%SET_MATRIX(this%MAT)
164! diffusion coefficient, outlet flag
165 this%OUTLET_FLAGGED = .false.
166 IF (n2d == 0) THEN
167 ALLOCATE(this%NU(numels + nsvois))
168 this%NU(1:numels + nsvois) = zero
169 ALLOCATE(this%FLAG_OUTLET(6 * numels))
170 this%FLAG_OUTLET(1:6 * numels) = 0
171 ELSE
172 ALLOCATE(this%NU(numelq + numeltg + nqvois + ntgvois))
173 this%NU(1:numelq + numeltg + nqvois + ntgvois) = zero
174 ALLOCATE(this%FLAG_OUTLET(4 * numelq + 3 * numeltg))
175 this%FLAG_OUTLET(1:4 * numelq + 3 * numeltg) = 0
176 ENDIF
177
subroutine mpi_allreduce(sendbuf, recvbuf, cnt, datatype, operation, comm, ierr)
Definition mpi.f:103

◆ solve_diffusion()

subroutine diffusion_mod::solve_diffusion ( class(t_diffusion) this)

Definition at line 187 of file diffusion_mod.F.

188C-----------------------------------------------
189C I m p l i c i t T y p e s
190C-----------------------------------------------
191 USE spmd_comm_world_mod, ONLY : spmd_comm_world
192#include "implicit_f.inc"
193 CLASS(T_DIFFUSION) :: this
194 INTEGER :: GLOB_DIM
195
196 glob_dim = this%LINEAR_SOLVER%GET_GLOBAL_DIM()
197 CALL this%LINEAR_SOLVER%SOLVE(this%SOL, this%NRHS * glob_dim)
198

◆ terminate_diffusion()

subroutine diffusion_mod::terminate_diffusion ( class(t_diffusion), intent(inout) this)

Definition at line 227 of file diffusion_mod.F.

228C-----------------------------------------------
229C I m p l i c i t T y p e s
230C-----------------------------------------------
231 USE spmd_comm_world_mod, ONLY : spmd_comm_world
232#include "implicit_f.inc"
233 CLASS(T_DIFFUSION), INTENT(INOUT) :: this
234
235
236 CALL this%LINEAR_SOLVER%TERMINATE()
237 CALL this%MAT%MATRIX_DESTROY()
238 CALL this%RHS%DESTROY()
239 IF (ALLOCATED(this%SOL)) DEALLOCATE(this%SOL)
240 IF (ALLOCATED(this%NU)) DEALLOCATE(this%NU)
241 IF (ALLOCATED(this%FLAG_OUTLET)) DEALLOCATE(this%FLAG_OUTLET)