17 SUBROUTINE formfunctionlocal_d(rhop, rhopd_nogp, fd, user, ierr)
29 USE mod_dft_disp_wda_d
34 USE vle_var
, Only: rhob
35 USE mod_dft
, ONLY : fa, zp
40 #include <finclude/petscsys.h> 44 petscscalar rhop(ncomp,user%gxs:user%gxe)
45 petscscalar rhopd_nogp(ncomp,user%xs:user%xe)
47 petscscalar fd(ncomp,user%xs:user%xe)
53 REAL,
dimension(user%gxs:user%gxe) :: n0,n1,n2,n3,nv1,nv2
54 REAL,
dimension(user%gxs:user%gxe) :: phi_dn0,phi_dn1,phi_dn2,phi_dn3,phi_dnv1,phi_dnv2
55 REAL,
dimension(user%gxs:user%gxe) :: phi_dn0d,phi_dn1d,phi_dn2d,phi_dn3d,phi_dnv1d,phi_dnv2d
56 REAL,
dimension(user%xs:user%xe,ncomp) :: df_drho_fmt,df_drho_fmtd
57 REAL,
dimension(user%gxs:user%gxe,ncomp) :: rhobar,
lambda,rhobard,lambdad
58 REAL,
dimension(user%xs:user%xe,ncomp) :: df_drho_chain,df_drho_chaind
62 REAL,
dimension(user%gxs:user%gxe,ncomp) :: rhop_wd,my_disp,df_disp_drk
63 REAL,
dimension(user%gxs:user%gxe,ncomp) :: rhop_wdd,my_dispd
64 REAL,
dimension(user%gxs:user%gxe) :: f_disp
65 REAL,
dimension(ncomp) :: df_drho_disp
66 REAL,
dimension(ncomp) :: df_drho_dispd
73 petscscalar :: rhopd(ncomp,user%gxs:user%gxe)
76 rhopd(1:ncomp,user%xs:user%xe) = rhopd_nogp(1:ncomp,user%xs:user%xe)
81 CALL fmt_weighted_densities_d(rhop, rhopd, n0, n1, n2, n3, nv1, nv2, &
82 & phi_dn0, phi_dn0d, phi_dn1, phi_dn1d, phi_dn2&
83 & , phi_dn2d, phi_dn3, phi_dn3d, phi_dnv1, &
84 & phi_dnv1d, phi_dnv2, phi_dnv2d, user)
86 CALL chain_aux_d(rhop, rhopd, rhobar, rhobard,
lambda, lambdad, user)
88 CALL disp_weighted_densities_d(rhop, rhopd, rhop_wd, rhop_wdd, user)
89 CALL disp_mu_d(rhop_wd, rhop_wdd, f_disp, my_disp, my_dispd, &
97 DO i = user%xs,user%xe
98 CALL fmt_dfdrho_d(i, fa, user, phi_dn0, phi_dn0d, phi_dn1, phi_dn1d&
99 & , phi_dn2, phi_dn2d, phi_dn3, phi_dn3d, phi_dnv1, &
100 & phi_dnv1d, phi_dnv2, phi_dnv2d, df_drho_fmt, &
102 CALL chain_dfdrho_d(i, rhop, rhopd,
lambda, lambdad, rhobar, rhobard&
103 & , df_drho_chain, df_drho_chaind, user)
106 CALL disp_dfdrho_wda_d(i, rhop, rhop_wd, my_disp, my_dispd, f_disp, &
107 & df_disp_drk, df_drho_disp, df_drho_dispd, user)
112 IF (zp(i) .LT. dhs(k)/2.0) vext(k) = 100000.0
114 arg1d = -df_drho_fmtd(i,k)-df_drho_chaind(i,k)-df_drho_dispd(k)
115 arg1 = chempot_res(k) - vext(k) - df_drho_fmt(i, k) - &
116 & df_drho_chain(i, k) - df_drho_disp(k)
118 fd(k, i) = rhob(1,k)*arg1d*exp(arg1) - rhopd(k, i)
122 END SUBROUTINE formfunctionlocal_d
135 Subroutine jac_shell_ad(Jshell,v_in,v_out)
140 #include "finclude/petsc.h90" 148 petscscalar,
pointer :: xd(:), rhop_loc(:,:),fd(:)
149 petscerrorcode :: ierr
157 call snesgetapplicationcontext(snes,user,ierr)
158 call snesgetdm(snes,da,ierr)
161 call dmgetlocalvector(da,rhop_local,ierr)
164 call dmglobaltolocalbegin(da,x,insert_values,rhop_local,ierr)
165 call dmglobaltolocalend(da,x,insert_values,rhop_local,ierr)
168 call dmdavecgetarrayf90(da,rhop_local,rhop_loc,ierr)
169 call vecgetarrayf90(v_in, xd, ierr )
170 call vecgetarrayf90(v_out, fd, ierr )
173 call dmdagetcorners(da, &
175 & petsc_null_integer, &
176 & petsc_null_integer, &
178 & petsc_null_integer, &
179 & petsc_null_integer, &
182 call dmdagetghostcorners(da, &
184 & petsc_null_integer, &
185 & petsc_null_integer, &
187 & petsc_null_integer, &
188 & petsc_null_integer, &
195 user%gxs = user%gxs+1
197 user%xe = user%xs+user%xm-1
198 user%gxe = user%gxs+user%gxm-1
207 call formfunctionlocal_d(rhop_loc,xd,fd,user,ierr)
214 call dmdavecrestorearrayf90(da,rhop_local,rhop_loc,ierr )
215 call vecrestorearrayf90( v_in, xd, ierr )
216 call vecrestorearrayf90( v_out, fd, ierr )
217 call dmrestorelocalvector(da,rhop_local,ierr)
220 End Subroutine jac_shell_ad
226 Subroutine jac_matrix_empty(snes,v_x,jac,B,flag,dummy,ierr)
228 #include "finclude/petsc.h90" 233 petscerrorcode :: ierr
235 End Subroutine jac_matrix_empty
double lambda
Latent heat of blowing agent, J/kg.
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...
This module contains variables associated with the PETSc solver.
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains the vari...
In this module, the application context is defined.
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...