34 INTEGER,
INTENT (INOUT) :: ifail
35 TYPE (solver_io),
INTENT (INOUT) :: solver
43 REAL (IDS_REAL) :: rho(solver%nrho)
46 REAL (IDS_REAL) :: amix
48 REAL (IDS_REAL) :: y(solver%nrho), ym(solver%nrho)
49 REAL (IDS_REAL) :: dy(solver%nrho)
51 REAL (IDS_REAL) :: yy(solver%nrho)
53 REAL (IDS_REAL) :: a(solver%nrho), b(solver%nrho)
54 REAL (IDS_REAL) :: c(solver%nrho), d(solver%nrho)
55 REAL (IDS_REAL) :: e(solver%nrho), f(solver%nrho)
56 REAL (IDS_REAL) :: g(solver%nrho), h
57 REAL (IDS_REAL) :: dd(solver%nrho), de(solver%nrho)
59 REAL (IDS_REAL) :: v(2), u(2), w(2)
77 equation_loop1:
DO idim = 1, ndim
78 IF (solver%EQ_FLAG(idim).EQ.0) goto 20
87 rho_loop1:
DO irho=1,nrho
88 rho(irho) = solver%RHO(irho)
90 y(irho) = solver%Y(idim,irho)
91 dy(irho) = solver%DY(idim,irho)
92 ym(irho) = solver%YM(idim,irho)
94 a(irho) = solver%A(idim,irho)
95 b(irho) = solver%B(idim,irho)
96 c(irho) = solver%C(idim,irho)
97 d(irho) = solver%D(idim,irho)
98 e(irho) = solver%E(idim,irho)
99 f(irho) = solver%F(idim,irho)
100 g(irho) = solver%G(idim,irho)
122 CALL
fem_pde_solver(a,b,c,d,dd,e,de,f,g,h, &
123 ym,yy,rho,nrho,u, v, w)
128 y = y*(1.e0_ids_real-amix) + yy*amix
132 solver%Y(idim,1:solver%NRHO) = y
133 solver%DY(idim,1:solver%NRHO) = dy
137 END DO equation_loop1
152 SUBROUTINE fem_pde_solver (A,B,C,D,DD,E,DE,F,G,dt_in,&
161 INTEGER,
INTENT(in) :: n
163 REAL (IDS_REAL),
INTENT(in) :: x(n), dt_in
164 REAL (IDS_REAL),
INTENT(in) :: a(n),b(n),c(n),d(n),e(n),f(n)
165 REAL (IDS_REAL),
INTENT(in) :: g(n),dd(n),de(n),ym(n)
167 REAL (IDS_REAL),
INTENT(in) :: u(2), v(2), w(2)
169 REAL (IDS_REAL),
INTENT(inOUT) :: yy(n)
173 REAL (IDS_REAL),
DIMENSION(:,:),
ALLOCATABLE :: mat,det,kof,det1,det2,det3
175 REAL (IDS_REAL),
DIMENSION(:,:),
ALLOCATABLE :: rhs,rhs_dirichle,&
179 INTEGER,
DIMENSION(:),
ALLOCATABLE :: pivot, pivot_dirichle
183 REAL (IDS_REAL) :: ksi(4), weight(4)
184 REAL (IDS_REAL) :: n1(4), n2(4)
185 REAL (IDS_REAL) :: nn1(2,2), nn2(2,2), nn3(2,2), nn4(2,2)
186 REAL (IDS_REAL) :: dnn1(2,2), dnn2(2,2), dnn3(2,2), dnn4(2,2)
187 REAL (IDS_REAL) :: dndn(2,2)
190 INTEGER :: k, i,j, i1, i2
193 REAL (IDS_REAL) :: delx
194 REAL (IDS_REAL) :: a_in(4), b_in(4), c_in(4), d_in(4)
195 REAL (IDS_REAL) :: e_in(4), f_in(4), g_in(4)
196 REAL (IDS_REAL) :: de_in(4), dd_in(4)
197 REAL (IDS_REAL) :: af(4), bf(4), cf(4), df(4)
200 REAL (IDS_REAL) :: matlok(2,2), koflok(1,2)
201 REAL (IDS_REAL) :: det1lok(2,2),det2lok(2,2), det3lok(2,2)
204 REAL (IDS_REAL) :: pom1(1,2), pom2(2,1)
205 REAL (IDS_REAL) :: tmp1(4,2), tmp22(4), tmp2(1,4)
218 ALLOCATE(rhs_dirichle(1,n-1))
219 ALLOCATE(lhs_dirichle(n-1,n-1))
221 ALLOCATE(pivot_dirichle(n-1))
225 mat(:,:) = 0.0e0_ids_real
226 det(:,:) = 0.0e0_ids_real
227 det1(:,:)= 0.0e0_ids_real
228 det2(:,:)= 0.0e0_ids_real
229 det3(:,:)= 0.0e0_ids_real
230 kof(1,:) = 0.0e0_ids_real
232 rhs(1,:) =0.0e0_ids_real
233 lhs(:,:) =0.0e0_ids_real
235 rhs_dirichle(1,:)=0.0e0_ids_real
236 lhs_dirichle(:,:)=0.0e0_ids_real
239 ksi = (/-0.86113631e0_ids_real,-0.33998104e0_ids_real,&
240 0.33998104e0_ids_real,0.86113631e0_ids_real/)
241 weight = (/ 0.34785485e0_ids_real,0.65214515e0_ids_real,&
242 0.65214515e0_ids_real,0.34785485e0_ids_real/)
252 nn1 = matmul(pom2,pom1)
258 nn2 = matmul(pom2,pom1)
264 nn3 = matmul(pom2,pom1)
270 nn4 = matmul(pom2,pom1)
272 dndn = reshape((/1, -1, -1, 1/), shape(dndn))
276 solveeqloop:
DO k =1, n-1
286 dnn1 = matmul(pom2,pom1)
290 dnn2 = matmul(pom2,pom1)
294 dnn3 = matmul(pom2,pom1)
298 dnn4 = matmul(pom2,pom1)
301 a_in = a(k) * n1 + a(k+1) *n2
302 b_in = b(k) * n1 + b(k+1) *n2
303 c_in = c(k) * n1 + c(k+1) *n2
304 d_in = d(k) * n1 + d(k+1) *n2
305 e_in = e(k) * n1 + e(k+1) *n2
306 f_in = f(k) * n1 + f(k+1) *n2
307 g_in = g(k) * n1 + g(k+1) *n2
308 de_in = de(k) * n1 + de(k+1) *n2
309 dd_in = dd(k) * n1 + dd(k+1) *n2
313 (( c_in(1)*a_in(1) + c_in(1)*g_in(1)*dt_in + de_in(1)*dt_in )*nn1*weight(1) +&
314 ( c_in(2)*a_in(2) + c_in(2)*g_in(2)*dt_in + de_in(2)*dt_in )*nn2*weight(2) +&
315 ( c_in(3)*a_in(3) + c_in(3)*g_in(3)*dt_in + de_in(3)*dt_in )*nn3*weight(3) +&
316 ( c_in(4)*a_in(4) + c_in(4)*g_in(4)*dt_in + de_in(4)*dt_in )*nn4*weight(4) )
318 det1lok = (delx/2) * (dt_in*e_in(1)*dnn1*weight(1) + dt_in*e_in(2)*dnn2*weight(2) +&
319 dt_in*e_in(3)*dnn3*weight(3) + dt_in*e_in(4)*dnn4*weight(4))
322 det2lok = 1/(2*delx) *(dt_in*d_in(1)*weight(1) + dt_in*d_in(2)*weight(2) +&
323 dt_in*d_in(3)*weight(3) + dt_in*d_in(4)*weight(4)) * dndn
325 det3lok = (delx/2) * (c_in(1)*b_in(1)*nn1*weight(1) + c_in(2)*b_in(2)*nn2*weight(2) +&
326 c_in(3)*b_in(3)*nn3*weight(3) + c_in(4)*b_in(4)*nn4*weight(4))
330 tmp1 = reshape((/n1,n2/),shape(tmp1))
331 tmp22 = (c_in*f_in)*weight*dt_in
332 tmp2 = reshape((/tmp22/),shape(tmp2))
333 koflok = matmul(tmp2,tmp1)
334 koflok = (delx/2)*koflok
339 mat(i1:i2,i1:i2)= mat(i1:i2,i1:i2)+matlok
340 det1(i1:i2,i1:i2)=det1(i1:i2,i1:i2)+det1lok
341 det2(i1:i2,i1:i2)=det2(i1:i2,i1:i2)+det2lok
342 det3(i1:i2,i1:i2)=det3(i1:i2,i1:i2)+det3lok
343 kof(:,i1:i2)=kof(:,i1:i2)+koflok
348 lhs = mat + det1 + det2
351 rhs = reshape( (/ym/), shape(rhs))
352 rhs = matmul(rhs,det3) + kof
361 rhs(1,n)=rhs(1,n)+w(2)/v(2)*d(n)*dt_in
362 lhs(n,n) = lhs(n,n) + u(2)/v(2)*d(n)*dt_in
365 CALL dgesv(n, 1, lhs, n, pivot, rhs, n, ok)
369 ELSEIF (v(2).EQ.0)
THEN
377 lhs_dirichle(i,j) = lhs(i,j)
384 rhs_dirichle(1,i) = rhs(1,i) - w(2)/u(2) * lhs(n,i)
387 lhs_dirichle = transpose(lhs_dirichle)
389 call dgesv(n-1, 1, lhs_dirichle, n-1, pivot_dirichle, rhs_dirichle, n-1, ok)
391 rhs(1,:n-1) = rhs_dirichle(1,:)
402 IF(
ALLOCATED(pivot))
DEALLOCATE(pivot)
403 IF(
ALLOCATED(pivot_dirichle))
DEALLOCATE(pivot_dirichle)
405 IF(
ALLOCATED(mat))
DEALLOCATE(mat)
406 IF(
ALLOCATED(det))
DEALLOCATE(det)
407 IF(
ALLOCATED(kof))
DEALLOCATE(kof)
410 IF(
ALLOCATED(det1))
DEALLOCATE(det1)
411 IF(
ALLOCATED(det2))
DEALLOCATE(det2)
412 IF(
ALLOCATED(det3))
DEALLOCATE(det3)
415 IF(
ALLOCATED(rhs))
DEALLOCATE(rhs)
416 IF(
ALLOCATED(lhs))
DEALLOCATE(lhs)
419 IF(
ALLOCATED(rhs_dirichle))
DEALLOCATE(rhs_dirichle)
420 IF(
ALLOCATED(lhs_dirichle))
DEALLOCATE(lhs_dirichle)
440 INTEGER,
INTENT(in) :: n
441 REAL (IDS_REAL),
INTENT(in) :: x1(n), f(n)
442 REAL (IDS_REAL),
INTENT (out) :: fc(n)
444 fc(1)= (-1.0)*(-1.0/2.0)*((f(1)-f(2))/(x1(1)-x1(2)))&
445 &+(-2.0)*(-1.0) *((f(1)-f(3))/(x1(1)-x1(3)))&
446 &+(-3.0)*(1.0/2.0) *((f(1)-f(4))/(x1(1)-x1(4)))
448 fc(2)= (-1.0)*(-1.0/2.0)*((f(2)-f(3))/(x1(2)-x1(3)))&
449 &+(-2.0)*(-1.0) *((f(2)-f(4))/(x1(2)-x1(4)))&
450 &+(-3.0)*(1.0/2.0) *((f(2)-f(5))/(x1(2)-x1(5)))
452 fc(3)= ((1.0/4.0)*((f(4)-f(2))/(x1(4)-x1(2)))*(2.0*1.0)) &
453 &+((1.0/8.0)*((f(5)-f(1))/(x1(5)-x1(1)))*(2.0*2.0))
455 fc(4:n-1-2)= ((5.0/32.0)*((f(5:n-1-1)-f(3:n-1-3))/(x1(5:n-1-1)-x1(3:n-1-3)))*2.0*1.0)&
456 &+(1.0/8.00)*((f(6:n-1) -f(2:n-1-4))/(x1(6:n-1) -x1(2:n-1-4)))*2.0*2.0&
457 &+(1.0/32.0)*((f(7:n-1+1)-f(1:n-1-5))/(x1(7:n-1+1)-x1(1:n-1-5)))*2.0*3.0
459 fc(n-1-1)= (((1.0/4.0)*((f(n-1+1-1)-f(n-1+1-2))/(x1(n-1+1-1)-x1(n-1+1-2)))*(2*1))&
460 &+((1.0/8.0)*((f(n-1+1) -f(n-1+1-4))/(x1(n-1+1) -x1(n-1+1-4)))*(2*2)))
462 fc(n-1)= (-1.0)*(-1.0/2.0)*((f(n-1+1-1)-f(n-1+1-2))/(x1(n-1+1-1)-x1(n-1+1-2)))&
463 &+(-2.0)*(-1.0) *((f(n-1+1-1)-f(n-1+1-3))/(x1(n-1+1-1)-x1(n-1+1-3)))&
464 &+(-3.0)*(1.0/2.0) *((f(n-1+1-1)-f(n-1+1-4))/(x1(n-1+1-1)-x1(n-1+1-4)))
466 fc(n-1+1)= (-1.0)*(-1.0/2.0)*((f(n-1+1)-f(n-1+1-1))/(x1(n-1+1)-x1(n-1+1-1)))&
467 &+(-2.0)*(-1.0) *((f(n-1+1)-f(n-1+1-2))/(x1(n-1+1)-x1(n-1+1-2)))&
468 &+(-3.0)*(1.0/2.0) *((f(n-1+1)-f(n-1+1-3))/(x1(n-1+1)-x1(n-1+1-3)))
The SOLVER_IO type includes variables that are used input and output to the nuermical solver of the t...
subroutine solutionfem(SOLVER, ifail)
This subroutine is prepared to solve single transport equation in standardised form adopted by the ET...
subroutine fem_pde_solver(A, B, C, D, DD, E, DE, F, G, dt_in, YM, YY, X, N, U, V, W)
subroutine deriv_holob(N, X1, F, FC)
These subroutines calculate derivative, DY of function Y respect to argument X.
The module declares types of variables used by numerical solvers.