MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
physicalProperties.f90
Go to the documentation of this file.
1 
8 module physicalproperties
9  use constants
10  use fmodena
11  implicit none
12  private
13  public polymerconductivity,gasconductivity,strutcontent
14 contains
15 !********************************BEGINNING*************************************
17 subroutine polymerconductivity(ksol,temp)
18  real(dp), intent(out) :: ksol
19  real(dp), intent(in) :: temp
20  !modena variables
21  integer(c_size_t) :: ksolTemppos
22 
23  integer(c_int) :: ret
24 
25  type(c_ptr) :: ksolModena = c_null_ptr
26  type(c_ptr) :: ksolInputs = c_null_ptr
27  type(c_ptr) :: ksolOutputs = c_null_ptr
28  ksolmodena = modena_model_new(&
29  c_char_"polymer_thermal_conductivity"//c_null_char)
30  if (modena_error_occurred()) then
31  call exit(modena_error())
32  endif
33  ksolinputs = modena_inputs_new(ksolmodena)
34  ksoloutputs = modena_outputs_new(ksolmodena)
35  ksoltemppos = modena_model_inputs_argpos(&
36  ksolmodena, c_char_"T"//c_null_char)
37  call modena_model_argpos_check(ksolmodena)
38  call modena_inputs_set(ksolinputs, ksoltemppos, temp)
39  ret = modena_model_call(ksolmodena, ksolinputs, ksoloutputs)
40  if(ret /= 0) then
41  call exit(ret)
42  endif
43  ksol=modena_outputs_get(ksoloutputs, 0_c_size_t)
44  call modena_inputs_destroy (ksolinputs)
45  call modena_outputs_destroy (ksoloutputs)
46  call modena_model_destroy (ksolmodena)
47 end subroutine polymerconductivity
48 !***********************************END****************************************
49 
50 
51 !********************************BEGINNING*************************************
53 subroutine gasconductivity(kgas,temp,xO2,xN2,xCO2,xCyP)
54  real(dp), intent(out) :: kgas
55  real(dp), intent(in) :: temp
56  real(dp), intent(in) :: xO2
57  real(dp), intent(in) :: xN2
58  real(dp), intent(in) :: xCO2
59  real(dp), intent(in) :: xCyP
60  !modena variables
61  integer(c_size_t) :: kgasTemppos
62  integer(c_size_t) :: kgasXCO2pos
63  integer(c_size_t) :: kgasXCyPpos
64  integer(c_size_t) :: kgasXO2pos
65  integer(c_size_t) :: kgasXN2pos
66 
67  integer(c_int) :: ret
68 
69  type(c_ptr) :: kgasModena = c_null_ptr
70  type(c_ptr) :: kgasInputs = c_null_ptr
71  type(c_ptr) :: kgasOutputs = c_null_ptr
72  kgasmodena = modena_model_new(&
73  c_char_"gasMixtureConductivity"//c_null_char)
74  if (modena_error_occurred()) then
75  call exit(modena_error())
76  endif
77  kgasinputs = modena_inputs_new(kgasmodena)
78  kgasoutputs = modena_outputs_new(kgasmodena)
79  kgastemppos = modena_model_inputs_argpos(&
80  kgasmodena, c_char_"T"//c_null_char)
81  kgasxco2pos = modena_model_inputs_argpos(&
82  kgasmodena, c_char_"x[A=CO2]"//c_null_char)
83  kgasxcyppos = modena_model_inputs_argpos(&
84  kgasmodena, c_char_"x[A=CyP]"//c_null_char)
85  kgasxo2pos = modena_model_inputs_argpos(&
86  kgasmodena, c_char_"x[A=O2]"//c_null_char)
87  kgasxn2pos = modena_model_inputs_argpos(&
88  kgasmodena, c_char_"x[A=N2]"//c_null_char)
89  call modena_model_argpos_check(kgasmodena)
90  call modena_inputs_set(kgasinputs, kgastemppos, temp)
91  call modena_inputs_set(kgasinputs, kgasxco2pos, xco2)
92  call modena_inputs_set(kgasinputs, kgasxcyppos, xcyp)
93  call modena_inputs_set(kgasinputs, kgasxo2pos, xo2)
94  call modena_inputs_set(kgasinputs, kgasxn2pos, xn2)
95  ret = modena_model_call(kgasmodena, kgasinputs, kgasoutputs)
96  if(ret /= 0) then
97  call exit(ret)
98  endif
99  kgas=modena_outputs_get(kgasoutputs, 0_c_size_t)
100  call modena_inputs_destroy (kgasinputs)
101  call modena_outputs_destroy (kgasoutputs)
102  call modena_model_destroy (kgasmodena)
103 end subroutine gasconductivity
104 !***********************************END****************************************
105 
106 
107 !********************************BEGINNING*************************************
109 subroutine strutcontent(strut_content,foam_density)
110  real(dp), intent(out) :: strut_content
111  real(dp), intent(in) :: foam_density
112  !modena variables
113  integer(c_size_t) :: fspos
114  integer(c_size_t) :: rhopos
115 
116  integer(c_int) :: ret
117 
118  type(c_ptr) :: fsModena = c_null_ptr
119  type(c_ptr) :: fsInputs = c_null_ptr
120  type(c_ptr) :: fsOutputs = c_null_ptr
121  fsmodena = modena_model_new(c_char_"strutContent"//c_null_char)
122  if (modena_error_occurred()) then
123  call exit(modena_error())
124  endif
125  fsinputs = modena_inputs_new(fsmodena)
126  fsoutputs = modena_outputs_new(fsmodena)
127  rhopos = modena_model_inputs_argpos(&
128  fsmodena, c_char_"rho"//c_null_char)
129  call modena_model_argpos_check(fsmodena)
130  call modena_inputs_set(fsinputs, rhopos, foam_density)
131  ret = modena_model_call(fsmodena, fsinputs, fsoutputs)
132  if(ret /= 0) then
133  call exit(ret)
134  endif
135  strut_content=modena_outputs_get(fsoutputs, 0_c_size_t)
136  call modena_inputs_destroy (fsinputs)
137  call modena_outputs_destroy (fsoutputs)
138  call modena_model_destroy (fsmodena)
139 end subroutine strutcontent
140 !***********************************END****************************************
141 end module physicalproperties