Delphi 7 e Erro de Access Violation no meu Código

21/05/2018

1

Prezados amigos, estou com um código escrito em PASCAL e compilado no Delphi 7. Ele está apresentando erro de execução de access violation e vi que o problema é na declaração de uma procedure, mas não vejo nada errado com ela. Algum de vocês podem dar uma olhada no código para ver se encontra o erro? Já usei breakpoints mas o melhor que consegui foi encontrar a posição do erro, mas não a solução do erro. Fico no aguardo, atenciosamente, Edisson Sávio.
Responder

Posts

Poste a linha de código nesta posição do erro que você encontrou para analisarmos.
Responder

21/05/2018

Edisson Maciel

Segue a procedure que apresenta erro na sua declaração. A questão é como vocês vão saber se no código não apresenta a declaração errada? Vocês tem que ver o código, na minha opinião. Mas aguardo seus comentários. Se precisarem do código eu mando para vocês. Obrigado, Edisson Sávio.

{----------------------------------------------------------------------------------------------------------------}

{----------------------------------------------------------------------------------------------------------------}
{ Defining the Temperature in the Field }
{----------------------------------------------------------------------------------------------------------------}

PROCEDURE Field_Temperatures_5_Species_TECNE(imax,jmax:INTEGER;a_char,Tref:DOUBLE;Computational:Computational_data;Physical_properties:Physical_data;General:General_data;Properties:SPEC1;Air:SPEC3;Q:TYPE1;VAR Temperatures:TYPE13); export;

{ This procedure calculates the translational/rotational temperature of the field to all volumes of the computational }
{ mesh. The initial temperature is estimated by the problem's initial condition. Posteriorly, the state equation }
{ involving mixture total energy, mixture internal energy, mixture Cartesian velocity components, and the mixture }
{ formation enthalpy is employed. From the definition of the internal energy [ei = Cv(mixt).(T-Tref)], an expression }
{ for the translational/rotational temperature is obtained. The thermal equilibrium is admited; Due to the thermal }
{ equilibrium hypothesis, the equality of translational and rotational temperatures is assumed and any vibrational }
{ mode is not considered. It is a strong hypothesis, but as initial study is valid. The translational / rotational }
{ temperature is redefined when the magnetic option is active. The Z energy variable should be considered together }
{ with the modulus of the magnetic field. }

TYPE

TYPE20 = ARRAY[1..14] OF DOUBLE;
Primitive_Variables = ^TYPE20;

VAR

f1 : TEXTFILE;
i,j : INTEGER;
Primitive : Primitive_Variables;
Mi_Mag,Cv_mixt,dhf_mixt : ^DOUBLE;

{ Order of Primitive variables }

{ Primitive^[1] = Den; }
{ Primitive^[2] = u; }
{ Primitive^[3] = v; }
{ Primitive^[4] = Z; }
{ Primitive^[5] = Bx; }
{ Primitive^[6] = By; }
{ Primitive^[7] = B; }
{ Primitive^[8] = En; }
{ Primitive^[9] = cs1; }
{ Primitive^[10] = cs2; }
{ Primitive^[11] = cs3; }
{ Primitive^[12] = cs4; }
{ Primitive^[13] = cs5; }
{ Primitive^[14] = ei_int; }

BEGIN

{ Main part of this procedure }

ASSIGNFILE(f1,'TEMPERATURAS.DAT');
REWRITE(f1);

{ Defining pointer }

NEW(Primitive);
NEW(Mi_Mag);
NEW(Cv_mixt);
NEW(dhf_mixt);

{ Volume temperatures }

FOR i := 1 TO (imax-1) DO

FOR j := 1 TO (jmax-1) DO

BEGIN

{ Volume temperatures at the first iteration determined by the initial condition }

IF (Computational.Iter = 0) THEN

{ Nondimensionalized initial temperature of each volume }

Temperatures[i,j,1] := Physical_properties.Temperature/a_char+Tref

ELSE

{ For the other iterations... }

BEGIN

{ Five species model composed of N, O, N2, O2, and NO. }

Primitive^[1] := Q[i,j,1];
Primitive^[2] := Q[i,j,2]/Q[i,j,1];
Primitive^[3] := Q[i,j,3]/Q[i,j,1];

{ Calculation of the mass fractions }

Primitive^[9] := Q[i,j,5]/Q[i,j,1];
Primitive^[10] := Q[i,j,6]/Q[i,j,1];
Primitive^[12] := Q[i,j,7]/Q[i,j,1];
Primitive^[13] := Q[i,j,8]/Q[i,j,1];
Primitive^[11] := 1.0E0-(Primitive^[9]+Primitive^[10]+Primitive^[12]+Primitive^[13]);

{ Calculation of the mixture specific heat at constant volume }

Cv_mixt^ := Primitive^[9]*Properties[1].Heat+Primitive^[10]*Properties[2].Heat+Primitive^[11]*Properties[3].Heat+Primitive^[12]*Properties[4].Heat+Primitive^[13]*Properties[5].Heat;

{ Calculation of the mixture formation enthalpy }

dhf_mixt^ := Primitive^[9]*Properties[1].Enthalpy+Primitive^[10]*Properties[2].Enthalpy+Primitive^[11]*Properties[3].Enthalpy+Primitive^[12]*Properties[4].Enthalpy+Primitive^[13]*Properties[5].Enthalpy;

{ Considering or not the magnetic effect }

IF (General.Magnetic = Gaitonde_1999) THEN

BEGIN

{ Considering magnetic field }

Primitive^[4] := Q[i,j,4]/Q[i,j,1];
Primitive^[5] := Q[i,j,13];
Primitive^[6] := Q[i,j,14];
Primitive^[7] := SQRT(Primitive^[5]*Primitive^[5]+Primitive^[6]*Primitive^[6]);
Mi_Mag^ := 1.0E0;

{ Internal energy considering magnetic field }

Primitive^[14] := Primitive^[4]-dhf_mixt^-0.5E0*(Primitive^[2]*Primitive^[2]+Primitive^[3]*Primitive^[3])-0.5E0*Air.Rb*(Primitive^[7]*Primitive^[7])/(Mi_Mag^*Primitive^[1]);

END

ELSE

BEGIN

{ Magnetic field is not considered }

Primitive^[8] := Q[i,j,4];

{ Internal energy without magnetic field actuation }

Primitive^[14] := Primitive^[8]/Primitive^[1]-dhf_mixt^-0.5E0*(Primitive^[2]*Primitive^[2]+Primitive^[3]*Primitive^[3]);

END;

{ Mixture translational/rotational temperature }

Temperatures[i,j,1] := Primitive^[14]/Cv_mixt^+Tref;

END;

WRITELN(f1,Temperatures[i,j,1]);

END;

{ The volume's temperatures are determined by the above calculations }

CLOSEFILE(f1);

DISPOSE(Primitive);
DISPOSE(Mi_Mag);
DISPOSE(Cv_mixt);
DISPOSE(dhf_mixt);

END;

{----------------------------------------------------------------------------------------------------------------}
Responder