11 public input,output,print_header
20 use physicalproperties
23 use fson_value_m
, only: fson_value_get
24 type(fson_value),
pointer :: json_data
25 character(len=1024) :: strval
26 character(len=99) :: after_foaming,after_foaming0=
'after_foaming.txt' 27 character(len=99) :: bg_res=
'../../foamExpansion/results/bubbleGrowth/' 28 character(len=99) :: qmom0D_res=
'../../foamExpansion/results/CFD0D/' 29 character(len=99) :: qmom3D_res=
'../../foamExpansion/results/CFD3D/' 33 json_data => fson_parse(
"../inputs/foamAging.json")
34 call fson_get(json_data,
"numerics.timeStart",
tbeg)
35 call fson_get(json_data,
"numerics.timeEnd",
tend)
36 call fson_get(json_data,
"numerics.numberOfOutputs",
nroutputs)
37 call fson_get(json_data,
"numerics.wallDiscretization",
divwall)
38 call fson_get(json_data,
"numerics.cellDiscretization",
divcell)
39 call fson_get(json_data,
"numerics.sheetDiscretization",
divsheet)
40 call fson_get(json_data,
"foamCondition.foamHalfThickness",
dfoam)
41 call fson_get(json_data,
"foamCondition.inProtectiveSheet",
sheet)
44 json_data,
"foamCondition.sheetThickness",
dsheet)
46 call fson_get(json_data,
"foamCondition.agingTemperature",
temp)
47 call fson_get(json_data,
"foamCondition.conductivityTemperature",
temp_cond)
48 call fson_get(json_data,
"foamCondition.initialPressure",
pressure)
49 call fson_get(json_data,
"foamCondition.boundaryPressure.O2",
pbg(1))
50 call fson_get(json_data,
"foamCondition.boundaryPressure.N2",
pbg(2))
51 call fson_get(json_data,
"foamCondition.boundaryPressure.CO2",
pbg(3))
53 json_data,
"foamCondition.boundaryPressure.Cyclopentane",
pbg(4))
54 call fson_get(json_data,
"sourceOfProperty.gasComposition", strval)
55 if (strval==
"BubbleGrowth")
then 56 after_foaming=trim(adjustl(bg_res))//trim(adjustl(after_foaming0))
57 open(unit=newunit(fi),file=after_foaming)
66 elseif (strval==
"Qmom0D")
then 67 after_foaming=trim(adjustl(qmom0d_res))//trim(adjustl(after_foaming0))
68 open(unit=newunit(fi),file=after_foaming)
77 elseif (strval==
"Qmom3D")
then 78 after_foaming=trim(adjustl(qmom3d_res))//trim(adjustl(after_foaming0))
79 open(unit=newunit(fi),file=after_foaming)
88 elseif (strval==
"DirectInput")
then 89 call fson_get(json_data,
"foamCondition.initialComposition.O2",
xg(1))
90 call fson_get(json_data,
"foamCondition.initialComposition.N2",
xg(2))
91 call fson_get(json_data,
"foamCondition.initialComposition.CO2",
xg(3))
93 json_data,
"foamCondition.initialComposition.Cyclopentane",
xg(4))
96 write(*,*)
'unknown source for gas composition' 99 call fson_get(json_data,
"sourceOfProperty.foamDensity", strval)
100 if (strval==
"BubbleGrowth")
then 101 after_foaming=trim(adjustl(bg_res))//trim(adjustl(after_foaming0))
102 open(unit=newunit(fi),file=after_foaming)
107 elseif (strval==
"Qmom0D")
then 108 after_foaming=trim(adjustl(qmom0d_res))//trim(adjustl(after_foaming0))
109 open(unit=newunit(fi),file=after_foaming)
114 elseif (strval==
"Qmom3D")
then 115 after_foaming=trim(adjustl(qmom3d_res))//trim(adjustl(after_foaming0))
116 open(unit=newunit(fi),file=after_foaming)
121 elseif (strval==
"DirectInput")
then 122 call fson_get(json_data,
"morphology.foamDensity",
rhof)
124 write(*,*)
'unknown source for foam density' 127 call fson_get(json_data,
"sourceOfProperty.cellSize", strval)
128 if (strval==
"BubbleGrowth")
then 129 after_foaming=trim(adjustl(bg_res))//trim(adjustl(after_foaming0))
130 open(unit=newunit(fi),file=after_foaming)
135 elseif (strval==
"Qmom0D")
then 136 after_foaming=trim(adjustl(qmom0d_res))//trim(adjustl(after_foaming0))
137 open(unit=newunit(fi),file=after_foaming)
142 elseif (strval==
"Qmom3D")
then 143 after_foaming=trim(adjustl(qmom3d_res))//trim(adjustl(after_foaming0))
144 open(unit=newunit(fi),file=after_foaming)
149 elseif (strval==
"DirectInput")
then 150 call fson_get(json_data,
"morphology.cellSize",
dcell)
152 write(*,*)
'unknown source for cell size' 155 call fson_get(json_data,
"sourceOfProperty.strutContent", strval)
156 if (strval==
"StrutContent")
then 158 elseif (strval==
"DirectInput")
then 159 call fson_get(json_data,
"morphology.strutContent",
fstrut)
161 write(*,*)
'unknown source for strut content' 164 call fson_get(json_data,
"sourceOfProperty.wallThickness", strval)
165 if (strval==
"DirectInput")
then 166 call fson_get(json_data,
"morphology.wallThickness",
dwall)
168 write(*,*)
'unknown source for wall thickness' 171 call fson_get(json_data,
"physicalProperties.polymerDensity",
rhop)
172 call fson_get(json_data, &
173 "physicalProperties.foam.solubilityModel.O2", strval)
174 if (strval==
"constant")
then 176 elseif ( strval==
"modena" )
then 179 print*,
"Solubility model must be constant or modena" 181 call fson_get(json_data, &
182 "physicalProperties.foam.solubilityModel.N2", strval)
183 if (strval==
"constant")
then 185 elseif ( strval==
"modena" )
then 188 print*,
"Solubility model must be constant or modena" 190 call fson_get(json_data, &
191 "physicalProperties.foam.solubilityModel.CO2", strval)
192 if (strval==
"constant")
then 194 elseif ( strval==
"modena" )
then 197 print*,
"Solubility model must be constant or modena" 199 call fson_get(json_data, &
200 "physicalProperties.foam.solubilityModel.Cyclopentane", strval)
201 if (strval==
"constant")
then 203 elseif ( strval==
"modena" )
then 206 print*,
"Solubility model must be constant or modena" 209 call fson_get(json_data,
"physicalProperties.foam.solubility.O2",
sg(1))
212 call fson_get(json_data,
"physicalProperties.foam.solubility.N2",
sg(2))
216 json_data,
"physicalProperties.foam.solubility.CO2",
sg(3))
220 json_data,
"physicalProperties.foam.solubility.Cyclopentane",
sg(4))
222 call fson_get(json_data, &
223 "physicalProperties.foam.diffusivityModel.O2", strval)
224 if (strval==
"constant")
then 226 elseif ( strval==
"modena" )
then 229 print*,
"Diffusivity model must be constant or modena" 231 call fson_get(json_data, &
232 "physicalProperties.foam.diffusivityModel.N2", strval)
233 if (strval==
"constant")
then 235 elseif ( strval==
"modena" )
then 238 print*,
"Diffusivity model must be constant or modena" 240 call fson_get(json_data, &
241 "physicalProperties.foam.diffusivityModel.CO2",strval)
242 if (strval==
"constant")
then 244 elseif ( strval==
"modena" )
then 247 print*,
"Diffusivity model must be constant or modena" 249 call fson_get(json_data, &
250 "physicalProperties.foam.diffusivityModel.Cyclopentane", strval)
251 if (strval==
"constant")
then 253 elseif ( strval==
"modena" )
then 256 print*,
"Diffusivity model must be constant or modena" 259 call fson_get(json_data, &
260 "physicalProperties.foam.diffusivity.O2",
dg(1))
263 call fson_get(json_data, &
264 "physicalProperties.foam.diffusivity.N2",
dg(2))
267 call fson_get(json_data, &
268 "physicalProperties.foam.diffusivity.CO2",
dg(3))
271 call fson_get(json_data, &
272 "physicalProperties.foam.diffusivity.Cyclopentane",
dg(4))
275 call fson_get(json_data, &
276 "physicalProperties.sheet.solubility.O2",
sheetsg(1))
277 call fson_get(json_data, &
278 "physicalProperties.sheet.solubility.N2",
sheetsg(2))
279 call fson_get(json_data, &
280 "physicalProperties.sheet.solubility.CO2",
sheetsg(3))
281 call fson_get(json_data, &
282 "physicalProperties.sheet.solubility.Cyclopentane",
sheetsg(4))
283 call fson_get(json_data, &
284 "physicalProperties.sheet.diffusivity.O2",
sheetdg(1))
285 call fson_get(json_data, &
286 "physicalProperties.sheet.diffusivity.N2",
sheetdg(2))
287 call fson_get(json_data, &
288 "physicalProperties.sheet.diffusivity.CO2",
sheetdg(3))
289 call fson_get(json_data, &
290 "physicalProperties.sheet.diffusivity.Cyclopentane",
sheetdg(4))
292 call fson_destroy(json_data)
302 subroutine output(iprof, time, ystate, neq, pp)
305 use model
, only:
ngas,
dz,mor,nfv,sol
306 integer,
intent(in) :: iprof
307 integer,
intent(in) :: neq
308 real(dp),
intent(in) :: time
309 real(dp),
intent(in) :: ystate(:)
310 real(dp),
intent(out) :: pp(:)
315 character(len=1) :: name_1
316 character(len=2) :: name_2
317 character(len=3) :: name_3
318 character(len=4) :: name_f
321 write(name_1,
'(I1)') iprof
322 name_f =
'000' // name_1
323 elseif (iprof >= 10 .and. iprof < 100)
then 324 write(name_2,
'(I2)') iprof
325 name_f =
'00' // name_2
326 elseif (iprof >= 100 .and. iprof < 1000)
then 327 write(name_3,
'(I3)') iprof
328 name_f =
'0' // name_3
330 write(name_f,
'(I4)') iprof
332 open(unit=11,file=
'H2perm_'//trim(name_f)//
'.dat')
333 open(unit=12,file=
'ppar_'//trim(name_f)//
'.dat')
337 write (11,100) time/(3600*24),pos,&
338 ystate(
ngas*(i-1)+1)*sol(
ngas*(i-1)+1),&
339 ystate(
ngas*(i-1)+2)*sol(
ngas*(i-1)+2),&
340 ystate(
ngas*(i-1)+3)*sol(
ngas*(i-1)+3),&
341 ystate(
ngas*(i-1)+4)*sol(
ngas*(i-1)+4)
349 pos=pos+(
dz(i-1)+
dz(i))/2
353 pp(j)=pp(j)+ystate(
ngas*(i-1)+j)*rg*
temp 356 write (12,101) time/(3600*24),pos,ystate(
ngas*(i-1)+1)*rg*
temp,&
364 100
format (f8.2,2x,es23.8e3,2x,es23.8e3,2x,es23.8e3,2x,es23.8e3,2x,es23.8e3)
365 101
format (f8.2,2x,es23.8e3,2x,es23.8e3,2x,es23.8e3,2x,es23.8e3,2x,es23.8e3)
366 end subroutine output
374 subroutine print_header
378 write(*,
'(A30,EN12.3,1x,A)')
'foam density:',
rhof,
'kg/m3' 379 write(*,
'(A30,EN12.3)')
'porosity:',
eps 380 write(*,
'(A30,EN12.3)')
'strut content:',
fstrut 381 write(*,
'(A30,EN12.3,1x,A)')
'cell size:',
dcell,
'm' 382 write(*,
'(A30,EN12.3,1x,A)')
'wall thickness:',
dwall,
'm' 384 write(*,
'(A30,EN12.3,1x,A)')
'sheet thickness:',
dsheet,
'm' 386 write(*,
'(A30,EN12.3,1x,A)')
'foam thickness:',
dfoam,
'm' 387 write(*,
'(A30,I12)')
'number of cells:',
ncell 388 write(*,
'(A30,EN12.3,1x,A)')
'aging temperature:',
temp,
'K' 389 write(*,
'(A30,EN12.3,1x,A)')
'conductivity temperature:',
temp_cond,
'K' 390 print*,
'Physical properties:' 391 write(*,
'(A30,EN12.3,1x,A)')
'polymer density:',
rhop,
'kg/m3' 392 write(*,
'(A30,EN12.3,1x,A)')
'diffusivity in gas:',
dgas,
'm2/s' 393 write(*,
'(A30,EN12.3,1x,A)')
'O2 diffusivity:',
dg(1),
'm2/s' 394 write(*,
'(A30,EN12.3,1x,A)')
'N2 diffusivity:',
dg(2),
'm2/s' 395 write(*,
'(A30,EN12.3,1x,A)')
'CO2 diffusivity:',
dg(3),
'm2/s' 396 write(*,
'(A30,EN12.3,1x,A)')
'pentane diffusivity:',
dg(4),
'm2/s' 397 write(*,
'(A30,EN12.3,1x,A)')
'O2 solubility:',
sg(1),
'g/g/bar' 398 write(*,
'(A30,EN12.3,1x,A)')
'N2 solubility:',
sg(2),
'g/g/bar' 399 write(*,
'(A30,EN12.3,1x,A)')
'CO2 solubility:',
sg(3),
'g/g/bar' 400 write(*,
'(A30,EN12.3,1x,A)')
'pentane solubility:',
sg(4),
'g/g/bar' 401 write(*,
'(A30,EN12.3,1x,A)')
'O2 permeability:',
sg(1)*
dg(1),
'm2/s*g/g/bar' 402 write(*,
'(A30,EN12.3,1x,A)')
'N2 permeability:',
sg(2)*
dg(2),
'm2/s*g/g/bar' 403 write(*,
'(A30,EN12.3,1x,A)')
'CO2 permeability:',
sg(3)*
dg(3),
'm2/s*g/g/bar' 404 write(*,
'(A30,EN12.3,1x,A)')
'pentane permeability:',
sg(4)*
dg(4),&
407 write(*,
'(A30,I12)')
'finite volumes in wall:',
divwall 408 write(*,
'(A30,I12)')
'finite volumes in cell:',
divcell 410 write(*,
'(A30,I12)')
'finite volumes in sheet:',
divsheet 412 write(*,
'(A30,I12)')
'finite volumes in total:',nfv
413 write(*,
'(A30,EN12.3,1x,A)')
'initial time:',
tbeg,
's' 414 write(*,
'(A30,EN12.3,1x,A)')
'end time:',
tend,
's' 415 end subroutine print_header
integer divwall
number of grid points in wall
integer, dimension(:), allocatable solmodel
solubility model
real(dp), dimension(:), allocatable xg
molar fractions of gases
integer ngas
number of dissolved gases
real(dp), dimension(:), allocatable sheetsg
gas solubility in sheet
integer divcell
number of grid points in cell
real(dp) rhop
polymer density
real(dp) temp
temperature (K)
real(dp) tbeg
time at the end
real(dp) eps
foam porosity
integer, dimension(:), allocatable diffmodel
diffusivity model
real(dp), dimension(:), allocatable pbg
boundary conditions
real(dp), dimension(:), allocatable dz
spatial discretization
real(dp), dimension(:), allocatable pressure
partial pressure(Pa)
real(dp), dimension(:), allocatable dg
gas diffusiviy in polymer
real(dp) dfoam
foam thickness
real(dp) rhof
foam density
integer nroutputs
number of outer endme steps
real(dp) fstrut
strut content
real(dp), dimension(:), allocatable sheetdg
gas diffusivity in sheet
integer divsheet
number of grid points in sheet
real(dp), dimension(:), allocatable sg
gas solubility in polymer
integer ncell
number of cells
real(dp) dsheet
sheet thickness
real(dp) temp_cond
temperature of conductivity measurements
namespace with global variables
logical sheet
determines if sheet is used on the outside of the foam
real(dp) dgas
gas diffusivity in gasphase
real(dp) dwall
wall thickness