REM


REM Preliminary note. If this file has been given the extension .htm for

REM documentation purposes, it must be renamed to scr.bat to enable it 

REM to act as a batch file



REM This file, scr.bat, organises a series of runs in which a coarse grid 

rem is refined 2 times.

rem The  final run requires parsol=t; but parsol is set =f for all the 

rem coarser-grid runs.

rem LSWEEP is set equal to the environment variable SWEEPS for all runs.

rem

rem The purpose of the script is to enable the advantage gained from the 

rem use of SPINTO to be established by obtaining first a non-SPINTO 

rem solution corresponding to a single restart (and therefore a total 

rem number of sweeps equal to 2*SWEEPS with the solution obtained after 

rem SPINTO-using sequence in which PARSOL=T only for the finest-grid run.





rem the runs are:

rem 1. finest grid, parsol=t, lsweep=2 so as to create pbcl.dat 

rem 2. coarsest grid, parsol=f, 

rem 3. SPINTO restart from run 2, finer grid (*2 in all directions), parsol=f 

rem 4. SPINTO restart from run 3, finest grid (*2 in all directions), parsol=t 

rem 5. finest grid, non-SPINTO, non-restart, parsol=t

rem 6. finest grid, non-SPINTO, restart from run 6





rem The q1 is set up with the coarsest grid; and it contains an incl(spinxyz1) 

rem statement above its subsequent grid-setting statements.

rem The spinxyz1 file is written by the spinto executable each time it runs;

rem but the spixyz1 files for runs 1, 2, 6 and 7 are written by the present 

rem script.

rem The spinto executable also writes a spinxyz2 file. But this is not used.

rem Instead, the present script  puts all necessary additional instructions 

rem into the q2 file.

rem The present script also write the Q1spin file which guves SPINTO its 

rem instructions. 





REM If it is desired to terminate execution of this script at any stage, 

rem place the following 'goto end' at the desired location if this file, 

rem after first removing the 'REM'from in front of it.

rem goto end



REM The following environment variable, SWEEPS, is the number of sweeps

REM to be carried out in all runs 

SET SWEEPS=40

rem goto 5

mkdir %sweeps%sweep



rem Run1, to make pbcl.dat

REM initialization of file INCLuded in the q1

ECHO nx=4*nx; ny=4*ny; nz=4*nz > spinxyz1

echo nx >> spinxyz1

echo ny >> spinxyz1

echo nz >> spinxyz1

REM Perform the first finest-grid run

ECHO TEXT(1 no restart; finest grid; make pbcl >Q2

echo lsweep=2 >>q2

CALL se

copy pbcl.dat pbcl.sav





rem Run 2, coarsest-grid 

REM initialization of file INCLuded in the q1

ECHO    no refinement > spinxyz1

ECHO TEXT(Run 2; no restart; coarsest grid >Q2

echo lsweep=%sweeps% >>q2

echo parsol=f >>q2

CALL se

REM Save the results

COPY SATLOG.TXT %sweeps%sweep\SATLOG2.TXT

COPY RESULT %sweeps%sweep\RES2

COPY PHI %sweeps%sweep\PHI2

COPY GXMONI.GIF %sweeps%sweep\GXMONI2.GIF

IF EXIST FORCES-S.CSV COPY FORCES-S.CSV %sweeps%sweep\FORCES2.CSV

REM

REM Prepare for SPINTO runs by echoing the necessary lines to q1spin

ECHO refine(x,2)            >Q1SPIN

ECHO refine(y,2)            >>Q1SPIN

ECHO refine(z,2)            >>Q1SPIN

ECHO do not interpolate p1  >>Q1SPIN

ECHO do not interpolate u1  >>Q1SPIN

ECHO do not interpolate v1  >>Q1SPIN

ECHO do not interpolate w1  >>Q1SPIN

ECHO stop                   >>Q1SPIN

REM According to the above commands, SPINTO will double the cell 

REM y-direction number, NY, unchanged.

REM It also: 1. writes the new values of NX, NY, NZ into the file

REM             spinxyz1, which is INCLuded in the Q1 file before the

REM             grid is created;

rem          2. declares the boolean variable newphi and sets it = t

REM          3. reads the existing PHI file and creates therefrom

REM             a new file, NPHI, from which the next EARTH run restarts.



REM Run 3, the first re-start-with finer-grid  reun

ECHO if(newphi) then                      >>Q2

ECHO real(fiinprps)                       >>Q2

ECHO fiinprps=fiinit(prps)                >>Q2 

ECHO restrt(all)                          >>Q2 

ECHO fiinit(prps)=fiinprps                >>Q2 

ECHO namfi=nphi                           >>Q2 

ECHO endif                                >>Q2 

ECHO TEXT(3  finer-grid restart   >>Q2

echo lsweep=%sweeps% >>q2

REM Call runspin to activate SPINTO, then se for SATELLITE and EARTH, 

REM then save the result, phi and gxmoni files for later study

CALL RUNSPIN

COPY NPHI NPHI3

CALL SE

COPY SATLOG.TXT %sweeps%sweep\SATLOG3.TXT

COPY RESULT %sweeps%sweep\RES3

COPY PHI %sweeps%sweep\PHI3

COPY GXMONI.GIF %sweeps%sweep\GXMONI3.GIF

IF EXIST FORCES-S.CSV COPY FORCES-S.CSV %sweeps%sweep\FORCES3.CSV



REM Run 4, the second re-start-with finest grid

copy pbcl.sav pbcl.dat

ECHO parsol=t                                    >>Q2

ECHO TEXT(4 finest-grid restart parsol=:parsol:  >>Q2

REM Call runspin to activate SPINTO, then se for SATELLITE and EARTH, 

REM then save the result, phi and gxmoni files for later study

CALL RUNSPIN

COPY NPHI NPHI4

CALL SE

COPY SATLOG.TXT %sweeps%sweep\SATLOG4.TXT

COPY RESULT %sweeps%sweep\RES4

COPY PHI %sweeps%sweep\PHI4

COPY GXMONI.GIF %sweeps%sweep\GXMONI4.GIF

IF EXIST FORCES-S.CSV COPY FORCES-S.CSV %sweeps%sweep\FORCES4.CSV



rem goto end

:5:

REM Run 5, the first non-spinto run

ECHO TEXT(Run 5 with finest-grid    >Q2

echo lsweep=%sweeps% >>q2

ECHO parsol=t >>Q2

echo newphi=f >>q2

CALL SE

COPY SATLOG.TXT %sweeps%sweep\SATLOG5.TXT

COPY RESULT %sweeps%sweep\RES5

COPY PHI %sweeps%sweep\PHI5

COPY GXMONI.GIF %sweeps%sweep\GXMONI5.GIF

IF EXIST FORCES-S.CSV COPY FORCES-S.CSV %sweeps%sweep\FORCES5.CSV



:6:

REM Run 6, the second no-spinto run

ECHO TEXT(Run 6 with finest-grid restart from run 5   >>Q2

ECHO restrt(all)                                      >>Q2

CALL SE

COPY SATLOG.TXT %sweeps%sweep\SATLOG6.TXT

COPY RESULT %sweeps%sweep\RES6

COPY PHI %sweeps%sweep\PHI6

COPY GXMONI.GIF %sweeps%sweep\GXMONI6.GIF

IF EXIST FORCES-S.CSV COPY FORCES-S.CSV %sweeps%sweep\FORCES6.CSV