Skip to content

Commit

Permalink
Few fixes in RFOF
Browse files Browse the repository at this point in the history
  • Loading branch information
miekkasarki committed Jul 24, 2024
1 parent 021f273 commit 3d4a839
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ HEADERS=ascot5.h math.h consts.h list.h octree.h physlib.h error.h \
neutral.h plasma.h particle.h endcond.h B_field.h gctransform.h \
E_field.h wall.h simulate.h diag.h offload.h boozer.h mhd.h \
random.h print.h hdf5_interface.h suzuki.h nbi.h biosaw.h \
asigma.h boschhale.h mpi_interface.h rfof_interface.h
asigma.h boschhale.h mpi_interface.h rfof.h

OBJS=math.o list.o octree.o error.c \
$(DIAGOBJS) $(BFOBJS) $(EFOBJS) $(WALLOBJS) \
Expand All @@ -146,7 +146,7 @@ OBJS=math.o list.o octree.o error.c \
neutral.o plasma.o particle.o endcond.o B_field.o gctransform.o \
E_field.o wall.o simulate.o diag.o offload.o boozer.o mhd.o \
random.o print.o hdf5_interface.o suzuki.o nbi.o biosaw.o \
asigma.o mpi_interface.o boschhale.o rfof_interface.o
asigma.o mpi_interface.o boschhale.o rfof.o

BINS=test_math test_nbi test_bsearch \
test_wall_2d test_plasma test_random \
Expand Down
2 changes: 1 addition & 1 deletion src/ascot5_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ int main(int argc, char** argv) {
};

if(sim.enable_icrh) {
rfof_interface_initev_excl_marker_stuff(&(sim.rfof_data));
rfof_init_offload(&(sim.rfof_data));
}

/* Initialize marker states array ps and free marker input p */
Expand Down
2 changes: 1 addition & 1 deletion src/libascot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ void libascot_eval_rfof(

int nharm; /* For storing return value which is not used */
rfof_eval_resonance_function(
&(res_cond[k]), &nharm, &rfof_mrk, &(sim.rfof_data.rfglobal));
&(res_cond[k]), &nharm, &rfof_mrk, &sim.rfof_data);

// TODO: this should return a non-zero value for failed evaluations
rfof_eval_rf_wave(
Expand Down
10 changes: 7 additions & 3 deletions src/rfof.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <math.h>
#include <stdlib.h>
#include "physlib.h"
#include "consts.h"
#include "particle.h"
#include "rfof.h"

Expand All @@ -28,7 +29,7 @@ typedef struct rfof_output {

#ifdef RFOF
void __ascot5_icrh_routines_MOD_call_initev_excl_marker_stuff(
char* xml_filename, int **xml_filename_len, void** cptr_rfglobal,
const char* xml_filename, int **xml_filename_len, void** cptr_rfglobal,
void** cptr_rfof_input_params);
void __ascot5_icrh_routines_MOD_call_initialise_res_mem(void** cptr_mem,
int* cptr_mem_shape_i, int* cptr_mem_shape_j, void** cptr_rfglobal,
Expand Down Expand Up @@ -132,11 +133,12 @@ void rfof_set_up(rfof_marker* rfof_mrk, rfof_data* rfof) {
#ifdef RFOF
for(int i=0; i< NSIMD; i++) {
/* Initialize marker data with dummy values */
int is_accelerated = 0;
int is_already_allocated = 0;
__ascot5_icrh_routines_MOD_call_set_marker_pointers(
&(rfof_mrk->p[i]), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&is_already_allocated);
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&is_accelerated, &is_already_allocated);

/* Initialize resonance history */
__ascot5_icrh_routines_MOD_call_initialise_res_mem(
Expand Down Expand Up @@ -237,6 +239,8 @@ void rfof_resonance_check_and_kick_gc(
int is_accelerated = 0;
int is_preallocated = 1;

psi *= CONST_2PI;

int dummy_id = -1;
int* dummy_Id_ptr = &dummy_id;

Expand Down
10 changes: 5 additions & 5 deletions src/rfof.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ void rfof_init(rfof_data* rfof, rfof_data* rfof_offload_data);

void rfof_free_offload(rfof_data* rfof);

void rfof_set_marker_manually(void** cptr_marker, int* id,
real* weight, real* R, real* phi, real* z, real* psi, real* charge,
real* mass, real* Ekin, real* vnorm, real* mu, real* Pphi,
real* vpar, real* vperp, real* gyrof, real* vdriftRho, real* acceleration,
int* is_accelerated, int* is_already_allocated);
void rfof_set_marker_manually(
rfof_marker* rfof_mrk, int* id, real* weight, real* R, real* phi, real* z,
real* psi, real* charge, real* mass, real* Ekin, real* vnorm, real* mu,
real* Pphi, real* vpar, real* vperp, real* gyrof, real* vdriftRho,
real* acceleration, int* is_accelerated, int* is_already_allocated);

void rfof_set_up(rfof_marker* rfof_mrk, rfof_data* rfof_data);

Expand Down

0 comments on commit 3d4a839

Please sign in to comment.