I am now trying to read in the same way as I write…This is my code.
-------------gen_press.F--------------------
program vort
implicit none
integer untin
real v_ycen, v_xcen
real v_strength, v_width, v_cl_x
integer i, j, ncel_x, ncel_y, two
double precision x, y, r1sq, r2sq, rblob
double precision press(-1:129, -1:145)
(snip)
open(55,file=‘press’,form=‘formatted’,status = ‘new’, access =
‘sequential’)
! Setting Vorticity in press
do j = -1,129
y = float(j)delta2+ylo
do i = -1,97
x = float(i)delta1+xlo
r1sq = (x-v_xcen)**2 + (y-v_ycen)**2
r2sq = (x-(twov_cl_x-v_xcen))**2 + (y-v_ycen)**2
press(i,j) = twov_strength/((1.d0-dexp(-1.d0))v_width)
(dexp(-r1sq/v_width2)-dexp(-r2sq/v_width2))
write (55,) press(i,j)
end do
end do
do j = 47,145
y = float(j)delta2/2+ylo
do i = 95,113
x = float(i)delta1/2+xlo
r1sq = (x-v_xcen)**2 + (y-v_ycen)**2
r2sq = (x-(twov_cl_x-v_xcen))**2 + (y-v_ycen)**2
press(i,j) = twov_strength/((1.d0-dexp(-1.d0))v_width)
(dexp(-r1sq/v_width2)-dexp(-r2sq/v_width2))
write (55,) press(i,j)
end do
end do
do j = 47,65
y = float(j)delta2/2+ylo
do i = 111,129
x = float(i)delta1/2+xlo
r1sq = (x-v_xcen)**2 + (y-v_ycen)**2
r2sq = (x-(twov_cl_x-v_xcen))**2 + (y-v_ycen)**2
press(i,j) = twov_strength/((1.d0-dexp(-1.d0))v_width)
(dexp(-r1sq/v_width2)-dexp(-r2sq/v_width2))
write (55,*) press(i,j)
end do
end do
I am trying to read ‘press’ in another code (Prob_2D.F) which contains
a bunch of subroutines, I am modifying the sub routine ‘FORT_INITDATA’
------- FORT_INITDATA--------------------------
subroutine FORT_INITDATA(level,time,lo,hi,nscal,
& vel,scal,DIMS(state),press,DIMS(press),
& delta,xlo,xhi)
implicit none
integer level, nscal, nvel
integer lo(SDIM), hi(SDIM)
integer DIMDEC(state)
integer DIMDEC(press)
REAL_T xlo(SDIM), xhi(SDIM)
REAL_T time, delta(SDIM)
REAL_T vel(DIMV(state),SDIM)
REAL_T scal(DIMV(state),nscal)
c REAL_T press(DIMV(press)) … commented out
double precision press(-1:129, -1:145) … creating an array
similar to the array in gen_press.F
include “htdata.H”
include “probdata.H”
integer i, j, n
REAL_T x, y
integer slo(SDIM), shi(SDIM)
character*(maxspnml) name
REAL_T Patm, r1sq, r2sq
REAL_T rblob
REAL_T pmf_vals(maxspec+3),Xt(maxspec),Yt(maxspec),rEval
if ((Temp.gt.0).neqv.(RhoH.gt.0)) then
call bl_abort(‘Need both Temp and RhoH, or neither’)
end if
if ((Temp .LT. 0) .OR. (RhoH .LT. 0)) then
call bl_abort(‘No IC’‘s for system without T, RhoH’)
endif
c ------------------
c Read press.dat
c ------------------
open(55,file=‘press’,form=‘formatted’,status=‘old’)
do j = -1,129
do i = -1,97
read (55,) press(i,j)
end do
end do
do j = 47,145
do i = 95,113
read (55,) press(i,j)
end do
end do
do j = 47,65
do i = 111,129
read (55,*) press(i,j)
end do
end do
(snip)
Now I get error as
add: Command not found.
could not open
could not open
add: Command not found.
add: Command not found.
add: Command not found.
Prob_2D.F is a bunch of subroutines, these subroutines are called in
other codes. FORT_INITDATA is being called in NaviersStokes.cpp as
NavierStokes::initData ()
{
BL_PROFILE(BL_PROFILE_THIS_NAME() + “::initData()”);
//
// Initialize the state and the pressure.
//
int ns = NUM_STATE - BL_SPACEDIM;
const Real* dx = geom.CellSize();
MultiFab& S_new = get_new_data(State_Type);
MultiFab& P_new = get_new_data(Press_Type);
const Real cur_time = state[State_Type].curTime();
for (MFIter snewmfi(S_new); snewmfi.isValid(); ++snewmfi)
{
BL_ASSERT(grids[snewmfi.index()] == snewmfi.validbox());
P_new[snewmfi].setVal(0);
const int i = snewmfi.index();
const int* lo = snewmfi.validbox().loVect();
const int* hi = snewmfi.validbox().hiVect();
const int* s_lo = S_new[snewmfi].loVect();
const int* s_hi = S_new[snewmfi].hiVect();
const int* p_lo = P_new[snewmfi].loVect();
const int* p_hi = P_new[snewmfi].hiVect();
FORT_INITDATA (&level,&cur_time,lo,hi,&ns,
S_new[snewmfi].dataPtr(Xvel),
S_new[snewmfi].dataPtr(BL_SPACEDIM),
ARLIM(s_lo), ARLIM(s_hi),
P_new[snewmfi].dataPtr(),
ARLIM(p_lo), ARLIM(p_hi),
dx,grid_loc_.lo(),grid_loc.hi() );
}
shall I make the changes in the function call in NavierStokes.cpp
or shall I change my code (gen_press.F) so that it generates array
press as how it is being initially generated in Prob_2D.F (that is by
using REAL_T macro and other stuffs). Actually I tried generating the
array press in my code by using macros, but later on it got so much
confusing that I reverted back to the simple way of generating array. Please let me know what shall I do._