commit 95d7ac221cda2877ed15e7ae1d6758afb2f606ff
parent b28218cb09646bc88fcd0ae4605526fbecc42beb
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 20 Apr 2018 14:35:25 +0200
Make the project compliant with Solstice 0.8
Update solpp as well ans the themis and cyl receiver file
Diffstat:
7 files changed, 47 insertions(+), 32 deletions(-)
diff --git a/Makefile.in b/Makefile.in
@@ -13,6 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#CFLAGS = -O2 -std=c99 -pedantic -Wall
-CFLAGS = -g -std=c99 -pedantic -Wall
+CFLAGS = -O2 -std=c99 -pedantic -Wall
+#CFLAGS = -g -std=c99 -pedantic -Wall
diff --git a/cyl/cyl-rcv.yaml b/cyl/cyl-rcv.yaml
@@ -1,5 +1,10 @@
########################################
# Receivers
########################################
-- {name: parab_trough_e.pt_pivot.tube_steel, side: FRONT_AND_BACK, per_primitive: 1}
-- {name: pt_2_e.pt_pivot.tube_steel, side: FRONT_AND_BACK, per_primitive: 1}
-\ No newline at end of file
+- name: parab_trough_e.pt_pivot.tube_steel
+ side: FRONT_AND_BACK
+ per_primitive: INCOMING_AND_ABSORBED
+
+- name: pt_2_e.pt_pivot.tube_steel
+ side: FRONT_AND_BACK
+ per_primitive: INCOMING
diff --git a/cyl/cyl.yaml b/cyl/cyl.yaml
@@ -49,7 +49,7 @@
# Define a specular material for the reflectors
- material: &specular
- front: {mirror: {reflectivity: 0.9, roughness: 0}}
+ front: {mirror: {reflectivity: 0.9, slope_error: 0}}
back: {matte: {reflectivity: 0.0}}
# Define a diffusely reflecting material for the receiver
diff --git a/solpp.c b/solpp.c
@@ -149,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 10\n");
+ fprintf(output, "FIELD PrimaryData 12\n");
#define WRITE(Side, Name) { \
fprintf(output, STR(Side)"_"STR(Name)" 2 %zu float\n", n); \
@@ -170,22 +170,24 @@ mesh_write_rcv_data_vtk
WRITE(BACK, efficiency);
#undef WRITE
- #define WRITE_MAP(Side) { \
- fprintf(output, STR(Side)"_map 2 %zu float\n", n); \
+ #define WRITE_MAP(Flux, Side) { \
+ fprintf(output, STR(Side)"_"STR(Flux)"_map 2 %zu float\n", n); \
FOR_EACH(ircv, 0, BUF_SZ(msh->entities)) { \
CHK(rcv = find_receiver_by_id(simul, BUF_AT(msh->entities, ircv))); \
- if(!BUF_SZ(rcv->map[Side])) { \
+ if(!BUF_SZ(rcv->map[Flux][Side])) { \
FOR_EACH(icell, 0, BUF_AT(msh->ncells,ircv)) fprintf(output,"-1 -1\n");\
} else { \
FOR_EACH(icell, 0, BUF_AT(msh->ncells,ircv)) { \
- const struct mc* mc = &BUF_AT(rcv->map[Side], icell); \
+ const struct mc* mc = &BUF_AT(rcv->map[Flux][Side], icell); \
fprintf(output, "%g %g\n", mc->E, mc->SE); \
} \
} \
} \
} (void)0
- WRITE_MAP(FRONT);
- WRITE_MAP(BACK);
+ WRITE_MAP(INCOMING, FRONT);
+ WRITE_MAP(INCOMING, BACK);
+ WRITE_MAP(ABSORBED, FRONT);
+ WRITE_MAP(ABSORBED, BACK);
#undef WRITE_MAP
}
diff --git a/solpp.h b/solpp.h
@@ -22,6 +22,7 @@
#define SOLPP_H
enum side { FRONT, BACK };
+enum flux_density { ABSORBED, INCOMING };
struct mc { double E/* Expected value */, SE/* Standard Error */; };
/*******************************************************************************
@@ -96,7 +97,7 @@ struct rcv {
struct flux in;
struct flux abs;
struct mc efficiency[2];
- BUF(struct mc) map[2];
+ BUF(struct mc) map[2][2]; /* Absorbed/Incoming, Front/Back */
char* name;
size_t id;
double area;
@@ -106,8 +107,10 @@ static inline void rcv_init(struct rcv* r) {memset(r, 0, sizeof(*r));}
static inline void rcv_release(struct rcv* r)
{
free(r->name);
- BUF_RELEASE(r->map[0]);
- BUF_RELEASE(r->map[1]);
+ BUF_RELEASE(r->map[ABSORBED][FRONT]);
+ BUF_RELEASE(r->map[ABSORBED][BACK]);
+ BUF_RELEASE(r->map[INCOMING][FRONT]);
+ BUF_RELEASE(r->map[INCOMING][BACK]);
}
/*******************************************************************************
@@ -231,17 +234,24 @@ read_receiver_map_side_data(struct rcv* rcv, const size_t n, FILE* input)
char* line = NULL;
size_t i;
enum side side;
+ enum flux_density flux;
+ const char* str;
CHK(line = read_line(&buf, input));
- if(!strncmp(line+8, "Front_faces", 5)) side = FRONT;
- else if(!strncmp(line+8, "Back_faces",4)) side = BACK;
+ str = line + 8;
+ if(!strncmp(str, "Front_faces", 11)) { side = FRONT; str += 12; }
+ else if(!strncmp(str, "Back_faces", 10)) { side = BACK; str += 11; }
else { fprintf(stderr, "Unexpected side name\n"); abort(); }
- CHK(read_line(&buf, input));
+ if(!strncmp(str, "Incoming_flux", 13)) { flux = INCOMING; }
+ else if(!strncmp(str, "Absorbed_flux", 13)) { flux = ABSORBED; }
+ else { fprintf(stderr, "Unexpected flux name\n"); abort(); }
+
+ CHK(read_line(&buf, input)); /* Discard "LOOKUP_TABLE default" line */
- BUF_RESIZE(rcv->map[side], n);
+ BUF_RESIZE(rcv->map[flux][side], n);
FOR_EACH(i, 0, n) {
- struct mc* mc = &BUF_AT(rcv->map[side], i);
+ struct mc* mc = &BUF_AT(rcv->map[flux][side], i);
CHK(line = read_line(&buf, input));
CHK(sscanf(line, "%lf %lf", &mc->E, &mc->SE) == 2);
}
@@ -275,15 +285,14 @@ read_receiver_map(struct simul* simul, FILE* input)
/* Read the map data of one side */
CHK(line = read_line(&buf, input));
CHK(sscanf(line, "CELL_DATA %zu", &n) == 1);
- read_receiver_map_side_data(rcv, n, input);
- fp = ftell(input);
-
- /* Read the optionnal map data of the other side */
- line = read_line(&buf, input);
- fseek(input, fp, SEEK_SET);
- if(line && !strncmp(line, "SCALAR", 6)) {
+ /* Read map data */
+ do {
read_receiver_map_side_data(rcv, n, input);
- }
+ fp = ftell(input);
+ line = read_line(&buf, input);
+ fseek(input, fp, SEEK_SET);
+ } while(line && !strncmp(line, "SCALARS", 7));
+
BUF_RELEASE(buf);
}
diff --git a/themis/Makefile b/themis/Makefile
@@ -15,7 +15,7 @@
include ../Makefile.in
-NEXPERIMENTS=1000
+NEXPERIMENTS=1000000
NPATHS=30
SUN_DIRS=270,30:160,40
diff --git a/themis/themis-rcv.yaml b/themis/themis-rcv.yaml
@@ -1,2 +1,2 @@
-- {name: target_e, side: FRONT, per_primitive: 1}
-- {name: nextcsp_rcv, side: BACK, per_primitive: 1}
+- {name: target_e, side: FRONT, per_primitive: INCOMING_AND_ABSORBED}
+- {name: nextcsp_rcv, side: BACK, per_primitive: INCOMING}