commit 5e4ddf4964b6824e2215f78f55394021621283d0
parent 6d8603312cb80977c2d9b76129342adee78cb114
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 27 Sep 2017 16:52:42 +0200
Upd to handle Solstice 0.6
Diffstat:
7 files changed, 115 insertions(+), 74 deletions(-)
diff --git a/cyl/cyl.yaml b/cyl/cyl.yaml
@@ -32,15 +32,15 @@
################################################################################
- medium: &air
refractive_index: 1
- absorption: 0
+ extinction: 0
- medium: &glass
refractive_index: 1.2
- absorption: 0.02
+ extinction: 0.02
- medium: &vacuum
refractive_index: 1
- absorption: 0
+ extinction: 0
# Define a material purely absorbant (e.g. for pylons)
- material: &occultant
diff --git a/solpaths.c b/solpaths.c
@@ -38,7 +38,7 @@ main(int argc, char** argv)
CHK(sscanf(line+19, "%lf %lf (%*f %*f %*f)", &azim, &elev) == 2);
CHK(snprintf(s, sizeof(s), "%g-%g-paths.vtk", azim, elev) < sizeof(s));
if(output) fclose(output);
- printf("Write `%s'\n", s);
+ printf("Writing `%s'\n", s);
CHK(output = fopen(s, "w"));
}
}
diff --git a/solpp.c b/solpp.c
@@ -128,14 +128,12 @@ mesh_write_prim_data_vtk
} (void)0
FOR_EACH(ircv, 0, BUF_SZ(simul->rcvs)) {
const struct rcv* rcv = &BUF_AT(simul->rcvs, ircv);
- WRITE(FRONT, absorbed_flux);
- WRITE(FRONT, flux);
- WRITE(FRONT, materials_loss);
- WRITE(FRONT, atmospheric_loss);
- WRITE(BACK, absorbed_flux);
- WRITE(BACK, flux);
- WRITE(BACK, materials_loss);
- WRITE(BACK, atmospheric_loss);
+ WRITE(FRONT, in.flux);
+ WRITE(FRONT, in.flux_mat_loss);
+ WRITE(FRONT, in.flux_atm_loss);
+ WRITE(BACK, in.flux);
+ WRITE(BACK, in.flux_mat_loss);
+ WRITE(BACK, in.flux_atm_loss);
}
#undef WRITE
}
@@ -151,7 +149,7 @@ mesh_write_rcv_data_vtk
n = BUF_SZ(msh->ids)/3;
fprintf(output, "CELL_DATA %zu\n", n);
- fprintf(output, "FIELD PrimaryData 12\n");
+ fprintf(output, "FIELD PrimaryData 10\n");
#define WRITE(Side, Name) { \
fprintf(output, STR(Side)"_"STR(Name)" 2 %zu float\n", n); \
@@ -162,16 +160,14 @@ mesh_write_rcv_data_vtk
} \
} \
} (void)0
- WRITE(FRONT, absorbed_flux);
- WRITE(FRONT, flux);
- WRITE(FRONT, materials_loss);
- WRITE(FRONT, atmospheric_loss);
+ WRITE(FRONT, in.flux);
+ WRITE(FRONT, in.flux_mat_loss);
+ WRITE(FRONT, in.flux_atm_loss);
WRITE(FRONT, efficiency);
- WRITE(BACK, absorbed_flux);
- WRITE(BACK, flux);
- WRITE(BACK, materials_loss);
- WRITE(BACK, atmospheric_loss);
- WRITE(BACK, efficiency);
+ WRITE(BACK, in.flux);
+ WRITE(BACK, in.flux_mat_loss);
+ WRITE(BACK, in.flux_atm_loss);
+ WRITE(BACK, efficiency);
#undef WRITE
#define WRITE_MAP(Side) { \
@@ -305,7 +301,7 @@ main(int argc, char** argv)
CHK(snprintf(filename, sizeof(filename),
"%sprimaries.vtk", prefix) < sizeof(prefix));
- printf("Write `%s'\n", filename);
+ printf("Writing `%s'\n", filename);
CHK(output = fopen(filename, "w"));
mesh_write_vtk(output, &msh_prim);
mesh_write_prim_data_vtk(output, &msh_prim, &simul);
@@ -313,7 +309,7 @@ main(int argc, char** argv)
CHK(snprintf(filename, sizeof(filename),
"%sreceivers.vtk", prefix) < sizeof(prefix));
- printf("Write `%s'\n", filename);
+ printf("Writing `%s'\n", filename);
CHK(output = fopen(filename, "w"));
mesh_write_vtk(output, &msh_rcv);
mesh_write_rcv_data_vtk(output, &msh_rcv, &simul);
@@ -321,7 +317,7 @@ main(int argc, char** argv)
CHK(snprintf(filename, sizeof(filename),
"%smiscellaneous.obj", prefix) < sizeof(prefix));
- printf("Write `%s'\n", filename);
+ printf("Writing `%s'\n", filename);
CHK(output = fopen(filename, "w"));
mesh_write_obj(output, &msh_misc);
fclose(output);
diff --git a/solpp.h b/solpp.h
@@ -84,11 +84,17 @@ read_line(buf_char_T* b, FILE* stream)
/*******************************************************************************
* Per receiver double sided estimations
******************************************************************************/
-struct rcv {
- struct mc absorbed_flux[2];
+struct flux {
struct mc flux[2];
- struct mc materials_loss[2];
- struct mc atmospheric_loss[2];
+ struct mc flux_no_mat_loss[2];
+ struct mc flux_no_atm_loss[2];
+ struct mc flux_mat_loss[2];
+ struct mc flux_atm_loss[2];
+};
+
+struct rcv {
+ struct flux in;
+ struct flux abs;
struct mc efficiency[2];
BUF(struct mc) map[2];
char* name;
@@ -122,10 +128,8 @@ static inline void prim_release(struct prim* p) {free(p->name);}
* Per receiver X primary estimations
******************************************************************************/
struct rcvXprim {
- struct mc absorbed_flux[2];
- struct mc flux[2];
- struct mc materials_loss[2];
- struct mc atmospheric_loss[2];
+ struct flux in;
+ struct flux abs;
size_t rcv_id;
size_t prim_id;
};
@@ -326,18 +330,34 @@ read_simulation(struct simul* simul, FILE* input)
(tk,
"%zu %lf "
"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf "
- "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",
+ "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf "
+ "%lf %lf "
+ "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf "
+ "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf "
+ "%lf %lf",
&rcv->id, &rcv->area,
- GET(FRONT, absorbed_flux),
- GET(FRONT, flux),
- GET(FRONT, materials_loss),
- GET(FRONT, atmospheric_loss),
+ GET(FRONT, in.flux),
+ GET(FRONT, in.flux_no_mat_loss),
+ GET(FRONT, in.flux_no_atm_loss),
+ GET(FRONT, in.flux_mat_loss),
+ GET(FRONT, in.flux_atm_loss),
+ GET(FRONT, abs.flux),
+ GET(FRONT, abs.flux_no_mat_loss),
+ GET(FRONT, abs.flux_no_atm_loss),
+ GET(FRONT, abs.flux_mat_loss),
+ GET(FRONT, abs.flux_atm_loss),
GET(FRONT, efficiency),
- GET(BACK, absorbed_flux),
- GET(BACK, flux),
- GET(BACK, materials_loss),
- GET(BACK, atmospheric_loss),
- GET(BACK, efficiency)) == 22);
+ GET(BACK, in.flux),
+ GET(BACK, in.flux_no_mat_loss),
+ GET(BACK, in.flux_no_atm_loss),
+ GET(BACK, in.flux_mat_loss),
+ GET(BACK, in.flux_atm_loss),
+ GET(BACK, abs.flux),
+ GET(BACK, abs.flux_no_mat_loss),
+ GET(BACK, abs.flux_no_atm_loss),
+ GET(BACK, abs.flux_mat_loss),
+ GET(BACK, abs.flux_atm_loss),
+ GET(BACK, efficiency)) == 46);
#undef GET
}
@@ -369,17 +389,19 @@ read_simulation(struct simul* simul, FILE* input)
CHK(sscanf
(line,
"%zu %zu "
- "%lf %lf %lf %lf %lf %lf %lf %lf "
- "%lf %lf %lf %lf %lf %lf %lf %lf",
+ "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf "
+ "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",
&rcvXprim->rcv_id, &rcvXprim->prim_id,
- GET(FRONT, absorbed_flux),
- GET(FRONT, flux),
- GET(FRONT, materials_loss),
- GET(FRONT, atmospheric_loss),
- GET(BACK, absorbed_flux),
- GET(BACK, flux),
- GET(BACK, materials_loss),
- GET(BACK, atmospheric_loss)) == 18);
+ GET(FRONT, in.flux),
+ GET(FRONT, in.flux_no_mat_loss),
+ GET(FRONT, in.flux_no_atm_loss),
+ GET(FRONT, in.flux_mat_loss),
+ GET(FRONT, in.flux_atm_loss),
+ GET(FRONT, abs.flux),
+ GET(FRONT, abs.flux_no_mat_loss),
+ GET(FRONT, abs.flux_no_atm_loss),
+ GET(FRONT, abs.flux_mat_loss),
+ GET(FRONT, abs.flux_atm_loss)) == 22);
#undef GET
}
diff --git a/solppraw.c b/solppraw.c
@@ -19,10 +19,19 @@ static inline void
print_rcv_side(FILE* output, const enum side side, struct rcv* rcv)
{
#define W(Name) rcv->Name[side].E, rcv->Name[side].SE
- fprintf(output, " Absorbed flux | %16g +/- %-16g\n", W(absorbed_flux));
- fprintf(output, " Flux | %16g +/- %-16g\n", W(flux));
- fprintf(output, " Materials loss | %16g +/- %-16g\n", W(materials_loss));
- fprintf(output, "Atmospheric loss | %16g +/- %-16g\n", W(atmospheric_loss));
+ fprintf(output, " | [Incoming] ");
+ fprintf(output, " [Absorbed] \n");
+ fprintf(output, " Flux | %16g +/- %-16g | %16g +/- %-16g\n",
+ W(in.flux), W(abs.flux));
+ fprintf(output, " Material loss | %16g +/- %-16g | %16g +/- %-16g\n",
+ W(in.flux_mat_loss), W(abs.flux_mat_loss));
+ fprintf(output, "Atmospheric loss | %16g +/- %-16g | %16g +/- %-16g\n",
+ W(in.flux_atm_loss), W(abs.flux_atm_loss));
+ fprintf(output, "No Material loss | %16g +/- %-16g | %16g +/- %-16g\n",
+ W(in.flux_no_mat_loss), W(abs.flux_no_mat_loss));
+ fprintf(output, " No Atmos. loss | %16g +/- %-16g | %16g +/- %-16g\n",
+ W(in.flux_no_atm_loss), W(abs.flux_no_atm_loss));
+ fprintf(output, " |\n");
fprintf(output, " Efficiency | %16g +/- %-16g\n", W(efficiency));
#undef W
}
@@ -31,10 +40,18 @@ static inline void
print_rcvXprim_side(FILE* output, const enum side side, struct rcvXprim* rXp)
{
#define W(Name) rXp->Name[side].E, rXp->Name[side].SE
- fprintf(output, " Absorbed flux | %16g +/- %-16g\n", W(absorbed_flux));
- fprintf(output, " Flux | %16g +/- %-16g\n", W(flux));
- fprintf(output, " Materials loss | %16g +/- %-16g\n", W(materials_loss));
- fprintf(output, "Atmospheric loss | %16g +/- %-16g\n", W(atmospheric_loss));
+ fprintf(output, " | [Incoming] ");
+ fprintf(output, " [Absorbed] \n");
+ fprintf(output, " Flux | %16g +/- %-16g | %16g +/- %-16g\n",
+ W(in.flux), W(abs.flux));
+ fprintf(output, " Material loss | %16g +/- %-16g | %16g +/- %-16g\n",
+ W(in.flux_mat_loss), W(abs.flux_mat_loss));
+ fprintf(output, "Atmospheric loss | %16g +/- %-16g | %16g +/- %-16g\n",
+ W(in.flux_atm_loss), W(abs.flux_atm_loss));
+ fprintf(output, "No Material loss | %16g +/- %-16g | %16g +/- %-16g\n",
+ W(in.flux_no_mat_loss), W(abs.flux_no_mat_loss));
+ fprintf(output, " No Atmos. loss | %16g +/- %-16g | %16g +/- %-16g\n",
+ W(in.flux_no_atm_loss), W(abs.flux_no_atm_loss));
#undef W
}
@@ -46,7 +63,8 @@ print_simulation(FILE* output, struct simul* simul)
/* Global results */
#define W(Name) simul->Name.E, simul->Name.SE
fprintf(output, " Overall results (#Samples = %zu)\n", simul->nsamps);
- fprintf(output, "------------------------------------------------------------\n");
+ fprintf(output, "------------------------------------------------------------");
+ fprintf(output, "------------------------------\n");
fprintf(output, " Potential flux | %16g +/- %-16g\n", W(potential_flux));
fprintf(output, " Absorbed flux | %16g +/- %-16g\n", W(absorbed_flux));
fprintf(output, " Cosine factor | %16g +/- %-16g\n", W(cos_factor));
@@ -60,12 +78,14 @@ print_simulation(FILE* output, struct simul* simul)
FOR_EACH(i, 0, BUF_SZ(simul->rcvs)) {
struct rcv* rcv = &BUF_AT(simul->rcvs, i);
fprintf(output, " Receiver `%s' (Area = %g)\n", rcv->name, rcv->area);
- if(rcv->flux[FRONT].E >= 0) {
- fprintf(output, "------------------[Front]-----------------------------------\n");
+ if(rcv->in.flux[FRONT].E >= 0) {
+ fprintf(output, "-----------------------------------------------------[Front]");
+ fprintf(output, "------------------------------\n");
print_rcv_side(output, FRONT, rcv);
}
- if(rcv->flux[BACK].E >= 0) {
- fprintf(output, "-------------------[Back]-----------------------------------\n");
+ if(rcv->in.flux[BACK].E >= 0) {
+ fprintf(output, "------------------------------------------------------[Back]");
+ fprintf(output, "------------------------------\n");
print_rcv_side(output, BACK, rcv);
}
fprintf(output, "\n");
@@ -76,7 +96,8 @@ print_simulation(FILE* output, struct simul* simul)
fprintf(output, " Primary `%s' (Area = %g; #Samples = %zu)\n",
prim->name, prim->area, prim->nsamps);
#define W(Name) prim->Name.E, prim->Name.SE
- fprintf(output, "------------------------------------------------------------\n");
+ fprintf(output, "------------------------------------------------------------");
+ fprintf(output, "------------------------------\n");
fprintf(output, " Cosine factor | %16g +/- %-16g\n", W(cos_factor));
fprintf(output, " Shadow loss | %16g +/- %-16g\n", W(shadow_loss));
fprintf(output, "\n");
@@ -88,12 +109,14 @@ print_simulation(FILE* output, struct simul* simul)
struct rcv* rcv = find_receiver_by_id(simul, rXp->rcv_id);
struct prim* prim = find_primary_by_id(simul, rXp->prim_id);
fprintf(output, " Receiver `%s' X Primary `%s'\n", rcv->name, prim->name);
- if(rXp->flux[FRONT].E >= 0) {
- fprintf(output, "------------------[Front]-----------------------------------\n");
+ if(rXp->in.flux[FRONT].E >= 0) {
+ fprintf(output, "-----------------------------------------------------[Front]");
+ fprintf(output, "------------------------------\n");
print_rcvXprim_side(output, FRONT, rXp);
}
- if(rXp->flux[BACK].SE >= 0) {
- fprintf(output, "-------------------[Back]-----------------------------------\n");
+ if(rXp->in.flux[BACK].E >= 0) {
+ fprintf(output, "------------------------------------------------------[Back]");
+ fprintf(output, "------------------------------\n");
print_rcvXprim_side(output, BACK, rXp);
}
fprintf(output, "\n");
@@ -127,7 +150,7 @@ main(int argc, char** argv)
simul.azimuth, simul.elevation) < sizeof(s));
read_simulation(&simul, input);
- printf("Write `%s'\n", s);
+ printf("Writing `%s'\n", s);
CHK(output = fopen(s, "w"));
print_simulation(output, &simul);
fclose(output);
diff --git a/themis/Makefile b/themis/Makefile
@@ -15,7 +15,7 @@
include ../Makefile.in
-NEXPERIMENTS=10000000
+NEXPERIMENTS=10000
NPATHS=100
SUN_DIRS=270,70
diff --git a/themis/themis.c b/themis/themis.c
@@ -1275,7 +1275,7 @@ main(int argc, char** argv)
/* Sun & atmosphere */
print_section("Sun & atmosphere");
printf("- sun: {dni: 1000, spectrum: *solar_spectrum}\n");
- printf("- atmosphere: {absorption: 0.0001}\n");
+ printf("- atmosphere: {extinction: 0.0001}\n");
printf("\n");
/* Materials */