Skip to content

Commit

Permalink
Define a_r_1d_rj_r and a_r_1d_rj_r with radius_1d_rj_r
Browse files Browse the repository at this point in the history
  • Loading branch information
hiromatsui committed Dec 20, 2024
1 parent f1f2606 commit 74cf68c
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 88 deletions.
4 changes: 2 additions & 2 deletions src/Fortran_libraries/MHD_src/sph_MHD/Makefile.depends
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ dup_fields_on_circle_to_IO.o: $(MHD_SPH_DIR)/dup_fields_on_circle_to_IO.f90 m_pr
$(F90) -c $(F90OPTFLAGS) $<
explicit_scalars_sph.o: $(MHD_SPH_DIR)/explicit_scalars_sph.f90 m_precision.o t_spheric_parameter.o t_spheric_rj_data.o t_boundary_data_sph_MHD.o t_physical_property.o t_base_field_labels.o t_base_force_labels.o t_diffusion_term_labels.o t_explicit_term_labels.o t_phys_data.o select_diff_adv_source.o cal_inner_core_rotation.o
$(F90) -c $(F90OPTFLAGS) $<
field_at_mid_equator.o: $(MHD_SPH_DIR)/field_at_mid_equator.f90 m_precision.o m_constants.o m_machine_parameter.o t_field_on_circle.o t_circle_transform.o t_spheric_parameter.o calypso_mpi.o calypso_mpi_real.o t_spheric_rj_data.o t_phys_data.o t_phys_address.o t_sph_circle_parameters.o transfer_to_long_integers.o
field_at_mid_equator.o: $(MHD_SPH_DIR)/field_at_mid_equator.f90 m_precision.o m_constants.o m_machine_parameter.o t_field_on_circle.o t_circle_transform.o t_spheric_parameter.o t_spheric_rj_data.o calypso_mpi.o calypso_mpi_real.o t_phys_data.o t_phys_address.o t_sph_circle_parameters.o transfer_to_long_integers.o
$(F90) -c $(F90OPTFLAGS) $<
fill_scalar_field.o: $(MHD_SPH_DIR)/fill_scalar_field.f90 m_precision.o m_constants.o t_boundary_params_sph_MHD.o
$(F90) -c $(F90OPTFLAGS) $<
Expand All @@ -146,7 +146,7 @@ init_external_magne_sph.o: $(MHD_SPH_DIR)/init_external_magne_sph.f90 m_precisio
$(F90) -c $(F90OPTFLAGS) $<
init_radial_infos_sph_mhd.o: $(MHD_SPH_DIR)/init_radial_infos_sph_mhd.f90 m_precision.o calypso_mpi.o m_constants.o m_spheric_constants.o m_machine_parameter.o t_control_parameter.o t_spheric_parameter.o t_spheric_group.o t_poloidal_rotation.o t_radial_reference_field.o t_fdm_coefs.o t_sph_boundary_input_data.o t_bc_data_list.o t_boundary_data_sph_MHD.o t_phys_address.o t_phys_data.o t_work_4_sph_trans.o t_physical_property.o second_fdm_node_coefs.o third_fdm_node_to_ele.o first_fdm_ele_to_node.o material_property.o init_sph_radius_variations.o set_bc_sph_mhd.o set_radius_func_noequi.o sph_mhd_rst_IO_control.o reference_sources_from_d_rj.o init_reference_scalar.o init_external_magne_sph.o radial_reference_field_IO.o m_base_field_labels.o
$(F90) -c $(F90OPTFLAGS) $<
init_sph_radius_variations.o: $(MHD_SPH_DIR)/init_sph_radius_variations.f90 m_precision.o m_constants.o t_control_parameter.o t_spheric_parameter.o t_phys_data.o t_sph_radial_interpolate.o t_field_data_IO.o t_fdm_coefs.o calypso_mpi_real.o transfer_to_long_integers.o set_sph_radial_variations.o m_base_field_labels.o m_diffusion_term_labels.o calypso_mpi.o field_file_IO.o copy_rj_phys_data_4_IO.o set_sph_extensions.o
init_sph_radius_variations.o: $(MHD_SPH_DIR)/init_sph_radius_variations.f90 m_precision.o m_constants.o t_control_parameter.o t_spheric_rj_data.o t_phys_data.o t_sph_radial_interpolate.o t_field_data_IO.o t_fdm_coefs.o calypso_mpi_real.o transfer_to_long_integers.o set_sph_radial_variations.o m_base_field_labels.o m_diffusion_term_labels.o calypso_mpi.o field_file_IO.o copy_rj_phys_data_4_IO.o set_sph_extensions.o
$(F90) -c $(F90OPTFLAGS) $<
init_sphrical_transform_MHD.o: $(MHD_SPH_DIR)/init_sphrical_transform_MHD.f90 m_precision.o m_constants.o m_machine_parameter.o m_work_time.o calypso_mpi.o t_SPH_MHD_model_data.o t_SPH_mesh_field_data.o t_sph_trans_comm_tbl.o t_poloidal_rotation.o t_sph_trans_arrays_MHD.o t_schmidt_poly_on_rtm.o t_work_4_sph_trans.o t_legendre_trans_select.o t_sph_FFT_selector.o t_const_wz_coriolis_rtp.o t_coriolis_terms_rlm.o t_gaunt_coriolis_rlm.o t_boundary_data_sph_MHD.o t_solver_SR.o set_address_sph_trans_MHD.o set_address_sph_trans_snap.o check_sph_mhd_openmp_size.o init_sph_trans.o init_FFT_4_MHD.o pole_sph_transform.o skip_comment_f.o m_legendre_transform_list.o test_legendre_transforms.o
$(F90) -c $(F90OPTFLAGS) $<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ subroutine init_rms_sph_mhd_control(MHD_prop, sph_MHD_bc, &
if(monitor%bench%iflag_dynamobench .gt. 0) then
call init_circle_field_name_dbench(SPH_MHD%ipol, &
& monitor%circ_mid_eq%d_circle, monitor%bench)
call init_mid_equator_point_global(SPH_MHD%sph, &
& monitor%circ_mid_eq)
call init_mid_equator_point_global &
& (SPH_MHD%sph%sph_params, SPH_MHD%sph%sph_rj, &
& monitor%circ_mid_eq)
call init_circle_point_global &
& (SPH_MHD%sph, SPH_MHD%comms, trans_p, &
& monitor%circ_mid_eq, SR_sig, SR_r)
Expand Down
21 changes: 13 additions & 8 deletions src/Fortran_libraries/MHD_src/sph_MHD/field_at_mid_equator.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
!>@brief data at mid-depth of the shell at equator for dynamo benchmark
!!
!!@verbatim
!! subroutine init_mid_equator_point_global(sph, cdat)
!! type(sph_grids), intent(in) :: sph
!! subroutine init_mid_equator_point_global(sph_params, sph_rj, &
!! & cdat)
!! type(sph_shell_parameters), intent(in) :: sph_params
!! type(sph_rj_grid), intent(in) :: sph_rj
!! type(phys_address), intent(in) :: ipol
!! type(circle_fld_maker), intent(inout) :: cdat
!!
Expand Down Expand Up @@ -46,21 +48,24 @@ module field_at_mid_equator
!
! ----------------------------------------------------------------------
!
subroutine init_mid_equator_point_global(sph, cdat)
subroutine init_mid_equator_point_global(sph_params, sph_rj, &
& cdat)
!
use t_spheric_parameter
use t_spheric_rj_data
!
type(sph_grids), intent(in) :: sph
type(sph_shell_parameters), intent(in) :: sph_params
type(sph_rj_grid), intent(in) :: sph_rj
type(circle_fld_maker), intent(inout) :: cdat
!
integer(kind = kint) :: kr_ICB, kr_CMB
real(kind = kreal) :: r_MID
!
!
kr_ICB = sph%sph_params%nlayer_ICB
kr_CMB = sph%sph_params%nlayer_CMB
r_MID = half * (sph%sph_rj%radius_1d_rj_r(kr_ICB) &
& + sph%sph_rj%radius_1d_rj_r(kr_CMB))
kr_ICB = sph_params%nlayer_ICB
kr_CMB = sph_params%nlayer_CMB
r_MID = half * (sph_rj%radius_1d_rj_r(kr_ICB) &
& + sph_rj%radius_1d_rj_r(kr_CMB))
!
cdat%circle%s_circle = r_MID
cdat%circle%z_circle = zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ subroutine init_r_infos_sph_mhd_evo(bc_IO, sph_grps, MHD_BC, &
call const_third_fdm_node_to_ele(sph%sph_rj, r_n2e_3rd)
!
!* ---------- Radial variations of density and diffusivities -------
call init_radius_variations_sph_mhd(sph, r_2nd, MHD_prop, &
call init_radius_variations_sph_mhd(sph%sph_rj, r_2nd, MHD_prop, &
& radial_variation)
!
!* ---------- boundary conditions ---------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
!>@brief Set radial variations for densityuy and diffusivities
!!
!!@verbatim
!! subroutine init_radius_variations_sph_mhd(sph, r_2nd, MHD_prop, &
!! & radial_variation)
!! type(sph_grids), intent(in) :: sph
!! subroutine init_radius_variations_sph_mhd &
!! & (sph_rj, r_2nd, MHD_prop, radial_variation)
!! type(sph_rj_grid), intent(in) :: sph_rj
!! type(fdm_matrices), intent(in) :: r_2nd
!! type(MHD_evolution_param), intent(inout) :: MHD_prop
!! type(phys_data), intent(inout) :: radial_variation
Expand All @@ -22,7 +22,7 @@ module init_sph_radius_variations
use m_precision
use m_constants
use t_control_parameter
use t_spheric_parameter
use t_spheric_rj_data
use t_phys_data
use t_sph_radial_interpolate
use t_field_data_IO
Expand All @@ -45,16 +45,16 @@ module init_sph_radius_variations
!
! -------------------------------------------------------------------
!
subroutine init_radius_variations_sph_mhd(sph, r_2nd, MHD_prop, &
& radial_variation)
subroutine init_radius_variations_sph_mhd &
& (sph_rj, r_2nd, MHD_prop, radial_variation)
!
use calypso_mpi_real
use transfer_to_long_integers
use set_sph_radial_variations
use m_base_field_labels
use m_diffusion_term_labels
!
type(sph_grids), intent(in) :: sph
type(sph_rj_grid), intent(in) :: sph_rj
type(fdm_matrices), intent(in) :: r_2nd

type(MHD_evolution_param), intent(inout) :: MHD_prop
Expand All @@ -71,7 +71,7 @@ subroutine init_radius_variations_sph_mhd(sph, r_2nd, MHD_prop, &
radial_variation%num_phys_viz = radial_variation%num_phys
radial_variation%ntot_phys = radial_variation%num_phys
call alloc_phys_name(radial_variation)
call alloc_phys_data((sph%sph_rj%nidx_rj(1)+1), radial_variation)
call alloc_phys_data((sph_rj%nidx_rj(1)+1), radial_variation)
!
call set_r_variation_data_address(MHD_prop, radial_variation)

Expand All @@ -81,30 +81,30 @@ subroutine init_radius_variations_sph_mhd(sph, r_2nd, MHD_prop, &
!
if(my_rank .eq. 0) then
radial_variation%d_fld(1,1) = 0.0d0
do k = 1, sph%sph_rj%nidx_rj(1)
radial_variation%d_fld(k+1,1) = sph%sph_rj%radius_1d_rj_r(k)
do k = 1, sph_rj%nidx_rj(1)
radial_variation%d_fld(k+1,1) = sph_rj%radius_1d_rj_r(k)
end do
!
call set_sph_radial_density(my_rank, radius_name, &
& density%name, MHD_prop%fl_prop%ir_rho, &
& sph%sph_rj, r_2nd, MHD_prop%polytrope_param, &
& sph_rj, r_2nd, MHD_prop%polytrope_param, &
& radial_variation, r_itp, fld_IO)
call set_sph_radial_diffusivity(my_rank, radius_name, &
& kinetic_viscosity%name, MHD_prop%fl_prop%ir_nu, &
& sph%sph_rj, r_2nd, MHD_prop%val_viscous_param, &
& sph_rj, r_2nd, MHD_prop%val_viscous_param, &
& radial_variation, r_itp, fld_IO)
!
call set_sph_radial_diffusivity(my_rank, radius_name, &
& magnetic_diffusivity%name, MHD_prop%cd_prop%ir_eta, &
& sph%sph_rj, r_2nd, MHD_prop%val_mag_diffuse_param, &
& sph_rj, r_2nd, MHD_prop%val_mag_diffuse_param, &
& radial_variation, r_itp, fld_IO)
call set_sph_radial_diffusivity(my_rank, radius_name, &
& thermal_diffusivity%name, MHD_prop%ht_prop%ir_kappa, &
& sph%sph_rj, r_2nd, MHD_prop%val_thermal_diffuse_param, &
& sph_rj, r_2nd, MHD_prop%val_thermal_diffuse_param, &
& radial_variation, r_itp, fld_IO)
call set_sph_radial_diffusivity(my_rank, radius_name, &
& chemical_diffusivity%name, MHD_prop%cp_prop%ir_kappa, &
& sph%sph_rj, r_2nd, MHD_prop%val_comp_diffuse_param, &
& sph_rj, r_2nd, MHD_prop%val_comp_diffuse_param, &
& radial_variation, r_itp, fld_IO)
end if
!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ subroutine find_belonged_pe_4_ele &
iele_dbl%k_ref(1:numele) = 0
!$omp end parallel workshare
!
!%omp parallel do private(iele,ie_one)
!$omp parallel do private(iele,ie_one)
do iele = 1, numele
ie_one = ie(iele,1)
call find_belonged_pe_each_ele &
& (inod_dbl%num_dbl, inod_dbl%irank, ie_one, &
& iele_dbl%irank(iele), iele_dbl%k_ref(iele))
end do
!%omp end parallel do
!$omp end parallel do
!
end subroutine find_belonged_pe_4_ele
!
Expand Down Expand Up @@ -154,7 +154,7 @@ subroutine find_belonged_pe_4_surf(my_rank, inod_dbl, &
isurf_dbl%k_ref(1:numsurf) = 0
!$omp end parallel workshare
!
!%omp parallel do private(isurf,ie_surf_one,nnod_same)
!$omp parallel do private(isurf,ie_surf_one,nnod_same)
do isurf = 1, numsurf
ie_surf_one(1:num_linear_sf) = ie_surf(isurf,1:num_linear_sf)
call find_belonged_pe_each_surf &
Expand All @@ -164,14 +164,14 @@ subroutine find_belonged_pe_4_surf(my_rank, inod_dbl, &
interior_surf(isurf) &
& = set_each_interior_flag(my_rank, isurf_dbl%irank(isurf))
end do
!%omp end parallel do
!$omp end parallel do
!
icou = 0
!%omp parallel do private(isurf) reduction(+:icou)
!$omp parallel do private(isurf) reduction(+:icou)
do isurf = 1, numsurf
if(isurf_dbl%irank(isurf) .eq. my_rank) icou = icou + 1
end do
!%omp end parallel do
!$omp end parallel do
internal_surf = icou
!
end subroutine find_belonged_pe_4_surf
Expand Down Expand Up @@ -202,7 +202,7 @@ subroutine find_belonged_pe_4_edge(my_rank, inod_dbl, &
iedge_dbl%k_ref(1:numedge) = 0
!$omp end parallel workshare
!
!%omp parallel do private(iedge,ie_edge_one,nnod_same)
!$omp parallel do private(iedge,ie_edge_one,nnod_same)
do iedge = 1, numedge
ie_edge_one(1) = ie_edge(iedge,1)
ie_edge_one(2) = ie_edge(iedge,2)
Expand All @@ -213,14 +213,14 @@ subroutine find_belonged_pe_4_edge(my_rank, inod_dbl, &
interior_edge(iedge) &
& = set_each_interior_flag(my_rank, iedge_dbl%irank(iedge))
end do
!%omp end parallel do
!$omp end parallel do
!
icou = 0
!%omp parallel do private(iedge) reduction(+:icou)
!$omp parallel do private(iedge) reduction(+:icou)
do iedge = 1, numedge
if(iedge_dbl%irank(iedge) .eq. my_rank) icou = icou + 1
end do
!%omp end parallel do
!$omp end parallel do
internal_edge = icou
!
end subroutine find_belonged_pe_4_edge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,29 @@ subroutine copy_sph_1d_gl_idx_rj &
! & write(*,*) 'Baka!', my_rank, i, sph_rj%idx_gl_1d_rj_r(i)
! end do
! end if

do i = 1, sph_rj%nidx_rj(1)
j = sph_rj%idx_gl_1d_rj_r(i)
sph_rj%radius_1d_rj_r(i) = s3d_radius%radius_1d_gl(j)
end do
!
do i = 1, sph_rj%nidx_rj(2)
j = i - 1 + sph_rj%ist_rj(2)
sph_rj%idx_gl_1d_rj_j(i,1) = sph_gl1d%idx_global_rj_j(j,1)
sph_rj%idx_gl_1d_rj_j(i,2) = sph_gl1d%idx_global_rj_j(j,2)
sph_rj%idx_gl_1d_rj_j(i,3) = sph_gl1d%idx_global_rj_j(j,3)
end do
!
do i = 1, sph_rj%nidx_rj(1)
j = sph_rj%idx_gl_1d_rj_r(i)
sph_rj%radius_1d_rj_r(i) = s3d_radius%radius_1d_gl(j)
end do
!
!$omp parallel do private(i)
do i = 1, sph_rj%nidx_rj(1)
sph_rj%a_r_1d_rj_r(i) = one / sph_rj%radius_1d_rj_r(i)
sph_rj%ar_1d_rj(i,1) = sph_rj%a_r_1d_rj_r(i)
sph_rj%ar_1d_rj(i,2) = sph_rj%ar_1d_rj(i,1) &
& * sph_rj%a_r_1d_rj_r(i)
sph_rj%ar_1d_rj(i,3) = sph_rj%ar_1d_rj(i,2) &
& * sph_rj%a_r_1d_rj_r(i)
end do
!$omp end parallel do
!
end subroutine copy_sph_1d_gl_idx_rj
!
Expand Down
4 changes: 2 additions & 2 deletions src/Fortran_libraries/UTILS_src/MERGE/Makefile.depends
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ new_SPH_restart.o: $(MERGE_DIR)/new_SPH_restart.f90 m_precision.o calypso_mpi.o
$(F90) -c $(F90OPTFLAGS) $<
parallel_assemble_sph.o: $(MERGE_DIR)/parallel_assemble_sph.f90 m_precision.o m_machine_parameter.o m_constants.o t_spheric_parameter.o t_phys_data.o t_spheric_rj_data.o t_sph_radial_interpolate.o
$(F90) -c $(F90OPTFLAGS) $<
r_interpolate_marged_sph.o: $(MERGE_DIR)/r_interpolate_marged_sph.f90 m_precision.o m_constants.o calypso_mpi.o t_spheric_parameter.o t_spheric_group.o t_sph_radial_interpolate.o calypso_mpi_int.o skip_comment_f.o radial_interpolation.o
r_interpolate_marged_sph.o: $(MERGE_DIR)/r_interpolate_marged_sph.f90 m_precision.o m_constants.o calypso_mpi.o t_spheric_parameter.o t_spheric_group.o t_sph_radial_interpolate.o calypso_mpi_int.o skip_comment_f.o t_spheric_rj_data.o radial_interpolation.o
$(F90) -c $(F90OPTFLAGS) $<
set_control_newsph.o: $(MERGE_DIR)/set_control_newsph.f90 m_precision.o m_constants.o calypso_mpi.o t_file_IO_parameter.o t_control_param_assemble.o t_spectr_data_4_assemble.o calypso_mpi_real.o calypso_mpi_int.o bcast_file_IO_parameter.o m_error_IDs.o t_control_data_4_merge.o t_SPH_mesh_field_data.o t_ctl_params_gen_sph_shell.o m_file_format_switch.o set_control_platform_item.o set_control_platform_data.o set_ctl_4_shell_grids.o new_SPH_restart.o skip_comment_f.o
$(F90) -c $(F90OPTFLAGS) $<
set_merged_restart_data.o: $(MERGE_DIR)/set_merged_restart_data.f90 m_precision.o t_phys_data.o m_base_field_labels.o m_explicit_term_labels.o
$(F90) -c $(F90OPTFLAGS) $<
share_field_data.o: $(MERGE_DIR)/share_field_data.f90 m_precision.o m_constants.o calypso_mpi.o calypso_mpi_real.o calypso_mpi_int.o t_time_data.o t_phys_data.o calypso_mpi_logical.o transfer_to_long_integers.o cal_minmax_and_stacks.o t_field_data_IO.o calypso_mpi_char.o
$(F90) -c $(F90OPTFLAGS) $<
share_spectr_index_data.o: $(MERGE_DIR)/share_spectr_index_data.f90 m_precision.o m_constants.o calypso_mpi.o t_spheric_parameter.o calypso_mpi_real.o calypso_mpi_int.o transfer_to_long_integers.o
share_spectr_index_data.o: $(MERGE_DIR)/share_spectr_index_data.f90 m_precision.o m_constants.o calypso_mpi.o t_spheric_rj_data.o calypso_mpi_real.o calypso_mpi_int.o transfer_to_long_integers.o
$(F90) -c $(F90OPTFLAGS) $<
t_control_data_4_merge.o: $(MERGE_DIR)/t_control_data_4_merge.f90 m_precision.o m_machine_parameter.o t_read_control_elements.o t_ctl_data_4_platforms.o t_ctl_data_4_fields.o t_ctl_data_4_time_steps.o t_control_array_real.o t_ctl_data_gen_sph_shell.o skip_comment_f.o ctl_data_platforms_IO.o ctl_file_gen_sph_shell_IO.o ctl_data_4_time_steps_IO.o
$(F90) -c $(F90OPTFLAGS) $<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ subroutine share_org_sph_rj_data(org_sph_array)
!
!
do ip = 1, org_sph_array%num_pe
call share_sph_rj_data(ip, org_sph_array%sph(ip))
call share_sph_rj_data(ip, org_sph_array%sph(ip)%sph_rj)
end do
!
end subroutine share_org_sph_rj_data
Expand Down
Loading

0 comments on commit 74cf68c

Please sign in to comment.