6 #include "ScaleSTL/FortranTestMacros.h"
8 character(*),
intent(in) :: file
9 integer,
intent(in) :: ns
13 type(origen_stateset) :: state_set
14 logical :: loaded,saved
15 real(C_DOUBLE),
allocatable :: conc_end(:)
16 real(C_DOUBLE),
allocatable :: conc_begin(:)
19 call casew2 % initialize(libw)
20 loaded = casew2 % set_initial_concentrations_from_file(file,ns)
21 expect_eq(0,casew2%nsteps())
22 call casew2 % set_times([0.d0])
26 saved = casew2 % save_states(
"a.f71",667)
32 call state_set%initialize()
35 expect_eq(ns+1,state_set%states_size())
36 call state_set%destroy()
40 call casew2 % destroy()
55 #include "ScaleSTL/FortranTestMacros.h"
58 use origen_testpaths_m
62 use nemesis_comm
, only: build_types, initialize, finalize, node
68 real(C_DOUBLE),
parameter :: rel_bal_limit=0.001d0
72 real(C_DOUBLE),
allocatable :: times(:),conc(:,:)
73 real(C_DOUBLE),
allocatable :: fluxes(:)
74 real(C_DOUBLE),
allocatable :: sum_typ(:,:)
76 type(origen_stateset) :: state_set
78 real(C_DOUBLE) :: conc0(2)
79 integer :: ids(2), lib_type(2)
80 integer :: i, j, errors, itot, typ, stat
81 real(C_DOUBLE) :: dt,tdepl,tin,tout,runtime,mass0,rel_bal,mass
82 logical :: saved,loaded
83 real(C_DOUBLE),
allocatable :: conc_end(:)
84 real(C_DOUBLE),
allocatable :: conc_begin(:)
86 logical :: file_exists
90 if ( node() /= 0 )
call finalize
92 inquire(file=ce14_e15_filepath,exist=file_exists)
93 expect_true(file_exists)
96 call libw%initialize(ce14_e15_filepath)
100 call casew%initialize(libw)
105 allocate(times(0:nsteps),fluxes(1:nsteps))
109 times(i)=times(i-1)+dt
112 call casew%set_times(times)
116 call casew%set_fluxes(fluxes)
118 expect_false(casew%get_decay_only())
123 lib_type=[origen_sublib_2ac,origen_sublib_2ac]
124 call casew%set_initial_concentrations(2,ids,conc0,lib_type,origen_concentrationunit_grams)
132 expect_eq(nsteps,casew % nsteps())
133 nsteps = casew % nsteps()
134 itot = casew % total_nuclides()
137 call casew % get_times(times)
138 call casew % get_fluxes(fluxes)
141 allocate( conc(0:nsteps,1:itot) )
142 call casew%get_concentrations(conc)
148 allocate( sum_typ(0:nsteps,1:3) )
151 typ=casew%libw%typ_nuc(j)
153 sum_typ(i,typ)=sum_typ(i,typ)+conc(i,j)
163 mass=sum(sum_typ(i,:))
164 rel_bal=mass/mass0-1.d0
165 expect_near(mass, mass0, rel_bal_limit)
169 open(unit=71, iostat=stat, file=
"a.f71", status=
'old')
170 if (stat == 0)
close(71, status=
'delete')
173 saved = casew % save_states(
"a.f71",666)
177 call casew % get_concentrations_at_time(conc_end,nsteps)
181 call state_set%initialize()
184 expect_eq(nsteps+1,state_set%states_size())
185 call state_set%destroy()
189 call casew2 % initialize(libw)
190 loaded = casew2 % set_initial_concentrations_from_file(
"a.f71",nsteps+1)
194 call casew2 % get_concentrations0(conc_begin)
195 call casew2 % destroy()
198 do i=1,
size(conc_end,1)
199 expect_eq(conc_end(i),conc_begin(i))
206 call casew % destroy()
207 call casew2 % destroy()
219 real(C_DOUBLE) :: concentrations(:,:)
220 integer,
intent(in) :: units
222 real(C_DOUBLE),
allocatable :: conc(:,:)
225 integer,
allocatable :: nucl(:)
226 real,
allocatable :: dis(:),m(:)
230 call this % get_concentrations(conc)
231 call this % libw % get_nucl(nucl)
232 call this % libw % get_dis(dis)
233 call this % libw % get_m(m)
235 do i=1,this%libw%get_itot()
238 case(origen_concentrationunit_gatoms)
241 case(origen_concentrationunit_atoms_b_cm)
243 wt = 1.0e24 / avogadro
244 case(origen_concentrationunit_grams)
247 case(origen_concentrationunit_curies)
249 wt = 1.6283e+13 * dis(i)
252 write(error_unit,*)
"*** Error: Invalid concentration units!"
257 do n=1,this%nsteps()+1
258 concentrations(n,i)=conc(n-1,i) / wt