From 3e71223319468ac1c8ab272a3ddf0efb275f5dd1 Mon Sep 17 00:00:00 2001 From: He-Feng Hsieh Date: Sun, 4 Aug 2024 12:41:40 +0800 Subject: [PATCH] Minor --- .../Hydro/ParticleTest/check_mesh2tracer.py | 10 +++++----- src/Output/Output_DumpData_Total_HDF5.cpp | 2 +- src/Particle/Par_Init_Attribute_Mesh.cpp | 19 +++++++++---------- .../Par_Output_TracerParticle_Mesh.cpp | 3 ++- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/example/test_problem/Hydro/ParticleTest/check_mesh2tracer.py b/example/test_problem/Hydro/ParticleTest/check_mesh2tracer.py index a46989ef22..354c3bdcd6 100644 --- a/example/test_problem/Hydro/ParticleTest/check_mesh2tracer.py +++ b/example/test_problem/Hydro/ParticleTest/check_mesh2tracer.py @@ -119,13 +119,13 @@ def comp_velx(ParX, ParY, Center, Ang_Freq): Center_Bg = 0.25 * param["BOX_SIZE"], 0.25 * param["BOX_SIZE"] Center_Mom = 0.50 * param["BOX_SIZE"], 0.50 * param["BOX_SIZE"] -Radius = np.hypot(ParPosX_tracer - Center_Bg[0], ParPosY_tracer - Center_Bg[1]) -Dens_IC = comp_dens(ParPosX_tracer, ParPosY_tracer, Center_Bg, param["ParTest_Dens_Bg"], param["BOX_SIZE"]) -Pres_IC = comp_pres(ParPosX_tracer, ParPosY_tracer, Center_Bg, param["ParTest_Pres_Bg"], param["BOX_SIZE"]) -VelX_IC = comp_velx(ParPosX_tracer, ParPosY_tracer, Center_Mom, param["ParTest_Ang_Freq"]) +Radius = np.hypot(ParPosX_tracer - Center_Bg[0], ParPosY_tracer - Center_Bg[1]) +Dens_ref = comp_dens(ParPosX_tracer, ParPosY_tracer, Center_Bg, param["ParTest_Dens_Bg"], param["BOX_SIZE"]) +Pres_ref = comp_pres(ParPosX_tracer, ParPosY_tracer, Center_Bg, param["ParTest_Pres_Bg"], param["BOX_SIZE"]) +VelX_ref = comp_velx(ParPosX_tracer, ParPosY_tracer, Center_Mom, param["ParTest_Ang_Freq"]) # create a data set and sort the data based on the x-coordinate position -dataset = zip(Radius, MeshDens_tracer, Dens_IC, MeshPres_tracer, Pres_IC, MeshVelX_tracer, VelX_IC) +dataset = zip(Radius, MeshDens_tracer, Dens_ref, MeshPres_tracer, Pres_ref, MeshVelX_tracer, VelX_ref) dataset = sorted(dataset) dataset = [np.array(data) for data in zip(*dataset)] diff --git a/src/Output/Output_DumpData_Total_HDF5.cpp b/src/Output/Output_DumpData_Total_HDF5.cpp index d8ee4c686b..ddd521866c 100644 --- a/src/Output/Output_DumpData_Total_HDF5.cpp +++ b/src/Output/Output_DumpData_Total_HDF5.cpp @@ -1364,7 +1364,7 @@ void Output_DumpData_Total_HDF5( const char *FileName ) Aux_Error( ERROR_INFO, "failed to write a particle attribute (lv %d, v %d) !!\n", lv, v ); H5_Status = H5Dclose( H5_SetID_ParData ); - } // for (int v=0; v 0 && FirstItem[0] != '#' ) - { -// initialize the bitwise indices and labels of mesh quantities to be mapped from - const long FieldIdx = Par_Get_MeshIndex( FirstItem ); + if ( NItem <= 0 || FirstItem[0] == '#' ) continue; - if ( FieldIdx == Idx_Undefined ) - Aux_Error( ERROR_INFO, "unknown input field label (%s) in %s !!\n", FirstItem, FileName ); +// initialize the bitwise indices and labels of mesh quantities to be mapped from + const long FieldIdx = Par_Get_MeshIndex( FirstItem ); - amr->Par->Mesh_Attr_Idx[NRow] = FieldIdx; + if ( FieldIdx == Idx_Undefined ) + Aux_Error( ERROR_INFO, "unknown input field label (%s) in %s !!\n", FirstItem, FileName ); - sprintf( amr->Par->Mesh_Attr_Label[NRow], "Mesh%s", FirstItem ); + amr->Par->Mesh_Attr_Idx[NRow] = FieldIdx; - NRow++; - } + sprintf( amr->Par->Mesh_Attr_Label[NRow], "Mesh%s", FirstItem ); + + NRow++; } diff --git a/src/Particle/Par_Output_TracerParticle_Mesh.cpp b/src/Particle/Par_Output_TracerParticle_Mesh.cpp index e3fd6e7768..80fe3db153 100644 --- a/src/Particle/Par_Output_TracerParticle_Mesh.cpp +++ b/src/Particle/Par_Output_TracerParticle_Mesh.cpp @@ -133,7 +133,8 @@ void Par_Output_TracerParticle_Mesh() double EdgeL[3], EdgeR[3]; - for (int d=0; d<3; d++) { + for (int d=0; d<3; d++) + { EdgeL[d] = amr->patch[0][lv][PID]->EdgeL[d] - dh*ParGhost; EdgeR[d] = amr->patch[0][lv][PID]->EdgeR[d] + dh*ParGhost; }