Unhandled exception error for bigger array sizes
Hi I need to create arrays with large sizes and I've written below code. as long as x & y (array size) ate small, there is no problem. but as soon as I enter bigger numbers for them it gives below error and make me break. Unhandled exception at 0x778d15de in twoDacid.exe: 0xC0000005: Access violation.
here is the code:
#include "StdAfx.h"
#include "math.h"
#include "iostream"
#include "fstream"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
//////////////////////////////////////////////////// constants
double poro0=0.2; // initial porosity
double mu=0.05; // acid viscusity (cp)
double L=0.5; // length of the core (cm)
double H=0.5; // width of the core
double q=1/60; // injection rate (cm3/s)
double A=H*H; // core surface area (cm2)
double U0=q/A; // initial velocity (cm/s)
double r0=1e-4; // initial mean pore radius (cm)
double a0=50; // initial interface area per unit volume (cm2/cm3)
double k0=1; // initial permeability (md)
double C0=0.15; // initial acid concentration (volume fraction)
double ks=0.2; // surface reaction rate constant (cm/s)
double Dm=4e-6; // acid diffusivity (cm2/s)
double beta=2; // Pore broadening parameter
double landaX=0.5; // constant in axial dispersion
double landaT=0.1; // constant in Transverse dispersion
double alfaos=0.5; // constant in dispersion correlation
double alfa=100/2; // gravimetric dissolving power of the acid (gr of rock / mole of acid) here for CaCO3 2moles of acid is...
//needed to dissolce 1 mole of rock ////////////// 100(gr/mol)*1mole / 2mole
double Pe=0;
double Ros=2.71; // solid density (gr/cm3)
double Roa=1; // acid density (gr/cm3) supposed to be constant
double phi2P=0.007; //2*ks*r0/Dm; // pore scale thielie module
double phi2D=1e6; //ks*a0*L^2/Dm; // Darcy scale thielie module
double Da=ks*a0*L/U0; // damkohler number
double Nac=0.1; //alfa*C0/Ros; // acid capacity number
double eta=2*r0/L;
///////////////////////////////////////////////////// solution parameters
const int x=100; // number of element in x direction
const int y=100; // number of element in y direction
double dx=1.0/x; // x block length (dimless)
double dy=(H/L)/y;
double endt=1; // end time (s)
double endtD=(endt/L)*U0; //dimless end time
const int T=100000; // number of time steps
double dt=endtD/T; // length of time steps
/////////////////////////////////////// initial valuse for parameters that vary with time:
double r[x][y];
double Av[x][y];
double K[x][y];
double u[x][y];
double Cf[x][y];
double ReP[x][y];
double Sh[x][y];
for (int i=0;i<=x-1;i++){
for (int j=0;j<=y-1;j++){
r[i][j]=1;
Av[i][j]=1;
K[i][j]=1;
u[i][j]=1;
Cf[i][j]=1;
ReP[i][j]=2*Roa*U0*r0/mu;
Sh[i][j]=3+7*(sqrt(ReP[i][j]));
}
}
///////////////////////////////////////////////// heterogenous medium
double poro[x][y];
for (int i=0;i<=x-1;i++){
for (int j=0;j<=y-1;j++){
if (j==2 && i==0)
poro[i][j ...
Can you at least indicate WHEN you are running into problems. What are larger numbers in your perception?