Commit 4f592803 authored by Ruben Farinelli's avatar Ruben Farinelli
Browse files

Moved the routine for sampling photons from synchrotron distribution to main MC folder

parent 8f4f6b44
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ MC_SYNC = ${MC_INSTDIR}/../../gr_code/synchrotron
#========================================================================


LOCAL_DIR_OBJ=  ${LOCAL_DIR}/main_program.o   ${LOCAL_DIR}/check_results.o  ${LOCAL_DIR}/compute_results.o ${LOCAL_DIR}/function_integrals.o ${LOCAL_DIR}/legendre_integration.o ${LOCAL_DIR}/set_deltatau.o ${LOCAL_DIR}/slab_polarization.o ${LOCAL_DIR}/solve_rte.o ${LOCAL_DIR}/mc_slab.o ${LOCAL_DIR}/compute_stokes.o ${LOCAL_DIR}/collect_photons.o  
LOCAL_DIR_OBJ=  ${LOCAL_DIR}/main_program.o   ${LOCAL_DIR}/check_results.o  ${LOCAL_DIR}/compute_results.o ${LOCAL_DIR}/function_integrals.o ${LOCAL_DIR}/legendre_integration.o ${LOCAL_DIR}/set_deltatau.o ${LOCAL_DIR}/slab_polarization.o ${LOCAL_DIR}/solve_rte.o ${LOCAL_DIR}/mc_slab.o ${LOCAL_DIR}/compute_stokes.o ${LOCAL_DIR}/collect_photons.o  ${LOCAL_DIR}/simul_sync.o

MC_POLARIZATION_OBJ=${MC_POLARIZATION}/ortonormal_axes.o ${MC_POLARIZATION}/unpolarized_seedphot.o ${MC_POLARIZATION}/polarization_probability.o ${MC_POLARIZATION}/depolarization_probability.o ${MC_POLARIZATION}/electfield_as_new.o ${MC_POLARIZATION}/sample_azim_angle.o ${MC_POLARIZATION}/allocate_stokes_pointer.o ${MC_POLARIZATION}/disk_polarizationelectricfield.o ${MC_POLARIZATION}/pdeg_atmosphere.o ${MC_POLARIZATION}/write_polardata.o ${MC_POLARIZATION}/select_quadrant.o $ ${MC_POLARIZATION}/detector_axis.o

@@ -26,13 +26,13 @@ MC_ELE_DISTRIBUTION_OBJ=${MC_ELE_DISTRIBUTION}/hybrid/eledist_hybrid.o ${MC_ELE_

MC_COORD_OBJ=${MC_COORD}/versor_boost.o ${MC_COORD}/elmag_lorentztransform.o 

MC_GENERAL_OBJ=${MC_INSTDIR}/../../gr_code/clock_random.o ${MC_INSTDIR}/../../gr_code/dmatrix.o ${MC_INSTDIR}/../../gr_code/round_to_digits.o ${MC_INSTDIR}/general_routines/gauleg.o ${MC_INSTDIR}/general_routines/numpar.o ${MC_INSTDIR}/general_routines/stringpar.o ${MC_INSTDIR}/general_routines/strrev.o ${MC_INSTDIR}/general_routines/stringconcat.o ${MC_INSTDIR}/general_routines/interpolate_kn.o ${MC_INSTDIR}/../../gr_code/dot_prod.o  ${MC_GENERAL}/read_array.o ${MC_INSTDIR}/../../gr_code/vect_prod.o ${MC_GENERAL}/read_matrix.o ${MC_GENERAL}/energy_lorentz_boost.o ${MC_GENERAL}/new_energy_erf.o ${MC_GENERAL}/make_array_angles.o ${MC_INSTDIR}/../../gr_code/init_mpi.o ${MC_INSTDIR}/../../gr_code/abs_val.o ${MC_GENERAL}/make_array_energy.o
MC_GENERAL_OBJ=${MC_INSTDIR}/../../gr_code/clock_random.o ${MC_INSTDIR}/../../gr_code/dmatrix.o ${MC_INSTDIR}/../../gr_code/round_to_digits.o ${MC_INSTDIR}/general_routines/gauleg.o ${MC_INSTDIR}/general_routines/numpar.o ${MC_INSTDIR}/general_routines/stringpar.o ${MC_INSTDIR}/general_routines/strrev.o ${MC_INSTDIR}/general_routines/stringconcat.o ${MC_INSTDIR}/general_routines/interpolate_kn.o ${MC_INSTDIR}/../../gr_code/dot_prod.o  ${MC_GENERAL}/read_array.o ${MC_INSTDIR}/../../gr_code/vect_prod.o ${MC_GENERAL}/read_matrix.o ${MC_GENERAL}/energy_lorentz_boost.o ${MC_GENERAL}/new_energy_erf.o ${MC_GENERAL}/make_array_angles.o ${MC_INSTDIR}/../../gr_code/init_mpi.o ${MC_INSTDIR}/../../gr_code/abs_val.o ${MC_GENERAL}/make_array_energy.o  ${MC_INSTDIR}/../../gr_code/trig_funct.o

MC_SEED_OBJ=${MC_SEED}/bb_spec.o

MC_HYDRO_OBJ=${MC_HYDRO}/reverse_array.o

MC_SYNC_OBJ=${MC_SYNC}/envelop_gaussian.o ${MC_SYNC}/optimize_envelop.o ${MC_SYNC}/sync_distribution.o ${MC_SYNC}/setup_syncvariables.o
MC_SYNC_OBJ=${MC_SYNC}/envelop_gaussian.o ${MC_SYNC}/optimize_envelop.o ${MC_SYNC}/sync_distribution.o ${MC_SYNC}/setup_syncvariables.o ${MC_SYNC}/sync_seedphotons.o ${MC_SYNC}/metropolis_gibbs.o

MC_SLAB_OBJ=${MC_SLAB}/electricfield_fromfile.o ${MC_SLAB}/read_resultsfile.o  ${MC_SLAB}/setup_gsl_objects.o ${MC_SLAB}/compute_cumulative_angdist.o 

+1 −1
Original line number Diff line number Diff line

$CC -o zio metropolis_gibbs.c  ${MC_INSTDIR}/../../gr_code/clock_random.c ${MC_INSTDIR}/../../gr_code/synchrotron/sync_distribution.c -I ${HEADERS_GSL}   -I ${MC_INSTDIR}/../../include/ -I ${HEADERS_MPI} -I ${HEADERS_CFITSIO}  -L ${LIB_GSL}  -lm -lgsl -lgslcblas
$CC -o zio main_test_sync.c  ${MC_INSTDIR}/../../gr_code/synchrotron/metropolis_gibbs.c  ${MC_INSTDIR}/../../gr_code/clock_random.c ${MC_INSTDIR}/../../gr_code/synchrotron/sync_distribution.c -I ${HEADERS_GSL}   -I ${MC_INSTDIR}/../../include/ -I ${HEADERS_MPI} -I ${HEADERS_CFITSIO}  -L ${LIB_GSL}  -lm -lgsl -lgslcblas
+9 −14
Original line number Diff line number Diff line
#include "iteration_functions.h"
#include "globals.h"
#include <mpi.h>
#include <stdio.h>

char* set_filename(char* root, char* tau_char, char* seed_char, char* albedo, char* method);

int seed;
double kte;
double ktbb;
double tau_c;
double disktau;
double albedobase;
double gmin;
double gmax;
double p1;


char* polarization_file;
char* diffusion_file;
char* polardisk;

int FlagEleDist;
int nph;
int rank;

//int nph;
//int rank;

int kiter;
int DiskPolarizationFlag;
int Albedoflag;

char* outspec;
char* polarfile;
//char* outspec;
//char* polarfile;
char* integral;
char* diffusion;
//char* diffusion;
char* polarinput;

FILE* dat_spectrum;
@@ -289,7 +284,7 @@ int main(int argc, char* argv[])

    //status = slab_mc(nph, seed);

    optimize_envelop();
    simul_sync();
    
    
    // check_results(Spline_sample_Iu, Spline_eval_pdeg, Spline_eval_limbdark);

main_test_sync.c

0 → 100644
+24 −0
Original line number Diff line number Diff line
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <local_header.h>
#include <synchrotron.h>


int main()
{

	int ii;
	double energy=0;
	double csi=0;

	for (ii=0; ii< 150000; ii++)
	{
		metropolis_gibbs_sampling(&energy, &csi, 50);
		printf("%lf %lf  %5.4e\n", energy, csi, Psync_total(energy, csi));
	}


    return 0;
}
+9 −15
Original line number Diff line number Diff line
@@ -25,28 +25,22 @@ double distance_top(double z0, double kz, double H);
/*Datatypes defined in the header globals.h*/
/*==================================================================*/

double obsmindeg;
double obsmaxdeg;
//double obsmindeg;
//double obsmaxdeg;

double* col1;
double* col2;
double* array_angles;
double* array_ubounds;

double** array_gb;
double** ptr_gb;
double** ptr_2colfile;
double** array_gb;
//double* array_angles;
//double* array_ubounds;

int nstepangles;
//double** array_gb;
//double** ptr_2colfile;

char* matrix_gb;

const gsl_root_fsolver_type* T_phi;
gsl_root_fsolver* s_phi;

const gsl_root_fsolver_type* T_disk;
gsl_root_fsolver* s_disk;
//const gsl_root_fsolver_type* T_disk;
//gsl_root_fsolver* s_disk;

const gsl_root_fsolver_type* T_maxw;
gsl_root_fsolver* s_maxw;
@@ -83,7 +77,7 @@ int slab_mc(int nphot, int seed)
  double Hphot;
  double L_top;
  double tau;
  double eps;
  //double eps;
  double l_int;
  double csi;
  double Pdeg;
Loading