Created
October 5, 2017 16:26
-
-
Save ishiy1993/801f2a81af6886afcf312868aeafe521 to your computer and use it in GitHub Desktop.
Formura bug sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dimension :: 1 | |
axes :: x | |
double :: h = 1/NX | |
double :: cfl = 0.1 | |
double :: dt = cfl*h*h | |
dd = fun(q) (q[i+1] + q[i-1] - 2*q[i])/(h**2) | |
begin function q = init() | |
double [] :: q = 0 | |
end function | |
begin function q' = step(q) | |
q' = q + dt*(dd q) | |
end function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initial_walls: | |
x: [50] | |
intra_node_shape: [100] | |
monitor_interval: 2 | |
mpi_grid_shape: [1] | |
temporal_blocking_interval: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mpi.h> | |
#include <math.h> | |
#include <stdbool.h> | |
#include "diffusion.h" | |
void Formura_internal(){ | |
for (int ix = 0 ; ix < 2 ;++ ix ){ | |
Facet_1_src__0_dest__1_Send.Ridge_1_St_q[ix]=q[ix+(2)];} | |
Formura_subroutine_0(3,51,-1,0,1,-1,0); | |
} | |
void Formura_internal_0(){ | |
for (int ix = 0 ; ix < 2 ;++ ix ){ | |
q[ix+(102)]=Facet_1_src__0_dest__1_Recv.Ridge_1_St_q[ix];} | |
Formura_subroutine_0(51,103,-1,0,1,-1,0); | |
} | |
void Formura_internal_1(){ | |
for (int ix = 0 ; ix < 2 ;++ ix ){ | |
Facet_m1_src__1_dest__0_Send.Ridge_m1_St_q[ix]=q[ix+(100)];} | |
Formura_subroutine_0(53,101,-1,0,1,1,0); | |
} | |
void Formura_internal_2(){ | |
for (int ix = 0 ; ix < 2 ;++ ix ){ | |
q[ix+(0)]=Facet_m1_src__1_dest__0_Recv.Ridge_m1_St_q[ix];} | |
Formura_subroutine_0(1,53,-1,0,1,1,0); | |
} | |
void Formura_subroutine_0(int argx0,int argx1,int argx2,int argx3,int argx4,int argx5,int argx6){ | |
for (int ix = argx0 ; ix < argx1 ; ix += 1 ){ | |
double a=(1.0/100.0)/*True*/; | |
double a_0=(0.1*a)/*True*/; | |
double a_1=(a_0*a)/*True*/; | |
double a_2=q[ix+(argx2)]/*True*/; | |
double a_3=q[ix+(argx3)]/*True*/; | |
double a_4=q[ix+(argx4)]/*True*/; | |
double a_5=(a_4+a_2)/*True*/; | |
double a_6=(2.0*a_3)/*True*/; | |
double a_7=(a_5-a_6)/*True*/; | |
double a_8=pow(a,2.0)/*True*/; | |
double a_9=(a_7/a_8)/*True*/; | |
double a_10=(a_1*a_9)/*True*/; | |
double a_11=(a_3+a_10)/*True*/; | |
q[ix+(argx5)+(argx6)]=a_11; | |
} | |
} |
diffusion_internal_0.c
では https://gist.github.com/ishiy1993/801f2a81af6886afcf312868aeafe521#file-diffusion_internal_0-c-L56 のようにqがただちに更新される.
https://gist.github.com/ishiy1993/801f2a81af6886afcf312868aeafe521#file-diffusion_internal_0-c-L29 や https://gist.github.com/ishiy1993/801f2a81af6886afcf312868aeafe521#file-diffusion_internal_0-c-L29 のような呼び出しはこれからの計算で必要になる値を更新してしまっているため計算がおかしくなる.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
diffusion.fmr
とdiffusion.yaml
から生成されたのがdiffusion_internal_0.c
.