summaryrefslogtreecommitdiff
path: root/lpic/src/domain.h
diff options
context:
space:
mode:
Diffstat (limited to 'lpic/src/domain.h')
-rw-r--r--lpic/src/domain.h141
1 files changed, 141 insertions, 0 deletions
diff --git a/lpic/src/domain.h b/lpic/src/domain.h
new file mode 100644
index 0000000..2edd12a
--- /dev/null
+++ b/lpic/src/domain.h
@@ -0,0 +1,141 @@
+/*
+ This file is part of LPIC++, a particle-in-cell code for
+ simulating the interaction of laser light with plasma.
+
+ Copyright (C) 1994-1997 Roland Lichters
+
+ LPIC++ is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifndef DOMAIN_H
+#define DOMAIN_H
+
+#include <common.h>
+#include <fstream>
+#include <stdio.h>
+#include <iomanip>
+#include <math.h>
+#include <error.h>
+#include <cell.h>
+#include <particle.h>
+#include <parameter.h>
+#include <readfile.h>
+
+struct ramp {
+ int length; // linear ramp length (form=0) or inner scale length (form=1 or 2) or inner ramp length (form=3) in cells
+ int form; // 0 = linear; 1 = exponential; 2 = double exp; 3 = lin-const-lin
+ int length2; // outer scale length (form=2) or outer ramp length (form=3) in cells
+ int cutoff; // max ramplength (<0 <=> disabled) in cells
+ int gluepos; // glue-point between the two exp-ramps (form=2) -> length of the inner ramp in cells; or inner point of outer linear ramp (form=3)
+ double middens; // density of the constant portion in the middle (form=3) in fractions of ni
+ double calculate_density(int position);
+};
+
+class input_domain {
+private:
+ char errname[filename_size];
+
+public:
+ int Q_restart; // start from t>0, using restart files
+ char restart_file[filename_size];
+ int Q_restart_save;
+
+ int n_domains; // grid
+ int cells;
+ int cells_per_wl;
+ int cells_left;
+ ramp lramp; // lefthand plasma ramp
+ ramp rramp; // righthand plasma ramp
+ int cells_plasma;
+ double dx;
+
+ double ux0; // initial momentum in x-direction
+
+ double n_ion_over_nc; // plasma density
+ double n_el_over_nc;
+
+ int nsp; // particles
+ int *ppc;
+ int *fix;
+ double *z, *zmax, *m;
+ double *vtherm;
+
+ double angle; // angles of incidence
+ double Gamma, Beta; // Lorentz transformation
+ int spp; // steps per laser period
+
+ readfile rf;
+ input_domain( parameter &p );
+ void save( parameter &p );
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
+class domain {
+ private:
+
+ char errname[filename_size];
+ int domain_number;
+ int n_domains;
+ char path[filename_size];
+ input_domain input;
+
+ void restart_configuration( void );
+ void set_boundaries( void );
+ void chain_cells( void );
+ void init_cells( void );
+ void chain_particles( void );
+ void init_particles( void );
+ double gauss_rand48( void );
+ double exponential_rand( double ); // ## exponential velocity distribution
+
+public:
+
+ int n_left; // cell number at the left boundary
+ int n_right; // cell number at the right boundary
+ int n_cells; // number of cells in this domain
+
+ double dx; // cell width
+
+ struct cell *Lbuf; // lhs: left buffer cell left of left
+ struct cell *lbuf; // right buffer left of left
+ struct cell *left; // pointer to the first occupied cell
+ struct cell *right; // pointer to the last occupied cell
+ struct cell *rbuf; // rhs: left buffer cell right of right
+ struct cell *Rbuf; // right buffer right of right
+ struct cell *dummy; // definitely the last one
+
+ int n_el; // # of electrons
+ int n_ion; // # of ions
+ int n_part; // total # particles
+
+ domain( parameter &p );
+ void count_particles( void );
+ void check( void );
+
+ void reo_to_prev( int request_to_prev, int *cells_to_prev, int *parts_to_prev );
+ void reo_to_next( int request_to_next, int *cells_to_next, int *parts_to_next );
+ void reo_delete_to_prev( int cells_to_prev, int parts_to_prev );
+ void reo_delete_to_next( int cells_to_next, int parts_to_next );
+ void reo_alloc_from_prev( int cells_from_prev, int parts_from_prev );
+ void reo_alloc_from_next( int cells_from_next, int parts_from_next );
+ void reo_update_n_el_n_ion( int el_count, int ion_count );
+};
+
+
+#endif
+
+
+