Fortran90-marc必备

更新时间:2024-06-26 00:48:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

REM 让marc自定义子程序支持f90

REM 请将本run_marc.bat文件copy到marc安装目录下tools文件夹 REM 作者:阚前华 REM *.bat清单:

REM######################################################################## @echo off setlocal

for %%i in (%0) do set DIR=%%~dpi

if exist \for %%i in (run_marc.bat) do set DIR=%%~dp$PATH:i :full_path

REM if edited in here by user, the path must include the drive letter

set DIR=%DIR%..

CALL \

REM

REM ######################################################################### REM REM run_marc - run a marc job REM -------------------------

REM REM usage: run_marc -j jid { options }

REM REM where options are:

REM REM -j jid job id number.

REM -pr prog program name (saved user subroutine executable) REM -r rid restart file job id. REM -si sid substructure file id. REM -pi post post file job id.

REM REM -u user user subroutine.

REM -sa y|n do or do not save load module: defaults to no REM -au y|n use auto restart feature: defaults to no

REM Auto restart control stops the analysis, runs REM a mesher to remesh and restarts the analysis

REM Windows NT only. Used for DCOM server support.

REM -nprocd number of tasks for domain decomposition. REM -nthread number of threads per task. REM -itree message passing tree for domain decomposition. REM -de defaults file. REM -vf viewfactor file.

REM -host host file: defaults to local

REM -me manual remeshing control

REM -ma maxall parameter. overrides value given in include file

REM -pc remote computer name: defaults to local. Windows NT only. REM Used for DCOM server support.

REM -dir sets the current directory. this is where the job REM i/o takes place. defaults to current directory REM -sdir sets the scratch directory. this is where scratch REM files for the job are created. defaults to current REM directory

REM -dcoup contact decoupling used for Superform problem with REM deformable tools REM

REM -alloc only perform memory allocation test, no analysis REM

REM -dytran flag to switch from Dytran to Marc

REM dytran = 0,program will run without Marc-Dytran switch. REM = 1,program will restart Marc after Dytran run. REM >= 2,Not supported yet.

REM -dytran is not supported for MSC.Marc2003 REM

REM ########################################################################

REM Variables for the MARC environment

SET EXITMSG=%DIR%\\tools\\MESSAGES SET AFMATDAT=%DIR%\\AF_flowmat\\

rem: define path to global unified material database SET MATFILE=

REM set PATH to include Patran mesh dynamic library SET PATH=%DIR%\\lib;%PATH%

REM defaults

set prog=marc set jid= set pid= set rid= set sid= set did= set vid= set dirjid= set dirpid= set dirrid=

set dirsid= set dirdid= set dirvid= set user= set userdir= set qid=y

rem set priority= set att= set pid= set prgsav=n set error= set nprocd=0 set nthread=0 set itree=0 set iam=

set nthreadmax=0 set marclink= set nauto=0 set ndcoup=0 set ndytran=0 set host= set userhost= set cpinput=y set cpresults=y set dist=n set mesh=0 set mach= set cmdline= set jidlog=

set dcomserver= set dotdat=.dat set dirscrset=

rem initialize dirjob and dirscr to current directory for /f \ \set dirjob=%curdir%

if exist \echo error, program

echo %dir%\\bin\\run_marc_read.exe

echo which reads the command line options does not exist goto end_of_file :run_marc_read

rem first run %dirjob%\\ through run_marc_read with -j as dummy rem argument to strip off backslash in case job is run in for instance c:\\

call \ \call .\\run_marc_read.bat set dirjob=%value2% set dirscr=%dirjob%

rem scratch directory can be specified via environmental variable rem MARCSCRATCH

if \if exist %MARCSCRATCH% goto marcscratchexists echo.

echo error, scratch directory \

echo specified via environmental variable MARCSCRATCH does not exist goto end_of_file :marcscratchexists

set dirscr=%MARCSCRATCH% :nomarcscratch

REM

########################################################################### REM parse input - arguments always come in pairs # REM

###########################################################################

set arg=%1

if not \set error=no input parameters specified goto read_arg_error :no_arg_end set cmdline=%1

:read_arg_beg shift

set cmdline=%cmdline% %1

if \ goto al_end1 if not \:al_end1

rem just run marc with -alloc option \goto end_of_file :al_end

set value=%1

if \ ==\if not \

call \

call .\\run_marc_read.bat

if not \ goto pr_end set prog=%value% goto read_new :pr_end

if not \ goto j_end set jid=%value% set dirjid=%value2%

if \goto read_new :j_end

if not \ goto pi_end set pid=%value% set dirpid=%value2%

if \goto read_new :pi_end

if not \ goto r_end set rid=%value% set dirrid=%value2%

if \goto read_new :r_end

if not \ goto si_end set sid=%value% set dirsid=%value2%

if \goto read_new :si_end

if not \ goto de_end set did=%value%

set dirdid=%value2%

if \goto read_new :de_end

if not \ goto vf_end set vid=%value% set dirvid=%value2%

if \goto read_new :vf_end

if not \ set user=%value% set userdir=%value2% goto read_new :u_end

if not \ set prgsav=%value% goto read_new :sa_end

if not \ set nprocd=%value% goto read_new :np_end

if not \ set nthread=%value% goto read_new :nt_end

if not \ set iam=%value% goto read_new :iam_end

if not \ set itree=%value% goto read_new :it_end

if not \ goto u_end goto sa_end goto np_end goto nt_end goto iam_end goto it_end goto b_end

set qid=%value%

rem qid is checked and reset below goto read_new :b_end

if not \ goto ho_end set host=%value% set userhost=%value% goto read_new :ho_end

if not \ set nauto=%value% goto read_new :au_end

if not \set ndcoup=%value% goto read_new :dcoup_end

if not \ set mesh=%value% goto read_new :me_end

if not \ set maxsize=%value% goto read_new :ma_end

if not \ set cpinput=%value% goto read_new :ci_end

if not \ set cpresults=%value% goto read_new :cr_end

if not \ set dirjob=%1

goto au_end goto dcoup_end goto me_end goto ma_end goto ci_end goto cr_end goto di_end if \goto read_new :di_end

if not \ goto sd_end set dirscr=%1 set dirscrset=yes goto read_new :sd_end

if not \ goto pc_end set mach=%1 set qid=n

goto read_new :pc_end

if not \ goto dytran_end set ndytran=%value% goto read_new :dytran_end

REM -server option only set by the marcsvr.exe program if not \ goto se_end set dcomserver=%1 set qid=%value% goto read_new :se_end

if \ goto read_new if \ goto read_new if \ goto read_new if \ goto read_new

set error=no such option: %arg% or input value: %value% goto read_arg_error

:read_new shift

set arg=%1

set cmdline=%cmdline% %1 goto read_arg_beg

:read_arg_end

if \set nthreadmax=%nthread%

if not \set nthreadmax=1

if not \ :nthreadmax_end

REM ########################################################################## REM check parameter validity # REM ########################################################################## REM

REM check for input file existence REM

if not \

rem if \if \ goto host_end

if not exist \ goto host_not_exist

REM Count the number of cpus. If only one, then REM this is the DCOM server host to connect with.

set /A MCOUNT=0

for /f \set mach=%%i

set /A MCOUNT+=%%j )

if not %MCOUNT% == 1 goto host_end goto run_dcom

rem if exist \ goto host_end :host_not_exist

set error=file %host% does not exist goto read_arg_error :host_end

set testfile=%dirjid%\\%jid%%dotdat%

if not \if exist \

set error=file \goto read_arg_error :dat_end

REM

REM assume that \REM

set MDSRCLIB=mdsrc.lib set bd=%BINDIR%\\

if not \ set program=marc.exe set prefix=

if not \ if not \

rem check if single processor executable exists if exist ?%\\marcs.exe set program=marcs.exe if exist ?%\\marcs.exe set MDSRCLIB=mdsrcs.lib :parallel

if \

if exist \ if exist \

set error=file %dirpid%\\%pid%.t16/t19 does not exist goto read_arg_error :mt16_end

if \

if exist \ set error=file %dirrid%\\%rid%.t08 does not exist goto read_arg_error :mt08_end

if \

if exist \ set error=file %dirdid%\\%prefix%%did%%dotdat% does not exist goto read_arg_error :mt49_end

if \

if exist \ set error=file %dirvid%\\%prefix%%vid%.vfs does not exist goto read_arg_error :mt50_end

if \

if exist \

if exist \ goto param_val_end set error=user routine %userdir%\\%user% does not exist goto read_arg_error :marc_end

set program=%prog%.exe set bd= set prefix=

if not \

if \

if exist \ set error=file %dirrid%\\%rid%.t08 does not exist goto read_arg_error :prt08_end

if \

if exist \ if exist \

set error=file %dirpid%\\%prefix%%pid%.t16/t19 does not exist goto read_arg_error :prt16_end

if \

if exist \ set error=file %dirdid%\\%prefix%%did%%dotdat% does not exist goto read_arg_error :prt49_end

if \

if exist \ set error=file %dirvid%\\%prefix%%vid%.vfs does not exist goto read_arg_error :prt50_end

if exist \

set error=user program ?%%prog%.exe does not exist goto read_arg_error

:param_val_end

REM #########################################################################

REM check argument integrity # REM #########################################################################

if exist \echo.

echo error, run directory \echo does not exist goto end_of_file :dirjob_exists

if exist \echo.

echo error, scratch directory \echo does not exist goto end_of_file :dirscr_exists

if not \set error=job id required goto read_arg_error :jid_end

if not \set qid=foreground goto qid_end :qid_yes

if not \set qid=background goto qid_end :qid_none

set error=bad value for background option; valid options are \goto read_arg_error :qid_end

if not \set prgsav=no goto prgsave_end :prgsave_yes

if not \set prgsav=yes goto prgsave_end :prgsave_none

set error=bad value for save option; valid options are \goto read_arg_error :prgsave_end

if not \set dist=yes goto dist_end :dist_no

if not \set dist=

goto dist_end :dist_none

set error=bad value for distributed option; valid options are \goto read_arg_error :dist_end

rem check that jobname and restart job name are not the same if \

if not \set error=job id is the same as restart job id goto read_arg_error :rid_end

goto print_beg

:read_arg_error

echo read error: %error% goto run_marc_exit

REM ######################################################################### REM print information REM #########################################################################

:print_beg

set jidlog=%jid%.log

if \if exist \ \

if \

echo MSC.Marc %REVISION% %MACHINE% version echo --------------------------------

echo :

echo Program name : %prog%

echo Job ID : %jid% echo User subroutine name : %user% echo Restart file job ID : %rid% echo Substructure file ID : %sid% echo Post file job ID : %pid% echo Defaults file ID : %did% echo View factor file ID : %vid% echo Save generated module: %prgsav% echo Auto restart : %nauto% echo Contact decoupling : %ndcoup%

REM echo Marc-Dytran Switch : %ndytran% echo Number of tasks : %nprocd% echo Host file : %host% echo Distributed i/o : %dist% echo Run directory : %dirjob% echo Scratch directory : %dirscr% echo Default bin directory: %BINDIR%

echo Material database : ˉmatdat% echo : goto printend :printback

echo MSC.Marc %REVISION% %MACHINE% version >> %jidlog% echo -------------------------------- >> %jidlog%

echo : >> %jidlog% echo Program name : %prog% >> %jidlog% echo Job ID : %jid% >> %jidlog% echo User subroutine name : %user% >> %jidlog% echo Restart file job ID : %rid% >> %jidlog% echo Substructure file ID : %sid% >> %jidlog% echo Post file job ID : %pid% >> %jidlog% echo Defaults file ID : %did% >> %jidlog% echo View factor file ID : %vid% >> %jidlog% echo Save generated module: %prgsav% >> %jidlog% echo Auto restart : %nauto% >> %jidlog% echo Contact decoupling : %ndcoup% >> %jidlog%

REM echo Marc-Dytran Switch : %ndytran% >> %jidlog% echo Number of tasks : %nprocd% >> %jidlog% echo Host file : %host% >> %jidlog% echo Distributed i/o : %dist% >> %jidlog% echo Run directory : %dirjob% >> %jidlog% echo Scratch directory : %dirscr% >> %jidlog% echo Default bin directory: %BINDIR% >> %jidlog%

echo Material database : ˉmatdat% >> %jidlog% echo : >> %jidlog%

:printend REM

REM user subroutine used REM

if \set program=%user%.exe set bd=

set marclink=yes :user_program_end

if \set bd=

:program_end

REM

REM set executable name REM

set execnm=?%%program%

if \

REM

REM make reasonable attempt to create UNC information REM if tools\\marc.net file does not exist. if UNC names REM cannot be created, create network drive information. REM put UNC and drive information into marc.drive file. REM

if \ set run_marc_path=

if exist \ if exist \ if exist \ net share > \

if exist \ if exist \

rem echo error: check that marc installation directory is shared rem echo error: check that tools\\marc.net file is current rem goto run_marc_exit :netinfo_end

REM

REM create marc.drive to contain marc.net plus network drive REM information. REM

if \

type \ net use >> \

if exist \ :netuse_end

REM

REM find sharename of executable path based on

if \

if exist run_marc_unc.bat erase run_marc_unc.bat if \ if not \ if not \ set execnm=%dirjob% set execshare=%execnm%

call \\\\\

if exist run_marc_unc.bat call .\\run_marc_unc.bat :defaultsh_end

REM

REM find sharename of input files if current path is standard path REM or network drive based.

REM if UNC or network drive name not find, use default working directory. REM

if \ if \

if exist run_marc_unc.bat erase run_marc_unc.bat

call \\\\\

if exist run_marc_unc.bat call .\\run_marc_unc.bat

REM dirjid

if exist run_marc_unc.bat erase run_marc_unc.bat

call \\\\\

if exist run_marc_unc.bat call .\\run_marc_unc.bat REM dirpid

if \

if exist run_marc_unc.bat erase run_marc_unc.bat

call \\\\\

if exist run_marc_unc.bat call .\\run_marc_unc.bat :end_unc_pid REM dirrid

if \

if exist run_marc_unc.bat erase run_marc_unc.bat

call \\\\\

if exist run_marc_unc.bat call .\\run_marc_unc.bat :end_unc_rid REM dirsid

if \

if exist run_marc_unc.bat erase run_marc_unc.bat

call \\\\\

if exist run_marc_unc.bat call .\\run_marc_unc.bat :end_unc_sid REM dirdid

if \

if exist run_marc_unc.bat erase run_marc_unc.bat

call \\\\\

if exist run_marc_unc.bat call .\\run_marc_unc.bat :end_unc_did REM dirvid

if \

if exist run_marc_unc.bat erase run_marc_unc.bat

call \\\\\

if exist run_marc_unc.bat call .\\run_marc_unc.bat :end_unc_vid

:dirshare_end rem

rem read user host file to see if working directory specified rem in host file. translate user hostfile. rem

if \

if \if not \ & set usub=1 if not \ set execnm=%execshare%\\%program% & set usub=1

if exist \

if %MPITYPE%==patent call \\\\

if %MPITYPE%==mpich call \\\\

if %MPITYPE%==mpipro call \\\\

if %MPITYPE%==nt-mpich call \\\\if exist \if not exist \:userhost_end

REM

REM write default hostfile or machinefile REM

if not \set /a ntmp1=%nprocd%-1

if %MPITYPE%==patent echo local %ntmp1% > %dirjob%\\%jid%.host if %MPITYPE%==mpipro echo %hostname% > %dirjob%\\%jid%.host if %MPITYPE%==nt-mpich echo %hostname% > %dirjob%\\%jid%.host set jid2=%jid%

for %%i in (%jid2%) do set jid2=%%~nxi set host=%jid2%.host :defaulthost_end

set host=%dirjob%\\%host%

if not \

:hostfile_end

REM ######################################################################### REM construct run stream (Marc only)

REM #########################################################################

if \if \

if %MPITYPE%==mpich set run_job=%run_job1% \-sharemem %sharemem% -jid %jid% -nprocd %nprocd% -maxnum %maxnum% -maxsize %maxsize% -itree %itree% -nthread %nthread% -dirjob \goto mpich_end :host_end

if %MPITYPE%==mpich set run_job=%run_job1% -np %nprocd% \

-sharemem %sharemem% -jid %jid% -nprocd %nprocd% -maxnum %maxnum% -maxsize %maxsize% -itree %itree% -nthread %nthread% -dirjob \:mpich_end

if %MPITYPE%==patent set run_job=%run_job1% \-sharemem %sharemem% -p4pg \-jid %jid% -nprocd %nprocd% -maxnum %maxnum% -maxsize %maxsize% -itree %itree% -nthread %nthread% -prog \

if %MPITYPE%==mpipro set run_job=%run_job1% -wd \\\-jid %jid% -nprocd %nprocd% -maxnum %maxnum% -maxsize %maxsize% -itree %itree% -nthread %nthread% -prog \-dirjob \

if %MPITYPE%==nt-mpich set run_job=%run_job1% -n %nprocd% -machinefile \-- \-jid %jid% -nprocd %nprocd% -maxnum %maxnum% -maxsize %maxsize% -itree %itree% -nthread %nthread% -dirjob \

for %%i in (%userhost%) do set fullpath=%%~fi

if not \

if not \ set run_job=%run_job% -dirjid \goto rid_add_beg

:single_beg

if \if \if \if \

set run_job=%run_job0% \-nthread %nthread% -prog %program% -dirjob \goto auto_end :auto_beg

rem only use the C program exe_auto to start a job if auto restart is used set run_job=\%run_job0% \-jid %jid% -maxnum %maxnum% -maxsize %maxsize% -nthread %nthread% -prog %program% -dirjob \:auto_end

:rid_add_beg

if \set run_job=%run_job% -rid %rid%

if not \ set run_job=%run_job% -dirrid \

:pid_add_beg

if \set run_job=%run_job% -pid %pid%

if not \ set run_job=%run_job% -dirpid \

:sid_add_beg

if \set run_job=%run_job% -sid %sid%

if not \ set run_job=%run_job% -dirsid \:sid_add_end

:did_add_beg

if \set run_job=%run_job% -def %did%

if not \ set run_job=%run_job% -dirdid \:did_add_end

:vid_add_beg

if \set run_job=%run_job% -vf %vid%

if not \ set run_job=%run_job% -dirvid \:vid_add_end

:aut_add_beg

if \set run_job=%run_job% -autorst %nauto% :aut_add_end

:dcoup_add_beg

if \set run_job=%run_job% -dcoup %ndcoup% :dcoup_add_end

:scratch_add_beg

if \set run_job=%run_job% -dirscr \:scratch_add_end

:dytran_add_beg

if \set run_job=%run_job% -dytran \: dytran_add_end

if \set run_job=%run_job% -iam %iam% :iam_add_end

REM ######################################################################### REM run the requested program

REM ######################################################################### rem

rem create a dummy status file so Mentat can do monitor rem

echo hello > %jid%.sts

REM

REM compile user subroutine if present REM

if not \set prgsav=yes goto marc_run_beg :no_link_end

rem the user subroutine object file is put in directory dirjob. rem if the user sub is in a directory without write permission rem the object file cannot be put there.

if exist \

if not exist \if \rem @echo on

echo %fortran% /object:\ \

%fortran% /object:\ \2>> %jid%.tmp 1>> %jidlog%

type %jid%.tmp >> %jidlog% erase %jid%.tmp rem @echo off

if exist \

echo compile failed for %dirjob%\\%user%.f90 >> %jidlog% goto run_marc_exit :compfor1 @echo on

%fortran% /object:\ \@echo off

if exist \echo compile failed for %dirjob%\\%user%.f90 goto run_marc_exit :user_for_end

if \rem @echo on

echo %fortran% /object:\ \

%fortran% /object:\ \2>> %jid%.tmp 1>> %jidlog%

type %jid%.tmp >> %jidlog% erase %jid%.tmp rem @echo off

if exist \echo compile failed for %dirjob%\\%user%.f >> %jidlog% goto run_marc_exit :compfor @echo on

%fortran% /object:\ \@echo off

if exist \echo compile failed for %dirjob%\\%user%.f goto run_marc_exit

:user_comp_end

if exist \set userobj=%dirjob%\\%user%.obj

if \

echo. >> %jidlog% echo %load% /out:\\\\\\\\\ %solverlibs% \\

%load% /out:\\\\\\\\\ %solverlibs% \\type %jid%.tmp >> %jidlog% erase %jid%.tmp erase \

if exist \

echo link failed for %user%.obj >> %jidlog% goto run_marc_exit

:linkfor

@echo on

%load% /out:\\\\\\\\\ %solverlibs% \\ @echo off

erase \

if exist \echo link failed for %user%.obj goto run_marc_exit :link_end rem

rem copy user subroutine executable if hostfile given rem

if \if \

call %DIR%\\tools\\run_copy -j %dirjid%\\%jid% -np %nprocd% -ho %userhost% -cp 2 -pr \

:copy_exe_end

REM

REM run marc REM

:marc_run_beg

rem first remove all old .log and .out files and _i_*.t08 rem if exist \ \if exist \ \

if exist \if \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \\:clean_log_end

if \if not \:mpi_clean_end

if \if \if not \

call %DIR%\\tools\\run_copy -j %dirjid%\\%jid% -np %nprocd% -ho %userhost% -cp 0 echo.

:cpinput_end

if \echo. >> %jidlog% date /t >> %jidlog% time /t >> %jidlog% echo. >> %jidlog% goto endecho :echofor echo. date /t time /t echo. :endecho

rem echo %run_job%

if \if \

if \if \

if not \

call %DIR%\\tools\\run_copy -j %dirjid%\\%jid% -np %nprocd% -ho %userhost% -cp 1 :cpresults_end

if exist \ \if exist \ \if exist \ \if exist \ \if exist \ \if exist \ \if exist \ \if exist \ \if exist \ \if exist \ \

if exist \ \if exist \ \

if \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \

for %%n in ( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ) do if exist \erase \:clean_t_end

if not \

:run_marc_exit

if exist .\\run_marc_read.bat erase .\\run_marc_read.bat if exist .\\run_marc_unc.bat erase .\\run_marc_unc.bat

if exist \goto end_of_file

:run_dcom

if not exist \%dir%\\bin\\marcclient.exe %cmdline% goto end_of_file :dcom_no_client

echo Error... The Marc DCOM client does not exist

:end_of_file endlocal

本文来源:https://www.bwwdw.com/article/w4w3.html

Top