26 USE ids_schemas
, ONLY: r8 => ids_real
34 INTEGER,
INTENT (INOUT) :: ifail
35 TYPE (solver_io),
INTENT (INOUT) :: solver
43 REAL (R8) :: rho(solver%nrho)
48 REAL (R8) :: y(solver%nrho), ym(solver%nrho)
49 REAL (R8) :: dy(solver%nrho)
51 REAL (R8) :: yy(solver%nrho)
53 REAL (R8) :: a(solver%nrho), b(solver%nrho)
54 REAL (R8) :: c(solver%nrho), d(solver%nrho)
55 REAL (R8) :: e(solver%nrho), f(solver%nrho)
56 REAL (R8) :: g(solver%nrho), h
57 REAL (R8) :: dd(solver%nrho), de(solver%nrho)
59 REAL (R8) :: 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)
107 write(*,*)
' ********** LINEAR ***********'
122 CALL
fem_pde_solver2(a,b,c,d,dd,e,de,f,g,h, &
123 ym,yy,rho,nrho,u, v, w)
128 y = y*(1.e0_r8-amix) + yy*amix
133 solver%DY(idim,:) = dy
137 END DO equation_loop1
152 SUBROUTINE fem_pde_solver2 (A,B,C,D,DD,E,DE,F,G,dt_in,&
158 USE ids_schemas
, ONLY: r8 => ids_real
161 INTEGER,
INTENT(in) :: n
163 REAL (R8),
INTENT(in) :: x(n), dt_in
164 REAL (R8),
INTENT(in) :: a(n),b(n),c(n),d(n),e(n),f(n)
165 REAL (R8),
INTENT(in) :: g(n),dd(n),de(n),ym(n)
167 REAL (R8),
INTENT(in) :: u(2), v(2), w(2)
169 REAL (R8),
INTENT(inOUT) :: yy(n)
173 REAL (R8),
DIMENSION(:,:),
ALLOCATABLE :: mat,kof,det1,det2
175 REAL (R8),
DIMENSION(:,:),
ALLOCATABLE :: rhs,rhs_dirichle,&
179 INTEGER,
DIMENSION(:),
ALLOCATABLE :: pivot, pivot_dirichle
183 REAL (R8) :: ksi(4), weight(4)
184 REAL (R8) :: n1(4), n2(4)
185 REAL (R8) :: nn1(2,2), nn2(2,2), nn3(2,2), nn4(2,2)
186 REAL (R8) :: dnn1(2,2), dnn2(2,2), dnn3(2,2), dnn4(2,2)
187 REAL (R8) :: dndn(2,2)
190 INTEGER :: k, i,j, i1, i2
194 REAL (R8) :: a_in(4), b_in(4), c_in(4), d_in(4)
195 REAL (R8) :: e_in(4), f_in(4), g_in(4), ym_in(4)
198 REAL (R8) :: matlok(2,2), koflok(1,2)
199 REAL (R8) :: det1lok(2,2),det2lok(2,2)
202 REAL (R8) :: pom1(1,2), pom2(2,1)
213 ALLOCATE(rhs_dirichle(1,n-1))
214 ALLOCATE(lhs_dirichle(n-1,n-1))
216 ALLOCATE(pivot_dirichle(n-1))
228 rhs_dirichle(1,:)=0.0e0_r8
229 lhs_dirichle(:,:)=0.0e0_r8
232 ksi = (/-0.86113631e0_r8,-0.33998104e0_r8,&
233 0.33998104e0_r8,0.86113631e0_r8/)
234 weight = (/ 0.34785485e0_r8,0.65214515e0_r8,&
235 0.65214515e0_r8,0.34785485e0_r8/)
245 nn1 = matmul(pom2,pom1)
251 nn2 = matmul(pom2,pom1)
257 nn3 = matmul(pom2,pom1)
263 nn4 = matmul(pom2,pom1)
265 dndn = reshape((/1, -1, -1, 1/), shape(dndn))
269 solveeqloop:
DO k =1, n-1
279 dnn1 = matmul(pom2,pom1)
283 dnn2 = matmul(pom2,pom1)
287 dnn3 = matmul(pom2,pom1)
291 dnn4 = matmul(pom2,pom1)
294 a_in = a(k) * n1 + a(k+1) *n2
295 b_in = b(k) * n1 + b(k+1) *n2
296 c_in = c(k) * n1 + c(k+1) *n2
297 d_in = d(k) * n1 + d(k+1) *n2
298 e_in = e(k) * n1 + e(k+1) *n2
299 f_in = f(k) * n1 + f(k+1) *n2
300 g_in = g(k) * n1 + g(k+1) *n2
301 ym_in = ym(k) * n1 + ym(k+1) *n2
306 (( c_in(1)*a_in(1) + c_in(1)*g_in(1)*dt_in )*nn1*weight(1) +&
307 ( c_in(2)*a_in(2) + c_in(2)*g_in(2)*dt_in )*nn2*weight(2) +&
308 ( c_in(3)*a_in(3) + c_in(3)*g_in(3)*dt_in )*nn3*weight(3) +&
309 ( c_in(4)*a_in(4) + c_in(4)*g_in(4)*dt_in )*nn4*weight(4) )
311 det1lok = -1*(delx/2) * (dt_in*e_in(1)*dnn1*weight(1) + dt_in*e_in(2)*dnn2*weight(2) +&
312 dt_in*e_in(3)*dnn3*weight(3) + dt_in*e_in(4)*dnn4*weight(4))
315 det2lok = 1/(2*delx) *(dt_in*d_in(1)*weight(1) + dt_in*d_in(2)*weight(2) +&
316 dt_in*d_in(3)*weight(3) + dt_in*d_in(4)*weight(4)) * dndn
318 koflok(1,1) = (delx/2) *(&
319 ( c_in(1)*b_in(1)*ym_in(1) + c_in(1)*f_in(1)*dt_in )*n1(1)*weight(1) +&
320 ( c_in(2)*b_in(2)*ym_in(2) + c_in(2)*f_in(2)*dt_in )*n1(2)*weight(2) +&
321 ( c_in(3)*b_in(3)*ym_in(3) + c_in(3)*f_in(3)*dt_in )*n1(3)*weight(3) +&
322 ( c_in(4)*b_in(4)*ym_in(4) + c_in(4)*f_in(4)*dt_in )*n1(4)*weight(4) );
323 koflok(1,2) = (delx/2) *(&
324 ( c_in(1)*b_in(1)*ym_in(1) + c_in(1)*f_in(1)*dt_in )*n2(1)*weight(1) +&
325 ( c_in(2)*b_in(2)*ym_in(2) + c_in(2)*f_in(2)*dt_in )*n2(2)*weight(2) +&
326 ( c_in(3)*b_in(3)*ym_in(3) + c_in(3)*f_in(3)*dt_in )*n2(3)*weight(3) +&
327 ( c_in(4)*b_in(4)*ym_in(4) + c_in(4)*f_in(4)*dt_in )*n2(4)*weight(4) )
335 mat(i1:i2,i1:i2)= mat(i1:i2,i1:i2)+matlok
336 det1(i1:i2,i1:i2)=det1(i1:i2,i1:i2)+det1lok
337 det2(i1:i2,i1:i2)=det2(i1:i2,i1:i2)+det2lok
338 kof(:,i1:i2)=kof(:,i1:i2)+koflok
343 lhs = mat + det1 + det2
351 rhs(1,1) = rhs(1,1) + dt_in*d(1)*w(1)/v(1);
352 lhs(1,1) = lhs(1,1) + dt_in*e(1);
355 IF ((v(2).NE.0) .and. (u(2).EQ.0))
THEN
357 rhs(1,n)=rhs(1,n)+w(2)/v(2)*d(n)*dt_in
358 lhs(n,n) = lhs(n,n) +e(n)*dt_in
361 CALL dgesv(n, 1, lhs, n, pivot, rhs, n, ok)
364 ELSEIF (v(2).EQ.0 .and. (u(2).NE.0))
THEN
369 lhs_dirichle(i,j) = lhs(i,j)
376 rhs_dirichle(1,i) = rhs(1,i) - w(2)/u(2) * lhs(i,n)
379 lhs_dirichle = transpose(lhs_dirichle)
381 call dgesv(n-1, 1, lhs_dirichle, n-1, pivot_dirichle, rhs_dirichle, n-1, ok)
383 rhs(1,:n-1) = rhs_dirichle(1,:)
388 lhs(n, n) = lhs(n, n) + dt_in*( d(n)*u(2)/v(2)+ e(n) )
389 rhs(1,n) = rhs(1, n) + dt_in* d(n)*w(2)/v(2);
392 CALL dgesv(n, 1, lhs, n, pivot, rhs, n, ok)
402 IF(
ALLOCATED(pivot))
DEALLOCATE(pivot)
403 IF(
ALLOCATED(pivot_dirichle))
DEALLOCATE(pivot_dirichle)
405 IF(
ALLOCATED(mat))
DEALLOCATE(mat)
406 IF(
ALLOCATED(kof))
DEALLOCATE(kof)
409 IF(
ALLOCATED(det1))
DEALLOCATE(det1)
410 IF(
ALLOCATED(det2))
DEALLOCATE(det2)
413 IF(
ALLOCATED(rhs))
DEALLOCATE(rhs)
414 IF(
ALLOCATED(lhs))
DEALLOCATE(lhs)
417 IF(
ALLOCATED(rhs_dirichle))
DEALLOCATE(rhs_dirichle)
418 IF(
ALLOCATED(lhs_dirichle))
DEALLOCATE(lhs_dirichle)
434 USE ids_schemas
, ONLY: r8 => ids_real
438 INTEGER,
INTENT(in) :: n
439 REAL (r8),
INTENT(in) :: x1(n), f(n)
440 REAL (r8),
INTENT (out) :: fc(n)
442 fc(1)= (-1.0)*(-1.0/2.0)*((f(1)-f(2))/(x1(1)-x1(2)))&
443 &+(-2.0)*(-1.0) *((f(1)-f(3))/(x1(1)-x1(3)))&
444 &+(-3.0)*(1.0/2.0) *((f(1)-f(4))/(x1(1)-x1(4)))
446 fc(2)= (-1.0)*(-1.0/2.0)*((f(2)-f(3))/(x1(2)-x1(3)))&
447 &+(-2.0)*(-1.0) *((f(2)-f(4))/(x1(2)-x1(4)))&
448 &+(-3.0)*(1.0/2.0) *((f(2)-f(5))/(x1(2)-x1(5)))
450 fc(3)= ((1.0/4.0)*((f(4)-f(2))/(x1(4)-x1(2)))*(2.0*1.0)) &
451 &+((1.0/8.0)*((f(5)-f(1))/(x1(5)-x1(1)))*(2.0*2.0))
453 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)&
454 &+(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&
455 &+(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
457 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))&
458 &+((1.0/8.0)*((f(n-1+1) -f(n-1+1-4))/(x1(n-1+1) -x1(n-1+1-4)))*(2*2)))
460 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)))&
461 &+(-2.0)*(-1.0) *((f(n-1+1-1)-f(n-1+1-3))/(x1(n-1+1-1)-x1(n-1+1-3)))&
462 &+(-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)))
464 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)))&
465 &+(-2.0)*(-1.0) *((f(n-1+1)-f(n-1+1-2))/(x1(n-1+1)-x1(n-1+1-2)))&
466 &+(-3.0)*(1.0/2.0) *((f(n-1+1)-f(n-1+1-3))/(x1(n-1+1)-x1(n-1+1-3)))
subroutine fem_pde_solver2(A, B, C, D, DD, E, DE, F, G, dt_in, YM, YY, X, N, U, V, W)
The SOLVER_IO type includes variables that are used input and output to the nuermical solver of the t...
subroutine deriv_holob2(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.
subroutine solutionfem2(SOLVER, ifail)
This subroutine is prepared to solve single transport equation in standardised form adopted by the ET...