Skip to content

Commit b97bd90

Browse files
committed
unified api for couple_with_injection
1 parent 6c3da76 commit b97bd90

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/gpu/transfer_fields_cuda.cu

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,29 @@ void FC_FUNC_(transfer_wavefield_discontinuity_to_device,
324324

325325
}
326326

327+
/**
328+
* @author nqdu
329+
* @brief copy injection field from host to device
330+
* @param size_face no. of points used = NDIM*num_abs_boundary_faces*NGLLSQUARE
331+
* @param veloc/tract_inj velocity/traction
332+
* @param Mesh_pointer mesh_ struct
333+
*/
334+
extern EXTERN_LANG
335+
void FC_FUNC_(transfer_injection_field_to_device,
336+
TRANSFER_INJECTION_FIELD_TO_DEVICE)(
337+
int* size_face,
338+
realw* veloc_inj,realw* traction_inj,
339+
long* Mesh_pointer) {
340+
341+
TRACE("transfer_injection_field_to_device");
342+
343+
Mesh* mp = (Mesh*)(*Mesh_pointer); //get mesh pointer out of fortran integer container
344+
345+
gpuMemcpy_todevice_realw(mp->d_veloc_inj, veloc_inj, (*size_face));
346+
gpuMemcpy_todevice_realw(mp->d_tract_inj, traction_inj, (*size_face));
347+
348+
}
349+
327350
/* ----------------------------------------------------------------------------------------------- */
328351

329352
extern EXTERN_LANG

src/specfem3D/iterate_time.F90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ subroutine iterate_time()
274274
call update_displ_Newmark()
275275
endif
276276

277+
if(COUPLE_WITH_INJECTION_TECHNIQUE) call fetch_injection_wavefield()
278+
277279
! computes acoustic domain (first)
278280
if (ACOUSTIC_SIMULATION) call compute_forces_acoustic_forward_calling()
279281
! computes elastic domain

src/specfem3D/prepare_gpu.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ subroutine prepare_GPU()
100100
NB_RUNS_ACOUSTIC_GPU, &
101101
FAULT_SIMULATION, &
102102
IS_WAVEFIELD_DISCONTINUITY, &
103+
COUPLE_WITH_INJECTION_TECHNIQUE,&
103104
UNDO_ATTENUATION_AND_OR_PML, &
104105
PML_CONDITIONS)
105106

0 commit comments

Comments
 (0)