Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hollmann dt #67

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ cmake -DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DCMAKE_Fortran_FLAGS="-malign-double -fconvert='big-endian'" \
-DCMAKE_C_FLAGS="-malign-double" \
-DCMAKE_CXX_FLAGS="-malign-double" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g3 -ffpe-trap=zero,overflow -fbacktrace" \
-DCMAKE_C_FLAGS_DEBUG="-g3" \
-DCMAKE_CXX_FLAGS_DEBUG="-g3" ../
-DCMAKE_Fortran_FLAGS_DEBUG="-g -ffpe-trap=zero,overflow -fbacktrace" \
-DCMAKE_C_FLAGS_DEBUG="-g" \
-DCMAKE_CXX_FLAGS_DEBUG="-g" \
../

make -j VERBOSE=1
141 changes: 109 additions & 32 deletions src/korc_HDF5.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1547,25 +1547,84 @@ subroutine save_simulation_parameters(params,spp,F,P)
call save_1d_array_to_hdf5(h5file_id,dset, &
P%X%Z*params%cpp%length,attr_array)

dset = TRIM(gname) // "/ne"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%ne_2D)

dset = TRIM(gname) // "/Te"
units = params%cpp%temperature
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%Te_2D)

dset = TRIM(gname) // "/Zeff"
call rsave_2d_array_to_hdf5(h5file_id, dset, &
P%Zeff_2D)
if (.not.(params%profile_model(10:12).eq.'Hdt')) then
dset = TRIM(gname) // "/ne"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%ne_2D)

dset = TRIM(gname) // "/Te"
units = params%cpp%temperature
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%Te_2D)

dset = TRIM(gname) // "/Zeff"
call rsave_2d_array_to_hdf5(h5file_id, dset, &
P%Zeff_2D)
else
dset = TRIM(gname) // "/ne"
units = params%cpp%density
call rsave_3d_array_to_hdf5(h5file_id, dset, &
units*P%ne_3D)

dset = TRIM(gname) // "/Te"
units = params%cpp%temperature
call rsave_3d_array_to_hdf5(h5file_id, dset, &
units*P%Te_3D)

dset = TRIM(gname) // "/Zeff"
call rsave_3d_array_to_hdf5(h5file_id, dset, &
P%Zeff_3D)
endif

if (params%profile_model(10:10).eq.'H') then
if (params%profile_model(10:11).eq.'H0') then

dset = TRIM(gname) // "/RHON"
call rsave_2d_array_to_hdf5(h5file_id, dset, &
P%RHON_2D)

dset = TRIM(gname) // "/nRE"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nRE_2D)

dset = TRIM(gname) // "/nAr0"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nAr0_2D)

dset = TRIM(gname) // "/nAr1"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nAr1_2D)

dset = TRIM(gname) // "/nAr2"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nAr2_2D)

dset = TRIM(gname) // "/nAr3"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nAr3_2D)

dset = TRIM(gname) // "/nD"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nD_2D)

dset = TRIM(gname) // "/nD1"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nD1_2D)

endif

if (params%profile_model(10:12).eq.'Hdt') then

dset = TRIM(gname) // "/RHON"
call rsave_2d_array_to_hdf5(h5file_id, dset, &
P%RHON)
call rsave_3d_array_to_hdf5(h5file_id, dset, &
P%RHON_3D)

dset = TRIM(gname) // "/nRE"
units = params%cpp%density
Expand All @@ -1574,33 +1633,38 @@ subroutine save_simulation_parameters(params,spp,F,P)

dset = TRIM(gname) // "/nAr0"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nAr0_2D)
call rsave_3d_array_to_hdf5(h5file_id, dset, &
units*P%nAr0_3D)

dset = TRIM(gname) // "/nAr1"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nAr1_2D)
call rsave_3d_array_to_hdf5(h5file_id, dset, &
units*P%nAr1_3D)

dset = TRIM(gname) // "/nAr2"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nAr2_2D)
call rsave_3d_array_to_hdf5(h5file_id, dset, &
units*P%nAr2_3D)

dset = TRIM(gname) // "/nAr3"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nAr3_2D)
call rsave_3d_array_to_hdf5(h5file_id, dset, &
units*P%nAr3_3D)

dset = TRIM(gname) // "/nAr4"
units = params%cpp%density
call rsave_3d_array_to_hdf5(h5file_id, dset, &
units*P%nAr4_3D)

dset = TRIM(gname) // "/nD"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nD_2D)
call rsave_3d_array_to_hdf5(h5file_id, dset, &
units*P%nD_3D)

dset = TRIM(gname) // "/nD1"
units = params%cpp%density
call rsave_2d_array_to_hdf5(h5file_id, dset, &
units*P%nD1_2D)
call rsave_3d_array_to_hdf5(h5file_id, dset, &
units*P%nD1_3D)

endif

Expand Down Expand Up @@ -2707,20 +2771,33 @@ subroutine save_restart_variables(params,spp,F)
!! Iterator for reading all the entried of params::outputs_list.
INTEGER :: mpierr
!! MPI error status.
INTEGER :: numel_send, numel_receive
INTEGER :: numel_send, numel_receive,exei
!! Variable used by MPI to count the amount of data sent by each MPI
!! procces.
!! Variable used by MPI to count the amount of data received by the main
!! MPI procces.
LOGICAL :: exist


! if ( MODULO(params%it,params%restart_output_cadence) .EQ. 0_ip ) then
if (params%mpi_params%rank.EQ.0_idef) then

write(output_unit_write,'("Saving restart: ",I15)') &
params%it/(params%t_skip*params%t_it_SC)
write(output_unit_write,'("Saving restart: ",I15)') &
params%it/(params%t_skip*params%t_it_SC)

filename = TRIM(params%path_to_outputs) // "restart_file.h5"

inquire(FILE=filename,exist=exist)

if (exist) then
call execute_command_line("rm " // TRIM(params%path_to_outputs) // "restart_file.h5",exitstat=exei)
IF (exei/=0) then
write(6,*) 'Error removing restart_file.h5'
call korc_abort(28)
end if
end if


call h5fcreate_f(TRIM(filename), H5F_ACC_TRUNC_F, h5file_id, h5error)

dset = "it"
Expand Down Expand Up @@ -3123,7 +3200,7 @@ subroutine load_prev_iter(params)
call h5fclose_f(h5file_id, h5error)
end if

CALL MPI_BCAST(params%prev_iter_2x1t,1,MPI_REAL8,0,MPI_COMM_WORLD,mpierr)
CALL MPI_BCAST(params%prev_iter_2x1t,1,MPI_INTEGER8,0,MPI_COMM_WORLD,mpierr)

end subroutine load_prev_iter

Expand Down
Loading
Loading