Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
hfhsieh committed Aug 4, 2024
1 parent 1b36ac0 commit 3e71223
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions example/test_problem/Hydro/ParticleTest/check_mesh2tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion src/Output/Output_DumpData_Total_HDF5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<PAR_NATT_STORED; v++)
} // for (int v=0; v<PAR_NATT_STORED+Par_NAtt_Mesh; v++)

// free resource
H5_Status = H5Sclose( H5_MemID_ParData );
Expand Down
19 changes: 9 additions & 10 deletions src/Particle/Par_Init_Attribute_Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,19 @@ void Par_Init_Attribute_Mesh()
NItem = sscanf( Line, "%s", FirstItem );

// skip empty lines and lines starting with #
if ( NItem > 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++;
}


Expand Down
3 changes: 2 additions & 1 deletion src/Particle/Par_Output_TracerParticle_Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3e71223

Please sign in to comment.