├── EXAMPLES ├── cbm4 │ ├── CBM4_RK │ │ ├── cbm4_rk │ │ ├── cbm4_rk_sol.txt │ │ ├── Makefile │ │ └── cbm4_rk_dr.F90 │ ├── CBM4_ROS │ │ ├── cbm4_ros │ │ ├── gmon.out │ │ ├── Makefile │ │ └── cbm4_ros_dr.F90 │ ├── CBM4_SDIRK │ │ ├── cbm4_sdirk │ │ ├── cbm4_sdirk_sol.txt │ │ ├── Makefile │ │ └── cbm4_sdirk_dr.F90 │ ├── CBM4_RK_ADJ │ │ ├── cbm4_rk_adj │ │ ├── cbm4_rk_sol.txt │ │ └── Makefile │ ├── CBM4_ROS_ADJ │ │ ├── cbm4_ros_adj │ │ ├── cbm4_ros_sol.txt │ │ └── Makefile │ └── CBM4_SDIRK_ADJ │ │ ├── cbm4_sdirk_adj │ │ ├── cbm4_sdirk_sol.txt │ │ └── Makefile ├── swe │ ├── SWE_ERK │ │ ├── swe2D_erk │ │ ├── Makefile │ │ └── swe2D_erk_dr.F90 │ ├── SWE_RK │ │ ├── swe2D_rk │ │ ├── Makefile │ │ └── swe2D_rk_dr.F90 │ ├── SWE_ROS │ │ ├── swe2D_ros │ │ ├── Makefile │ │ └── swe2D_ros_dr.F90 │ ├── SWE_SDIRK │ │ ├── swe2D_sdirk │ │ └── Makefile │ ├── SWE_RK_ADJ │ │ ├── swe2D_rk_adj │ │ ├── Makefile │ │ └── swe2D_rk_adj_dr.F90 │ ├── SWE_RK_TLM │ │ ├── swe2D_rk_tlm │ │ ├── Makefile │ │ └── swe2D_rk_tlm_dr.F90 │ ├── SWE_ERK_ADJ │ │ ├── swe2D_erk_adj │ │ ├── .swe2D_erk_adj_dr.F90.swp │ │ └── Makefile │ ├── SWE_ERK_TLM │ │ ├── swe2D_erk_tlm │ │ ├── Makefile │ │ └── swe2D_erk_tlm_dr.F90 │ ├── SWE_ROS_ADJ │ │ ├── swe2D_ros_adj │ │ └── Makefile │ ├── SWE_ROS_TLM │ │ ├── swe2D_ros_tlm │ │ └── Makefile │ ├── SWE_SDIRK_ADJ │ │ ├── swe2D_sdirk_adj │ │ ├── Makefile │ │ └── swe2D_sdirk_adj_dr.F90 │ └── SWE_SDIRK_TLM │ │ ├── swe2D_sdirk_tlm │ │ ├── Makefile │ │ └── swe2D_sdirk_tlm_dr.F90 ├── small_strato │ ├── small_rk │ │ ├── small_strato │ │ ├── small_strato_dr.F90 │ │ ├── Makefile │ │ └── User_Parameters.F90 │ ├── small_ros │ │ ├── small_strato │ │ ├── small_strato_dr.F90 │ │ ├── Makefile │ │ └── User_Parameters.F90 │ ├── small_sdirk │ │ ├── small_strato │ │ ├── small_strato_dr.F90 │ │ ├── Makefile │ │ └── User_Parameters.F90 │ └── small_ros_adj │ │ ├── small_strato │ │ ├── rkadj_ADJ_results.m │ │ ├── Makefile │ │ └── small_strato_dr.F90 └── roberts │ ├── ROBERTS_RK_ADJ │ ├── roberts_rk_adj │ ├── Makefile │ └── roberts_rk_adj_dr.F90 │ ├── ROBERTS_ROS_ADJ │ ├── roberts_ros_adj │ └── Makefile │ └── ROBERTS_SDIRK_ADJ │ ├── roberts_sdirk_adj │ ├── Makefile │ └── roberts_sdirk_adj_dr.F90 ├── LSS_LIBS └── x86_64_Linux │ ├── UMFPACK │ ├── libamd.a │ ├── libumfpack.a │ ├── umf4_f77wrapper.o │ ├── umf4_f77zwrapper.o │ └── Makefile │ └── SUPERLU │ ├── c_fortran_dgssv.o │ ├── c_fortran_zgssv.o │ ├── libsuperlu_4.2.a │ ├── Makefile │ ├── c_fortran_dgssv.c │ └── c_fortran_zgssv.c └── README.md /EXAMPLES/cbm4/CBM4_RK/cbm4_rk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/cbm4/CBM4_RK/cbm4_rk -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ERK/swe2D_erk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_ERK/swe2D_erk -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_RK/swe2D_rk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_RK/swe2D_rk -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ROS/swe2D_ros: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_ROS/swe2D_ros -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_ROS/cbm4_ros: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/cbm4/CBM4_ROS/cbm4_ros -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_ROS/gmon.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/cbm4/CBM4_ROS/gmon.out -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_SDIRK/cbm4_sdirk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/cbm4/CBM4_SDIRK/cbm4_sdirk -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_SDIRK/swe2D_sdirk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_SDIRK/swe2D_sdirk -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_RK_ADJ/cbm4_rk_adj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/cbm4/CBM4_RK_ADJ/cbm4_rk_adj -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_RK_ADJ/swe2D_rk_adj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_RK_ADJ/swe2D_rk_adj -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_RK_TLM/swe2D_rk_tlm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_RK_TLM/swe2D_rk_tlm -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_ROS_ADJ/cbm4_ros_adj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/cbm4/CBM4_ROS_ADJ/cbm4_ros_adj -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ERK_ADJ/swe2D_erk_adj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_ERK_ADJ/swe2D_erk_adj -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ERK_TLM/swe2D_erk_tlm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_ERK_TLM/swe2D_erk_tlm -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ROS_ADJ/swe2D_ros_adj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_ROS_ADJ/swe2D_ros_adj -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ROS_TLM/swe2D_ros_tlm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_ROS_TLM/swe2D_ros_tlm -------------------------------------------------------------------------------- /LSS_LIBS/x86_64_Linux/UMFPACK/libamd.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/LSS_LIBS/x86_64_Linux/UMFPACK/libamd.a -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_SDIRK_ADJ/swe2D_sdirk_adj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_SDIRK_ADJ/swe2D_sdirk_adj -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_SDIRK_TLM/swe2D_sdirk_tlm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_SDIRK_TLM/swe2D_sdirk_tlm -------------------------------------------------------------------------------- /LSS_LIBS/x86_64_Linux/UMFPACK/libumfpack.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/LSS_LIBS/x86_64_Linux/UMFPACK/libumfpack.a -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_SDIRK_ADJ/cbm4_sdirk_adj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/cbm4/CBM4_SDIRK_ADJ/cbm4_sdirk_adj -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_rk/small_strato: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/small_strato/small_rk/small_strato -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_ros/small_strato: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/small_strato/small_ros/small_strato -------------------------------------------------------------------------------- /EXAMPLES/roberts/ROBERTS_RK_ADJ/roberts_rk_adj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/roberts/ROBERTS_RK_ADJ/roberts_rk_adj -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_sdirk/small_strato: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/small_strato/small_sdirk/small_strato -------------------------------------------------------------------------------- /LSS_LIBS/x86_64_Linux/SUPERLU/c_fortran_dgssv.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/LSS_LIBS/x86_64_Linux/SUPERLU/c_fortran_dgssv.o -------------------------------------------------------------------------------- /LSS_LIBS/x86_64_Linux/SUPERLU/c_fortran_zgssv.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/LSS_LIBS/x86_64_Linux/SUPERLU/c_fortran_zgssv.o -------------------------------------------------------------------------------- /LSS_LIBS/x86_64_Linux/SUPERLU/libsuperlu_4.2.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/LSS_LIBS/x86_64_Linux/SUPERLU/libsuperlu_4.2.a -------------------------------------------------------------------------------- /LSS_LIBS/x86_64_Linux/UMFPACK/umf4_f77wrapper.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/LSS_LIBS/x86_64_Linux/UMFPACK/umf4_f77wrapper.o -------------------------------------------------------------------------------- /EXAMPLES/roberts/ROBERTS_ROS_ADJ/roberts_ros_adj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/roberts/ROBERTS_ROS_ADJ/roberts_ros_adj -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_ros_adj/small_strato: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/small_strato/small_ros_adj/small_strato -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ERK_ADJ/.swe2D_erk_adj_dr.F90.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/swe/SWE_ERK_ADJ/.swe2D_erk_adj_dr.F90.swp -------------------------------------------------------------------------------- /LSS_LIBS/x86_64_Linux/UMFPACK/umf4_f77zwrapper.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/LSS_LIBS/x86_64_Linux/UMFPACK/umf4_f77zwrapper.o -------------------------------------------------------------------------------- /EXAMPLES/roberts/ROBERTS_SDIRK_ADJ/roberts_sdirk_adj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ComputationalScienceLaboratory/FATODE/HEAD/EXAMPLES/roberts/ROBERTS_SDIRK_ADJ/roberts_sdirk_adj -------------------------------------------------------------------------------- /LSS_LIBS/x86_64_Linux/SUPERLU/Makefile: -------------------------------------------------------------------------------- 1 | # Minimun modification of the path of SuperLU source is required. 2 | 3 | default: fortran 4 | # set the original SuperLU direcotry 5 | export SLUPATH = /home/hong/Software/SuperLU_4.2 6 | 7 | include $(SLUPATH)/make.inc 8 | 9 | HEADER = $(SLUPATH)/SRC 10 | 11 | fortran:c_fortran_zgssv.o c_fortran_dgssv.o 12 | 13 | c_fortran_zgssv.o: c_fortran_zgssv.c 14 | $(CC) $(CFLAGS) $(CDEFS) -I$(HEADER) -c $< 15 | 16 | c_fortran_dgssv.o: c_fortran_dgssv.c 17 | $(CC) $(CFLAGS) $(CDEFS) -I$(HEADER) -c $< 18 | 19 | clean: 20 | rm c_fortran*.o 21 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_ros_adj/rkadj_ADJ_results.m: -------------------------------------------------------------------------------- 1 | 0.4766074593073413E-10 0.4766180310265307E-10 0.4783608534813828E-10 -0.3549700534936065E-07 -0.3547849710662225E-07 2 | 0.3169406964419250E-03 0.3169477265627898E-03 0.3181066915597250E-03 -0.2357114866744025E+00 -0.2355884081277102E+00 3 | 0.2571677094308589E+00 0.2571734137159162E+00 0.2581138053315037E+00 -0.1915346346161845E+03 -0.1914347678957277E+03 4 | -0.2908460911491545E-04 -0.2908525424606973E-04 -0.2919160866597241E-04 0.8546300107671584E+00 0.8546187162522503E+00 5 | 0.2908460911491714E-04 0.2908525424607151E-04 0.2919160866597453E-04 0.1453699892328424E+00 0.1453812837477506E+00 6 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_RK/cbm4_rk_sol.txt: -------------------------------------------------------------------------------- 1 | 0.3719123228443048E-01 2 | 0.3233107629687772E+12 3 | 0.3269443149110212E+01 4 | 0.2531313416857557E-33 5 | 0.3757073584976722E-30 6 | 0.1396144587055864E+08 7 | 0.0000000000000000E+00 8 | 0.2246668068124229E-01 9 | 0.3974746325592220E+09 10 | 0.2673751615867104E+09 11 | 0.1204574689905275E-34 12 | 0.1192967134388085E+13 13 | 0.5418861198984759E-07 14 | 0.3878781662780311E-31 15 | 0.2261675037925974E-13 16 | 0.1898837639975914E+13 17 | 0.8583290832217761E-13 18 | 0.5946610393142112E+09 19 | -0.3065581533258501E-24 20 | 0.8449483578496444E+01 21 | 0.3029223899169074E+11 22 | 0.3612067373487132E-13 23 | 0.2090981388674493E-17 24 | 0.2798893869669442E+00 25 | 0.2098675744642242E+13 26 | 0.1564704541118249E+11 27 | 0.3906305844659356E+08 28 | 0.9865846306174607E+09 29 | 0.1268625568891129E+05 30 | 0.3579021142113394E+08 31 | 0.2676676377296733E+10 32 | 0.8210224676783475E-02 33 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_RK_ADJ/cbm4_rk_sol.txt: -------------------------------------------------------------------------------- 1 | 0.3719123214010662E-01 2 | 0.3233107597486959E+12 3 | 0.3269443235959660E+01 4 | 0.2531309474704074E-33 5 | 0.3757074120080860E-30 6 | 0.1396144361705073E+08 7 | 0.0000000000000000E+00 8 | 0.2246668684146087E-01 9 | 0.3974744026574298E+09 10 | 0.2673751741510453E+09 11 | 0.1204574958648276E-34 12 | 0.1192967136272623E+13 13 | 0.5418861841668208E-07 14 | 0.3878775488839192E-31 15 | 0.6826898143451607E-13 16 | 0.1898837645853814E+13 17 | 0.4710294593899800E-12 18 | 0.5946611551664462E+09 19 | 0.1081587475325647E-24 20 | 0.8449484032833064E+01 21 | 0.3029223885495064E+11 22 | 0.3571107600521705E-13 23 | 0.4986494458325569E-17 24 | 0.2798894008451608E+00 25 | 0.2098675736498075E+13 26 | 0.1564704354223442E+11 27 | 0.3906306102826488E+08 28 | 0.9865847324082509E+09 29 | 0.1268625541782511E+05 30 | 0.3579021174685134E+08 31 | 0.2676676583226274E+10 32 | 0.8210225414068118E-02 33 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_ROS_ADJ/cbm4_ros_sol.txt: -------------------------------------------------------------------------------- 1 | 0.3719123500361147E-01 2 | 0.3233107660661603E+12 3 | 0.3269404000628041E+01 4 | 0.2530660333767018E-33 5 | 0.3756096532029446E-30 6 | 0.1396144705089065E+08 7 | 0.0000000000000000E+00 8 | 0.2246638604637488E-01 9 | 0.3974746442585290E+09 10 | 0.2673751263357335E+09 11 | 0.1204260626812883E-34 12 | 0.1192967135899397E+13 13 | 0.5418788606877993E-07 14 | 0.3877778994461921E-31 15 | -0.1252647272267647E-20 16 | 0.1898837594234759E+13 17 | 0.2973790981810957E-13 18 | 0.5946610595181597E+09 19 | 0.1877707163333613E-31 20 | 0.8449371347272786E+01 21 | 0.3029223889784420E+11 22 | -0.8648733850241021E-49 23 | 0.1179496512188717E-29 24 | 0.2798856691904291E+00 25 | 0.2098675898080911E+13 26 | 0.1564704470750062E+11 27 | 0.3906305692141421E+08 28 | 0.9865845971697181E+09 29 | 0.1268625638941464E+05 30 | 0.3579021427842010E+08 31 | 0.2676675588568124E+10 32 | 0.8210126935053567E-02 33 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_SDIRK/cbm4_sdirk_sol.txt: -------------------------------------------------------------------------------- 1 | 0.3719122924958576E-01 2 | 0.3233107654710536E+12 3 | 0.3269444485052116E+01 4 | 0.2530240167093588E-33 5 | 0.3755470302212714E-30 6 | 0.1396144707753783E+08 7 | 0.0000000000000000E+00 8 | 0.2246667931727332E-01 9 | 0.3974752906070144E+09 10 | 0.2673752318486754E+09 11 | 0.1204060679121852E-34 12 | 0.1192967129349619E+13 13 | 0.5418865338441745E-07 14 | 0.3877140933389581E-31 15 | 0.1350072830720871E-33 16 | 0.1898837693527754E+13 17 | 0.3666090260605331E-44 18 | 0.5946609424651351E+09 19 | 0.1877401164103276E-31 20 | 0.8449489451679440E+01 21 | 0.3029223905291207E+11 22 | 0.0000000000000000E+00 23 | 0.0000000000000000E+00 24 | 0.2798895847506692E+00 25 | 0.2098675573387965E+13 26 | 0.1564704846641861E+11 27 | 0.3906306118515978E+08 28 | 0.9865846493482614E+09 29 | 0.1268625518604320E+05 30 | 0.3579020787445552E+08 31 | 0.2676677633353522E+10 32 | 0.8210226565942936E-02 33 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_SDIRK_ADJ/cbm4_sdirk_sol.txt: -------------------------------------------------------------------------------- 1 | 0.3719122927526732E-01 2 | 0.3233107656087742E+12 3 | 0.3269444483112381E+01 4 | 0.2530229532608750E-33 5 | 0.3755453838157571E-30 6 | 0.1396144670233438E+08 7 | 0.0000000000000000E+00 8 | 0.2246668252578064E-01 9 | 0.3974753071039798E+09 10 | 0.2673752412966211E+09 11 | 0.1204055439248545E-34 12 | 0.1192967129279707E+13 13 | 0.5418865388554263E-07 14 | 0.3877123918476058E-31 15 | 0.1350066881181457E-33 16 | 0.1898837692590919E+13 17 | 0.3666026717637824E-44 18 | 0.5946609531479193E+09 19 | 0.1877393064837139E-31 20 | 0.8449489374555506E+01 21 | 0.3029223906014386E+11 22 | 0.0000000000000000E+00 23 | 0.0000000000000000E+00 24 | 0.2798895822498933E+00 25 | 0.2098675574837157E+13 26 | 0.1564704841060669E+11 27 | 0.3906306190241343E+08 28 | 0.9865846708828220E+09 29 | 0.1268625518651086E+05 30 | 0.3579020784604654E+08 31 | 0.2676677733913082E+10 32 | 0.8210226409141321E-02 33 | -------------------------------------------------------------------------------- /LSS_LIBS/x86_64_Linux/UMFPACK/Makefile: -------------------------------------------------------------------------------- 1 | # * Minimum modification of the path of UMFPACK is required. 2 | # * If you want to use 64bits for integers, just apply the command 'make fortran64'. 3 | 4 | default:fortran 5 | 6 | # set the original UMFPACK directory 7 | export UMFPATH = /home/hong/Software/UMF_5.5.0 8 | 9 | include $(UMFPATH)/UFconfig/UFconfig.mk 10 | 11 | C = $(CC) $(CFLAGS) $(UMFPACK_CONFIG) -I$(UMFPATH)/UMFPACK/Include -I$(UMFPATH)/AMD/Include -I$(UMFPATH)/UFconfig 12 | 13 | fortran: umf4_f77wrapper.o umf4_f77zwrapper.o 14 | 15 | fortran64: umf4_f77wrapper64.o umf4_f77zwrapper64.o 16 | 17 | UMFPACK = libumfpack.a libamd.a 18 | 19 | umf4_f77wrapper.o:umf4_f77wrapper.c $(INC) 20 | $(C) -c umf4_f77wrapper.c -o umf4_f77wrapper.o 21 | 22 | umf4_f77zwrapper.o: umf4_f77zwrapper.c $(INC) 23 | $(C) -c umf4_f77zwrapper.c -o umf4_f77zwrapper.o 24 | 25 | umf4_f77wrapper64.o:umf4_f77wrapper.c $(INC) 26 | $(C) -DDLONG -c umf4_f77wrapper.c -o umf4_f77wrapper64.o 27 | 28 | umf4_f77zwrapper64.o: umf4_f77zwrapper.c $(INC) 29 | $(C) -DDLONG -c umf4_f77zwrapper.c -o umf4_f77zwrapper64.o 30 | 31 | clean: 32 | - rm umf4*.o 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FATODE 2 | 3 | FATODE version 1.2 4 | by Hong Zhang and Adrian Sandu 5 | Released April 30, 2013 6 | 7 | FATODE version 1.1 8 | by Hong Zhang and Adrian Sandu 9 | Released November 11, 2012 10 | 11 | FATODE contains a set of integrators to solve ordinary differential system 12 | y'=f(t,y) with capabilities of direct and adjoint sensitivity analysis. 13 | FATODE is implemented in FORTRAN90, and has been tested with the following 14 | compilers: Portland group's pgf90, Intel's ifort, Lahey's lf95, Sun's sunf90, 15 | gfortran, Absoft. 16 | 17 | FATODE contains the following directory structure: 18 | 19 | FATODE/README general instructions 20 | FATODE/FWD forward model integrators 21 | FATODE/ADJ adjoint model integrators 22 | FATODE/TLM tangent linear model integrators 23 | FATODE/LSS_LIBS lib files of linear solvers 24 | FATODE/EXAMPLES example programs 25 | FATODE/DOC documentation (user's guide) 26 | 27 | FATODE implementation requires BLAS and LAPACK libraries. For solution of 28 | linear systems arised in the integration, FATODE provides options to use BLAS/ 29 | LAPACK routines (with macro definition -DFULL_ALGEBRA) and to use sparse linear 30 | solvers such as UMFPACK (-DSPARSE_UMF) and SuperLU (-DSPARSE_LU). If sparse 31 | linear solvers are needed, the FATODE code must be linked with corresponding 32 | (static) libraries for the linear solvers. For installation instuctions of 33 | UMFPACK and SuperLU, please refer to their websites. 34 | UMFPACK can be accessed at: 35 | http://www.cise.ufl.edu/research/sparse/umfpack/ 36 | SuperLU can be accessed at: 37 | http://crd.lbl.gov/~xiaoye/SuperLU/ 38 | 39 | Since UMFPACK and SuperLU are written in C, wrappers for calling C routines from 40 | FORTRAN are needed. They can be found in the original packages of UMFPACK and 41 | SuperLU. For convenience, they are also included in FATODE/LSS_LIBS directory as well as makefiles to generate object files which can be linked to FATODE code. Make sure to modify the installation PATH first in the makefiles if you need to regenerate the object files. 42 | 43 | For usage of FATODE, please refer to the user's guide, as well as the example programs containing drivers and makefiles which can be used as templates. 44 | 45 | 46 | ## Changes 47 | 48 | ### Changes from Version 1.1 49 | Bug fixes: 50 | - Fixed a possible initilization problem of method coefficients for windows users. 51 | - Fixed improper use of drdy in the adjoint Rosenbrock solver. 52 | Complier options: 53 | - The option -mp for ifort compiler is deprecated. Use -fltconsistency instead. 54 | 55 | 56 | ### Changes from Version 1.0 57 | New example: 58 | - CBM-IV: a stiff chemical system used to demonstrate the usage of FATODE for computing sensivities with respect to system parameters. 59 | Bug fixes: 60 | - Fixed several bugs in Rosenbrock solvers 61 | Complier options: 62 | - ifort sometimes reulsts in inconsistent output with other compilers due to floating-point calculation consistency. The option -mp can solve this problem. 63 | Documentation: 64 | - Add a user's guide for FATODE 65 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ERK_TLM/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | # Configuration flags for linear solvers. Must choose one from the following three options. 20 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # -DSPARSE_UMF use UMFpack (sparse format) 22 | # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) 41 | #BLAS = /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | #~~~> sunf90 45 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 46 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 47 | #BLAS = -xlic_lib=sunperf 48 | #LAPACK = 49 | 50 | #~~~> gfortran (GNU FORTRAN Compiler) 51 | export FC = gfortran 52 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 53 | BLAS=/opt/lapack/lib/libblas.a 54 | LAPACK=/opt/lapack/lib/liblapack.a 55 | 56 | #~~~> PGF90 (Portland Group Compiler) 57 | #export FC=pgf90 58 | #export FFLAGS= -O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess ${LS_CONFIG} 59 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 60 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 61 | #other libraries 62 | #XERBLA = -lpgftnrtl -pgf90libs 63 | 64 | #~~~> LAHEY 65 | #export FC = lf95 66 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 67 | #BLAS=-lssl2mt 68 | #LAPACK= 69 | 70 | 71 | FATDIR = ../../.. 72 | LIBDIR = $(FATDIR)/LSS_LIBS/ 73 | MODEL = TLM 74 | FAMILY = ERK_TLM 75 | 76 | APP = swe2D_erk_tlm 77 | PAR = swe2D_upwind.o 78 | INTEGRATOR = $(FAMILY)_f90_Integrator.o 79 | 80 | default: driver 81 | 82 | swe2D_upwind.o: swe2D_upwind.F90 83 | $(FC) $(FFLAGS) -c $< 84 | 85 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 86 | $(FC) $(FFLAGS) -c $< 87 | 88 | swe2D_erk_tlm_dr.o: swe2D_erk_tlm_dr.F90 $(PAR) $(INTEGRATOR) 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | 92 | LIB = -lm 93 | 94 | default: driver 95 | 96 | driver: swe2D_erk_tlm_dr.o $(PAR) $(INTEGRATOR) 97 | $(FC) $(FFLAGS) -o $(APP) $< $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 98 | 99 | purge: clean 100 | 101 | clean: 102 | rm -f *~ *.mod *.o 103 | 104 | help: 105 | @$(ECHO) "usage: make ?" 106 | 107 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_sdirk/small_strato_dr.F90: -------------------------------------------------------------------------------- 1 | PROGRAM small_strato_dr 2 | USE SDIRK_f90_Integrator 3 | USE User_Parameters 4 | IMPLICIT NONE 5 | CHARACTER(LEN=12), PARAMETER, DIMENSION(7) :: SPC_NAMES = (/ & 6 | 'O1D ','O ','O3 ', & 7 | 'NO ','NO2 ','M ', & 8 | 'O2 ' /) 9 | INTEGER, PARAMETER, DIMENSION(6) :: MONITOR = (/ & 10 | 1, 2, 3, 4, 5, 7 /) 11 | CHARACTER(LEN=12), PARAMETER, DIMENSION(1) :: SMASS = (/ & 12 | 'N ' /) 13 | 14 | INTEGER :: i 15 | 16 | INTEGER, PARAMETER :: NSPEC = 7 17 | !~~> Control (in) and status (out) arguments for the integration 18 | DOUBLE PRECISION, DIMENSION(20) :: RCNTRL, RSTATUS 19 | INTEGER, DIMENSION(20) :: ICNTRL, ISTATUS 20 | DOUBLE PRECISION :: CFACTOR, x 21 | DOUBLE PRECISION :: ATOL(NVAR), RTOL(NVAR), VAR(NVAR) 22 | DOUBLE PRECISION:: TSTART, TEND, T, l2,l2tmp,error 23 | DOUBLE PRECISION,DIMENSION(5):: ANS = (/154.2258448,1034529328.3727823,& 24 | 832159397391.5885010,905729267.2488701,190770732.7509280/) 25 | INTEGER :: iter,hz,clock0,clock1,cpu 26 | DOUBLE PRECISION :: time 27 | !~~~> Tolerances for calculating concentrations 28 | DO i=1,NVAR 29 | RTOL(i) = 1.0d-1 30 | ATOL(i) = 1.0d-1 31 | END DO 32 | 33 | DO iter = 1, 5 34 | !~~~> Tolerances for calculating concentrations 35 | DO i=1,NVAR 36 | RTOL(i) = 0.1*RTOL(i) 37 | ATOL(i) = 0.1*ATOL(i) 38 | END DO 39 | 40 | ! Initialize 41 | CFACTOR = 1.000000e+00 42 | x = (0.)*CFACTOR 43 | DO i = 1, NVAR 44 | VAR(i) = x 45 | END DO 46 | x = (0.)*CFACTOR 47 | DO i = 1, NFIX 48 | FIX(i) = x 49 | END DO 50 | VAR(1) = (9.906E+01)*CFACTOR 51 | VAR(2) = (6.624E+08)*CFACTOR 52 | VAR(3) = (5.326E+11)*CFACTOR 53 | VAR(4) = (8.725E+08)*CFACTOR 54 | VAR(5) = (2.240E+08)*CFACTOR 55 | FIX(1) = (8.120E+16)*CFACTOR 56 | FIX(2) = (1.697E+16)*CFACTOR 57 | TSTART = (12*3600) 58 | TEND = TSTART + (30*24*3600) 59 | 60 | !~~~> Default control options 61 | ICNTRL(1:20) = 0 62 | RCNTRL(1:20) = 0.0d0 63 | 64 | !~~~> Begin time loop 65 | 66 | T = TSTART 67 | 68 | call system_clock(count_rate=hz) 69 | call system_clock(count=clock0) 70 | CALL INTEGRATE(TIN=T,TOUT=TEND,N=NVAR,NNZERO=NNZ,VAR=VAR,RTOL=RTOL,& 71 | ATOL=ATOL,FUN=FUN_U,JAC=JAC_U,RSTATUS_U=RSTATUS,ISTATUS_U=ISTATUS,& 72 | ICNTRL_U=ICNTRL) 73 | call system_clock(count=clock1) 74 | cpu = clock1-clock0 75 | time = real(cpu)/(real(hz)) 76 | !~~~> End time loop ~~~~~~~~~~ 77 | ! print *,VAR 78 | l2=0d0 79 | l2tmp=0d0 80 | do i=1,NVAR 81 | l2=l2+(VAR(i)-ANS(i))*(VAR(i)-ANS(i)) 82 | l2tmp =l2tmp+ANS(i)*ANS(i) 83 | end do 84 | error=sqrt(l2/l2tmp) 85 | write(6,919) error,time 86 | 919 FORMAT(2x,'L2 norm:',F12.9,' time elapsed:',F12.9) 87 | 88 | 89 | WRITE(6,991) RSTATUS(1), & 90 | ( TRIM(SPC_NAMES(MONITOR(i))), & 91 | VAR(MONITOR(i))/CFACTOR, i=1,NVAR ) 92 | 93 | 991 FORMAT(' AT TIME',E10.3,2X,200(A,'=',E11.4,'; ')) 94 | end do 95 | END PROGRAM small_strato_dr 96 | 97 | 98 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_rk/small_strato_dr.F90: -------------------------------------------------------------------------------- 1 | PROGRAM small_strato_dr 2 | USE RK_f90_Integrator 3 | USE User_Parameters 4 | IMPLICIT NONE 5 | CHARACTER(LEN=12), PARAMETER, DIMENSION(7) :: SPC_NAMES = (/ & 6 | 'O1D ','O ','O3 ', & 7 | 'NO ','NO2 ','M ', & 8 | 'O2 ' /) 9 | INTEGER, PARAMETER, DIMENSION(6) :: MONITOR = (/ & 10 | 1, 2, 3, 4, 5, 7 /) 11 | CHARACTER(LEN=12), PARAMETER, DIMENSION(1) :: SMASS = (/ & 12 | 'N ' /) 13 | 14 | INTEGER :: i, ind_1 = 1, ind_2 = 2, NMONITOR=6, NMASS=1 15 | 16 | INTEGER, PARAMETER :: NSPEC = 7 17 | !~~> Control (in) and status (out) arguments for the integration 18 | DOUBLE PRECISION, DIMENSION(20) :: RCNTRL, RSTATUS 19 | INTEGER, DIMENSION(20) :: ICNTRL, ISTATUS 20 | DOUBLE PRECISION :: CFACTOR, x 21 | DOUBLE PRECISION :: ATOL(NVAR), RTOL(NVAR), VAR(NVAR) 22 | DOUBLE PRECISION:: TSTART, TEND, T, l2,l2tmp,error 23 | DOUBLE PRECISION,DIMENSION(5):: ANS = (/154.2258448,1034529328.3727823,& 24 | 832159397391.5885010,905729267.2488701,190770732.7509280/) 25 | INTEGER :: iter,hz,clock0,clock1,cpu 26 | DOUBLE PRECISION :: time 27 | !~~~> Tolerances for calculating concentrations 28 | DO i=1,NVAR 29 | RTOL(i) = 1.0d-2 30 | ATOL(i) = 1.0d-1 31 | END DO 32 | 33 | DO iter = 1, 5 34 | !~~~> Tolerances for calculating concentrations 35 | DO i=1,NVAR 36 | RTOL(i) = 0.1*RTOL(i) 37 | ATOL(i) = 0.1*ATOL(i) 38 | END DO 39 | 40 | ! Initialize 41 | CFACTOR = 1.000000e+00 42 | x = (0.)*CFACTOR 43 | DO i = 1, NVAR 44 | VAR(i) = x 45 | END DO 46 | x = (0.)*CFACTOR 47 | DO i = 1, NFIX 48 | FIX(i) = x 49 | END DO 50 | VAR(1) = (9.906E+01)*CFACTOR 51 | VAR(2) = (6.624E+08)*CFACTOR 52 | VAR(3) = (5.326E+11)*CFACTOR 53 | VAR(4) = (8.725E+08)*CFACTOR 54 | VAR(5) = (2.240E+08)*CFACTOR 55 | FIX(1) = (8.120E+16)*CFACTOR 56 | FIX(2) = (1.697E+16)*CFACTOR 57 | TSTART = (12*3600) 58 | TEND = TSTART + (30*24*3600) 59 | 60 | !~~~> Default control options 61 | ICNTRL(1:20) = 0 62 | RCNTRL(1:20) = 0.0d0 63 | 64 | !~~~> Begin time loop 65 | 66 | T = TSTART 67 | 68 | call system_clock(count_rate=hz) 69 | call system_clock(count=clock0) 70 | CALL INTEGRATE(TIN=T,TOUT=TEND,N=NVAR,NNZERO=NNZ,VAR=VAR,RTOL=RTOL,& 71 | ATOL=ATOL,FUN=FUN_U,JAC=JAC_U,RSTATUS_U=RSTATUS,ISTATUS_U=ISTATUS,& 72 | ICNTRL_U=ICNTRL) 73 | call system_clock(count=clock1) 74 | cpu = clock1-clock0 75 | time = real(cpu)/(real(hz)) 76 | !~~~> End time loop ~~~~~~~~~~ 77 | ! print *,VAR 78 | l2=0d0 79 | l2tmp=0d0 80 | do i=1,NVAR 81 | l2=l2+(VAR(i)-ANS(i))*(VAR(i)-ANS(i)) 82 | l2tmp =l2tmp+ANS(i)*ANS(i) 83 | end do 84 | error=sqrt(l2/l2tmp) 85 | write(6,919) error,time 86 | 919 FORMAT(2x,'L2 norm:',F12.9,' time elapsed:',F12.9) 87 | 88 | 89 | WRITE(6,991) RSTATUS(1), & 90 | ( TRIM(SPC_NAMES(MONITOR(i))), & 91 | VAR(MONITOR(i))/CFACTOR, i=1,NVAR ) 92 | 93 | 991 FORMAT(' AT TIME',E10.3,2X,200(A,'=',E11.4,'; ')) 94 | end do 95 | END PROGRAM small_strato_dr 96 | 97 | 98 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_ros/small_strato_dr.F90: -------------------------------------------------------------------------------- 1 | PROGRAM small_strato_dr 2 | USE ROS_f90_Integrator 3 | USE User_Parameters 4 | IMPLICIT NONE 5 | CHARACTER(LEN=12), PARAMETER, DIMENSION(7) :: SPC_NAMES = (/ & 6 | 'O1D ','O ','O3 ', & 7 | 'NO ','NO2 ','M ', & 8 | 'O2 ' /) 9 | INTEGER, PARAMETER, DIMENSION(6) :: MONITOR = (/ & 10 | 1, 2, 3, 4, 5, 7 /) 11 | CHARACTER(LEN=12), PARAMETER, DIMENSION(1) :: SMASS = (/ & 12 | 'N ' /) 13 | 14 | INTEGER :: i, ind_1 = 1, ind_2 = 2, NMONITOR=6, NMASS=1 15 | 16 | INTEGER, PARAMETER :: NSPEC = 7 17 | !~~> Control (in) and status (out) arguments for the integration 18 | DOUBLE PRECISION, DIMENSION(20) :: RCNTRL, RSTATUS 19 | INTEGER, DIMENSION(20) :: ICNTRL, ISTATUS 20 | DOUBLE PRECISION :: CFACTOR, x 21 | DOUBLE PRECISION :: ATOL(NVAR), RTOL(NVAR), VAR(NVAR) 22 | DOUBLE PRECISION:: TSTART, TEND, T, l2,l2tmp,error 23 | DOUBLE PRECISION,DIMENSION(5):: ANS = (/154.2258448,1034529328.3727823,& 24 | 832159397391.5885010,905729267.2488701,190770732.7509280/) 25 | INTEGER :: iter,hz,clock0,clock1,cpu 26 | DOUBLE PRECISION :: time 27 | !~~~> Tolerances for calculating concentrations 28 | DO i=1,NVAR 29 | RTOL(i) = 1.0d-1 30 | ATOL(i) = 1.0d-0 31 | END DO 32 | 33 | DO iter = 1, 5 34 | !~~~> Tolerances for calculating concentrations 35 | DO i=1,NVAR 36 | RTOL(i) = 0.1*RTOL(i) 37 | ATOL(i) = 0.1*ATOL(i) 38 | END DO 39 | 40 | ! Initialize 41 | CFACTOR = 1.000000e+00 42 | x = (0.)*CFACTOR 43 | DO i = 1, NVAR 44 | VAR(i) = x 45 | END DO 46 | x = (0.)*CFACTOR 47 | DO i = 1, NFIX 48 | FIX(i) = x 49 | END DO 50 | VAR(1) = (9.906E+01)*CFACTOR 51 | VAR(2) = (6.624E+08)*CFACTOR 52 | VAR(3) = (5.326E+11)*CFACTOR 53 | VAR(4) = (8.725E+08)*CFACTOR 54 | VAR(5) = (2.240E+08)*CFACTOR 55 | FIX(1) = (8.120E+16)*CFACTOR 56 | FIX(2) = (1.697E+16)*CFACTOR 57 | TSTART = (12*3600) 58 | TEND = TSTART + (30*24*3600) 59 | 60 | !~~~> Default control options 61 | ICNTRL(1:20) = 0 62 | RCNTRL(1:20) = 0.0d0 63 | 64 | !~~~> Begin time loop 65 | 66 | T = TSTART 67 | 68 | call system_clock(count_rate=hz) 69 | call system_clock(count=clock0) 70 | CALL INTEGRATE(TIN=T,TOUT=TEND,N=NVAR,NNZERO=NNZ,VAR=VAR,RTOL=RTOL,& 71 | ATOL=ATOL,FUN=FUN_U,JAC=JAC_U,RSTATUS_U=RSTATUS,ISTATUS_U=ISTATUS,& 72 | ICNTRL_U=ICNTRL) 73 | call system_clock(count=clock1) 74 | cpu = clock1-clock0 75 | time = real(cpu)/(real(hz)) 76 | !~~~> End time loop ~~~~~~~~~~ 77 | ! print *,VAR 78 | l2=0d0 79 | l2tmp=0d0 80 | do i=1,NVAR 81 | l2=l2+(VAR(i)-ANS(i))*(VAR(i)-ANS(i)) 82 | l2tmp =l2tmp+ANS(i)*ANS(i) 83 | end do 84 | error=sqrt(l2/l2tmp) 85 | write(6,919) error,time 86 | 919 FORMAT(2x,'L2 norm:',F12.9,' time elapsed:',F12.9) 87 | 88 | 89 | WRITE(6,991) RSTATUS(1), & 90 | ( TRIM(SPC_NAMES(MONITOR(i))), & 91 | VAR(MONITOR(i))/CFACTOR, i=1,NVAR ) 92 | 93 | 991 FORMAT(' AT TIME',E9.3,2X,200(A,'=',E11.4,'; ')) 94 | end do 95 | END PROGRAM small_strato_dr 96 | 97 | 98 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ERK_ADJ/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | # Configuration flags for linear solvers. Must choose one from the following three options. 20 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # -DSPARSE_UMF use UMFpack (sparse format) 22 | # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | 39 | #~~~> intel fortran 40 | #export FC=ifort 41 | #export FFLAGS= -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 42 | 43 | #BLAS = /opt/ifort_libs/libblas.a 44 | #LAPACK = /opt/ifort_libs/liblapack.a 45 | 46 | #~~~> sunf90 47 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 48 | #export FFLAGS = -O2 -free 49 | #BLAS = -xlic_lib=sunperf 50 | #LAPACK = 51 | 52 | 53 | #~~~> gfortran (GNU FORTRAN Compiler) 54 | export FC = gfortran 55 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 56 | BLAS=/opt/lapack/lib/libblas.a 57 | LAPACK=/opt/lapack/lib/liblapack.a 58 | 59 | 60 | #~~~> PGF90 (Portland Group Compiler) 61 | #export FC=pgf90 62 | #export FFLAGS= -O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess ${LS_CONFIG} 63 | #export FFLAGS +=-C -g -Minform=inform -Mchkfpstk -Mchkptr -Mchkstk -traceback -Mr8 64 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 65 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 66 | #other libraries 67 | #XERBLA = -lpgftnrtl -pgf90libs 68 | 69 | 70 | #~~~> LAHEY 71 | #export FC = lf95 72 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 73 | #BLAS=-lssl2mt 74 | #LAPACK= 75 | 76 | 77 | FATDIR = ../../.. 78 | LIBDIR = $(FATDIR)/LSS_LIBS/ 79 | MODEL = ADJ 80 | FAMILY = ERK_ADJ 81 | 82 | APP = swe2D_erk_adj 83 | PAR = swe2D_upwind.o 84 | INTEGRATOR = $(FAMILY)_f90_Integrator.o 85 | 86 | default: driver 87 | 88 | swe2D_upwind.o: swe2D_upwind.F90 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 92 | $(FC) $(FFLAGS) -c $< 93 | 94 | swe2D_erk_adj_dr.o: swe2D_erk_adj_dr.F90 $(PAR) $(INTEGRATOR) 95 | $(FC) $(FFLAGS) -c $< 96 | 97 | 98 | LIB = -lm 99 | 100 | default: driver 101 | 102 | driver: swe2D_erk_adj_dr.o $(PAR) $(INTEGRATOR) 103 | $(FC) $(FFLAGS) -o $(APP) $< $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 104 | 105 | purge: clean 106 | 107 | clean: 108 | rm -f *~ *.mod *.o 109 | 110 | help: 111 | @$(ECHO) "usage: make ?" 112 | 113 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ERK/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | # Configuration flags for linear solvers. Must choose one from the following three options. 20 | # # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # # -DSPARSE_UMF use UMFpack (sparse format) 22 | # # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -O2 -nogen-interface -fltconsitency -warn all 41 | 42 | #BLAS = /opt/intel/mkl/lib/intel64/libmkl_intel_lp64.a \ 43 | /opt/intel/mkl/lib/intel64/libmkl_sequential.a \ 44 | /opt/intel/mkl/lib/intel64/libmkl_core.a 45 | #LAPACK = 46 | 47 | 48 | #~~~> sunf90 49 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 50 | #export FFLAGS = -O2 -free 51 | #BLAS = -xlic_lib=sunperf 52 | #LAPACK = 53 | 54 | 55 | #~~~> gfortran (GNU FORTRAN Compiler) 56 | export FC = gfortran 57 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 58 | BLAS=/opt/lapack/lib/libblas.a 59 | LAPACK=/opt/lapack/lib/liblapack.a 60 | 61 | 62 | #~~~> PGF90 (Portland Group Compiler) 63 | #export FC=pgf90 64 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 65 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 66 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 67 | #other libraries 68 | #XERBLA = -lpgftnrtl -pgf90libs 69 | 70 | 71 | #~~~> LAHEY 72 | #export FC = lf95 73 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 74 | #BLAS=-lssl2mt 75 | #LAPACK= 76 | 77 | 78 | FATDIR = ../../.. 79 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 80 | MODEL = FWD 81 | FAMILY = ERK 82 | 83 | APP = swe2D_erk 84 | PAR = swe2D_upwind.o 85 | INTEGRATOR = $(FAMILY)_f90_Integrator.o 86 | 87 | default: driver 88 | 89 | swe2D_upwind.o: swe2D_upwind.F90 90 | $(FC) $(FFLAGS) -c $< 91 | 92 | 93 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 94 | $(FC) $(FFLAGS) -c $< 95 | 96 | swe2D_erk_dr.o: swe2D_erk_dr.F90 $(PAR) $(INTEGRATOR) 97 | $(FC) $(FFLAGS) -c $< 98 | 99 | 100 | LIB = -lm 101 | 102 | 103 | default: driver 104 | 105 | driver: swe2D_erk_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 106 | $(FC) $(FFLAGS) -o $(APP) $< $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 107 | 108 | purge: clean 109 | 110 | clean: 111 | rm -f *~ *.mod *.o 112 | 113 | help: 114 | @$(ECHO) "usage: make ?" 115 | 116 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_sdirk/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | ## Module: Makefile 4 | # 5 | ## Purpose: Top-level Makefile 6 | # 7 | ## Creation date: Nov 27, 2010 8 | # 9 | ## Modified: 10 | # 11 | ## Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################# 14 | export ARCH=ar -cr 15 | export RANLIB=ranlib 16 | 17 | # Configuration flags for linear solvers. Must choose one from the following three options. 18 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 19 | # -DSPARSE_UMF use UMFpack (sparse format) 20 | # -DSPARSE_LU use SuperLU (sparse format) 21 | # 22 | LS_CONFIG = -DFULL_ALGEBRA 23 | 24 | #~~~> NAG fortran 25 | #export FC=nagfor 26 | #export FFLAGS = -O2 $(LS_CONFIG) 27 | #BLAS = ~/nagfor_libs/libblas.a 28 | #LAPACK = ~/nagfor_libs/liblapack.a 29 | 30 | #~~~> absoft fortran 31 | #export FC=f95 32 | #export FFLAGS = -O2 $(LS_CONFIG) 33 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 34 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 35 | 36 | #~~~> intel fortran 37 | #export FC=ifort 38 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 39 | #BLAS = /opt/ifort_libs/libblas.a 40 | #LAPACK = /opt/ifort_libs/liblapack.a 41 | 42 | #~~~> sunf90 43 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 44 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 45 | #BLAS = -xlic_lib=sunperf 46 | #LAPACK = 47 | 48 | #~~~> gfortran (GNU FORTRAN Compiler) 49 | export FC = gfortran 50 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 51 | BLAS=/opt/lapack/lib/libblas.a 52 | LAPACK=/opt/lapack/lib/liblapack.a 53 | 54 | 55 | #~~~> PGF90 (Portland Group Compiler) 56 | #export FC=pgf90 57 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 58 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 59 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 60 | #other libraries 61 | #XERBLA = -lpgftnrtl -pgf90libs 62 | 63 | 64 | #~~~> LAHEY 65 | #export FC = lf95 66 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 67 | #BLAS=-lssl2mt 68 | #LAPACK= 69 | 70 | FATDIR = ../../.. 71 | MODEL = FWD 72 | FAMILY = SDIRK 73 | 74 | APP = small_strato 75 | PAR = User_Parameters.o 76 | 77 | LSSOLVER=LS_Solver.o 78 | 79 | INTEGRATOR=$(FAMILY)_f90_Integrator.o 80 | 81 | default: driver clean 82 | 83 | User_Parameters.o: User_Parameters.F90 84 | $(FC) $(FFLAGS) -c $< 85 | 86 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 87 | $(FC) $(FFLAGS) -c $< 88 | 89 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 90 | $(FC) $(FFLAGS) -c $< 91 | 92 | small_strato_dr.o: small_strato_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 93 | $(FC) $(FFLAGS) -c $< 94 | 95 | 96 | LIB = -lm 97 | 98 | 99 | default: driver 100 | 101 | driver: small_strato_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 102 | $(FC) $(FFLAGS) -o $(APP) $< $(INTEGRATOR) $(LSSOLVER) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 103 | 104 | purge: clean 105 | 106 | clean: 107 | rm -f *~ *.o *.mod 108 | rm -f driver 109 | help: 110 | @$(ECHO) "usage: make ?" 111 | 112 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ROS_ADJ/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | 20 | #Configuration flags for linear solvers. Must choose one from the following three options. 21 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 22 | # -DSPARSE_UMF use UMFpack (sparse format) 23 | # -DSPARSE_LU use SuperLU (sparse format) 24 | # 25 | LS_CONFIG = -DSPARSE_LU 26 | 27 | #~~~> intel fortran 28 | #export FC=ifort 29 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 30 | #BLAS = /opt/ifort_libs/libblas.a 31 | #LAPACK = /opt/ifort_libs/liblapack.a 32 | 33 | 34 | #~~~> sunF90 35 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 36 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 37 | #BLAS = -xlic_lib=sunperf 38 | #LAPACK = 39 | 40 | 41 | #~~~> gfortran (GNU FORTRAN Compiler) 42 | export FC = gfortran 43 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 44 | BLAS=/opt/lapack/lib/libblas.a 45 | LAPACK=/opt/lapack/lib/liblapack.a 46 | 47 | 48 | #~~~> PGF90 (Portland Group Compiler) 49 | #export FC=pgf90 50 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 51 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 52 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 53 | #other libraries 54 | #XERBLA = -lpgftnrtl -pgf90libs 55 | 56 | 57 | #~~~> LAHEY 58 | #export FC = lf95 59 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 60 | #BLAS = -lssl2mt 61 | #LAPACK = 62 | 63 | FATDIR = ../../.. 64 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 65 | MODEL = ADJ 66 | FAMILY = ROS_ADJ 67 | 68 | APP = swe2D_ros_adj 69 | PAR = swe2D_upwind.o 70 | LSSOLVER = LS_Solver.o 71 | 72 | INTEGRATOR= $(FAMILY)_f90_Integrator.o 73 | 74 | default: driver 75 | 76 | swe2D_upwind.o: swe2D_upwind.F90 77 | $(FC) $(FFLAGS) -c $< 78 | 79 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 80 | $(FC) $(FFLAGS) -c $< 81 | 82 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 83 | $(FC) $(FFLAGS) -c $< 84 | 85 | swe2D_ros_adj_dr.o: swe2D_ros_adj_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 86 | $(FC) $(FFLAGS) -c $< 87 | 88 | LIB = -lm 89 | 90 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 91 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 92 | 93 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 94 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 95 | 96 | default: driver 97 | 98 | driver: swe2D_ros_adj_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 99 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(INTEGRATOR) $(LSSOLVER) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 100 | 101 | purge: clean 102 | 103 | clean: 104 | rm -f *~ *.mod *.o 105 | 106 | help: 107 | @$(ECHO) "usage: make ?" 108 | 109 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ROS_TLM/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | # Configuration flags for linear solvers. Must choose one from the following three options. 20 | # # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # # -DSPARSE_UMF use UMFpack (sparse format) 22 | # # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | 25 | LS_CONFIG = -DSPARSE_UMF 26 | 27 | #~~~> intel fortran 28 | #export FC=ifort 29 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 30 | #BLAS = /opt/ifort_libs/libblas.a 31 | #LAPACK = /opt/ifort_libs/liblapack.a 32 | 33 | 34 | #~~~> sunf90 35 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 36 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 37 | #BLAS = -xlic_lib=sunperf 38 | #LAPACK = 39 | 40 | #~~~> gfortran (GNU FORTRAN Compiler) 41 | export FC = gfortran 42 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 43 | BLAS=/opt/lapack/lib/libblas.a 44 | LAPACK=/opt/lapack/lib/liblapack.a 45 | 46 | 47 | #~~~> PGF90 (Portland Group Compiler) 48 | #export FC=pgf90 49 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 50 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 51 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 52 | #other libraries 53 | #XERBLA = -lpgftnrtl -pgf90libs 54 | 55 | 56 | #~~~> LAHEY 57 | #export FC = lf95 58 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 59 | #BLAS=-lssl2mt 60 | #LAPACK= 61 | 62 | 63 | FATDIR = ../../.. 64 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 65 | MODEL = TLM 66 | FAMILY = ROS_TLM 67 | 68 | APP = swe2D_ros_tlm 69 | PAR = swe2D_upwind.o 70 | LSSOLVER = LS_Solver.o 71 | INTEGRATOR = $(FAMILY)_f90_Integrator.o 72 | 73 | default: driver 74 | 75 | swe2D_upwind.o: swe2D_upwind.F90 76 | $(FC) $(FFLAGS) -c $< 77 | 78 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 79 | $(FC) $(FFLAGS) -c $< 80 | 81 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 82 | $(FC) $(FFLAGS) -c $< 83 | 84 | swe2D_ros_tlm_dr.o: swe2D_ros_tlm_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 85 | $(FC) $(FFLAGS) -c $< 86 | 87 | 88 | 89 | LIB = -lm 90 | 91 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 92 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 93 | 94 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 95 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 96 | 97 | default: driver 98 | 99 | driver: swe2D_ros_tlm_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 100 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(INTEGRATOR) $(LSSOLVER) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 101 | 102 | purge: clean 103 | 104 | clean: 105 | rm -f *~ *.mod *.o 106 | 107 | help: 108 | @$(ECHO) "usage: make ?" 109 | 110 | -------------------------------------------------------------------------------- /EXAMPLES/roberts/ROBERTS_ROS_ADJ/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | #Configuration flags for linear solvers. Must choose one from the following three options. 20 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # -DSPARSE_UMF use UMFpack (sparse format) 22 | # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f95 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS = /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | 45 | #~~~> sunf90 46 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 47 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 48 | #BLAS = -xlic_lib=sunperf 49 | #LAPACK = 50 | 51 | #~~~> gfortran (GNU FORTRAN Compiler) 52 | export FC = gfortran 53 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 54 | BLAS=/opt/lapack/lib/libblas.a 55 | LAPACK=/opt/lapack/lib/liblapack.a 56 | 57 | 58 | #~~~> PGF90 (Portland Group Compiler) 59 | #export FC=pgf90 60 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 61 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 62 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 63 | #other libraries 64 | #XERBLA = -lpgftnrtl -pgf90libs 65 | 66 | 67 | #~~~> LAHEY 68 | #export FC = lf95 69 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 70 | #BLAS = -lssl2mt 71 | 72 | FATDIR = ../../.. 73 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 74 | MODEL = ADJ 75 | FAMILY = ROS_ADJ 76 | 77 | APP = roberts_ros_adj 78 | PAR = 79 | LSSOLVER = LS_Solver.o 80 | 81 | INTEGRATOR= $(FAMILY)_f90_Integrator.o 82 | 83 | default: driver clean 84 | 85 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 86 | $(FC) $(FFLAGS) -c $< 87 | 88 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | roberts_ros_adj_dr.o: roberts_ros_adj_dr.F90 $(LSSOLVER) $(INTEGRATOR) 92 | $(FC) $(FFLAGS) -c $< 93 | 94 | 95 | LIB = -lm 96 | 97 | LUPACK = 98 | LUWRAP = 99 | 100 | UMFPACK = 101 | UMFWRAP = 102 | 103 | default: driver 104 | 105 | driver: roberts_ros_adj_dr.o $(LSSOLVER) $(INTEGRATOR) 106 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(INTEGRATOR) $(LSSOLVER) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 107 | 108 | purge: clean 109 | 110 | clean: 111 | rm -f *~ *.mod *.o 112 | 113 | help: 114 | @$(ECHO) "usage: make ?" 115 | 116 | -------------------------------------------------------------------------------- /EXAMPLES/roberts/ROBERTS_RK_ADJ/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | #Configuration flags for linear solvers. Must choose one from the following three options. 20 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # # -DSPARSE_UMF use UMFpack (sparse format) 22 | # -DSPARSE_LU use SuperLU (sparse format) 23 | # # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f95 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS = /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | 45 | #~~~> sunf90 46 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 47 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 48 | #BLAS = -xlic_lib=sunperf 49 | #LAPACK = 50 | 51 | #~~~> gfortran (GNU FORTRAN Compiler) 52 | export FC = gfortran 53 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 54 | BLAS=/opt/lapack/lib/libblas.a 55 | LAPACK=/opt/lapack/lib/liblapack.a 56 | 57 | 58 | #~~~> PGF90 (Portland Group Compiler) 59 | #export FC=pgf90 60 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 61 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 62 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 63 | #other libraries 64 | #XERBLA = -lpgftnrtl -pgf90libs 65 | 66 | 67 | #~~~> LAHEY 68 | #export FC = lf95 69 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 70 | #BLAS = -lssl2mt 71 | #LAPACK = 72 | 73 | FATDIR = ../../.. 74 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 75 | MODEL = ADJ 76 | FAMILY = RK_ADJ 77 | 78 | APP = roberts_rk_adj 79 | PAR = 80 | 81 | LSSOLVER = LS_Solver.o 82 | 83 | INTEGRATOR= $(FAMILY)_f90_Integrator.o 84 | 85 | default: driver clean 86 | 87 | 88 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 92 | $(FC) $(FFLAGS) -c $< 93 | 94 | roberts_rk_adj_dr.o: roberts_rk_adj_dr.F90 $(LSSOLVER) $(INTEGRATOR) 95 | $(FC) $(FFLAGS) -c $< 96 | 97 | LIB = -lm 98 | 99 | LUPACK = 100 | LUWRAP = 101 | 102 | UMFPACK = 103 | UMFWRAP = 104 | 105 | 106 | default: driver 107 | 108 | driver: roberts_rk_adj_dr.o $(LSSOLVER) $(INTEGRATOR) 109 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 110 | 111 | purge: clean 112 | 113 | clean: 114 | rm -f *~ *.mod *.o 115 | 116 | help: 117 | @$(ECHO) "usage: make ?" 118 | 119 | -------------------------------------------------------------------------------- /EXAMPLES/roberts/ROBERTS_SDIRK_ADJ/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | #Configuration flags for linear solvers. Must choose one from the following three options. 20 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # -DSPARSE_UMF use UMFpack (sparse format) 22 | # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | 27 | #~~~> NAG fortran 28 | #export FC=nagfor 29 | #export FFLAGS = -O2 $(LS_CONFIG) 30 | #BLAS = ~/nagfor_libs/libblas.a 31 | #LAPACK = ~/nagfor_libs/liblapack.a 32 | 33 | #~~~> absoft fortran 34 | #export FC=f90 35 | #export FFLAGS = -O2 $(LS_CONFIG) 36 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 37 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 38 | 39 | #~~~> intel fortran 40 | #export FC=ifort 41 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 42 | #BLAS = /opt/ifort_libs/libblas.a 43 | #LAPACK = /opt/ifort_libs/liblapack.a 44 | 45 | 46 | #~~~> sunf90 47 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 48 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 49 | #BLAS = -xlic_lib=sunperf 50 | #LAPACK = 51 | 52 | #~~~> gfortran (GNU FORTRAN Compiler) 53 | export FC = gfortran 54 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 55 | BLAS=/opt/lapack/lib/libblas.a 56 | LAPACK=/opt/lapack/lib/liblapack.a 57 | 58 | 59 | #~~~> PGF90 (Portland Group Compiler) 60 | #export FC=pgf90 61 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 62 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 63 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 64 | #other libraries 65 | #XERBLA = -lpgftnrtl -pgf90libs 66 | 67 | 68 | #~~~> LAHEY 69 | #export FC = lf95 70 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 71 | #BLAS = -lssl2mt 72 | #LAPACK = 73 | 74 | FATDIR = ../../.. 75 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 76 | MODEL = ADJ 77 | FAMILY = SDIRK_ADJ 78 | 79 | APP = roberts_sdirk_adj 80 | PAR = 81 | LSSOLVER = LS_Solver.o 82 | 83 | 84 | INTEGRATOR =$(FAMILY)_f90_Integrator.o 85 | 86 | default: driver 87 | 88 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 92 | $(FC) $(FFLAGS) -c $< 93 | 94 | roberts_sdirk_adj_dr.o: roberts_sdirk_adj_dr.F90 $(LSSOLVER) $(INTEGRATOR) 95 | $(FC) $(FFLAGS) -c $< 96 | 97 | 98 | LIB = -lm 99 | 100 | LUPACK = 101 | LUWRAP = 102 | 103 | UMFPACK = 104 | UMFWRAP = 105 | 106 | 107 | default: driver 108 | 109 | driver: roberts_sdirk_adj_dr.o $(LSSOLVER) $(INTEGRATOR) 110 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 111 | 112 | purge: clean 113 | 114 | clean: 115 | rm -f *~ *.mod *.o 116 | 117 | help: 118 | @$(ECHO) "usage: make ?" 119 | 120 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_rk/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | ## Module: Makefile 4 | # 5 | ## Purpose: Top-level Makefile 6 | # 7 | ## Creation date: Nov 27, 2010 8 | # 9 | ## Modified: 10 | # 11 | ## Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################# 14 | export ARCH=ar -cr 15 | export RANLIB=ranlib 16 | 17 | # Configuration flags for linear solvers. Must choose one from the following three options. 18 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 19 | # -DSPARSE_UMF use UMFpack (sparse format) 20 | # -DSPARSE_LU use SuperLU (sparse format) 21 | 22 | LS_CONFIG = -DFULL_ALGEBRA 23 | 24 | #~~~> NAG fortran 25 | #export FC=nagfor 26 | #export FFLAGS = -O2 $(LS_CONFIG) 27 | #BLAS = ~/nagfor_libs/libblas.a 28 | #LAPACK = ~/nagfor_libs/liblapack.a 29 | 30 | #~~~> absoft fortran 31 | #export FC=f90 32 | #export FFLAGS = -O2 $(LS_CONFIG) 33 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 34 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 35 | 36 | #~~~> intel fortran 37 | #export FC=ifort 38 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) 39 | #BLAS = /opt/ifort_libs/libblas.a 40 | #LAPACK = /opt/ifort_libs/liblapack.a 41 | 42 | 43 | #~~~> sunf90 44 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 45 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 46 | #BLAS = -xlic_lib=sunperf 47 | #LAPACK = 48 | 49 | #~~~> gfortran (GNU FORTRAN Compiler) 50 | export FC = gfortran 51 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 52 | BLAS=/opt/lapack/lib/libblas.a 53 | LAPACK=/opt/lapack/lib/liblapack.a 54 | 55 | 56 | #~~~> PGF90 (Portland Group Compiler) 57 | #export FC=pgf90 58 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 59 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 60 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 61 | #XERBLA = -lpgftnrtl -pgf90libs 62 | 63 | 64 | #~~~> LAHEY 65 | #export FC = lf95 66 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 67 | #BLAS=-lssl2mt 68 | #LAPACK= 69 | 70 | FATDIR = ../../.. 71 | MODEL = FWD 72 | FAMILY = RK 73 | 74 | APP = small_strato 75 | PAR = User_Parameters.o 76 | LSSOLVER=LS_Solver.o 77 | 78 | INTEGRATOR=$(FAMILY)_f90_Integrator.o 79 | 80 | default: driver 81 | 82 | User_Parameters.o: User_Parameters.F90 83 | $(FC) $(FFLAGS) -c $< 84 | 85 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 86 | $(FC) $(FFLAGS) -c $< 87 | 88 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | small_strato_dr.o: small_strato_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 92 | $(FC) $(FFLAGS) -c $< 93 | 94 | LIB = -lm 95 | 96 | #LUPACK = $(LIBDIR)/libsuperlu_4.2.a 97 | #LUWRAP = $(LIBDIR)/c_fortran_dgssv.o $(LIBDIR)/c_fortran_zgssv.o 98 | 99 | #UMFPACK = $(LIBDIR)/libumfpack.a $(LIBDIR)/libamd.a 100 | #UMFWRAP = $(LIBDIR)/umf4_f77wrapper.o $(LIBDIR)/umf4_f77zwrapper.o 101 | 102 | default: driver clean 103 | 104 | driver: small_strato_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 105 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(INTEGRATOR) $(LSSOLVER) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 106 | 107 | purge: clean 108 | 109 | clean: 110 | rm -f *~ *.o *.mod 111 | rm -f driver 112 | help: 113 | @$(ECHO) "usage: make ?" 114 | 115 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_ros/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | ## Module: Makefile 4 | # 5 | ## Purpose: Top-level Makefile 6 | # 7 | ## Creation date: Nov 27, 2010 8 | # 9 | ## Modified: 10 | # 11 | ## Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################# 14 | export ARCH=ar -cr 15 | export RANLIB=ranlib 16 | 17 | # Configuration flags for linear solvers. Must choose one from the following three options. 18 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 19 | # -DSPARSE_UMF use UMFpack (sparse format) 20 | # -DSPARSE_LU use SuperLU (sparse format) 21 | # 22 | LS_CONFIG = -DFULL_ALGEBRA 23 | 24 | #~~~> NAG fortran 25 | #export FC=nagfor 26 | #export FFLAGS = -O2 $(LS_CONFIG) 27 | #BLAS = ~/nagfor_libs/libblas.a 28 | #LAPACK = ~/nagfor_libs/liblapack.a 29 | 30 | #~~~> absoft fortran 31 | #export FC=f90 32 | #export FFLAGS = -O2 $(LS_CONFIG) 33 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 34 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 35 | 36 | #~~~> intel fortran 37 | #export FC=ifort 38 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) 39 | #BLAS = /opt/ifort_libs/libblas.a 40 | #LAPACK = /opt/ifort_libs/liblapack.a 41 | 42 | 43 | #~~~> sunf90 44 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 45 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 46 | #BLAS = -xlic_lib=sunperf 47 | #LAPACK = 48 | 49 | #~~~> gfortran (GNU FORTRAN Compiler) 50 | export FC = gfortran 51 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 52 | BLAS=/opt/lapack/lib/libblas.a 53 | LAPACK=/opt/lapack/lib/liblapack.a 54 | 55 | 56 | #~~~> PGF90 (Portland Group Compiler) 57 | #export FC=pgf90 58 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 59 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 60 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 61 | #other libraries 62 | #XERBLA = -lpgftnrtl -pgf90libs 63 | 64 | 65 | #~~~> LAHEY 66 | #export FC = lf95 67 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 68 | #BLAS=-lssl2mt 69 | #LAPACK= 70 | 71 | 72 | FATDIR = ../../.. 73 | MODEL = FWD 74 | FAMILY = ROS 75 | 76 | APP = small_strato 77 | PAR = User_Parameters.o 78 | 79 | LSSOLVER=LS_Solver.o 80 | 81 | INTEGRATOR=$(FAMILY)_f90_Integrator.o 82 | 83 | default: driver 84 | 85 | User_Parameters.o: User_Parameters.F90 86 | $(FC) $(FFLAGS) -c $< 87 | 88 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 92 | $(FC) $(FFLAGS) -c $< 93 | 94 | small_strato_dr.o: small_strato_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 95 | $(FC) $(FFLAGS) -c $< 96 | 97 | 98 | LIB = -lm 99 | 100 | #UMFPACK = $(FATDIR)/LSS_LIBS/libumfpack.a $(FATDIR)/LSS_LIBS/libamd.a 101 | #UMFWRAP = $(FATDIR)/LSS_LIBS/umf4_f77wrapper.o 102 | 103 | #LUPACK = $(FATDIR)/LSS_LIBS/libsuperlu_4.0.a 104 | #LUWRAP = $(FATDIR)/LSS_LIBS/c_fortran_dgssv.o 105 | 106 | default: driver clean 107 | 108 | driver: small_strato_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 109 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(INTEGRATOR) $(LSSOLVER) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 110 | 111 | purge: clean 112 | 113 | clean: 114 | rm -f *~ *.o *.mod 115 | rm -f driver 116 | help: 117 | @$(ECHO) "usage: make ?" 118 | 119 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ROS/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | 20 | # Configuration flags for linear solvers. Must choose one from the following three options. 21 | # # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 22 | # # -DSPARSE_UMF use UMFpack (sparse format) 23 | # # -DSPARSE_LU use SuperLU (sparse format) 24 | # 25 | LS_CONFIG = -DSPARSE_UMF 26 | 27 | #~~~> NAG fortran 28 | #export FC=nagfor 29 | #export FFLAGS = -O2 $(LS_CONFIG) 30 | #BLAS = ~/nagfor_libs/libblas.a 31 | #LAPACK = ~/nagfor_libs/liblapack.a 32 | 33 | #~~~> absoft fortran 34 | #export FC=f90 35 | #export FFLAGS = -O2 $(LS_CONFIG) 36 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 37 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 38 | 39 | #~~~> intel fortran 40 | #export FC=ifort 41 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency -r8 $(LS_CONFIG) -warn all 42 | #BLAS = /opt/ifort_libs/libblas.a 43 | #LAPACK = /opt/ifort_libs/liblapack.a 44 | 45 | #~~~> sunf90 46 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 47 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 48 | #BLAS = -xlic_lib=sunperf 49 | #LAPACK = 50 | 51 | 52 | #~~~> gfortran (GNU FORTRAN Compiler) 53 | export FC = gfortran 54 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 55 | BLAS=/opt/lapack/lib/libblas.a 56 | LAPACK=/opt/lapack/lib/liblapack.a 57 | 58 | 59 | #~~~> PGF90 (Portland Group Compiler) 60 | #export FC=pgf90 61 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 62 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 63 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 64 | #other libraries 65 | #XERBLA = -lpgftnrtl -pgf90libs 66 | 67 | 68 | #~~~> LAHEY 69 | #export FC = lf95 70 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 71 | #BLAS=-lssl2mt 72 | #LAPACK= 73 | 74 | 75 | FATDIR = ../../.. 76 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 77 | MODEL = FWD 78 | FAMILY = ROS 79 | 80 | APP = swe2D_ros 81 | PAR = swe2D_upwind.o 82 | LSSOLVER = LS_Solver.o 83 | INTEGRATOR= $(FAMILY)_f90_Integrator.o 84 | 85 | default: driver 86 | 87 | swe2D_upwind.o: swe2D_upwind.F90 88 | $(FC) $(FFLAGS) -c $< 89 | 90 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 91 | $(FC) $(FFLAGS) -c $< 92 | 93 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 94 | $(FC) $(FFLAGS) -c $< 95 | 96 | swe2D_ros_dr.o: swe2D_ros_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 97 | $(FC) $(FFLAGS) -c $< 98 | 99 | 100 | LIB = -lm 101 | 102 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 103 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 104 | 105 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 106 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 107 | 108 | default: driver 109 | 110 | driver: swe2D_ros_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 111 | $(FC) $(FFLAGS) -o swe2D_ros $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(INTEGRATOR) $(LSSOLVER) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 112 | 113 | purge: clean 114 | 115 | clean: 116 | rm -f *~ *.mod *.o 117 | 118 | help: 119 | @$(ECHO) "usage: make ?" 120 | 121 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_RK/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | # Configuration flags for linear solvers. Must choose one from the following three options. 20 | # # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # # -DSPARSE_UMF use UMFpack (sparse format) 22 | # # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DSPARSE_UMF 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS = /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | 45 | #~~~> sunf90 46 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 47 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 48 | #BLAS = -xlic_lib=sunperf 49 | #LAPACK = 50 | 51 | 52 | #~~~> gfortran (GNU FORTRAN Compiler) 53 | export FC = gfortran 54 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 55 | BLAS=/opt/lapack/lib/libblas.a 56 | LAPACK=/opt/lapack/lib/liblapack.a 57 | 58 | 59 | #~~~> PGF90 (Portland Group Compiler) 60 | #export FC=pgf90 61 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=inform -Mpreprocess $(LS_CONFIG) 62 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 63 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 64 | #other libraries 65 | #XERBLA = -lpgftnrtl -pgf90libs 66 | 67 | 68 | #~~~> LAHEY 69 | #export FC = lf95 70 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 71 | #BLAS=-lssl2mt 72 | #LAPACK= 73 | 74 | 75 | FATDIR = ../../.. 76 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 77 | MODEL = FWD 78 | FAMILY = RK 79 | 80 | APP = swe2D_rk 81 | PAR = swe2D_upwind.o 82 | LSSOLVER = LS_Solver.o 83 | INTEGRATOR = $(FAMILY)_f90_Integrator.o 84 | 85 | default: driver 86 | 87 | swe2D_upwind.o: swe2D_upwind.F90 88 | $(FC) $(FFLAGS) -c $< 89 | 90 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 91 | $(FC) $(FFLAGS) -c $< 92 | 93 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 94 | $(FC) $(FFLAGS) -c $< 95 | 96 | swe2D_rk_dr.o: swe2D_rk_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 97 | $(FC) $(FFLAGS) -c $< 98 | 99 | 100 | LIB = -lm 101 | 102 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 103 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 104 | 105 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 106 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 107 | 108 | 109 | default: driver 110 | 111 | driver: swe2D_rk_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 112 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 113 | 114 | purge: clean 115 | 116 | clean: 117 | rm -f *~ *.mod *.o 118 | 119 | help: 120 | @$(ECHO) "usage: make ?" 121 | 122 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_ros_adj/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | ## Module: Makefile 4 | # 5 | ## Purpose: Top-level Makefile 6 | # 7 | ## Creation date: Nov 27, 2010 8 | # 9 | ## Modified: 10 | # 11 | ## Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################# 14 | export ARCH=ar -cr 15 | export RANLIB=ranlib 16 | 17 | 18 | #Configuration flags for linear solvers. Must choose one from the following three options. 19 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 20 | # -DSPARSE_UMF use UMFpack (sparse format) 21 | # -DSPARSE_LU use SuperLU (sparse format) 22 | # 23 | LS_CONFIG = -DFULL_ALGEBRA 24 | 25 | #~~~> NAG fortran 26 | #export FC=nagfor 27 | #export FFLAGS = -O2 $(LS_CONFIG) 28 | #BLAS = ~/nagfor_libs/libblas.a 29 | #LAPACK = ~/nagfor_libs/liblapack.a 30 | 31 | #~~~> absoft fortran 32 | #export FC=f90 33 | #export FFLAGS = -O2 $(LS_CONFIG) 34 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 35 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 36 | 37 | #~~~> intel fortran 38 | #export FC=ifort 39 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) 40 | #BLAS = /opt/ifort_libs/libblas.a 41 | #LAPACK = /opt/ifort_libs/liblapack.a 42 | 43 | #~~~> sunf90 44 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 45 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 46 | #BLAS = -xlic_lib=sunperf 47 | #LAPACK = 48 | 49 | #~~~> gfortran (GNU FORTRAN Compiler) 50 | export FC = gfortran 51 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 52 | BLAS=/opt/lapack/lib/libblas.a 53 | LAPACK=/opt/lapack/lib/liblapack.a 54 | 55 | #~~~> PGF90 (Portland Group Compiler) 56 | #export FC=pgf90 57 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 58 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 59 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 60 | #other libraries 61 | #XERBLA = -lpgftnrtl -pgf90libs 62 | 63 | 64 | #~~~> LAHEY 65 | #export FC = lf95 66 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 67 | #BLAS = -lssl2mt 68 | #LAPACK = 69 | 70 | FATDIR = ../../.. 71 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 72 | MODEL = ADJ 73 | FAMILY = ROS_ADJ 74 | 75 | APP = small_strato 76 | PAR = User_Parameters.o 77 | LSSOLVER=LS_Solver.o 78 | 79 | INTEGRATOR=$(FAMILY)_f90_Integrator.o 80 | 81 | default: driver clean 82 | 83 | User_Parameters.o: User_Parameters.F90 84 | $(FC) $(FFLAGS) -c $< 85 | 86 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 87 | $(FC) $(FFLAGS) -c $< 88 | 89 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 90 | $(FC) $(FFLAGS) -c $< 91 | 92 | small_strato_dr.o: small_strato_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 93 | $(FC) $(FFLAGS) -c $< 94 | 95 | 96 | LIB = -lm 97 | 98 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 99 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 100 | 101 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 102 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 103 | 104 | 105 | default: driver 106 | 107 | driver: small_strato_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 108 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(INTEGRATOR) $(LSSOLVER) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 109 | 110 | purge: clean 111 | 112 | clean: 113 | rm -f *~ *.o *.mod 114 | rm -f driver 115 | help: 116 | @$(ECHO) "usage: make ?" 117 | 118 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_RK/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | # Configuration flags for linear solvers. Must choose one from the following three options. 20 | # # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # # -DSPARSE_UMF use UMFpack (sparse format) 22 | # # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS = /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | 45 | #~~~> sunf90 46 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 47 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 48 | #BLAS = -xlic_lib=sunperf 49 | #LAPACK = 50 | 51 | 52 | #~~~> gfortran (GNU FORTRAN Compiler) 53 | export FC = gfortran 54 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 55 | BLAS=/opt/lapack/lib/libblas.a 56 | LAPACK=/opt/lapack/lib/liblapack.a 57 | 58 | 59 | #~~~> PGF90 (Portland Group Compiler) 60 | #export FC=pgf90 61 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=inform -Mpreprocess $(LS_CONFIG) 62 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 63 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 64 | #other libraries 65 | #XERBLA = -lpgftnrtl -pgf90libs 66 | 67 | 68 | #~~~> LAHEY 69 | #export FC = lf95 70 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 71 | #BLAS=-lssl2mt 72 | #LAPACK= 73 | 74 | 75 | FATDIR = ../../.. 76 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 77 | MODEL = FWD 78 | FAMILY = RK 79 | 80 | APP = cbm4_rk 81 | PAR = cbm4_parameters.o 82 | LSSOLVER = LS_Solver.o 83 | INTEGRATOR = $(FAMILY)_f90_Integrator.o 84 | 85 | default: driver 86 | 87 | cbm4_parameters.o: cbm4_parameters.F90 88 | $(FC) $(FFLAGS) -c $< 89 | 90 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 91 | $(FC) $(FFLAGS) -c $< 92 | 93 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 94 | $(FC) $(FFLAGS) -c $< 95 | 96 | cbm4_rk_dr.o: cbm4_rk_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 97 | $(FC) $(FFLAGS) -c $< 98 | 99 | 100 | LIB = -lm 101 | 102 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 103 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 104 | 105 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 106 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 107 | 108 | 109 | default: driver clean 110 | 111 | driver: cbm4_rk_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 112 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 113 | 114 | purge: clean 115 | 116 | clean: 117 | rm -f *~ *.mod *.o 118 | 119 | help: 120 | @$(ECHO) "usage: make ?" 121 | 122 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_RK_ADJ/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | #Configuration flags for linear solvers. Must choose one from the following three options. 20 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # -DSPARSE_UMF use UMFpack (sparse format) 22 | # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DSPARSE_UMF 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS= /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | #~~~> sunf90 45 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 46 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 47 | #BLAS = -xlic_lib=sunperf 48 | #LAPACK = 49 | 50 | 51 | #~~~> gfortran (GNU FORTRAN Compiler) 52 | export FC = gfortran 53 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 54 | BLAS=/opt/lapack/lib/libblas.a 55 | LAPACK=/opt/lapack/lib/liblapack.a 56 | 57 | 58 | #~~~> PGF90 (Portland Group Compiler) 59 | #export FC=pgf90 60 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 61 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 62 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 63 | #other libraries 64 | #XERBLA = -lpgftnrtl -pgf90libs 65 | 66 | 67 | #~~~> LAHEY 68 | #export FC = lf95 69 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 70 | #BLAS = -lssl2mt 71 | #LAPACK = 72 | 73 | 74 | FATDIR = ../../.. 75 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 76 | MODEL = ADJ 77 | FAMILY = RK_ADJ 78 | 79 | APP = swe2D_rk_adj 80 | PAR = swe2D_upwind.o 81 | LSSOLVER = LS_Solver.o 82 | FAMILY = RK_ADJ 83 | 84 | INTEGRATOR= $(FAMILY)_f90_Integrator.o 85 | 86 | default: driver 87 | 88 | swe2D_upwind.o: swe2D_upwind.F90 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 92 | $(FC) $(FFLAGS) -c $< 93 | 94 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 95 | $(FC) $(FFLAGS) -c $< 96 | 97 | swe2D_rk_adj_dr.o: swe2D_rk_adj_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 98 | $(FC) $(FFLAGS) -c $< 99 | 100 | LIB = -lm 101 | 102 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 103 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 104 | 105 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 106 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 107 | 108 | default: driver 109 | 110 | driver: swe2D_rk_adj_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 111 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 112 | 113 | purge: clean 114 | 115 | clean: 116 | rm -f *~ *.mod *.o 117 | 118 | help: 119 | @$(ECHO) "usage: make ?" 120 | 121 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_SDIRK_ADJ/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | #Configuration flags for linear solvers. Must choose one from the following three options. 20 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # -DSPARSE_UMF use UMFpack (sparse format) 22 | # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DSPARSE_UMF 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS = /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | 45 | #~~~> sunf90 46 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 47 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 48 | #BLAS = -xlic_lib=sunperf 49 | #LAPACK = 50 | 51 | #~~~> gfortran (GNU FORTRAN Compiler) 52 | export FC = gfortran 53 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 54 | BLAS=/opt/lapack/lib/libblas.a 55 | LAPACK=/opt/lapack/lib/liblapack.a 56 | 57 | 58 | #~~~> PGF90 (Portland Group Compiler) 59 | #export FC=pgf90 60 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 61 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 62 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 63 | #other libraries 64 | #XERBLA = -lpgftnrtl -pgf90libs 65 | 66 | 67 | #~~~> LAHEY 68 | #export FC = lf95 69 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 70 | #BLAS = -lssl2mt 71 | #LAPACK = 72 | 73 | FATDIR = ../../.. 74 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 75 | MODEL = ADJ 76 | FAMILY = SDIRK_ADJ 77 | 78 | APP = swe2D_sdirk_adj 79 | PAR = swe2D_upwind.o 80 | LSSOLVER = LS_Solver.o 81 | 82 | 83 | INTEGRATOR =$(FAMILY)_f90_Integrator.o 84 | 85 | default: driver 86 | 87 | swe2D_upwind.o: swe2D_upwind.F90 88 | $(FC) $(FFLAGS) -c $< 89 | 90 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 91 | $(FC) $(FFLAGS) -c $< 92 | 93 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 94 | $(FC) $(FFLAGS) -c $< 95 | 96 | swe2D_sdirk_adj_dr.o: swe2D_sdirk_adj_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 97 | $(FC) $(FFLAGS) -c $< 98 | 99 | 100 | LIB = -lm 101 | 102 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 103 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 104 | 105 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 106 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 107 | 108 | 109 | default: driver 110 | 111 | driver: swe2D_sdirk_adj_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 112 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 113 | 114 | purge: clean 115 | 116 | clean: 117 | rm -f *~ *.mod *.o 118 | 119 | help: 120 | @$(ECHO) "usage: make ?" 121 | 122 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_SDIRK/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | # Configuration flags for linear solvers. Must choose one from the following three options. 20 | # # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # # -DSPARSE_UMF use UMFpack (sparse format) 22 | # # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DSPARSE_UMF 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS = /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | 45 | #~~~> sunf90 46 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 47 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 48 | #BLAS = -xlic_lib=sunperf 49 | #LAPACK = 50 | 51 | 52 | #~~~> gfortran (GNU FORTRAN Compiler) 53 | export FC = gfortran 54 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 55 | BLAS=/opt/lapack/lib/libblas.a 56 | LAPACK=/opt/lapack/lib/liblapack.a 57 | 58 | 59 | #~~~> PGF90 (Portland Group Compiler) 60 | #export FC=pgf90 61 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 62 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 63 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 64 | #other libraries 65 | #XERBLA = -lpgftnrtl -pgf90libs 66 | 67 | 68 | #~~~> LAHEY 69 | #export FC = lf95 70 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 71 | #BLAS=-lssl2mt 72 | #LAPACK= 73 | 74 | 75 | FATDIR = ../../.. 76 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 77 | MODEL = FWD 78 | FAMILY = SDIRK 79 | 80 | APP = swe2D_sdirk 81 | PAR = swe2D_upwind.o 82 | LSSOLVER = LS_Solver.o 83 | INTEGRATOR = $(FAMILY)_f90_Integrator.o 84 | 85 | default: driver 86 | 87 | swe2D_upwind.o: swe2D_upwind.F90 88 | $(FC) $(FFLAGS) -c $< 89 | 90 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 91 | $(FC) $(FFLAGS) -c $< 92 | 93 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 94 | $(FC) $(FFLAGS) -c $< 95 | 96 | swe2D_sdirk_dr.o: swe2D_sdirk_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 97 | $(FC) $(FFLAGS) -c $< 98 | 99 | 100 | LIB = -lm 101 | 102 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 103 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 104 | 105 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 106 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 107 | 108 | default: driver 109 | 110 | driver: swe2D_sdirk_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 111 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 112 | 113 | purge: clean 114 | 115 | clean: 116 | rm -f *~ *.mod *.o 117 | 118 | help: 119 | @$(ECHO) "usage: make ?" 120 | 121 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_SDIRK_TLM/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | # Configuration flags for linear solvers. Must choose one from the following three options. 20 | # # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # # -DSPARSE_UMF use UMFpack (sparse format) 22 | # # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DSPARSE_UMF 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS = /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | 45 | #~~~> sunf90 46 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 47 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 48 | #BLAS = -xlic_lib=sunperf 49 | #LAPACK = 50 | 51 | 52 | #~~~> gfortran (GNU FORTRAN Compiler) 53 | export FC = gfortran 54 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 55 | BLAS=/opt/lapack/lib/libblas.a 56 | LAPACK=/opt/lapack/lib/liblapack.a 57 | 58 | 59 | #~~~> PGF90 (Portland Group Compiler) 60 | #export FC=pgf90 61 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 62 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 63 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 64 | #other libraries 65 | #XERBLA = -lpgftnrtl -pgf90libs 66 | 67 | 68 | #~~~> LAHEY 69 | #export FC = lf95 70 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 71 | #BLAS=-lssl2mt 72 | #LAPACK= 73 | 74 | 75 | FATDIR = ../../.. 76 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 77 | MODEL = TLM 78 | FAMILY = SDIRK_TLM 79 | 80 | APP = swe2D_sdirk_tlm 81 | PAR = swe2D_upwind.o 82 | LSSOLVER = LS_Solver.o 83 | INTEGRATOR = $(FAMILY)_f90_Integrator.o 84 | 85 | default: driver 86 | 87 | swe2D_upwind.o: swe2D_upwind.F90 88 | $(FC) $(FFLAGS) -c $< 89 | 90 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 91 | $(FC) $(FFLAGS) -c $< 92 | 93 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 94 | $(FC) $(FFLAGS) -c $< 95 | 96 | swe2D_sdirk_tlm_dr.o: swe2D_sdirk_tlm_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 97 | $(FC) $(FFLAGS) -c $< 98 | 99 | 100 | LIB = -lm 101 | 102 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 103 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 104 | 105 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 106 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 107 | 108 | default: driver 109 | 110 | driver: swe2D_sdirk_tlm_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 111 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 112 | 113 | purge: clean 114 | 115 | clean: 116 | rm -f *~ *.mod *.o 117 | 118 | help: 119 | @$(ECHO) "usage: make ?" 120 | 121 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_RK_ADJ/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | #Configuration flags for linear solvers. Must choose one from the following three options. 20 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # -DSPARSE_UMF use UMFpack (sparse format) 22 | # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS= /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | #~~~> sunf90 45 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 46 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 47 | #BLAS = -xlic_lib=sunperf 48 | #LAPACK = 49 | 50 | 51 | #~~~> gfortran (GNU FORTRAN Compiler) 52 | export FC = gfortran 53 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 54 | BLAS=/opt/lapack/lib/libblas.a 55 | LAPACK=/opt/lapack/lib/liblapack.a 56 | 57 | 58 | #~~~> PGF90 (Portland Group Compiler) 59 | #export FC=pgf90 60 | #export FFLAGS=-g -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 61 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 62 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 63 | #other libraries 64 | #XERBLA = -lpgftnrtl -pgf90libs 65 | 66 | 67 | #~~~> LAHEY 68 | #export FC = lf95 69 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 70 | #BLAS = -lssl2mt 71 | #LAPACK = 72 | 73 | 74 | FATDIR = ../../.. 75 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 76 | MODEL = ADJ 77 | FAMILY = RK_ADJ 78 | 79 | APP = cbm4_rk_adj 80 | PAR = cbm4_Parameters.o 81 | LSSOLVER = LS_Solver.o 82 | FAMILY = RK_ADJ 83 | 84 | INTEGRATOR= $(FAMILY)_f90_Integrator.o 85 | 86 | default: driver 87 | 88 | cbm4_Parameters.o: cbm4_Parameters.F90 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 92 | $(FC) $(FFLAGS) -c $< 93 | 94 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 95 | $(FC) $(FFLAGS) -c $< 96 | 97 | cbm4_rk_adj_dr.o: cbm4_rk_adj_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 98 | $(FC) $(FFLAGS) -c $< 99 | 100 | LIB = -lm 101 | 102 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 103 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 104 | 105 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 106 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 107 | 108 | default: driver clean 109 | 110 | driver: cbm4_rk_adj_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 111 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 112 | 113 | purge: clean 114 | 115 | clean: 116 | rm -f *~ *.mod *.o 117 | 118 | help: 119 | @$(ECHO) "usage: make ?" 120 | 121 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_ROS_ADJ/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | #Configuration flags for linear solvers. Must choose one from the following three options. 20 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # -DSPARSE_UMF use UMFpack (sparse format) 22 | # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS= /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | #~~~> sunf90 45 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 46 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 47 | #BLAS = -xlic_lib=sunperf 48 | #LAPACK = 49 | 50 | 51 | #~~~> gfortran (GNU FORTRAN Compiler) 52 | export FC = gfortran 53 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 54 | BLAS=/opt/lapack/lib/libblas.a 55 | LAPACK=/opt/lapack/lib/liblapack.a 56 | 57 | 58 | #~~~> PGF90 (Portland Group Compiler) 59 | #export FC=pgf90 60 | #export FFLAGS=-g -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=inform -Mpreprocess $(LS_CONFIG) 61 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 62 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 63 | #other libraries 64 | #XERBLA = -lpgftnrtl -pgf90libs 65 | 66 | 67 | #~~~> LAHEY 68 | #export FC = lf95 69 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 70 | #BLAS = -lssl2mt 71 | #LAPACK = 72 | 73 | 74 | FATDIR = ../../.. 75 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 76 | MODEL = ADJ 77 | FAMILY = ROS_ADJ 78 | 79 | APP = cbm4_ros_adj 80 | PAR = cbm4_Parameters.o 81 | LSSOLVER = LS_Solver.o 82 | FAMILY = ROS_ADJ 83 | 84 | INTEGRATOR= $(FAMILY)_f90_Integrator.o 85 | 86 | default: driver 87 | 88 | cbm4_Parameters.o: cbm4_Parameters.F90 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 92 | $(FC) $(FFLAGS) -c $< 93 | 94 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 95 | $(FC) $(FFLAGS) -c $< 96 | 97 | cbm4_ros_adj_dr.o: cbm4_ros_adj_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 98 | $(FC) $(FFLAGS) -c $< 99 | 100 | LIB = -lm 101 | 102 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 103 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 104 | 105 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 106 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 107 | 108 | default: driver clean 109 | 110 | driver: cbm4_ros_adj_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 111 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 112 | 113 | purge: clean 114 | 115 | clean: 116 | rm -f *~ *.mod *.o 117 | 118 | help: 119 | @$(ECHO) "usage: make ?" 120 | 121 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_SDIRK/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | # Configuration flags for linear solvers. Must choose one from the following three options. 20 | # # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # # -DSPARSE_UMF use UMFpack (sparse format) 22 | # # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS = /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | 45 | #~~~> sunf90 46 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 47 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 48 | #BLAS = -xlic_lib=sunperf 49 | #LAPACK = 50 | 51 | 52 | #~~~> gfortran (GNU FORTRAN Compiler) 53 | export FC = gfortran 54 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 55 | BLAS=/opt/lapack/lib/libblas.a 56 | LAPACK=/opt/lapack/lib/liblapack.a 57 | 58 | 59 | #~~~> PGF90 (Portland Group Compiler) 60 | #export FC=pgf90 61 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 62 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 63 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 64 | #other libraries 65 | #XERBLA = -lpgftnrtl -pgf90libs 66 | 67 | 68 | #~~~> LAHEY 69 | #export FC = lf95 70 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 71 | #BLAS=-lssl2mt 72 | #LAPACK= 73 | 74 | 75 | FATDIR = ../../.. 76 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 77 | MODEL = FWD 78 | FAMILY = SDIRK 79 | 80 | APP = cbm4_sdirk 81 | PAR = cbm4_parameters.o 82 | LSSOLVER = LS_Solver.o 83 | INTEGRATOR = $(FAMILY)_f90_Integrator.o 84 | 85 | default: driver 86 | 87 | cbm4_parameters.o: cbm4_parameters.F90 88 | $(FC) $(FFLAGS) -c $< 89 | 90 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 91 | $(FC) $(FFLAGS) -c $< 92 | 93 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 94 | $(FC) $(FFLAGS) -c $< 95 | 96 | cbm4_sdirk_dr.o: cbm4_sdirk_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 97 | $(FC) $(FFLAGS) -c $< 98 | 99 | 100 | LIB = -lm 101 | 102 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 103 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 104 | 105 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 106 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 107 | 108 | default: driver clean 109 | 110 | driver: cbm4_sdirk_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 111 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 112 | 113 | purge: clean 114 | 115 | clean: 116 | rm -f *~ *.mod *.o 117 | 118 | help: 119 | @$(ECHO) "usage: make ?" 120 | 121 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_SDIRK_ADJ/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | #Configuration flags for linear solvers. Must choose one from the following three options. 20 | # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # -DSPARSE_UMF use UMFpack (sparse format) 22 | # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS= /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | #~~~> sunf90 45 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 46 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 47 | #BLAS = -xlic_lib=sunperf 48 | #LAPACK = 49 | 50 | 51 | #~~~> gfortran (GNU FORTRAN Compiler) 52 | export FC = gfortran 53 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 54 | BLAS=/opt/lapack/lib/libblas.a 55 | LAPACK=/opt/lapack/lib/liblapack.a 56 | 57 | 58 | #~~~> PGF90 (Portland Group Compiler) 59 | #export FC=pgf90 60 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess $(LS_CONFIG) 61 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 62 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 63 | #other libraries 64 | #XERBLA = -lpgftnrtl -pgf90libs 65 | 66 | 67 | #~~~> LAHEY 68 | #export FC = lf95 69 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 70 | #BLAS = -lssl2mt 71 | #LAPACK = 72 | 73 | 74 | FATDIR = ../../.. 75 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 76 | MODEL = ADJ 77 | FAMILY = SDIRK_ADJ 78 | 79 | APP = cbm4_sdirk_adj 80 | PAR = cbm4_Parameters.o 81 | LSSOLVER = LS_Solver.o 82 | FAMILY = SDIRK_ADJ 83 | 84 | INTEGRATOR= $(FAMILY)_f90_Integrator.o 85 | 86 | default: driver 87 | 88 | cbm4_Parameters.o: cbm4_Parameters.F90 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 92 | $(FC) $(FFLAGS) -c $< 93 | 94 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 95 | $(FC) $(FFLAGS) -c $< 96 | 97 | cbm4_sdirk_adj_dr.o: cbm4_sdirk_adj_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 98 | $(FC) $(FFLAGS) -c $< 99 | 100 | LIB = -lm 101 | 102 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 103 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 104 | 105 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 106 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 107 | 108 | default: driver clean 109 | 110 | driver: cbm4_sdirk_adj_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 111 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 112 | 113 | purge: clean 114 | 115 | clean: 116 | rm -f *~ *.mod *.o 117 | 118 | help: 119 | @$(ECHO) "usage: make ?" 120 | 121 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_RK_TLM/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | # Configuration flags for linear solvers. Must choose one from the following three options. 20 | # # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # # -DSPARSE_UMF use UMFpack (sparse format) 22 | # # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DSPARSE_UMF 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS = /opt/ifort_libs/libblas.a 42 | #LAPACK = /opt/ifort_libs/liblapack.a 43 | 44 | 45 | #~~~> sunf90 46 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 47 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 48 | #BLAS = -xlic_lib=sunperf 49 | #LAPACK = 50 | 51 | 52 | #~~~> gfortran (GNU FORTRAN Compiler) 53 | export FC = gfortran 54 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 55 | BLAS=/opt/lapack/lib/libblas.a 56 | LAPACK=/opt/lapack/lib/liblapack.a 57 | 58 | 59 | #~~~> PGF90 (Portland Group Compiler) 60 | #export FC=pgf90 61 | #export FFLAGS= -O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=warn -Mpreprocess ${LS_CONFIG} 62 | #export FFLAGS=-C -g -Minform=inform -Mchkfpstk -Mchkptr -Mchkstk -traceback -Mr8 63 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 64 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 65 | #other libraries 66 | #XERBLA = -lpgftnrtl -pgf90libs 67 | 68 | 69 | #~~~> LAHEY 70 | #export FC = lf95 71 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 72 | #BLAS=-lssl2mt 73 | #LAPACK= 74 | 75 | 76 | FATDIR = ../../.. 77 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 78 | MODEL = TLM 79 | FAMILY = RK_TLM 80 | 81 | APP = swe2D_rk_tlm 82 | PAR = swe2D_upwind.o 83 | LSSOLVER = LS_Solver.o 84 | INTEGRATOR = $(FAMILY)_f90_Integrator.o 85 | 86 | default: driver 87 | 88 | swe2D_upwind.o: swe2D_upwind.F90 89 | $(FC) $(FFLAGS) -c $< 90 | 91 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 92 | $(FC) $(FFLAGS) -c $< 93 | 94 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 95 | $(FC) $(FFLAGS) -c $< 96 | 97 | swe2D_rk_tlm_dr.o: swe2D_rk_tlm_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 98 | $(FC) $(FFLAGS) -c $< 99 | 100 | 101 | 102 | LIB = -lm 103 | 104 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 105 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 106 | 107 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 108 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 109 | 110 | 111 | default: driver 112 | 113 | driver: swe2D_rk_tlm_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 114 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(INTEGRATOR) $(LSSOLVER) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 115 | 116 | purge: clean 117 | 118 | clean: 119 | rm -f *~ *.mod *.o 120 | 121 | help: 122 | @$(ECHO) "usage: make ?" 123 | 124 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_ROS/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################ 2 | # 3 | # Module: Makefile 4 | # 5 | # Purpose: Top-level Makefile 6 | # 7 | # Creation date: Feb 27, 2011 8 | # 9 | # Modified: 10 | # 11 | # Send bug reports, comments or suggestions to zhang@vt.edu 12 | # 13 | ############################################################################ 14 | 15 | 16 | export ARCH=ar -cr 17 | export RANLIB=ranlib 18 | 19 | # Configuration flags for linear solvers. Must choose one from the following three options. 20 | # # -DFULL_ALGEBRA use BLAS and LAPACK library (full algebra) 21 | # # -DSPARSE_UMF use UMFpack (sparse format) 22 | # # -DSPARSE_LU use SuperLU (sparse format) 23 | # 24 | LS_CONFIG = -DFULL_ALGEBRA 25 | 26 | #~~~> NAG fortran 27 | #export FC=nagfor 28 | #export FFLAGS = -O2 $(LS_CONFIG) 29 | #BLAS = ~/nagfor_libs/libblas.a 30 | #LAPACK = ~/nagfor_libs/liblapack.a 31 | 32 | #~~~> absoft fortran 33 | #export FC=f90 34 | #export FFLAGS = -O2 $(LS_CONFIG) 35 | #BLAS = /Applications/Absoft10.1/lib/libblas.a 36 | #LAPACK = /Applications/Absoft10.1/lib/liblapack.a 37 | 38 | #~~~> intel fortran 39 | #export FC=ifort 40 | #export FFLAGS= -cpp -O2 -nogen-interface -fltconsitency $(LS_CONFIG) -warn all 41 | #BLAS = -L/opt/intel/mkl/lib/intel64/ -lmkl_core -lmkl_intel_lp64 -lmkl_sequential 42 | #LAPACK = -L/opt/intel/mkl/lib/intel64/ -lmkl_core -lmkl_intel_lp64 -lmkl_sequential 43 | #BLAS = /opt/ifort_libs/libblas.a 44 | #LAPACK = /opt/ifort_libs/liblapack.a 45 | 46 | 47 | #~~~> sunf90 48 | #export FC = /opt/oracle/solstudio12.2/bin/sunf90 49 | #export FFLAGS = -fpp -O2 -free $(LS_CONFIG) 50 | #BLAS = -xlic_lib=sunperf 51 | #LAPACK = 52 | 53 | 54 | #~~~> gfortran (GNU FORTRAN Compiler) 55 | export FC = gfortran 56 | export FFLAGS = -cpp -O2 -ffree-line-length-none $(LS_CONFIG) 57 | BLAS=/opt/lapack/lib/libblas.a 58 | LAPACK=/opt/lapack/lib/liblapack.a 59 | 60 | 61 | #~~~> PGF90 (Portland Group Compiler) 62 | #export FC=pgf90 63 | #export FFLAGS=-O2 -fastsse -Mcache_align -tp=penryn-64 -Mflushz -Minform=inform -Mpreprocess $(LS_CONFIG) 64 | #BLAS=/opt/pgi/linux86-64/7.2-5/lib/libblas.a 65 | #LAPACK=/opt/pgi/linux86-64/7.2-5/lib/liblapack.a 66 | #other libraries 67 | #XERBLA = -lpgftnrtl -pgf90libs 68 | 69 | 70 | #~~~> LAHEY 71 | #export FC = lf95 72 | #export FFLAGS = -O2 -Cpp $(LS_CONFIG) 73 | #BLAS=-lssl2mt 74 | #LAPACK= 75 | 76 | 77 | FATDIR = ../../.. 78 | LIBDIR = $(FATDIR)/LSS_LIBS/x86_64_Linux 79 | MODEL = FWD 80 | FAMILY = ROS 81 | 82 | APP = cbm4_ros 83 | PAR = cbm4_Parameters.o 84 | LSSOLVER = LS_Solver.o 85 | INTEGRATOR = $(FAMILY)_f90_Integrator.o 86 | 87 | default: driver 88 | 89 | cbm4_Parameters.o: cbm4_Parameters.F90 90 | $(FC) $(FFLAGS) -c $< 91 | 92 | LS_Solver.o: $(FATDIR)/$(MODEL)/$(FAMILY)/LS_Solver.F90 93 | $(FC) $(FFLAGS) -c $< 94 | 95 | $(FAMILY)_f90_Integrator.o: $(FATDIR)/$(MODEL)/$(FAMILY)/$(FAMILY)_f90_Integrator.F90 96 | $(FC) $(FFLAGS) -c $< 97 | 98 | cbm4_ros_dr.o: cbm4_ros_dr.F90 $(PAR) $(LSSOLVER) $(INTEGRATOR) 99 | $(FC) $(FFLAGS) -c $< 100 | 101 | 102 | LIB = -lm 103 | 104 | LUPACK = $(LIBDIR)/SUPERLU/libsuperlu_4.2.a 105 | LUWRAP = $(LIBDIR)/SUPERLU/c_fortran_dgssv.o $(LIBDIR)/SUPERLU/c_fortran_zgssv.o 106 | 107 | UMFPACK = $(LIBDIR)/UMFPACK/libumfpack.a $(LIBDIR)/UMFPACK/libamd.a 108 | UMFWRAP = $(LIBDIR)/UMFPACK/umf4_f77wrapper.o $(LIBDIR)/UMFPACK/umf4_f77zwrapper.o 109 | 110 | 111 | default: driver clean 112 | 113 | driver: cbm4_ros_dr.o $(PAR) $(LSSOLVER) $(INTEGRATOR) 114 | $(FC) $(FFLAGS) -o $(APP) $< $(LUWRAP) $(LUPACK) $(UMFWRAP) $(UMFPACK) $(LSSOLVER) $(INTEGRATOR) $(PAR) $(LAPACK) $(BLAS) $(XERBLA) $(LIB) 115 | 116 | purge: clean 117 | 118 | clean: 119 | rm -f *~ *.mod *.o 120 | 121 | help: 122 | @$(ECHO) "usage: make ?" 123 | 124 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_ros_adj/small_strato_dr.F90: -------------------------------------------------------------------------------- 1 | PROGRAM small_strato_dr 2 | USE ROS_ADJ_f90_Integrator 3 | USE User_Parameters 4 | IMPLICIT NONE 5 | INTEGER,PARAMETER :: NADJ = 5 6 | CHARACTER(LEN=12), PARAMETER, DIMENSION(7) :: SPC_NAMES = (/ & 7 | 'O1D ','O ','O3 ', & 8 | 'NO ','NO2 ','M ', & 9 | 'O2 ' /) 10 | INTEGER, PARAMETER, DIMENSION(6) :: MONITOR = (/ & 11 | 1, 2, 3, 4, 5, 7 /) 12 | CHARACTER(LEN=12), PARAMETER, DIMENSION(1) :: SMASS = (/ & 13 | 'N ' /) 14 | 15 | INTEGER :: i, j, ind_1 = 1, ind_2 = 2, NMONITOR=6, NMASS=1, NP=0 16 | 17 | INTEGER, PARAMETER :: NSPEC = 7 18 | DOUBLE PRECISION, DIMENSION(NVAR,NADJ) :: Y_adj, ATOL_adj, RTOL_adj 19 | 20 | !~~> Control (in) and status (out) arguments for the integration 21 | DOUBLE PRECISION, DIMENSION(20) :: RCNTRL, RSTATUS 22 | INTEGER, DIMENSION(20) :: ICNTRL, ISTATUS 23 | DOUBLE PRECISION :: CFACTOR, x 24 | DOUBLE PRECISION :: ATOL(NVAR), RTOL(NVAR), VAR(NVAR), & 25 | DVAL(NSPEC) 26 | 27 | DOUBLE PRECISION:: TSTART, TEND, T 28 | 29 | !~~~> Tolerances for calculating concentrations 30 | DO i=1,NVAR 31 | RTOL(i) = 1.0d-4 32 | ATOL(i) = 1.0d-3 33 | END DO 34 | 35 | DO j=1,NADJ 36 | DO i=1,NVAR 37 | RTOL_adj(i,j) = 1.0d-4 38 | ATOL_adj(i,j) = 1.0d-10 39 | END DO 40 | END DO 41 | 42 | ! Initialize 43 | CFACTOR = 1.000000e+00 44 | x = (0.)*CFACTOR 45 | DO i = 1, NVAR 46 | VAR(i) = x 47 | END DO 48 | x = (0.)*CFACTOR 49 | DO i = 1, NFIX 50 | FIX(i) = x 51 | END DO 52 | VAR(1) = (9.906E+01)*CFACTOR 53 | VAR(2) = (6.624E+08)*CFACTOR 54 | VAR(3) = (5.326E+11)*CFACTOR 55 | VAR(4) = (8.725E+08)*CFACTOR 56 | VAR(5) = (2.240E+08)*CFACTOR 57 | FIX(1) = (8.120E+16)*CFACTOR 58 | FIX(2) = (1.697E+16)*CFACTOR 59 | TSTART = (12*3600) 60 | TEND = TSTART + (3*24*3600) 61 | 62 | !~~~> Default control options 63 | ICNTRL(1:20) = 0 64 | RCNTRL(1:20) = 0.0d0 65 | 66 | !~~~> Begin time loop 67 | 68 | T = TSTART 69 | ! get mass 70 | DVAL(1) = VAR(4)+VAR(5)+FIX(1)+FIX(1) 71 | 72 | 73 | CALL INTEGRATE_ADJ(TIN=T,TOUT=TEND,NVAR=NVAR,NNZERO=NNZ,Lambda=Y_adj,Y=VAR, & 74 | NP=NP,RTOL=RTOL,ATOL=ATOL,NADJ=NADJ,ATOL_adj=ATOL_adj,RTOL_adj=RTOL_adj,& 75 | FUN=FUN_U, JAC=JAC_U,ADJINIT=adjinit,HESSTR_VEC= HESSTR_VEC_U, & 76 | RSTATUS_U=RSTATUS, ISTATUS_U=ISTATUS,ICNTRL_U=ICNTRL) 77 | DVAL(1) = VAR(4)+VAR(5)+FIX(1)+FIX(1) 78 | 79 | 80 | !~~~> End time loop ~~~~~~~~~~ 81 | print *,VAR 82 | 83 | OPEN(20, FILE='rkadj_ADJ_results.m') 84 | WRITE(6,*) '**************************************************' 85 | WRITE(6,*) ' Concentrations and Sensitivities at final time ' 86 | WRITE(6,*) ' were written in the file rkadj_ADJ_results.m' 87 | WRITE(6,*) '**************************************************' 88 | DO j=1,NADJ 89 | WRITE(20,993) ( Y_adj(i,j), i=1,NVAR ) 90 | END DO 91 | 92 | WRITE(6,995) TRIM(SPC_NAMES(ind_1)),TRIM(SPC_NAMES(ind_1)), & 93 | Y_adj(ind_1,1) 94 | WRITE(6,995) TRIM(SPC_NAMES(ind_2)),TRIM(SPC_NAMES(ind_2)), & 95 | Y_adj(ind_2,2) 96 | WRITE(6,995) TRIM(SPC_NAMES(ind_2)),TRIM(SPC_NAMES(ind_1)), & 97 | Y_adj(ind_1,2) 98 | WRITE(6,995) TRIM(SPC_NAMES(ind_1)),TRIM(SPC_NAMES(ind_2)), & 99 | Y_adj(ind_2,1) 100 | 101 | 102 | 993 FORMAT(1000(E24.16,2X)) 103 | 995 FORMAT('ADJ: d[',A,'](tf)/d[',A,'](t0)=',E14.7) 104 | 105 | !~~~> The entire matrix of sensitivities 106 | WRITE(6,996) ( 'd ',TRIM(SPC_NAMES(i)), i=1,NVAR ) 107 | DO j=1,NADJ 108 | WRITE(6,997) TRIM(SPC_NAMES(j)),( Y_adj(i,j), i=1,NVAR ) 109 | END DO 110 | 996 FORMAT(12X,100(' ',A2,A6,4X)) 111 | 997 FORMAT('d/d',A6,' = ',100(E12.5,2X)) 112 | 113 | END PROGRAM small_strato_dr 114 | 115 | 116 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_rk/User_Parameters.F90: -------------------------------------------------------------------------------- 1 | MODULE User_Parameters 2 | INTEGER, PARAMETER :: NVAR = 5 3 | INTEGER, PARAMETER :: NNZ = 19 4 | INTEGER, PARAMETER :: NREACT=10 , NFIX=2 5 | ! RCONST - Rate constants (local) 6 | DOUBLE PRECISION :: RCONST(NREACT) 7 | ! FIX - Concentrations of fixed species 8 | DOUBLE PRECISION :: FIX(NFIX) 9 | CONTAINS 10 | SUBROUTINE FUN_U(NVAR,T, V, FCT) 11 | IMPLICIT NONE 12 | INTEGER :: NVAR 13 | ! V - Concentrations of variable species (local) 14 | ! FCT - Time derivative of variable species concentrations 15 | DOUBLE PRECISION :: A(NREACT) 16 | DOUBLE PRECISION :: V(NVAR), FCT(NVAR) 17 | DOUBLE PRECISION :: T, SUN 18 | CALL Update_SUN(T,SUN) 19 | CALL Update_RCONST(SUN) 20 | ! Computation of equation rates 21 | A(1) = RCONST(1)*FIX(2) 22 | A(2) = RCONST(2)*V(2)*FIX(2) 23 | A(3) = RCONST(3)*V(3) 24 | A(4) = RCONST(4)*V(2)*V(3) 25 | A(5) = RCONST(5)*V(3) 26 | A(6) = RCONST(6)*V(1)*FIX(1) 27 | A(7) = RCONST(7)*V(1)*V(3) 28 | A(8) = RCONST(8)*V(3)*V(4) 29 | A(9) = RCONST(9)*V(2)*V(5) 30 | A(10) = RCONST(10)*V(5) 31 | ! Aggregate function 32 | FCT(1) = A(5)-A(6)-A(7) 33 | FCT(2) = 2*A(1)-A(2)+A(3)-A(4)+A(6)-A(9)+A(10) 34 | FCT(3) = A(2)-A(3)-A(4)-A(5)-A(7)-A(8) 35 | FCT(4) = -A(8)+A(9)+A(10) 36 | FCT(5) = A(8)-A(9)-A(10) 37 | END SUBROUTINE FUN_U 38 | 39 | SUBROUTINE JAC_U(NVAR,T, V, JF) 40 | IMPLICIT NONE 41 | INTEGER :: NVAR 42 | ! V - Concentrations of variable species (local) 43 | DOUBLE PRECISION :: V(NVAR), T, SUN 44 | DOUBLE PRECISION :: JF(NVAR,NVAR) 45 | ! B - Temporary array 46 | DOUBLE PRECISION :: B(16) 47 | CALL Update_SUN(T, SUN) 48 | CALL Update_RCONST(SUN) 49 | JF(:,:) = 0.0d0 50 | 51 | B(2) = RCONST(2)*FIX(2) 52 | B(4) = RCONST(3) 53 | B(5) = RCONST(4)*V(3) 54 | B(6) = RCONST(4)*V(2) 55 | B(7) = RCONST(5) 56 | B(8) = RCONST(6)*FIX(1) 57 | B(10) = RCONST(7)*V(3) 58 | B(11) = RCONST(7)*V(1) 59 | B(12) = RCONST(8)*V(4) 60 | B(13) = RCONST(8)*V(3) 61 | B(14) = RCONST(9)*V(5) 62 | B(15) = RCONST(9)*V(2) 63 | B(16) = RCONST(10) 64 | ! Construct the Jacobian terms from B's 65 | JF(1,1) = -B(8)-B(10) 66 | JF(1,3) = B(7)-B(11) 67 | JF(2,1) = B(8) 68 | JF(2,2) = -B(2)-B(5)-B(14) 69 | JF(2,3) = B(4)-B(6) 70 | JF(2,5) = -B(15)+B(16) 71 | JF(3,1) = -B(10) 72 | JF(3,2) = B(2)-B(5) 73 | JF(3,3) = -B(4)-B(6)-B(7)-B(11)-B(12) 74 | JF(3,4) = -B(13) 75 | JF(3,5) = 0 76 | JF(4,2) = B(14) 77 | JF(4,3) = -B(12) 78 | JF(4,4) = -B(13) 79 | JF(4,5) = B(15)+B(16) 80 | JF(5,2) = -B(14) 81 | JF(5,3) = B(12) 82 | JF(5,4) = B(13) 83 | JF(5,5) = -B(15)-B(16) 84 | END SUBROUTINE JAC_U 85 | 86 | SUBROUTINE Update_SUN(TIME, SUN) 87 | IMPLICIT NONE 88 | DOUBLE PRECISION :: TIME,SUN 89 | DOUBLE PRECISION :: SunRise, SunSet 90 | DOUBLE PRECISION :: Thour, Tlocal, Ttmp 91 | ! PI - Value of pi 92 | DOUBLE PRECISION, PARAMETER :: PI = 3.14159265358979d0 93 | 94 | SunRise = 4.5 95 | SunSet = 19.5 96 | Thour = TIME/3600.0 97 | Tlocal = Thour - (INT(Thour)/24)*24 98 | 99 | IF ((Tlocal>=SunRise).AND.(Tlocal<=SunSet)) THEN 100 | Ttmp = (2.0*Tlocal-SunRise-SunSet)/(SunSet-SunRise) 101 | IF (Ttmp.GT.0) THEN 102 | Ttmp = Ttmp*Ttmp 103 | ELSE 104 | Ttmp = -Ttmp*Ttmp 105 | END IF 106 | SUN = ( 1.0 + COS(PI*Ttmp) )/2.0 107 | ELSE 108 | SUN = 0.0 109 | END IF 110 | 111 | END SUBROUTINE Update_SUN 112 | 113 | SUBROUTINE Update_RCONST(SUN) 114 | IMPLICIT NONE 115 | DOUBLE PRECISION :: SUN 116 | RCONST(1) = ((2.643E-10)*SUN*SUN*SUN) 117 | RCONST(2) = ((8.018E-17)) 118 | RCONST(3) = ((6.120E-04)*SUN) 119 | RCONST(4) = ((1.576E-15)) 120 | RCONST(5) = ((1.070E-03)*SUN*SUN) 121 | RCONST(6) = ((7.110E-11)) 122 | RCONST(7) = ((1.200E-10)) 123 | RCONST(8) = ((6.062E-15)) 124 | RCONST(9) = ((1.069E-11)) 125 | RCONST(10) = ((1.289E-02)*SUN) 126 | END SUBROUTINE Update_RCONST 127 | 128 | SUBROUTINE Update_PHOTO (SUN) 129 | DOUBLE PRECISION :: SUN 130 | RCONST(1) = ((2.643E-10)*SUN*SUN*SUN) 131 | RCONST(3) = ((6.120E-04)*SUN) 132 | RCONST(5) = ((1.070E-03)*SUN*SUN) 133 | RCONST(10) = ((1.289E-02)*SUN) 134 | END SUBROUTINE Update_PHOTO 135 | 136 | END MODULE User_Parameters 137 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_sdirk/User_Parameters.F90: -------------------------------------------------------------------------------- 1 | MODULE User_Parameters 2 | INTEGER, PARAMETER :: NVAR = 5 3 | INTEGER, PARAMETER :: NNZ = 19 4 | INTEGER, PARAMETER :: NREACT=10 , NFIX=2 5 | ! RCONST - Rate constants (local) 6 | DOUBLE PRECISION :: RCONST(NREACT) 7 | ! FIX - Concentrations of fixed species 8 | DOUBLE PRECISION :: FIX(NFIX) 9 | CONTAINS 10 | SUBROUTINE FUN_U(NVAR,T, V, FCT) 11 | IMPLICIT NONE 12 | INTEGER :: NVAR 13 | ! V - Concentrations of variable species (local) 14 | ! FCT - Time derivative of variable species concentrations 15 | DOUBLE PRECISION :: A(NREACT) 16 | DOUBLE PRECISION :: V(NVAR), FCT(NVAR) 17 | DOUBLE PRECISION :: T, SUN 18 | CALL Update_SUN(T,SUN) 19 | CALL Update_RCONST(SUN) 20 | ! Computation of equation rates 21 | A(1) = RCONST(1)*FIX(2) 22 | A(2) = RCONST(2)*V(2)*FIX(2) 23 | A(3) = RCONST(3)*V(3) 24 | A(4) = RCONST(4)*V(2)*V(3) 25 | A(5) = RCONST(5)*V(3) 26 | A(6) = RCONST(6)*V(1)*FIX(1) 27 | A(7) = RCONST(7)*V(1)*V(3) 28 | A(8) = RCONST(8)*V(3)*V(4) 29 | A(9) = RCONST(9)*V(2)*V(5) 30 | A(10) = RCONST(10)*V(5) 31 | ! Aggregate function 32 | FCT(1) = A(5)-A(6)-A(7) 33 | FCT(2) = 2*A(1)-A(2)+A(3)-A(4)+A(6)-A(9)+A(10) 34 | FCT(3) = A(2)-A(3)-A(4)-A(5)-A(7)-A(8) 35 | FCT(4) = -A(8)+A(9)+A(10) 36 | FCT(5) = A(8)-A(9)-A(10) 37 | END SUBROUTINE FUN_U 38 | 39 | SUBROUTINE JAC_U(NVAR,T, V, JF) 40 | IMPLICIT NONE 41 | INTEGER :: NVAR 42 | ! V - Concentrations of variable species (local) 43 | DOUBLE PRECISION :: V(NVAR), T, SUN 44 | DOUBLE PRECISION :: JF(NVAR,NVAR) 45 | ! B - Temporary array 46 | DOUBLE PRECISION :: B(16) 47 | CALL Update_SUN(T, SUN) 48 | CALL Update_RCONST(SUN) 49 | JF(:,:) = 0.0d0 50 | 51 | B(2) = RCONST(2)*FIX(2) 52 | B(4) = RCONST(3) 53 | B(5) = RCONST(4)*V(3) 54 | B(6) = RCONST(4)*V(2) 55 | B(7) = RCONST(5) 56 | B(8) = RCONST(6)*FIX(1) 57 | B(10) = RCONST(7)*V(3) 58 | B(11) = RCONST(7)*V(1) 59 | B(12) = RCONST(8)*V(4) 60 | B(13) = RCONST(8)*V(3) 61 | B(14) = RCONST(9)*V(5) 62 | B(15) = RCONST(9)*V(2) 63 | B(16) = RCONST(10) 64 | ! Construct the Jacobian terms from B's 65 | JF(1,1) = -B(8)-B(10) 66 | JF(1,3) = B(7)-B(11) 67 | JF(2,1) = B(8) 68 | JF(2,2) = -B(2)-B(5)-B(14) 69 | JF(2,3) = B(4)-B(6) 70 | JF(2,5) = -B(15)+B(16) 71 | JF(3,1) = -B(10) 72 | JF(3,2) = B(2)-B(5) 73 | JF(3,3) = -B(4)-B(6)-B(7)-B(11)-B(12) 74 | JF(3,4) = -B(13) 75 | JF(3,5) = 0 76 | JF(4,2) = B(14) 77 | JF(4,3) = -B(12) 78 | JF(4,4) = -B(13) 79 | JF(4,5) = B(15)+B(16) 80 | JF(5,2) = -B(14) 81 | JF(5,3) = B(12) 82 | JF(5,4) = B(13) 83 | JF(5,5) = -B(15)-B(16) 84 | END SUBROUTINE JAC_U 85 | 86 | SUBROUTINE Update_SUN(TIME, SUN) 87 | IMPLICIT NONE 88 | DOUBLE PRECISION :: TIME,SUN 89 | DOUBLE PRECISION :: SunRise, SunSet 90 | DOUBLE PRECISION :: Thour, Tlocal, Ttmp 91 | ! PI - Value of pi 92 | DOUBLE PRECISION, PARAMETER :: PI = 3.14159265358979d0 93 | 94 | SunRise = 4.5 95 | SunSet = 19.5 96 | Thour = TIME/3600.0 97 | Tlocal = Thour - (INT(Thour)/24)*24 98 | 99 | IF ((Tlocal>=SunRise).AND.(Tlocal<=SunSet)) THEN 100 | Ttmp = (2.0*Tlocal-SunRise-SunSet)/(SunSet-SunRise) 101 | IF (Ttmp.GT.0) THEN 102 | Ttmp = Ttmp*Ttmp 103 | ELSE 104 | Ttmp = -Ttmp*Ttmp 105 | END IF 106 | SUN = ( 1.0 + COS(PI*Ttmp) )/2.0 107 | ELSE 108 | SUN = 0.0 109 | END IF 110 | 111 | END SUBROUTINE Update_SUN 112 | 113 | SUBROUTINE Update_RCONST(SUN) 114 | IMPLICIT NONE 115 | DOUBLE PRECISION :: SUN 116 | RCONST(1) = ((2.643E-10)*SUN*SUN*SUN) 117 | RCONST(2) = ((8.018E-17)) 118 | RCONST(3) = ((6.120E-04)*SUN) 119 | RCONST(4) = ((1.576E-15)) 120 | RCONST(5) = ((1.070E-03)*SUN*SUN) 121 | RCONST(6) = ((7.110E-11)) 122 | RCONST(7) = ((1.200E-10)) 123 | RCONST(8) = ((6.062E-15)) 124 | RCONST(9) = ((1.069E-11)) 125 | RCONST(10) = ((1.289E-02)*SUN) 126 | END SUBROUTINE Update_RCONST 127 | 128 | SUBROUTINE Update_PHOTO (SUN) 129 | DOUBLE PRECISION :: SUN 130 | RCONST(1) = ((2.643E-10)*SUN*SUN*SUN) 131 | RCONST(3) = ((6.120E-04)*SUN) 132 | RCONST(5) = ((1.070E-03)*SUN*SUN) 133 | RCONST(10) = ((1.289E-02)*SUN) 134 | END SUBROUTINE Update_PHOTO 135 | 136 | END MODULE User_Parameters 137 | -------------------------------------------------------------------------------- /EXAMPLES/small_strato/small_ros/User_Parameters.F90: -------------------------------------------------------------------------------- 1 | MODULE User_Parameters 2 | INTEGER, PARAMETER :: NVAR = 5 3 | INTEGER, PARAMETER :: NNZ = 19 4 | INTEGER, PARAMETER :: NREACT=10 , NFIX=2 5 | ! RCONST - Rate constants (local) 6 | DOUBLE PRECISION :: RCONST(NREACT) 7 | ! FIX - Concentrations of fixed species 8 | DOUBLE PRECISION :: FIX(NFIX) 9 | CONTAINS 10 | SUBROUTINE FUN_U(NVAR,T, V, FCT) 11 | IMPLICIT NONE 12 | INTEGER :: NVAR 13 | ! V - Concentrations of variable species (local) 14 | ! FCT - Time derivative of variable species concentrations 15 | DOUBLE PRECISION :: A(NREACT) 16 | DOUBLE PRECISION :: V(NVAR), FCT(NVAR) 17 | DOUBLE PRECISION :: T, SUN 18 | CALL Update_SUN(T,SUN) 19 | CALL Update_RCONST(SUN) 20 | ! Computation of equation rates 21 | A(1) = RCONST(1)*FIX(2) 22 | A(2) = RCONST(2)*V(2)*FIX(2) 23 | A(3) = RCONST(3)*V(3) 24 | A(4) = RCONST(4)*V(2)*V(3) 25 | A(5) = RCONST(5)*V(3) 26 | A(6) = RCONST(6)*V(1)*FIX(1) 27 | A(7) = RCONST(7)*V(1)*V(3) 28 | A(8) = RCONST(8)*V(3)*V(4) 29 | A(9) = RCONST(9)*V(2)*V(5) 30 | A(10) = RCONST(10)*V(5) 31 | ! Aggregate function 32 | FCT(1) = A(5)-A(6)-A(7) 33 | FCT(2) = 2*A(1)-A(2)+A(3)-A(4)+A(6)-A(9)+A(10) 34 | FCT(3) = A(2)-A(3)-A(4)-A(5)-A(7)-A(8) 35 | FCT(4) = -A(8)+A(9)+A(10) 36 | FCT(5) = A(8)-A(9)-A(10) 37 | END SUBROUTINE FUN_U 38 | 39 | SUBROUTINE JAC_U(NVAR,T, V, JF) 40 | IMPLICIT NONE 41 | INTEGER :: NVAR 42 | ! V - Concentrations of variable species (local) 43 | DOUBLE PRECISION :: V(NVAR), T, SUN 44 | DOUBLE PRECISION :: JF(NVAR,NVAR) 45 | ! B - Temporary array 46 | DOUBLE PRECISION :: B(16) 47 | INTEGER :: i, j 48 | CALL Update_SUN(T, SUN) 49 | CALL Update_RCONST(SUN) 50 | JF(:,:) = 0.0d0 51 | 52 | B(2) = RCONST(2)*FIX(2) 53 | B(4) = RCONST(3) 54 | B(5) = RCONST(4)*V(3) 55 | B(6) = RCONST(4)*V(2) 56 | B(7) = RCONST(5) 57 | B(8) = RCONST(6)*FIX(1) 58 | B(10) = RCONST(7)*V(3) 59 | B(11) = RCONST(7)*V(1) 60 | B(12) = RCONST(8)*V(4) 61 | B(13) = RCONST(8)*V(3) 62 | B(14) = RCONST(9)*V(5) 63 | B(15) = RCONST(9)*V(2) 64 | B(16) = RCONST(10) 65 | ! Construct the Jacobian terms from B's 66 | JF(1,1) = -B(8)-B(10) 67 | JF(1,3) = B(7)-B(11) 68 | JF(2,1) = B(8) 69 | JF(2,2) = -B(2)-B(5)-B(14) 70 | JF(2,3) = B(4)-B(6) 71 | JF(2,5) = -B(15)+B(16) 72 | JF(3,1) = -B(10) 73 | JF(3,2) = B(2)-B(5) 74 | JF(3,3) = -B(4)-B(6)-B(7)-B(11)-B(12) 75 | JF(3,4) = -B(13) 76 | JF(3,5) = 0 77 | JF(4,2) = B(14) 78 | JF(4,3) = -B(12) 79 | JF(4,4) = -B(13) 80 | JF(4,5) = B(15)+B(16) 81 | JF(5,2) = -B(14) 82 | JF(5,3) = B(12) 83 | JF(5,4) = B(13) 84 | JF(5,5) = -B(15)-B(16) 85 | END SUBROUTINE JAC_U 86 | 87 | SUBROUTINE Update_SUN(TIME, SUN) 88 | IMPLICIT NONE 89 | DOUBLE PRECISION :: TIME,SUN 90 | DOUBLE PRECISION :: SunRise, SunSet 91 | DOUBLE PRECISION :: Thour, Tlocal, Ttmp 92 | ! PI - Value of pi 93 | DOUBLE PRECISION, PARAMETER :: PI = 3.14159265358979d0 94 | 95 | SunRise = 4.5 96 | SunSet = 19.5 97 | Thour = TIME/3600.0 98 | Tlocal = Thour - (INT(Thour)/24)*24 99 | 100 | IF ((Tlocal>=SunRise).AND.(Tlocal<=SunSet)) THEN 101 | Ttmp = (2.0*Tlocal-SunRise-SunSet)/(SunSet-SunRise) 102 | IF (Ttmp.GT.0) THEN 103 | Ttmp = Ttmp*Ttmp 104 | ELSE 105 | Ttmp = -Ttmp*Ttmp 106 | END IF 107 | SUN = ( 1.0 + COS(PI*Ttmp) )/2.0 108 | ELSE 109 | SUN = 0.0 110 | END IF 111 | 112 | END SUBROUTINE Update_SUN 113 | 114 | SUBROUTINE Update_RCONST(SUN) 115 | IMPLICIT NONE 116 | DOUBLE PRECISION :: SUN 117 | RCONST(1) = ((2.643E-10)*SUN*SUN*SUN) 118 | RCONST(2) = ((8.018E-17)) 119 | RCONST(3) = ((6.120E-04)*SUN) 120 | RCONST(4) = ((1.576E-15)) 121 | RCONST(5) = ((1.070E-03)*SUN*SUN) 122 | RCONST(6) = ((7.110E-11)) 123 | RCONST(7) = ((1.200E-10)) 124 | RCONST(8) = ((6.062E-15)) 125 | RCONST(9) = ((1.069E-11)) 126 | RCONST(10) = ((1.289E-02)*SUN) 127 | END SUBROUTINE Update_RCONST 128 | 129 | SUBROUTINE Update_PHOTO (SUN) 130 | DOUBLE PRECISION :: SUN 131 | RCONST(1) = ((2.643E-10)*SUN*SUN*SUN) 132 | RCONST(3) = ((6.120E-04)*SUN) 133 | RCONST(5) = ((1.070E-03)*SUN*SUN) 134 | RCONST(10) = ((1.289E-02)*SUN) 135 | END SUBROUTINE Update_PHOTO 136 | 137 | END MODULE User_Parameters 138 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ERK/swe2D_erk_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine fun(nvar, t, y, p ) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | use swe2dxy_parameters,only:temp_par,fz_par,feigvalues_par,geigvalues_par 5 | implicit none 6 | integer :: nvar 7 | double precision :: t 8 | double precision :: y(nvar), p(nvar) 9 | 10 | call vec2grid(y, temp_par) 11 | call compute_f(temp_par,fz_par,feigvalues_par,geigvalues_par) 12 | call grid2vec(fz_par, p) 13 | 14 | end subroutine fun 15 | 16 | subroutine output_statics(var,tstart,tend, tcpu, istate) 17 | use swe2dxy_parameters 18 | implicit none 19 | double precision :: tstart, tend, tcpu 20 | double precision :: var(ndim) 21 | integer :: istate(20) 22 | double precision :: tmp(ndim), delta(ndim) 23 | double precision :: l2, l2tmp, error 24 | integer :: i 25 | 26 | open(unit=2010,file='swe_lsode_sol.txt',form='formatted') 27 | do i=1,ndim 28 | read(2010,"(e24.16)") tmp(i) 29 | end do 30 | close(2010) 31 | 32 | do i=1,ndim 33 | delta(i)=var(i)-tmp(i) 34 | end do 35 | ! *****errors are shown in the form ||delta(x)||/||x||***** 36 | l2=0d0 37 | l2tmp=0d0 38 | do i=1,ndim 39 | l2=l2+delta(i)*delta(i) 40 | l2tmp =l2tmp+tmp(i)*tmp(i) 41 | end do 42 | error=sqrt(l2/l2tmp) 43 | 44 | write(6,2010) tstart,tend,istate(3:5),tcpu,error 45 | 2010 format (2x,'time interval [',f5.2,'-',f5.2, '] nsteps=',i5,& 46 | ' nasteps=',i5,' nrsteps=',i5,/,2x,& 47 | 'cputime=', f14.3,/,2x,'rerror=',f12.8,//) 48 | ! store results into a file 49 | ! open(unit=11,file='swe2d_rk_sol.txt',status='replace') 50 | ! do i=1,ndim 51 | ! write(11,2011) var(i) 52 | ! 2011 format(e24.16) 53 | ! end do 54 | ! close(11) 55 | 56 | end subroutine output_statics 57 | 58 | program swe_rk_dr 59 | use swe2dxy_parameters 60 | use erk_f90_integrator 61 | implicit none 62 | external fun 63 | integer ::i,j,state 64 | double precision :: tols(10)=(/1d-2, .316227766d-2, 1d-3, .316227766d-3, 1d-4, .316227766d-4, 1d-5, .316227766d-5, 1d-6, .316227766d-6/) 65 | double precision :: atol(ndim),rtol(ndim), var(ndim) 66 | double precision:: tstart, tend, t1, t2, tcpu 67 | double precision:: rstate(20),rcntrl(20) 68 | double precision :: a=30d0 69 | integer ::istate(20),icntrl(20) 70 | !~~> solution 71 | ! u(1,:,:) = h(t,x,y) 72 | ! u(2,:,:) = u(t,x,y) 73 | ! u(3,:,:) = v(t,x,y) 74 | allocate(f_par(3, mx+4, my+4), fz_par(3, mx+4, my+4), stat=state) 75 | if (state .ne. 0) then 76 | stop 'allocation error for f or fz' 77 | end if 78 | 79 | allocate(temp_par(3, mx+4, my+4), feigvalues_par(3, mx+4, my+4), geigvalues_par(3, mx+4,my+4), stat=state) 80 | if (state .ne. 0) then 81 | stop 'allocation error for temp or feigvalues or geigvalues' 82 | end if 83 | 84 | allocate(jf(ndim, ndim), jg(ndim, ndim), stat=state) 85 | if (state .ne. 0) then 86 | stop 'allocation error for jacf, jf or jg' 87 | end if 88 | 89 | ! do i=1,ndim 90 | ! rtol(i) = 0.01 91 | ! atol(i) = 0.01 92 | ! end do 93 | 94 | do j = 1, 10 95 | do i=1,ndim 96 | rtol(i) = tols(j) 97 | atol(i) = tols(j) 98 | end do 99 | 100 | call initializegaussiangrid(temp_par, a) 101 | temp_par(2,:,:) =2d0 102 | temp_par(3,:,:) =2d0 103 | call grid2vec(temp_par,var) 104 | 105 | tstart = 0.0d0 106 | tend = tstart + 50*2.1573758800627289e-003 107 | istate(:)=0 108 | icntrl(:)=0 109 | ! icntrl(3)=3 110 | rcntrl(:)=0 111 | ! change initial step size 112 | ! rcntrl(3)=1e-3 113 | call cpu_time(t1) 114 | call integrate(tin=tstart, tout=tend, nvar=ndim, var=var,& 115 | rtol=rtol, atol=atol,fun=fun,rstatus_u=rstate,& 116 | rcntrl_u=rcntrl, istatus_u=istate, icntrl_u=icntrl) 117 | call cpu_time(t2) 118 | tcpu=t2-t1 119 | call output_statics(var,tstart,tend,tcpu,istate) 120 | end do 121 | 122 | deallocate(f_par, fz_par, stat = state) 123 | if (state .ne. 0) then 124 | print *, 'deallocation error of f fz' 125 | stop 1 126 | end if 127 | deallocate(temp_par, feigvalues_par, geigvalues_par, stat = state) 128 | if (state .ne. 0) then 129 | print *, 'deallocation error of temp,feigvalues,geigvalues' 130 | stop 1 131 | end if 132 | 133 | deallocate(jf, jg, stat = state) 134 | if (state .ne. 0) then 135 | print *, 'deallocation error of jf jg' 136 | stop 1 137 | end if 138 | 139 | end program swe_rk_dr 140 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ROS/swe2D_ros_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine jac(n, t, y, fjac) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | use swe2dxy_parameters 5 | implicit none 6 | integer :: n 7 | double precision ::t 8 | double precision ::y(n),fjac(n,n) 9 | call vec2grid(y,u_par) 10 | call compute_f(u_par,f_par,feigvalues_par,geigvalues_par) 11 | call compute_jacf(u_par,feigvalues_par,geigvalues_par) 12 | fjac(:,:)=jf(:,:) 13 | end subroutine jac 14 | 15 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 | subroutine fun(n, t, y, p ) 17 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | use swe2dxy_parameters 19 | implicit none 20 | integer :: n 21 | double precision :: t 22 | double precision :: y(n), p(n) 23 | 24 | call vec2grid(y, temp_par) 25 | call compute_f(temp_par,fz_par,feigvalues_par,geigvalues_par) 26 | call grid2vec(fz_par, p) 27 | 28 | end subroutine fun 29 | 30 | subroutine output_statics(var,tstart,tend, tcpu, istate) 31 | use swe2dxy_parameters 32 | implicit none 33 | double precision :: tstart, tend, tcpu 34 | double precision :: var(ndim) 35 | integer :: istate(20) 36 | double precision :: tmp(ndim),delta(ndim) 37 | double precision :: l2, l2tmp,error 38 | integer :: i 39 | 40 | open(unit=2010,file='swe_lsode_sol.txt',form='formatted') 41 | do i=1,ndim 42 | read(2010,"(e24.16)") tmp(i) 43 | end do 44 | close(2010) 45 | 46 | do i=1,ndim 47 | delta(i)=var(i)-tmp(i) 48 | end do 49 | ! *****errors are shown in the form ||delta(x)||/||x||***** 50 | l2=0d0 51 | l2tmp=0d0 52 | do i=1,ndim 53 | l2=l2+delta(i)*delta(i) 54 | l2tmp =l2tmp+tmp(i)*tmp(i) 55 | end do 56 | error=sqrt(l2/l2tmp) 57 | 58 | write(6,2010) tstart,tend,istate(3:5),tcpu, error 59 | 2010 format (2x,'time interval [',f5.2,'-',f5.2, ']',/,& 60 | 2x,'nsteps=',i5,' nasteps=',i5,' nrsteps=',i5,/,& 61 | 2x, 'cputime=', f14.3,' seconds',/,2x,'rerror=',f12.8,//) 62 | ! store results into a file 63 | ! open(unit=11,file='swe2d_rk_sol.txt',status='replace') 64 | ! do i=1,ndim 65 | ! write(11,2011) var(i) 66 | ! 2011 format(e24.16) 67 | ! end do 68 | ! close(11) 69 | 70 | end subroutine output_statics 71 | 72 | 73 | program swe_rk_dr 74 | use swe2dxy_parameters 75 | use ROS_f90_integrator 76 | implicit none 77 | external fun,jac 78 | integer ::i,j,state 79 | 80 | double precision :: atol(ndim),rtol(ndim), var(ndim) 81 | double precision:: tstart, tend, t1, t2, tcpu 82 | double precision:: rstate(20),rcntrl(20) 83 | double precision :: a=30d0 84 | integer ::istate(20),icntrl(20) 85 | 86 | allocate(f_par(3, mx+4, my+4), fz_par(3, mx+4, my+4), stat=state) 87 | if (state .ne. 0) then 88 | stop 'allocation error for f or fz' 89 | end if 90 | 91 | allocate(temp_par(3, mx+4, my+4), feigvalues_par(3, mx+4, my+4), geigvalues_par(3, mx+4,my+4), stat=state) 92 | if (state .ne. 0) then 93 | stop 'allocation error for temp or feigvalues or geigvalues' 94 | end if 95 | 96 | allocate(jf(ndim, ndim), jg(ndim, ndim), stat=state) 97 | if (state .ne. 0) then 98 | stop 'allocation error for jacf, jf or jg' 99 | end if 100 | 101 | do i=1,ndim 102 | rtol(i) = 0.1 103 | atol(i) = 0.1 104 | end do 105 | 106 | do j=1,6 107 | do i=1,ndim 108 | rtol(i) = 0.1 * rtol(i) 109 | atol(i) = 0.1 * atol(i) 110 | end do 111 | 112 | call cpu_time(t1) 113 | call initializegaussiangrid(temp_par, a) 114 | temp_par(2,:,:) = 2d0 115 | temp_par(3,:,:) = 2d0 116 | call grid2vec(temp_par,var) 117 | 118 | tstart = 0.0d0 119 | tend = tstart + 50*2.1573758800627289e-003 120 | istate(:)=0 121 | icntrl(:)=0 122 | rcntrl(:)=0 123 | ! change initial step size 124 | ! rcntrl(3)=1e-4 125 | call integrate(tin=tstart,tout=tend,n=ndim,nnzero=nnz,var=var,& 126 | rtol=rtol,atol=atol,fun=fun,jac=jac,rstatus_u=rstate,& 127 | rcntrl_u=rcntrl,istatus_u=istate,icntrl_u=icntrl) 128 | call cpu_time(t2) 129 | 130 | tcpu=t2-t1 131 | 132 | call output_statics(var,tstart,tend,tcpu,istate) 133 | end do 134 | 135 | deallocate(f_par, fz_par, stat = state) 136 | if (state .ne. 0) then 137 | print *, 'deallocation error of f fz' 138 | stop 1 139 | end if 140 | deallocate(temp_par, feigvalues_par, geigvalues_par, stat = state) 141 | if (state .ne. 0) then 142 | print *, 'deallocation error of temp,feigvalues,geigvalues' 143 | stop 1 144 | end if 145 | 146 | deallocate(jf, jg, stat = state) 147 | if (state .ne. 0) then 148 | print *, 'deallocation error of jf jg' 149 | stop 1 150 | end if 151 | 152 | end program swe_rk_dr 153 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_RK/swe2D_rk_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine jac(nvar, t, y, fjac) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | use swe2dxy_parameters,only:u_par,f_par,feigvalues_par,geigvalues_par,jf 5 | implicit none 6 | integer :: nvar 7 | double precision ::t 8 | double precision ::y(nvar),fjac(nvar,nvar) 9 | call vec2grid(y,u_par) 10 | call compute_f(u_par,f_par,feigvalues_par,geigvalues_par) 11 | call compute_jacf(u_par,feigvalues_par,geigvalues_par) 12 | fjac(:,:)=jf(:,:) 13 | end subroutine jac 14 | 15 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 | subroutine fun(nvar, t, y, p ) 17 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | use swe2dxy_parameters,only:temp_par,fz_par,feigvalues_par,geigvalues_par 19 | implicit none 20 | integer :: nvar 21 | double precision :: t 22 | double precision :: y(nvar), p(nvar) 23 | 24 | call vec2grid(y, temp_par) 25 | call compute_f(temp_par,fz_par,feigvalues_par,geigvalues_par) 26 | call grid2vec(fz_par, p) 27 | 28 | end subroutine fun 29 | 30 | subroutine output_statics(var,tstart,tend, tcpu, istate) 31 | use swe2dxy_parameters 32 | implicit none 33 | double precision :: tstart, tend, tcpu 34 | double precision :: var(ndim) 35 | integer :: istate(20) 36 | double precision :: tmp(ndim), delta(ndim) 37 | double precision :: l2, l2tmp, error 38 | integer :: i 39 | 40 | open(unit=2010,file='swe_lsode_sol.txt',form='formatted') 41 | do i=1,ndim 42 | read(2010,"(e24.16)") tmp(i) 43 | end do 44 | close(2010) 45 | 46 | do i=1,ndim 47 | delta(i)=var(i)-tmp(i) 48 | end do 49 | ! *****errors are shown in the form ||delta(x)||/||x||***** 50 | l2=0d0 51 | l2tmp=0d0 52 | do i=1,ndim 53 | l2=l2+delta(i)*delta(i) 54 | l2tmp =l2tmp+tmp(i)*tmp(i) 55 | end do 56 | error=sqrt(l2/l2tmp) 57 | 58 | write(6,2010) tstart,tend,istate(3:5),tcpu,error 59 | 2010 format (2x,'time interval [',f5.2,'-',f5.2, '] nsteps=',i5,& 60 | ' nasteps=',i5,' nrsteps=',i5,/,2x,& 61 | 'cputime=', f14.3,'seconds',/,2x,'rerror=',f12.8,//) 62 | ! store results into a file 63 | ! open(unit=11,file='swe2d_rk_sol.txt',status='replace') 64 | ! do i=1,ndim 65 | ! write(11,2011) var(i) 66 | ! 2011 format(e24.16) 67 | ! end do 68 | ! close(11) 69 | 70 | end subroutine output_statics 71 | 72 | program swe_rk_dr 73 | use swe2dxy_parameters 74 | use rk_f90_integrator 75 | implicit none 76 | external fun,jac 77 | integer ::i,j,state 78 | 79 | double precision :: atol(ndim),rtol(ndim), var(ndim) 80 | double precision:: tstart, tend, t1, t2, tcpu 81 | double precision:: rstate(20),rcntrl(20) 82 | double precision :: a=30d0 83 | integer ::istate(20),icntrl(20) 84 | !~~> solution 85 | ! u(1,:,:) = h(t,x,y) 86 | ! u(2,:,:) = u(t,x,y) 87 | ! u(3,:,:) = v(t,x,y) 88 | allocate(f_par(3, mx+4, my+4), fz_par(3, mx+4, my+4), stat=state) 89 | if (state .ne. 0) then 90 | stop 'allocation error for f or fz' 91 | end if 92 | 93 | allocate(temp_par(3, mx+4, my+4), feigvalues_par(3, mx+4, my+4), geigvalues_par(3, mx+4,my+4), stat=state) 94 | if (state .ne. 0) then 95 | stop 'allocation error for temp or feigvalues or geigvalues' 96 | end if 97 | 98 | allocate(jf(ndim, ndim), jg(ndim, ndim), stat=state) 99 | if (state .ne. 0) then 100 | stop 'allocation error for jacf, jf or jg' 101 | end if 102 | 103 | do i=1,ndim 104 | rtol(i) = 0.1 105 | atol(i) = 0.1 106 | end do 107 | 108 | do j = 1, 6 109 | do i=1,ndim 110 | rtol(i) = 0.1*rtol(i) 111 | atol(i) = 0.1*atol(i) 112 | end do 113 | call initializegaussiangrid(temp_par, a) 114 | temp_par(2,:,:) =2d0 115 | temp_par(3,:,:) =2d0 116 | call grid2vec(temp_par,var) 117 | 118 | tstart = 0.0d0 119 | tend = tstart + 50*2.1573758800627289e-003 120 | istate(:)=0 121 | icntrl(:)=0 122 | rcntrl(:)=0 123 | ! change initial step size 124 | ! rcntrl(3)=1e-3 125 | call cpu_time(t1) 126 | call integrate(tin=tstart, tout=tend, nvar=ndim, nnzero = nnz,var=var,& 127 | rtol=rtol, atol=atol,fun=fun,jac=jac,rstatus_u=rstate,& 128 | rcntrl_u=rcntrl, istatus_u=istate, icntrl_u=icntrl) 129 | call cpu_time(t2) 130 | tcpu=t2-t1 131 | call output_statics(var,tstart,tend,tcpu,istate) 132 | end do 133 | 134 | deallocate(f_par, fz_par, stat = state) 135 | if (state .ne. 0) then 136 | print *, 'deallocation error of f fz' 137 | stop 1 138 | end if 139 | deallocate(temp_par, feigvalues_par, geigvalues_par, stat = state) 140 | if (state .ne. 0) then 141 | print *, 'deallocation error of temp,feigvalues,geigvalues' 142 | stop 1 143 | end if 144 | 145 | deallocate(jf, jg, stat = state) 146 | if (state .ne. 0) then 147 | print *, 'deallocation error of jf jg' 148 | stop 1 149 | end if 150 | 151 | end program swe_rk_dr 152 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_RK_TLM/swe2D_rk_tlm_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine jac(n, t, y, fjac) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | use swe2dxy_parameters 5 | implicit none 6 | integer :: n 7 | double precision ::t 8 | double precision ::y(n),fjac(n,n) 9 | call vec2grid(y,u_par) 10 | call compute_f(u_par,f_par,feigvalues_par,geigvalues_par) 11 | call compute_jacf(u_par,feigvalues_par,geigvalues_par) 12 | fjac(:,:)=jf(:,:) 13 | end subroutine jac 14 | 15 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 | subroutine fun(n,t, y, p ) 17 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | use swe2dxy_parameters 19 | implicit none 20 | integer :: n 21 | double precision :: t 22 | double precision :: y(n), p(n) 23 | 24 | call vec2grid(y, temp_par) 25 | call compute_f(temp_par,f_par,feigvalues_par,geigvalues_par) 26 | call grid2vec(f_par, p) 27 | 28 | end subroutine fun 29 | 30 | subroutine output_statics(var,tstart,tend, tcpu, istate) 31 | use swe2dxy_parameters 32 | implicit none 33 | double precision :: tstart, tend, tcpu 34 | double precision :: var(nvar) 35 | integer :: istate(20) 36 | 37 | write(6,2010) tstart,tend,istate(3:5),tcpu 38 | 2010 format (2x,'time interval [',f5.2,'-',f5.2, ']',/,& 39 | 2x,'nsteps=',i5,' nasteps=',i5,' nrsteps=',i5,/,& 40 | 2x, 'cputime=', f14.3,' seconds',//) 41 | 42 | ! store results into a file 43 | ! open(unit=11,file='swe2d_rk_sol.txt',status='replace') 44 | ! do i=1,nvar 45 | ! write(11,2011) var(i) 46 | ! 2011 format(e24.16) 47 | ! end do 48 | ! close(11) 49 | 50 | end subroutine output_statics 51 | 52 | subroutine output_sen(n,ntlm,y_tlm,fno) 53 | implicit none 54 | double precision :: y_tlm(n,ntlm) 55 | integer :: n,ntlm,i,j,fno 56 | character(len=12) :: fname 57 | write(fname,'(a,i3.3,a)') 'RK_TLM_',fno,'.m' 58 | open(unit=20,file=fname,status='replace') 59 | do j=1,ntlm 60 | do i=1,n 61 | write(20,'(E24.16)') y_tlm(i,j) 62 | end do 63 | end do 64 | end subroutine output_sen 65 | 66 | program swe_rk_tlm_dr 67 | use swe2dxy_parameters 68 | use rk_tlm_f90_integrator 69 | implicit none 70 | external fun,jac 71 | integer, parameter :: ntlm = 1 72 | integer ::i,j,k,state 73 | double precision :: atol(nvar),rtol(nvar), var(nvar) 74 | double precision :: atol_tlm(nvar,ntlm),rtol_tlm(nvar,ntlm),y_tlm(nvar,ntlm) 75 | double precision:: tstart, tend, t1, t2, tcpu 76 | double precision:: rstate(20),rcntrl(20) 77 | double precision :: a=30d0 78 | integer ::istate(20),icntrl(20) 79 | 80 | ! allocate memory 81 | allocate(f_par(3, mx+4, my+4), stat=state) 82 | if (state .ne. 0) then 83 | stop 'allocation error for f ' 84 | end if 85 | 86 | allocate(temp_par(3, mx+4, my+4), feigvalues_par(3, mx+4, my+4), geigvalues_par(3, mx+4,my+4), stat=state) 87 | if (state .ne. 0) then 88 | stop 'allocation error for temp or feigvalues or geigvalues' 89 | end if 90 | 91 | allocate(jf(nvar, nvar), jg(nvar, nvar), stat=state) 92 | if (state .ne. 0) then 93 | stop 'allocation error for jacf, jf or jg' 94 | end if 95 | 96 | do i=1,nvar 97 | rtol(i) = 0.1 98 | atol(i) = 0.1 99 | end do 100 | 101 | do j = 1,6 102 | do i=1,nvar 103 | rtol(i) = 0.1 * rtol(i) 104 | atol(i) = 0.1 * atol(i) 105 | end do 106 | 107 | do k=1,ntlm 108 | do i=1,nvar 109 | rtol_tlm(i,k) = rtol(i) 110 | atol_tlm(i,k) = atol(i) 111 | end do 112 | end do 113 | 114 | 115 | call initializegaussiangrid(temp_par, a) 116 | temp_par(2,:,:) = 2d0 117 | temp_par(3,:,:) = 2d0 118 | call grid2vec(temp_par,var) 119 | 120 | !~~~> the tlmoint values at the final time 121 | y_tlm(1:nvar,1:ntlm) = 0.0d0 122 | do k=1,ntlm 123 | y_tlm(k,k) = 1.0d0 124 | end do 125 | 126 | tstart = 0.0d0 127 | tend = tstart + 5*2.1573758800627289e-003 128 | istate(:)=0 129 | icntrl(:)=0 130 | rcntrl(:)=0 131 | ! change initial step size 132 | ! rcntrl(3)=1e-3 133 | 134 | call cpu_time(t1) 135 | call integrate_tlm(tin=tstart, tout=tend, n=nvar, nnzero=nnz, & 136 | y_tlm=y_tlm, y=var, rtol=rtol, atol=atol, ntlm=ntlm,& 137 | atol_tlm=atol_tlm, rtol_tlm=rtol_tlm, fun=fun, jac=jac,& 138 | rstatus_u=rstate,rcntrl_u=rcntrl, istatus_u=istate,& 139 | icntrl_u=icntrl) 140 | call cpu_time(t2) 141 | tcpu=t2-t1 142 | call output_statics(var,tstart,tend,tcpu,istate) 143 | call output_sen(nvar,ntlm,y_tlm,j) 144 | end do 145 | 146 | ! free memory 147 | deallocate(f_par, stat = state) 148 | if (state .ne. 0) then 149 | print *, 'deallocation error of f ' 150 | stop 1 151 | end if 152 | deallocate(temp_par, feigvalues_par, geigvalues_par, stat = state) 153 | if (state .ne. 0) then 154 | print *, 'deallocation error of temp,feigvalues,geigvalues' 155 | stop 1 156 | end if 157 | 158 | deallocate(jf, jg, stat = state) 159 | if (state .ne. 0) then 160 | print *, 'deallocation error of jf jg' 161 | stop 1 162 | end if 163 | 164 | end program swe_rk_tlm_dr 165 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_SDIRK/cbm4_sdirk_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine jac(n, t, y, fjac) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | use cbm4_parameters 5 | implicit none 6 | integer :: n 7 | double precision ::t 8 | double precision ::y(nvar),fjac(nvar,nvar) 9 | fjac(:,:) = 0.0d0 10 | call update_sun(t) 11 | call update_rconst() 12 | call cbm4_jac(y,fix,rconst,fjac) 13 | end subroutine jac 14 | 15 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 | subroutine fun(n, t, y, p ) 17 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | use cbm4_parameters 19 | implicit none 20 | integer :: n 21 | double precision :: t 22 | double precision :: y(nvar), p(nvar) 23 | 24 | call update_sun(t) 25 | call update_rconst() 26 | call cbm4_fun(y,fix,rconst,p) 27 | 28 | ! add emisions 29 | p(31) = p(31) + 2.0d3 30 | p(26) = p(26) + 2.0d3 31 | end subroutine fun 32 | 33 | subroutine output_statics(var,tstart,tend, tcpu, istate) 34 | use cbm4_parameters 35 | implicit none 36 | double precision :: tstart, tend, tcpu 37 | double precision :: var(nvar) 38 | integer :: istate(20) 39 | double precision :: tmp(nvar), delta(nvar) 40 | double precision :: l2, l2tmp, error, atol 41 | integer :: i 42 | 43 | write(6,2010) tstart,tend,istate(3:5),tcpu 44 | 2010 format (2x,'time interval [',f10.2,'-',f10.2, '] nsteps=',i5,& 45 | ' nasteps=',i5,' nrsteps=',i5,/,2x,& 46 | 'cputime=', f14.3,'seconds',/,2x,//) 47 | ! store results into a file 48 | open(unit=11,file='cbm4_sdirk_sol.txt',status='replace') 49 | do i=1,nvar 50 | write(11,2011) var(i) 51 | 2011 format(e24.16) 52 | end do 53 | close(11) 54 | 55 | end subroutine output_statics 56 | 57 | program cbm4_rk_dr 58 | use cbm4_parameters 59 | use sdirk_f90_integrator 60 | implicit none 61 | external fun,jac 62 | integer :: i,j,state,ntests 63 | 64 | double precision :: atol(nvar),rtol(nvar), var(nvar) 65 | double precision :: tstart, tend, t1, t2, tcpu 66 | double precision :: rstate(20),rcntrl(20) 67 | double precision :: a=30d0, cfactor=2.55d10 68 | integer ::istate(20),icntrl(20) 69 | 70 | do i=1,nvar 71 | rtol(i) = 1.0d-5 72 | atol(i) = 1.0d-7 73 | end do 74 | 75 | do i=1,nvar 76 | rtol(i) = 0.1*rtol(i) 77 | atol(i) = 0.1*atol(i) 78 | end do 79 | 80 | ! initialization 81 | do i = 1,nfix 82 | fix(i) = 1.0d-8 * cfactor 83 | end do 84 | fix(1) = (1.25d+8)*cfactor 85 | ! constant rate coefficients 86 | rconst(4) = 9.3d-12 87 | rconst(11) = 2.2d-10 88 | rconst(18) = 1.3d-21 89 | rconst(21) = 4.39999d-40 90 | rconst(24) = 6.6d-12 91 | rconst(25) = 1d-20 92 | rconst(36) = 2.2d-13 93 | rconst(37) = 1d-11 94 | rconst(41) = 6.3d-16 95 | rconst(44) = 2.5d-15 96 | rconst(49) = 2d-12 97 | rconst(50) = 6.5d-12 98 | rconst(52) = 8.1d-13 99 | rconst(54) = 1600.d0 100 | rconst(55) = 1.5d-11 101 | rconst(59) = 7.7d-15 102 | rconst(64) = 8.1d-12 103 | rconst(65) = 4.2d0 104 | rconst(66) = 4.1d-11 105 | rconst(67) = 2.2d-11 106 | rconst(68) = 1.4d-11 107 | rconst(70) = 3d-11 108 | rconst(73) = 1.7d-11 109 | rconst(75) = 1.8d-11 110 | rconst(76) = 9.6d-11 111 | rconst(77) = 1.2d-17 112 | rconst(78) = 3.2d-13 113 | rconst(79) = 8.1d-12 114 | rconst(81) = 6.8d-13 115 | var(1) = 3.652686375061191d-02 116 | var(2) = 3.470772014720235d+11 117 | var(3) = 2.558736854382598d+03 118 | var(4) = 3.353179955426548d-23 119 | var(5) = 5.287698343141944d-20 120 | var(6) = 1.307511063007438d+07 121 | var(7) = 0.0 122 | var(8) = 1.985180650951722d+01 123 | var(9) = 3.839565210778183d+08 124 | var(10) = 2.675425503948970d+08 125 | var(11) = 1.593461800730453d-24 126 | var(12) = 1.191924698309334d+12 127 | var(13) = 4.894101892069533d-05 128 | var(14) = 5.462490511678749d-21 129 | var(15) = 1.943997577140665d-23 130 | var(16) = 2.329863421033919d+12 131 | var(17) = 2.106517721289787d-30 132 | var(18) = 5.518957651363696d+08 133 | var(19) = 2.633932009302457d-21 134 | var(20) = 8.118206770655152d+03 135 | var(21) = 3.000632019118241d+10 136 | var(22) = 0.0d0 137 | var(23) = 0.0d0 138 | var(24) = 2.687919546821573d+02 139 | var(25) = 2.061185883675469d+12 140 | var(26) = 1.561906017211229d+10 141 | var(27) = 3.671987743784878d+07 142 | var(28) = 9.888485531199334d+08 143 | var(29) = 1.248793414327174d+04 144 | var(30) = 3.357869003391008d+07 145 | var(31) = 2.727638922137502d+09 146 | var(32) = 6.534644475169904d+00 147 | 148 | tstart = 12.0d0 * 3600.d0 149 | tend = tstart + 24.d0 * 3600.d0 * 3.d0 150 | temp = 298.0d0 151 | 152 | call update_sun(tstart) 153 | call update_rconst() 154 | istate(:)=0 155 | icntrl(:)=0 156 | rcntrl(:)=0 157 | ! change initial step size 158 | ! rcntrl(3)=1d-3 159 | call cpu_time(t1) 160 | call integrate(tin=tstart, tout=tend, n=nvar, nnzero = nnz,var=var,& 161 | rtol=rtol, atol=atol,fun=fun,jac=jac,rstatus_u=rstate,& 162 | rcntrl_u=rcntrl, istatus_u=istate, icntrl_u=icntrl) 163 | call cpu_time(t2) 164 | tcpu=t2-t1 165 | call output_statics(var,tstart,tend,tcpu,istate) 166 | 167 | ! do i=1,nvar 168 | ! write(*,2012) var(i) 169 | !2012 format(e24.16e3) 170 | ! end do 171 | 172 | end program cbm4_rk_dr 173 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_RK/cbm4_rk_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine jac(n, t, y, fjac) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | use cbm4_parameters 5 | implicit none 6 | integer :: n 7 | double precision ::t 8 | double precision ::y(nvar),fjac(nvar,nvar) 9 | fjac(:,:) = 0.0d0 10 | call update_sun(t) 11 | call update_rconst() 12 | call cbm4_jac(y,fix,rconst,fjac) 13 | end subroutine jac 14 | 15 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 | subroutine fun(n, t, y, p ) 17 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | use cbm4_parameters 19 | implicit none 20 | integer :: n 21 | double precision :: t 22 | double precision :: y(nvar), p(nvar) 23 | 24 | call update_sun(t) 25 | call update_rconst() 26 | call cbm4_fun(y,fix,rconst,p) 27 | 28 | ! add emisions 29 | p(31) = p(31) + 2.0d3 30 | p(26) = p(26) + 2.0d3 31 | end subroutine fun 32 | 33 | subroutine output_statics(var,tstart,tend, tcpu, istate) 34 | use cbm4_parameters 35 | implicit none 36 | double precision :: tstart, tend, tcpu 37 | double precision :: var(nvar) 38 | integer :: istate(20) 39 | double precision :: tmp(nvar), delta(nvar) 40 | double precision :: l2, l2tmp, error, atol 41 | integer :: i 42 | 43 | write(6,2010) tstart,tend,istate(3:5),tcpu 44 | 2010 format (2x,'time interval [',f10.2,'-',f10.2, '] nsteps=',i5,& 45 | ' nasteps=',i5,' nrsteps=',i5,/,2x,& 46 | 'cputime=', f14.3,'seconds',//) 47 | ! store results into a file 48 | open(unit=11,file='cbm4_rk_sol.txt',status='replace') 49 | do i=1,nvar 50 | write(11,2011) var(i) 51 | 2011 format(e24.16) 52 | end do 53 | close(11) 54 | 55 | end subroutine output_statics 56 | 57 | program cbm4_rk_dr 58 | use cbm4_parameters 59 | use rk_f90_integrator 60 | implicit none 61 | external fun,jac 62 | integer :: i,j,state,ntests 63 | 64 | double precision :: atol(nvar),rtol(nvar), var(nvar) 65 | double precision :: tstart, tend, t1, t2, tcpu 66 | double precision :: rstate(20),rcntrl(20) 67 | double precision :: a=30d0, cfactor=2.55d10 68 | integer ::istate(20),icntrl(20) 69 | 70 | do i=1,nvar 71 | rtol(i) = 1.0d-5 72 | atol(i) = 1.0d-7 73 | end do 74 | 75 | do i=1,nvar 76 | rtol(i) = 0.1*rtol(i) 77 | atol(i) = 0.1*atol(i) 78 | end do 79 | 80 | ! initialization 81 | do i = 1,nfix 82 | fix(i) = 1.0d-8 * cfactor 83 | end do 84 | fix(1) = (1.25d+8)*cfactor 85 | ! constant rate coefficients 86 | rconst(4) = 9.3d-12 87 | rconst(11) = 2.2d-10 88 | rconst(18) = 1.3d-21 89 | rconst(21) = 4.39999d-40 90 | rconst(24) = 6.6d-12 91 | rconst(25) = 1d-20 92 | rconst(36) = 2.2d-13 93 | rconst(37) = 1d-11 94 | rconst(41) = 6.3d-16 95 | rconst(44) = 2.5d-15 96 | rconst(49) = 2d-12 97 | rconst(50) = 6.5d-12 98 | rconst(52) = 8.1d-13 99 | rconst(54) = 1600.d0 100 | rconst(55) = 1.5d-11 101 | rconst(59) = 7.7d-15 102 | rconst(64) = 8.1d-12 103 | rconst(65) = 4.2d0 104 | rconst(66) = 4.1d-11 105 | rconst(67) = 2.2d-11 106 | rconst(68) = 1.4d-11 107 | rconst(70) = 3d-11 108 | rconst(73) = 1.7d-11 109 | rconst(75) = 1.8d-11 110 | rconst(76) = 9.6d-11 111 | rconst(77) = 1.2d-17 112 | rconst(78) = 3.2d-13 113 | rconst(79) = 8.1d-12 114 | rconst(81) = 6.8d-13 115 | var(1) = 3.652686375061191d-02 116 | var(2) = 3.470772014720235d+11 117 | var(3) = 2.558736854382598d+03 118 | var(4) = 3.353179955426548d-23 119 | var(5) = 5.287698343141944d-20 120 | var(6) = 1.307511063007438d+07 121 | var(7) = 0.0 122 | var(8) = 1.985180650951722d+01 123 | var(9) = 3.839565210778183d+08 124 | var(10) = 2.675425503948970d+08 125 | var(11) = 1.593461800730453d-24 126 | var(12) = 1.191924698309334d+12 127 | var(13) = 4.894101892069533d-05 128 | var(14) = 5.462490511678749d-21 129 | var(15) = 1.943997577140665d-23 130 | var(16) = 2.329863421033919d+12 131 | var(17) = 2.106517721289787d-30 132 | var(18) = 5.518957651363696d+08 133 | var(19) = 2.633932009302457d-21 134 | var(20) = 8.118206770655152d+03 135 | var(21) = 3.000632019118241d+10 136 | var(22) = 0.0d0 137 | var(23) = 0.0d0 138 | var(24) = 2.687919546821573d+02 139 | var(25) = 2.061185883675469d+12 140 | var(26) = 1.561906017211229d+10 141 | var(27) = 3.671987743784878d+07 142 | var(28) = 9.888485531199334d+08 143 | var(29) = 1.248793414327174d+04 144 | var(30) = 3.357869003391008d+07 145 | var(31) = 2.727638922137502d+09 146 | var(32) = 6.534644475169904d+00 147 | 148 | tstart = 12.0d0 * 3600.d0 149 | tend = tstart + 24.d0 * 3600.d0 * 3.d0 150 | temp = 298.0d0 151 | 152 | call update_sun(tstart) 153 | call update_rconst() 154 | istate(:)=0 155 | icntrl(:)=0 156 | icntrl(3)=1 157 | rcntrl(:)=0 158 | ! change initial step size 159 | ! rcntrl(3)=1d-3 160 | call cpu_time(t1) 161 | call integrate(tin=tstart, tout=tend, n=nvar, nnzero = nnz,var=var,& 162 | rtol=rtol, atol=atol,fun=fun,jac=jac,rstatus_u=rstate,& 163 | rcntrl_u=rcntrl, istatus_u=istate, icntrl_u=icntrl) 164 | call cpu_time(t2) 165 | tcpu=t2-t1 166 | call output_statics(var,tstart,tend,tcpu,istate) 167 | 168 | ! do i=1,nvar 169 | ! write(*,2012) var(i) 170 | !2012 format(e24.16e3) 171 | ! end do 172 | 173 | end program cbm4_rk_dr 174 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_ERK_TLM/swe2D_erk_tlm_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine jac(n, t, y, fjac) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | use swe2dxy_parameters 5 | implicit none 6 | integer :: n 7 | double precision ::t 8 | double precision ::y(n),fjac(n,n) 9 | print *,'calling jac' 10 | call vec2grid(y,u_par) 11 | call compute_f(u_par,f_par,feigvalues_par,geigvalues_par) 12 | call compute_jacf(u_par,feigvalues_par,geigvalues_par) 13 | fjac(:,:)=jf(:,:) 14 | end subroutine jac 15 | 16 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 17 | subroutine fun(n,t, y, p ) 18 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 19 | use swe2dxy_parameters 20 | implicit none 21 | integer :: n 22 | double precision :: t 23 | double precision :: y(n), p(n) 24 | 25 | call vec2grid(y, temp_par) 26 | call compute_f(temp_par,f_par,feigvalues_par,geigvalues_par) 27 | call grid2vec(f_par, p) 28 | 29 | end subroutine fun 30 | 31 | subroutine output_statics(var,tstart,tend, tcpu, istate) 32 | use swe2dxy_parameters 33 | implicit none 34 | double precision :: tstart, tend, tcpu 35 | double precision :: var(nvar) 36 | integer :: istate(20) 37 | 38 | write(6,2010) tstart,tend,istate(3:5),tcpu 39 | 2010 format (2x,'time interval [',f5.2,'-',f5.2, ']',/,& 40 | 2x,'nsteps=',i5,' nasteps=',i5,' nrsteps=',i5,/,& 41 | 2x, 'cputime=', f14.3,//) 42 | 43 | ! store results into a file 44 | ! open(unit=11,file='swe2d_rk_sol.txt',status='replace') 45 | ! do i=1,nvar 46 | ! write(11,2011) var(i) 47 | ! 2011 format(e24.16) 48 | ! end do 49 | ! close(11) 50 | 51 | end subroutine output_statics 52 | 53 | subroutine output_sen(n,ntlm,y_tlm,fno) 54 | implicit none 55 | double precision :: y_tlm(n,ntlm) 56 | integer :: n,ntlm,i,j,fno 57 | character(len=13) :: fname 58 | write(fname,'(a,i3.3,a)') 'ERK_TLM_',fno,'.m' 59 | open(unit=20,file=fname,status='replace') 60 | do j=1,ntlm 61 | do i=1,n 62 | write(20,'(E24.16)') y_tlm(i,j) 63 | end do 64 | end do 65 | end subroutine output_sen 66 | 67 | program swe_rk_tlm_dr 68 | use swe2dxy_parameters 69 | use erk_tlm_f90_integrator 70 | implicit none 71 | external fun,jac 72 | integer, parameter :: ntlm = 1 73 | integer ::i,j,k,state 74 | double precision :: atol(nvar),rtol(nvar), var(nvar) 75 | double precision :: atol_tlm(nvar,ntlm),rtol_tlm(nvar,ntlm),y_tlm(nvar,ntlm) 76 | double precision:: tstart, tend, t1, t2, tcpu 77 | double precision:: rstate(20),rcntrl(20) 78 | double precision :: a=30d0 79 | integer ::istate(20),icntrl(20) 80 | 81 | ! allocate memory 82 | allocate(f_par(3, mx+4, my+4), stat=state) 83 | if (state .ne. 0) then 84 | stop 'allocation error for f ' 85 | end if 86 | 87 | allocate(temp_par(3, mx+4, my+4), feigvalues_par(3, mx+4, my+4), geigvalues_par(3, mx+4,my+4), stat=state) 88 | if (state .ne. 0) then 89 | stop 'allocation error for temp or feigvalues or geigvalues' 90 | end if 91 | 92 | allocate(jf(nvar, nvar), jg(nvar, nvar), stat=state) 93 | if (state .ne. 0) then 94 | stop 'allocation error for jacf, jf or jg' 95 | end if 96 | 97 | do i=1,nvar 98 | rtol(i) = 0.1 99 | atol(i) = 0.1 100 | end do 101 | 102 | do j = 1,6 103 | do i=1,nvar 104 | rtol(i) = 0.1 * rtol(i) 105 | atol(i) = 0.1 * atol(i) 106 | end do 107 | 108 | do k=1,ntlm 109 | do i=1,nvar 110 | rtol_tlm(i,k) = rtol(i) 111 | atol_tlm(i,k) = atol(i) 112 | end do 113 | end do 114 | 115 | call initializegaussiangrid(temp_par, a) 116 | temp_par(2,:,:) = 2d0 117 | temp_par(3,:,:) = 2d0 118 | call grid2vec(temp_par,var) 119 | 120 | !~~~> the tlmoint values at the final time 121 | y_tlm(1:nvar,1:ntlm) = 0.0d0 122 | do k=1,ntlm 123 | y_tlm(k,k) = 1.0d0 124 | end do 125 | 126 | tstart = 0.0d0 127 | tend = tstart + 5*2.1573758800627289e-003 128 | istate(:)=0 129 | icntrl(:)=0 130 | icntrl(3) = 4 ! ~~~> choose method 131 | rcntrl(:)=0 132 | ! change initial step size 133 | ! rcntrl(3)=1e-3 134 | 135 | call cpu_time(t1) 136 | call integrate_tlm(tin=tstart, tout=tend, nvar=nvar, & 137 | var_tlm=y_tlm, var=var, rtol=rtol, atol=atol, ntlm=ntlm,& 138 | fun=fun, jac=jac, rstatus_u=rstate,rcntrl_u=rcntrl, & 139 | istatus_u=istate, icntrl_u=icntrl, & 140 | atol_tlm =atol_tlm, rtol_tlm = rtol_tlm) 141 | call cpu_time(t2) 142 | tcpu=t2-t1 143 | call output_statics(var,tstart,tend,tcpu,istate) 144 | call output_sen(nvar,ntlm,y_tlm,j) 145 | print *,'number of rhs evaluations:',istate(1) 146 | end do 147 | 148 | ! free memory 149 | deallocate(f_par, stat = state) 150 | if (state .ne. 0) then 151 | print *, 'deallocation error of f ' 152 | stop 1 153 | end if 154 | deallocate(temp_par, feigvalues_par, geigvalues_par, stat = state) 155 | if (state .ne. 0) then 156 | print *, 'deallocation error of temp,feigvalues,geigvalues' 157 | stop 1 158 | end if 159 | 160 | deallocate(jf, jg, stat = state) 161 | if (state .ne. 0) then 162 | print *, 'deallocation error of jf jg' 163 | stop 1 164 | end if 165 | 166 | end program swe_rk_tlm_dr 167 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_SDIRK_TLM/swe2D_sdirk_tlm_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine jac(n,t,y,fjac) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | use swe2dxy_parameters 5 | implicit none 6 | integer :: n 7 | double precision ::t 8 | double precision ::y(n),fjac(n,n) 9 | call vec2grid(y,u_par) 10 | call compute_f(u_par,f_par,feigvalues_par,geigvalues_par) 11 | call compute_jacf(u_par,feigvalues_par,geigvalues_par) 12 | fjac(:,:)=jf(:,:) 13 | end subroutine jac 14 | 15 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 | subroutine fun(n,t, y, p ) 17 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | use swe2dxy_parameters 19 | implicit none 20 | integer :: n 21 | double precision :: t 22 | double precision :: y(n), p(n) 23 | 24 | call vec2grid(y, temp_par) 25 | call compute_f(temp_par,fz_par,feigvalues_par,geigvalues_par) 26 | call grid2vec(fz_par, p) 27 | 28 | end subroutine fun 29 | 30 | subroutine output_statics(var,tstart,tend, tcpu, istate) 31 | use swe2dxy_parameters 32 | implicit none 33 | double precision :: tstart, tend, tcpu 34 | double precision :: var(ndim) 35 | integer :: istate(20) 36 | 37 | 38 | write(6,2010) tstart,tend,istate(3:5),tcpu 39 | 2010 format (2x,'time interval [',f5.2,'-',f5.2, ']',/,& 40 | 2x,'nsteps=',i5,' nasteps=',i5,' nrsteps=',i5,/,& 41 | 2x, 'cputime=', f14.3,' seconds',//) 42 | 43 | ! store results into a file 44 | ! open(unit=11,file='swe2d_sdirk_sol.txt',status='replace') 45 | ! do i=1,ndim 46 | ! write(11,2011) var(i) 47 | ! 2011 format(e24.16) 48 | ! end do 49 | ! close(11) 50 | 51 | end subroutine output_statics 52 | 53 | subroutine output_sen(n,ntlm,y_tlm,fno) 54 | implicit none 55 | double precision :: y_tlm(n,ntlm) 56 | integer :: n,ntlm,i,j,fno 57 | character(len=12) :: fname 58 | write(fname,'(a,i3.3,a)') 'SD_TLM_',fno,'.m' 59 | open(unit=20,file=fname,status='replace') 60 | do j=1,ntlm 61 | do i=1,n 62 | write(20,'(E24.16)') y_tlm(i,j) 63 | end do 64 | end do 65 | end subroutine output_sen 66 | 67 | 68 | program swe_sdirk_tlm_dr 69 | use swe2dxy_parameters 70 | use sdirk_tlm_f90_integrator 71 | implicit none 72 | external fun,jac 73 | integer, parameter :: ntlm = 1 74 | integer ::i,j,k,state 75 | double precision :: atol(ndim),rtol(ndim), var(ndim) 76 | double precision :: atol_tlm(ndim,ntlm),rtol_tlm(ndim,ntlm),y_tlm(ndim,ntlm) 77 | double precision:: tstart, tend, t1, t2, tcpu 78 | double precision:: rstate(20),rcntrl(20) 79 | double precision :: a=30d0 80 | integer ::istate(20),icntrl(20) 81 | !~~> solution 82 | ! u(1,:,:) = h(t,x,y) 83 | ! u(2,:,:) = u(t,x,y) 84 | ! u(3,:,:) = v(t,x,y) 85 | allocate(f_par(3, mx+4, my+4), fz_par(3, mx+4, my+4), stat=state) 86 | if (state .ne. 0) then 87 | stop 'allocation error for f or fz' 88 | end if 89 | 90 | allocate(temp_par(3, mx+4, my+4), feigvalues_par(3, mx+4, my+4), geigvalues_par(3, mx+4,my+4), stat=state) 91 | if (state .ne. 0) then 92 | stop 'allocation error for temp or feigvalues or geigvalues' 93 | end if 94 | 95 | allocate(jf(ndim, ndim), jg(ndim, ndim), stat=state) 96 | if (state .ne. 0) then 97 | stop 'allocation error for jacf, jf or jg' 98 | end if 99 | 100 | do i=1,ndim 101 | rtol(i) = 0.1 102 | atol(i) = 0.1 103 | end do 104 | 105 | do j = 1,6 106 | do i=1,ndim 107 | rtol(i) = 0.1 * rtol(i) 108 | atol(i) = 0.1 * atol(i) 109 | end do 110 | 111 | do k=1,ntlm 112 | do i=1,ndim 113 | rtol_tlm(i,k) = rtol(i) 114 | atol_tlm(i,k) = atol(i) 115 | end do 116 | end do 117 | 118 | 119 | call initializegaussiangrid(temp_par, a) 120 | temp_par(2,:,:) = 2d0 121 | temp_par(3,:,:) = 2d0 122 | call grid2vec(temp_par,var) 123 | 124 | !~~~> the tlmoint values at the final time 125 | y_tlm(1:ndim,1:ntlm) = 0.0d0 126 | do k=1,ntlm 127 | y_tlm(k,k) = 1.0d0 128 | end do 129 | 130 | tstart = 0.0d0 131 | tend = tstart + 5*2.1573758800627289e-003 132 | istate(:)=0 133 | icntrl(:)=0 134 | rcntrl(:)=0 135 | ! change initial step size 136 | ! rcntrl(3)=1e-3 137 | 138 | call cpu_time(t1) 139 | call integrate_tlm(tin=tstart, tout=tend, n=ndim,nnzero=nnz, & 140 | y_tlm=y_tlm, y=var, rtol=rtol, atol=atol, ntlm=ntlm,& 141 | atol_tlm=atol_tlm, rtol_tlm=rtol_tlm, fun=fun,jac=jac,& 142 | rstatus_u=rstate,rcntrl_u=rcntrl, istatus_u=istate,& 143 | icntrl_u=icntrl) 144 | call cpu_time(t2) 145 | tcpu=t2-t1 146 | call output_statics(var,tstart,tend,tcpu,istate) 147 | call output_sen(ndim,ntlm,y_tlm,j) 148 | end do 149 | 150 | deallocate(f_par, fz_par, stat = state) 151 | if (state .ne. 0) then 152 | print *, 'deallocation error of f fz' 153 | stop 1 154 | end if 155 | deallocate(temp_par, feigvalues_par, geigvalues_par, stat = state) 156 | if (state .ne. 0) then 157 | print *, 'deallocation error of temp,feigvalues,geigvalues' 158 | stop 1 159 | end if 160 | 161 | deallocate(jf, jg, stat = state) 162 | if (state .ne. 0) then 163 | print *, 'deallocation error of jf jg' 164 | stop 1 165 | end if 166 | 167 | end program swe_sdirk_tlm_dr 168 | -------------------------------------------------------------------------------- /EXAMPLES/cbm4/CBM4_ROS/cbm4_ros_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine jac(n, t, y, fjac) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | use cbm4_parameters, only:fix,rconst,update_sun,update_rconst,cbm4_jac 5 | implicit none 6 | integer, intent(in) :: n 7 | double precision, intent(in) ::t,y(n) 8 | double precision, intent(inout) :: fjac(n,n) 9 | fjac(:,:) = 0.0d0 10 | call update_sun(t) 11 | call update_rconst() 12 | call cbm4_jac(y,fix,rconst,fjac) 13 | end subroutine jac 14 | 15 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 | subroutine fun(n, t, y, p ) 17 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | use cbm4_parameters, only:fix,rconst,update_sun,update_rconst,cbm4_fun 19 | implicit none 20 | integer, intent(in) :: n 21 | double precision, intent(in) :: t,y(n) 22 | double precision, intent(inout) :: p(n) 23 | 24 | call update_sun(t) 25 | call update_rconst() 26 | call cbm4_fun(y,fix,rconst,p) 27 | 28 | ! add emisions 29 | p(31) = p(31) + 2.0d3 30 | p(26) = p(26) + 2.0d3 31 | end subroutine fun 32 | 33 | subroutine output_statics(var,tstart,tend, tcpu, istate) 34 | use cbm4_parameters, only: nvar 35 | implicit none 36 | double precision :: tstart, tend, tcpu 37 | double precision :: var(nvar) 38 | integer :: istate(20) 39 | double precision :: tmp(nvar), delta(nvar) 40 | double precision :: l2, l2tmp, error, atol 41 | integer :: i 42 | 43 | write(6,2010) tstart,tend,istate(3:5),tcpu 44 | 2010 format (2x,'time interval [',f10.2,'-',f10.2, '] nsteps=',i5,& 45 | ' nasteps=',i5,' nrsteps=',i5,/,2x,& 46 | 'cputime=', f14.3,'seconds',//) 47 | ! store results into a file 48 | ! open(unit=11,file='cbm42d_ros_sol.txt',status='replace') 49 | ! do i=1,nvar 50 | ! write(11,2011) var(i) 51 | ! 2011 format(e24.16) 52 | ! end do 53 | ! close(11) 54 | 55 | end subroutine output_statics 56 | 57 | program cbm4_ros_dr 58 | use cbm4_parameters, only: temp,nvar,nnz,nfix,fix,rconst,update_sun,update_rconst 59 | use ros_f90_integrator 60 | implicit none 61 | external fun,jac 62 | integer :: i,j,state,ntests 63 | 64 | double precision :: atol(nvar),rtol(nvar), var(nvar) 65 | double precision :: tstart, tend, t1, t2, tcpu 66 | double precision :: rstate(20),rcntrl(20) 67 | double precision :: a=30d0, cfactor=2.55d10 68 | integer :: istate(20),icntrl(20) 69 | 70 | do i=1,nvar 71 | rtol(i) = 1.0d-5 72 | atol(i) = 1.0d-7 73 | end do 74 | 75 | do i=1,nvar 76 | rtol(i) = 0.1*rtol(i) 77 | atol(i) = 0.1*atol(i) 78 | end do 79 | 80 | ! initialization 81 | do i = 1,nfix 82 | fix(i) = 1.0d-8 * cfactor 83 | end do 84 | fix(1) = (1.25d+8)*cfactor 85 | ! constant rate coefficients 86 | rconst(4) = 9.3d-12 87 | rconst(11) = 2.2d-10 88 | rconst(18) = 1.3d-21 89 | rconst(21) = 4.39999d-40 90 | rconst(24) = 6.6d-12 91 | rconst(25) = 1d-20 92 | rconst(36) = 2.2d-13 93 | rconst(37) = 1d-11 94 | rconst(41) = 6.3d-16 95 | rconst(44) = 2.5d-15 96 | rconst(49) = 2d-12 97 | rconst(50) = 6.5d-12 98 | rconst(52) = 8.1d-13 99 | rconst(54) = 1600.d0 100 | rconst(55) = 1.5d-11 101 | rconst(59) = 7.7d-15 102 | rconst(64) = 8.1d-12 103 | rconst(65) = 4.2d0 104 | rconst(66) = 4.1d-11 105 | rconst(67) = 2.2d-11 106 | rconst(68) = 1.4d-11 107 | rconst(70) = 3d-11 108 | rconst(73) = 1.7d-11 109 | rconst(75) = 1.8d-11 110 | rconst(76) = 9.6d-11 111 | rconst(77) = 1.2d-17 112 | rconst(78) = 3.2d-13 113 | rconst(79) = 8.1d-12 114 | rconst(81) = 6.8d-13 115 | var(1) = 3.652686375061191d-02 116 | var(2) = 3.470772014720235d+11 117 | var(3) = 2.558736854382598d+03 118 | var(4) = 3.353179955426548d-23 119 | var(5) = 5.287698343141944d-20 120 | var(6) = 1.307511063007438d+07 121 | var(7) = 0.0 122 | var(8) = 1.985180650951722d+01 123 | var(9) = 3.839565210778183d+08 124 | var(10) = 2.675425503948970d+08 125 | var(11) = 1.593461800730453d-24 126 | var(12) = 1.191924698309334d+12 127 | var(13) = 4.894101892069533d-05 128 | var(14) = 5.462490511678749d-21 129 | var(15) = 1.943997577140665d-23 130 | var(16) = 2.329863421033919d+12 131 | var(17) = 2.106517721289787d-30 132 | var(18) = 5.518957651363696d+08 133 | var(19) = 2.633932009302457d-21 134 | var(20) = 8.118206770655152d+03 135 | var(21) = 3.000632019118241d+10 136 | var(22) = 0.0d0 137 | var(23) = 0.0d0 138 | var(24) = 2.687919546821573d+02 139 | var(25) = 2.061185883675469d+12 140 | var(26) = 1.561906017211229d+10 141 | var(27) = 3.671987743784878d+07 142 | var(28) = 9.888485531199334d+08 143 | var(29) = 1.248793414327174d+04 144 | var(30) = 3.357869003391008d+07 145 | var(31) = 2.727638922137502d+09 146 | var(32) = 6.534644475169904d+00 147 | 148 | tstart = 12.0d0 * 3600.d0 149 | tend = tstart + 24.d0 * 3600.d0 * 3.d0 150 | temp = 298.0d0 151 | 152 | call update_sun(tstart) 153 | call update_rconst() 154 | istate(:)=0 155 | icntrl(:)=0 156 | rcntrl(:)=0 157 | ! change initial step size 158 | icntrl(3) = 4 159 | rcntrl(3)=1d-3 160 | call cpu_time(t1) 161 | call integrate(tin=tstart, tout=tend, n=nvar, nnzero = nnz,var=var,& 162 | rtol=rtol, atol=atol,fun=fun,jac=jac,rstatus_u=rstate,& 163 | rcntrl_u=rcntrl, istatus_u=istate, icntrl_u=icntrl) 164 | call cpu_time(t2) 165 | tcpu=t2-t1 166 | call output_statics(var,tstart,tend,tcpu,istate) 167 | 168 | ! do i=1,nvar 169 | ! write(*,2012) var(i) 170 | !2012 format(e24.16e3) 171 | ! end do 172 | 173 | end program cbm4_ros_dr 174 | -------------------------------------------------------------------------------- /EXAMPLES/roberts/ROBERTS_RK_ADJ/roberts_rk_adj_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine DRDP(nadj,n,nrp,t,y,rp) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | integer :: nadj,n,nrp 5 | double precision :: t,y(n),rp(nrp,nadj) 6 | rp(:,:) = 0d0 7 | end subroutine 8 | 9 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10 | subroutine DRDY(nadj,n,nry,t,y,ry) 11 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 | integer :: nadj,n,nry 13 | double precision :: t,y(n),ry(nry,nadj) 14 | ry(:,:) = 0d0 15 | ry(1,1) = 1.0d0 16 | ry(2,2) = 1.0d0 17 | ry(3,3) = 1.0d0 18 | end subroutine 19 | 20 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 21 | subroutine JACP(n,np,t,y,fpjac) 22 | ! fpjac = df/dp 23 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 24 | integer :: n,np 25 | double precision :: t,y(n),fpjac(n,np) 26 | fpjac(1,1) = -y(1) 27 | fpjac(2,1) = y(1) 28 | fpjac(1,2) = y(2)*y(3) 29 | fpjac(2,2) = -y(2)*y(3) 30 | fpjac(2,3) = -y(2)*y(2) 31 | fpjac(3,3) = y(2)*y(2) 32 | end subroutine 33 | 34 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | subroutine jac(nvar,t,y,fjac) 36 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | implicit none 38 | integer :: nvar 39 | double precision :: c(3) 40 | double precision ::t 41 | double precision ::y(nvar),fjac(nvar,nvar) 42 | c(1) = 0.04e0 43 | c(2) = 1.0e4 44 | c(3) = 3.0e7 45 | 46 | fjac(1,1) = -c(1) 47 | fjac(1,2) = c(2)*y(3) 48 | fjac(1,3) = c(2)*y(2) 49 | 50 | fjac(2,1) = c(1) 51 | fjac(2,2) = -c(2)*y(3)-2*c(3)*y(2) 52 | fjac(2,3) = -c(2)*y(2) 53 | 54 | fjac(3,2) = 2*c(3)*y(2) 55 | end subroutine jac 56 | 57 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 58 | subroutine fun(nvar,t, y, p ) 59 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 60 | implicit none 61 | integer :: nvar 62 | double precision,parameter :: c(3) = (/0.04e0, 1.0e4, 3.0e7/) 63 | double precision :: t 64 | double precision :: y(nvar), p(nvar) 65 | 66 | p(1) = -c(1)*y(1) +c(2)*y(2)*y(3) 67 | p(3) = c(3)*y(2)*y(2) 68 | p(2) = -p(1) - p(3) 69 | 70 | end subroutine fun 71 | 72 | !~~~> Initialize adjoint variables 73 | subroutine adjinit(n,np,nadj,t,y,lambda,mu) 74 | integer :: n,np,nadj,k 75 | double precision :: t,y(n),lambda(n,nadj) 76 | double precision,optional :: mu(np,nadj) 77 | !~~~> if number of parameters is not zero, extra adjoint varaible mu should be 78 | !defined 79 | if(NP>0 .and. .not. present(mu)) stop 'undefined argument mu' 80 | !~~~> the adjoint values at the final time 81 | lambda(1:n,1:nadj) = 0.0d0 82 | do k=1,nadj 83 | lambda(k,k) = y(k) 84 | end do 85 | mu(:,:) = 0.d0 86 | mu(1,1) = -y(1)*y(1) 87 | mu(2,1) = y(1)*y(2) 88 | mu(1,2) = y(2)*y(3)*y(1) 89 | mu(2,2) = -y(2)*y(3)*y(2) 90 | mu(2,3) = -y(2)*y(2)*y(2) 91 | mu(3,3) = y(2)*y(2)*y(3) 92 | 93 | end subroutine 94 | 95 | subroutine qfun(n,nr,t,y,r) 96 | integer :: nr,n 97 | double precision :: t,y(n),r(nr) 98 | r(1) = y(1) 99 | r(2) = y(2) 100 | r(3) = y(3) 101 | end subroutine 102 | 103 | program roberts_ros_adj_dr 104 | 105 | use rk_adj_f90_integrator 106 | implicit none 107 | external fun,jac,DRDP,DRDY,JACP,AdjInit,QFUN 108 | integer, parameter :: nvar = 3, nnz=0,nadj = 3,np=3 109 | integer ::i,k 110 | double precision :: atol(nvar),rtol(nvar), var(nvar), q(nadj) 111 | double precision :: atol_adj(nvar,nadj),rtol_adj(nvar,nadj),y_adj(nvar,nadj),yp_adj(np,nadj) 112 | double precision:: tstart, tend, t1, t2, tcpu 113 | double precision:: rstate(20),rcntrl(20) 114 | integer ::istate(20),icntrl(20) 115 | 116 | 117 | ! Print problem description 118 | print *,'Adjoint Sensitivity Example for Chemical Kinetics' 119 | print *, '-------------------------------------------------' 120 | print *, 'ODE: dy1/dt = -p1*y1 + p2*y2*y3 ' 121 | print *, ' dy2/dt = p1*y1 - p2*y2*y3 - p3*(y2)^2' 122 | print *, ' dy3/dt = p3*(y2)^2 ' 123 | print *, ' Find dG/dp for ' 124 | print *, ' G = R = int_t0^tB0 r(t,p,y) dt ' 125 | print *, ' r(t,p,y) = y(t,p) ' 126 | 127 | 128 | do i=1,nvar 129 | rtol(i) = 1e-6 130 | end do 131 | 132 | atol(1) = 1e-8 133 | atol(2) = 1e-14 134 | atol(3) = 1e-6 135 | 136 | do k=1,nadj 137 | do i=1,nvar 138 | rtol_adj(i,k) = 1e-1 139 | atol_adj(i,k) = 1e-2 140 | end do 141 | end do 142 | 143 | ! initialize y 144 | var(1) = 1.0d0 145 | var(2) = 0.0d0 146 | var(3) = 0.0d0 147 | 148 | q(1) = 0.0d0 149 | q(2) = 0.0d0 150 | q(3) = 0.0d0 151 | tstart = 0.0d0 152 | tend = 4.0e7 153 | ! tend = 0.2d0 154 | istate(:)=0 155 | icntrl(:)=0 156 | rcntrl(:)=0 157 | ! change initial step size 158 | rcntrl(3)=1.0e-3 159 | 160 | call cpu_time(t1) 161 | call integrate_adj(tin=tstart, tout=tend, nvar=nvar, np=np, nnzero=nnz,& 162 | lambda=y_adj, mu= yp_adj, y=var, rtol=rtol, atol=atol, nadj=nadj,& 163 | atol_adj=atol_adj, rtol_adj=rtol_adj, fun=fun, jac=jac, & 164 | drdp =DRDP, drdy=DRDY, jacp=JACP,adjinit=AdjInit,& 165 | rstatus_u=rstate,rcntrl_u=rcntrl, istatus_u=istate,& 166 | icntrl_u=icntrl,q=q, qfun=qfun) 167 | call cpu_time(t2) 168 | tcpu=t2-t1 169 | 170 | write(6,2010) tstart,tend,istate(3:5),tcpu 171 | 2010 FORMAT (2x,'Time interval [',f12.2,'-',f12.2, ']',/,& 172 | 2x,'Nsteps=',I5,' NAsteps=',I5,' NRsteps=',I5,/,& 173 | 2x, 'CPUtime=', f14.3,/,2x, //) 174 | 175 | print *, '-------------------------------------' 176 | print *, 'dG/dp', yp_adj(:,1) 177 | print *, 'lambda',y_adj(:,1) 178 | print *, 'VAR',var(:) 179 | print *, 'Q',q(:) 180 | end program roberts_ros_adj_dr 181 | -------------------------------------------------------------------------------- /EXAMPLES/roberts/ROBERTS_SDIRK_ADJ/roberts_sdirk_adj_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine DRDP(nadj,n,nrp,t,y,rp) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | integer :: nadj,n,nrp 5 | double precision :: t,y(n),rp(nrp,nadj) 6 | rp(:,:) = 0d0 7 | end subroutine 8 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 | subroutine DRDY(nadj,n,nry,t,y,ry) 10 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11 | integer :: nadj,n,nry 12 | double precision :: t,y(n),ry(nry,nadj) 13 | ry(:,:) = 0d0 14 | ry(1,1) = 1.0d0 15 | ry(2,2) = 2.0d0 16 | ry(3,3) = 3.0d0 17 | end subroutine 18 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 19 | subroutine JACP(n,np,t,y,fpjac) 20 | ! fpjac = df/dp 21 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 22 | integer :: n,np 23 | double precision :: t,y(n),fpjac(n,np) 24 | fpjac(1,1) = -y(1) 25 | fpjac(2,1) = y(1) 26 | fpjac(1,2) = y(2)*y(3) 27 | fpjac(2,2) = -y(2)*y(3) 28 | fpjac(2,3) = -y(2)*y(2) 29 | fpjac(3,3) = y(2)*y(2) 30 | end subroutine 31 | 32 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 33 | subroutine jac(nvar,t,y,fjac) 34 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | implicit none 36 | integer :: nvar 37 | double precision :: c(3) 38 | double precision ::t 39 | double precision ::y(nvar),fjac(nvar,nvar) 40 | c(1) = 0.04e0 41 | c(2) = 1.0e4 42 | c(3) = 3.0e7 43 | 44 | fjac(1,1) = -c(1) 45 | fjac(1,2) = c(2)*y(3) 46 | fjac(1,3) = c(2)*y(2) 47 | 48 | fjac(2,1) = c(1) 49 | fjac(2,2) = -c(2)*y(3)-2*c(3)*y(2) 50 | fjac(2,3) = -c(2)*y(2) 51 | 52 | fjac(3,2) = 2*c(3)*y(2) 53 | end subroutine jac 54 | 55 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | subroutine fun(nvar,t, y, p ) 57 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 58 | implicit none 59 | integer :: nvar 60 | double precision,parameter :: c(3) = (/0.04e0, 1.0e4, 3.0e7/) 61 | double precision :: t 62 | double precision :: y(nvar), p(nvar) 63 | 64 | p(1) = -c(1)*y(1) +c(2)*y(2)*y(3) 65 | p(3) = c(3)*y(2)*y(2) 66 | p(2) = -p(1) - p(3) 67 | 68 | end subroutine fun 69 | 70 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 71 | subroutine qfun(n,nr,t, y, r ) 72 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | implicit none 74 | integer :: n,nr 75 | double precision :: t 76 | double precision :: y(n), r(nr) 77 | 78 | r(1) = y(1) 79 | r(2) = y(2) 80 | r(3) = y(3) 81 | 82 | end subroutine qfun 83 | 84 | !~~~> Initialize adjoint variables 85 | subroutine adjinit(n,np,nadj,t,y,lambda,mu) 86 | integer :: n,np,nadj,k 87 | double precision :: t,y(n),lambda(n,nadj) 88 | double precision,optional :: mu(np,nadj) 89 | !~~~> if number of parameters is not zero, extra adjoint varaible mu should be 90 | !defined 91 | if(NP>0 .and. .not. present(mu)) stop 'undefined argument mu' 92 | !~~~> the adjoint values at the final time 93 | lambda(1:n,1:nadj) = 0.0d0 94 | do k=1,nadj 95 | lambda(k,k) = y(k) 96 | end do 97 | mu(1:np,1:nadj) = 0.d0 98 | mu(1,1) = -y(1)*y(1) 99 | mu(1,2) = y(1)*y(2)*y(3) 100 | mu(2,1) = y(1)*y(2) 101 | mu(2,2) = -y(2)*y(2)*y(3) 102 | mu(2,3) = -y(2)*y(2)*y(2) 103 | mu(3,3) = y(2)*y(2)*y(3) 104 | end subroutine 105 | 106 | program roberts_ros_adj_dr 107 | 108 | use sdirk_adj_f90_integrator 109 | implicit none 110 | external fun,qfun,jac, adjinit,DRDP,DRDY,JACP 111 | integer, parameter :: nvar = 3, nnz=0, nadj=3, np=3 112 | integer ::i,k 113 | double precision :: atol(nvar),rtol(nvar), var(nvar), q(nadj) 114 | double precision :: atol_adj(nvar,nadj),rtol_adj(nvar,nadj),y_adj(nvar,nadj),yp_adj(np,nadj) 115 | double precision:: tstart, tend, t1, t2, tcpu 116 | double precision:: rstate(20),rcntrl(20) 117 | integer ::istate(20),icntrl(20) 118 | 119 | 120 | ! Print problem description 121 | print *,'Adjoint Sensitivity Example for Chemical Kinetics' 122 | print *, '-------------------------------------------------' 123 | print *, 'ODE: dy1/dt = -p1*y1 + p2*y2*y3 ' 124 | print *, ' dy2/dt = p1*y1 - p2*y2*y3 - p3*(y2)^2' 125 | print *, ' dy3/dt = p3*(y2)^2 ' 126 | print *, ' Find dG/dp for ' 127 | print *, ' G = int_t0^tB0 g(t,p,y) dt ' 128 | print *, ' g(t,p,y) = y(t,p) ' 129 | 130 | 131 | do i=1,nvar 132 | rtol(i) = 1e-6 133 | end do 134 | 135 | atol(1) = 1e-8 136 | atol(2) = 1e-14 137 | atol(3) = 1e-6 138 | 139 | do k=1,nadj 140 | do i=1,nvar 141 | rtol_adj(i,k) = 1e-1 142 | atol_adj(i,k) = 1e-2 143 | end do 144 | end do 145 | 146 | ! initialize y 147 | var(1) = 1.0d0 148 | var(2) = 0.0d0 149 | var(3) = 0.0d0 150 | q(:) = 0.d0 151 | tstart = 0.0d0 152 | tend = 4.0e7 153 | istate(:)=0 154 | icntrl(:)=0 155 | rcntrl(:)=0 156 | ! change initial step size 157 | rcntrl(3)=1e-3 158 | 159 | call cpu_time(t1) 160 | call integrate_adj(tin=tstart, tout=tend, nvar=nvar, np=np, nnzero=nnz,& 161 | lambda=y_adj, mu= yp_adj, y=var, rtol=rtol, atol=atol, nadj=nadj,& 162 | atol_adj=atol_adj, rtol_adj=rtol_adj, fun=fun, jac=jac,adjinit=adjinit,& 163 | drdp =DRDP, drdy=DRDY, jacp=JACP,qfun=qfun,q=q,& 164 | rstatus_u=rstate,rcntrl_u=rcntrl, istatus_u=istate, icntrl_u=icntrl) 165 | call cpu_time(t2) 166 | tcpu=t2-t1 167 | 168 | write(6,2010) tstart,tend,istate(3:5),tcpu 169 | 2010 FORMAT (2x,'Time interval [',f12.2,'-',f12.2, ']',/,& 170 | 2x,'Nsteps=',I5,' NAsteps=',I5,' NRsteps=',I5,/,& 171 | 2x, 'CPUtime=', f14.3,/,2x, //) 172 | 173 | print *, '-------------------------------------' 174 | print *, 'dG/dp', yp_adj(:,1) 175 | print *, 'lambda',y_adj(:,1) 176 | print *, 'VAR',var(:) 177 | print *, 'Q',q(:) 178 | end program roberts_ros_adj_dr 179 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_RK_ADJ/swe2D_rk_adj_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine jac(n, t, y, fjac) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | use swe2dxy_parameters 5 | implicit none 6 | integer :: n 7 | double precision ::t 8 | double precision ::y(n),fjac(n,n) 9 | call vec2grid(y,u_par) 10 | call compute_f(u_par,f_par,feigvalues_par,geigvalues_par) 11 | call compute_jacf(u_par,feigvalues_par,geigvalues_par) 12 | fjac(:,:)=jf(:,:) 13 | end subroutine jac 14 | 15 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 | subroutine fun(n, t, y, p ) 17 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | use swe2dxy_parameters 19 | implicit none 20 | integer :: n 21 | double precision :: t 22 | double precision :: y(n), p(n) 23 | 24 | call vec2grid(y, temp_par) 25 | call compute_f(temp_par,f_par,feigvalues_par,geigvalues_par) 26 | call grid2vec(f_par, p) 27 | 28 | end subroutine fun 29 | 30 | !~~~> initialize adjoint variables 31 | subroutine adjinit(n,np,nadj,t,y,lambda,mu) 32 | integer :: n,np,nadj,k 33 | double precision :: t,y(n),lambda(n,nadj) 34 | double precision,optional :: mu(np,nadj) 35 | !~~~> if number of parameters is not zero, extra adjoint varaible mu should be 36 | !defined 37 | if(NP>0 .and. .not. present(mu)) stop 'undefined argument mu' 38 | !~~~> the adjoint values at the final time 39 | lambda(1:n,1:nadj) = 0.0d0 40 | do k=1,nadj 41 | lambda(k,k) = 1.0d0 42 | end do 43 | end subroutine 44 | 45 | subroutine output_statics(var,tstart,tend, tcpu, istate) 46 | use swe2dxy_parameters 47 | implicit none 48 | double precision :: tstart, tend, tcpu 49 | double precision :: var(ndim) 50 | integer :: istate(20) 51 | 52 | write(6,2010) tstart,tend,istate(3:5),tcpu 53 | 2010 format (2x,'time interval [',f5.2,'-',f5.2, ']',/,& 54 | 2x,'nsteps=',i5,' nasteps=',i5,' nrsteps=',i5,/,& 55 | 2x, 'cputime=', f14.3,' seconds',//) 56 | 57 | ! store results into a file 58 | ! open(unit=11,file='swe2d_rk_sol.txt',status='replace') 59 | ! do i=1,ndim 60 | ! write(11,2011) var(i) 61 | ! 2011 format(e24.16) 62 | ! end do 63 | ! close(11) 64 | 65 | end subroutine output_statics 66 | 67 | subroutine output_sen(ndim,nadj,y_adj,fno) 68 | implicit none 69 | double precision :: y_adj(ndim,nadj) 70 | integer :: ndim,nadj,i,j,fno 71 | character(len=12) :: fname 72 | write(fname,'(a,i3.3,a)') 'RK_ADJ_',fno,'.m' 73 | open(unit=20,file=fname,status='replace') 74 | do j=1,nadj 75 | do i=1,ndim 76 | write(20,'(E24.16)') y_adj(i,j) 77 | end do 78 | end do 79 | end subroutine output_sen 80 | 81 | program swe_rk_adj_dr 82 | use swe2dxy_parameters 83 | use rk_adj_f90_integrator 84 | implicit none 85 | external fun,jac,adjinit 86 | integer, parameter :: nadj = 1 87 | integer ::i,j,k,state,np=0 88 | double precision :: atol(ndim),rtol(ndim), var(ndim) 89 | double precision :: atol_adj(ndim,nadj),rtol_adj(ndim,nadj),y_adj(ndim,nadj) 90 | double precision:: tstart, tend, t1, t2, tcpu 91 | double precision:: rstate(20),rcntrl(20) 92 | double precision :: a=30d0 93 | integer ::istate(20),icntrl(20) 94 | !~~> solution 95 | ! u(1,:,:) = h(t,x,y) 96 | ! u(2,:,:) = u(t,x,y) 97 | ! u(3,:,:) = v(t,x,y) 98 | allocate(f_par(3, mx+4, my+4), stat=state) 99 | if (state .ne. 0) then 100 | stop 'allocation error for f or fz' 101 | end if 102 | 103 | allocate(U_par(3,mx+4,my+4),temp_par(3, mx+4, my+4), feigvalues_par(3, mx+4, my+4), & 104 | geigvalues_par(3, mx+4,my+4), stat=state) 105 | if (state .ne. 0) then 106 | stop 'allocation error for temp or feigvalues or geigvalues' 107 | end if 108 | 109 | allocate(jf(ndim, ndim), jg(ndim, ndim), stat=state) 110 | if (state .ne. 0) then 111 | stop 'allocation error for jacf, jf or jg' 112 | end if 113 | 114 | do i=1,ndim 115 | rtol(i) = 0.1 116 | atol(i) = 0.1 117 | end do 118 | 119 | do j = 1,6 120 | do i=1,ndim 121 | rtol(i) = 0.1 * rtol(i) 122 | atol(i) = 0.1 * atol(i) 123 | end do 124 | 125 | do k=1,nadj 126 | do i=1,ndim 127 | rtol_adj(i,k) = rtol(i) 128 | atol_adj(i,k) = atol(i) 129 | end do 130 | end do 131 | 132 | 133 | call initializegaussiangrid(temp_par, a) 134 | temp_par(2,:,:) = 2d0 135 | temp_par(3,:,:) = 2d0 136 | call grid2vec(temp_par,var) 137 | 138 | tstart = 0.0d0 139 | tend = tstart + 5*2.1573758800627289e-003 140 | istate(:)=0 141 | icntrl(:)=0 142 | rcntrl(:)=0 143 | ! change initial step size 144 | ! rcntrl(3)=1e-3 145 | 146 | call cpu_time(t1) 147 | call integrate_adj(tin=tstart, tout=tend, np=np,nvar=ndim,nnzero=nnz, & 148 | lambda=y_adj, y=var, rtol=rtol, atol=atol, nadj=nadj,& 149 | atol_adj=atol_adj, rtol_adj=rtol_adj, fun=fun, jac=jac, adjinit=adjinit,& 150 | rstatus_u=rstate,rcntrl_u=rcntrl, istatus_u=istate,& 151 | icntrl_u=icntrl) 152 | call cpu_time(t2) 153 | tcpu=t2-t1 154 | call output_statics(var,tstart,tend,tcpu,istate) 155 | call output_sen(ndim,nadj,y_adj,j) 156 | end do 157 | 158 | deallocate(f_par, stat = state) 159 | if (state .ne. 0) then 160 | print *, 'deallocation error of f fz' 161 | stop 1 162 | end if 163 | deallocate(U_par,temp_par, feigvalues_par, geigvalues_par, stat = state) 164 | if (state .ne. 0) then 165 | print *, 'deallocation error of u,feigvalues,geigvalues' 166 | stop 1 167 | end if 168 | 169 | deallocate(jf, jg, stat = state) 170 | if (state .ne. 0) then 171 | print *, 'deallocation error of jf jg' 172 | stop 1 173 | end if 174 | 175 | end program swe_rk_adj_dr 176 | -------------------------------------------------------------------------------- /EXAMPLES/swe/SWE_SDIRK_ADJ/swe2D_sdirk_adj_dr.F90: -------------------------------------------------------------------------------- 1 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | subroutine jac(n,t,y,fjac) 3 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | use swe2dxy_parameters 5 | implicit none 6 | integer :: n 7 | double precision ::t 8 | double precision ::y(n),fjac(n,n) 9 | call vec2grid(y,u_par) 10 | call compute_f(u_par,f_par,feigvalues_par,geigvalues_par) 11 | call compute_jacf(u_par,feigvalues_par,geigvalues_par) 12 | fjac(:,:)=jf(:,:) 13 | end subroutine jac 14 | 15 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 | subroutine fun(n,t, y, p ) 17 | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | use swe2dxy_parameters 19 | implicit none 20 | integer :: n 21 | double precision :: t 22 | double precision :: y(n), p(n) 23 | 24 | call vec2grid(y, temp_par) 25 | call compute_f(temp_par,fz_par,feigvalues_par,geigvalues_par) 26 | call grid2vec(fz_par, p) 27 | 28 | end subroutine fun 29 | 30 | !~~~> Initialize adjoint variables 31 | subroutine adjinit(n,np,nadj,t,y,lambda,mu) 32 | integer :: n,np,nadj,k 33 | double precision :: t,y(n),lambda(n,nadj) 34 | double precision,optional :: mu(np,nadj) 35 | !~~~> if number of parameters is not zero, extra adjoint varaible mu should be 36 | !defined 37 | if(NP>0 .and. .not. present(mu)) stop 'undefined argument mu' 38 | !~~~> the adjoint values at the final time 39 | lambda(1:n,1:nadj) = 0.0d0 40 | do k=1,nadj 41 | lambda(k,k) = 1.0d0 42 | end do 43 | end subroutine 44 | 45 | subroutine output_statics(var,tstart,tend, tcpu, istate) 46 | use swe2dxy_parameters 47 | implicit none 48 | double precision :: tstart, tend, tcpu 49 | double precision :: var(ndim) 50 | integer :: istate(20) 51 | 52 | write(6,2010) tstart,tend,istate(3:5),tcpu 53 | 2010 format (2x,'time interval [',f5.2,'-',f5.2, ']',/,& 54 | 2x,'nsteps=',i5,' nasteps=',i5,' nrsteps=',i5,/,& 55 | 2x, 'cputime=', f10.3,' seconds',//) 56 | 57 | ! store results into a file 58 | ! open(unit=11,file='swe2d_sdirk_sol.txt',status='replace') 59 | ! do i=1,ndim 60 | ! write(11,2011) var(i) 61 | ! 2011 format(e24.16) 62 | ! end do 63 | ! close(11) 64 | 65 | end subroutine output_statics 66 | 67 | subroutine output_sen(ndim,nadj,y_adj,fno) 68 | implicit none 69 | double precision :: y_adj(ndim,nadj) 70 | integer :: ndim,nadj,i,j,fno 71 | character(len=12) :: fname 72 | write(fname,'(a,i3.3,a)') 'SD_ADJ_',fno,'.m' 73 | open(unit=20,file=fname,status='replace') 74 | do j=1,nadj 75 | do i=1,ndim 76 | write(20,'(E24.16)') y_adj(i,j) 77 | end do 78 | end do 79 | end subroutine output_sen 80 | 81 | 82 | program swe_sdirk_adj_dr 83 | use swe2dxy_parameters 84 | use sdirk_adj_f90_integrator 85 | implicit none 86 | external fun,jac,adjinit 87 | integer, parameter :: nadj = 1 88 | integer ::i,j,k,state,np = 0 89 | double precision :: atol(ndim),rtol(ndim), var(ndim) 90 | double precision :: atol_adj(ndim,nadj),rtol_adj(ndim,nadj),y_adj(ndim,nadj) 91 | double precision:: tstart, tend, t1, t2, tcpu 92 | double precision:: rstate(20),rcntrl(20) 93 | double precision :: a=30d0 94 | integer ::istate(20),icntrl(20) 95 | !~~> solution 96 | ! u(1,:,:) = h(t,x,y) 97 | ! u(2,:,:) = u(t,x,y) 98 | ! u(3,:,:) = v(t,x,y) 99 | allocate(f_par(3, mx+4, my+4), fz_par(3, mx+4, my+4), stat=state) 100 | if (state .ne. 0) then 101 | stop 'allocation error for f or fz' 102 | end if 103 | 104 | allocate(temp_par(3, mx+4, my+4), feigvalues_par(3, mx+4, my+4), geigvalues_par(3, mx+4,my+4), stat=state) 105 | if (state .ne. 0) then 106 | stop 'allocation error for temp or feigvalues or geigvalues' 107 | end if 108 | 109 | allocate(jf(ndim, ndim), jg(ndim, ndim), stat=state) 110 | if (state .ne. 0) then 111 | stop 'allocation error for jacf, jf or jg' 112 | end if 113 | 114 | do i=1,ndim 115 | rtol(i) = 0.1 116 | atol(i) = 0.1 117 | end do 118 | 119 | do j = 1,6 120 | do i=1,ndim 121 | rtol(i) = 0.1 * rtol(i) 122 | atol(i) = 0.1 * atol(i) 123 | end do 124 | 125 | do k=1,nadj 126 | do i=1,ndim 127 | rtol_adj(i,k) = rtol(i) 128 | atol_adj(i,k) = atol(i) 129 | end do 130 | end do 131 | 132 | 133 | call initializegaussiangrid(temp_par, a) 134 | temp_par(2,:,:) = 2d0 135 | temp_par(3,:,:) = 2d0 136 | call grid2vec(temp_par,var) 137 | 138 | tstart = 0.0d0 139 | tend = tstart + 5*2.1573758800627289e-003 140 | istate(:)=0 141 | icntrl(:)=0 142 | rcntrl(:)=0 143 | ! change initial step size 144 | ! rcntrl(3)=1e-3 145 | 146 | call cpu_time(t1) 147 | call integrate_adj(tin=tstart, tout=tend, nvar=ndim, np=np,nnzero=nnz,& 148 | lambda=y_adj, y=var, rtol=rtol, atol=atol, nadj=nadj,& 149 | atol_adj=atol_adj, rtol_adj=rtol_adj, fun=fun, jac=jac,adjinit=adjinit,& 150 | rstatus_u=rstate,rcntrl_u=rcntrl, istatus_u=istate,& 151 | icntrl_u=icntrl) 152 | call cpu_time(t2) 153 | tcpu=t2-t1 154 | call output_statics(var,tstart,tend,tcpu,istate) 155 | call output_sen(ndim,nadj,y_adj,j) 156 | end do 157 | 158 | deallocate(f_par, fz_par, stat = state) 159 | if (state .ne. 0) then 160 | print *, 'deallocation error of f fz' 161 | stop 1 162 | end if 163 | deallocate(temp_par, feigvalues_par, geigvalues_par, stat = state) 164 | if (state .ne. 0) then 165 | print *, 'deallocation error of temp,feigvalues,geigvalues' 166 | stop 1 167 | end if 168 | 169 | deallocate(jf, jg, stat = state) 170 | if (state .ne. 0) then 171 | print *, 'deallocation error of jf jg' 172 | stop 1 173 | end if 174 | 175 | end program swe_sdirk_adj_dr 176 | -------------------------------------------------------------------------------- /LSS_LIBS/x86_64_Linux/SUPERLU/c_fortran_dgssv.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * -- SuperLU routine (version 3.0) -- 4 | * Univ. of California Berkeley, Xerox Palo Alto Research Center, 5 | * and Lawrence Berkeley National Lab. 6 | * October 15, 2003 7 | * 8 | */ 9 | 10 | #include "slu_ddefs.h" 11 | 12 | #define HANDLE_SIZE 8 13 | /* kind of integer to hold a pointer. Use int. 14 | This might need to be changed on 64-bit systems. */ 15 | typedef long fptr; /* 64-bit by default */ 16 | 17 | typedef struct { 18 | SuperMatrix *L; 19 | SuperMatrix *U; 20 | int *perm_c; 21 | int *perm_r; 22 | } factors_t; 23 | 24 | void 25 | c_fortran_dgssv_(int* tr, int *iopt, int *n, int *nnz, int *nrhs, 26 | double *values, int *rowind, int *colptr, 27 | double *b, int *ldb, 28 | fptr *f_factors, /* a handle containing the address 29 | pointing to the factored matrices */ 30 | int *info) 31 | 32 | { 33 | /* 34 | * This routine can be called from Fortran. 35 | * 36 | * iopt (input) int 37 | * Specifies the operation: 38 | * = 1, performs LU decomposition for the first time 39 | * = 2, performs triangular solve 40 | * = 3, free all the storage in the end 41 | * 42 | * f_factors (input/output) fptr* 43 | * If iopt == 1, it is an output and contains the pointer pointing to 44 | * the structure of the factored matrices. 45 | * Otherwise, it it an input. 46 | * 47 | */ 48 | 49 | SuperMatrix A, AC, B; 50 | SuperMatrix *L, *U; 51 | int *perm_r; /* row permutations from partial pivoting */ 52 | int *perm_c; /* column permutation vector */ 53 | int *etree; /* column elimination tree */ 54 | SCformat *Lstore; 55 | NCformat *Ustore; 56 | int i, panel_size, permc_spec, relax; 57 | trans_t trans; 58 | mem_usage_t mem_usage; 59 | superlu_options_t options; 60 | SuperLUStat_t stat; 61 | factors_t *LUfactors; 62 | 63 | if ( *tr == 1 ) 64 | trans = TRANS; 65 | else if ( *tr == 0 ) 66 | trans = NOTRANS; 67 | else { 68 | fprintf(stderr,"Invalid tr=%d passed to c_fortran_dgssv()\n",*tr); 69 | exit(-1); 70 | } 71 | 72 | 73 | if ( *iopt == 1 ) { /* LU decomposition */ 74 | 75 | /* Set the default input options. */ 76 | set_default_options(&options); 77 | 78 | /* Initialize the statistics variables. */ 79 | StatInit(&stat); 80 | 81 | /* Adjust to 0-based indexing */ 82 | for (i = 0; i < *nnz; ++i) --rowind[i]; 83 | for (i = 0; i <= *n; ++i) --colptr[i]; 84 | 85 | dCreate_CompCol_Matrix(&A, *n, *n, *nnz, values, rowind, colptr, 86 | SLU_NC, SLU_D, SLU_GE); 87 | L = (SuperMatrix *) SUPERLU_MALLOC( sizeof(SuperMatrix) ); 88 | U = (SuperMatrix *) SUPERLU_MALLOC( sizeof(SuperMatrix) ); 89 | if ( !(perm_r = intMalloc(*n)) ) ABORT("Malloc fails for perm_r[]."); 90 | if ( !(perm_c = intMalloc(*n)) ) ABORT("Malloc fails for perm_c[]."); 91 | if ( !(etree = intMalloc(*n)) ) ABORT("Malloc fails for etree[]."); 92 | 93 | /* 94 | * Get column permutation vector perm_c[], according to permc_spec: 95 | * permc_spec = 0: natural ordering 96 | * permc_spec = 1: minimum degree on structure of A'*A 97 | * permc_spec = 2: minimum degree on structure of A'+A 98 | * permc_spec = 3: approximate minimum degree for unsymmetric matrices 99 | */ 100 | permc_spec = options.ColPerm; 101 | get_perm_c(permc_spec, &A, perm_c); 102 | 103 | sp_preorder(&options, &A, perm_c, etree, &AC); 104 | 105 | panel_size = sp_ienv(1); 106 | relax = sp_ienv(2); 107 | 108 | dgstrf(&options, &AC, relax, panel_size, etree, 109 | NULL, 0, perm_c, perm_r, L, U, &stat, info); 110 | 111 | // if ( *info == 0 ) { 112 | // Lstore = (SCformat *) L->Store; 113 | // Ustore = (NCformat *) U->Store; 114 | // printf("No of nonzeros in factor L = %d\n", Lstore->nnz); 115 | // printf("No of nonzeros in factor U = %d\n", Ustore->nnz); 116 | // printf("No of nonzeros in L+U = %d\n", Lstore->nnz + Ustore->nnz); 117 | // dQuerySpace(L, U, &mem_usage); 118 | // printf("L\\U MB %.3f\ttotal MB needed %.3f\n", 119 | // mem_usage.for_lu/1e6, mem_usage.total_needed/1e6); 120 | // } else { 121 | // printf("dgstrf() error returns INFO= %d\n", *info); 122 | // if ( *info <= *n ) { /* factorization completes */ 123 | // dQuerySpace(L, U, &mem_usage); 124 | // printf("L\\U MB %.3f\ttotal MB needed %.3f\n", 125 | // mem_usage.for_lu/1e6, mem_usage.total_needed/1e6); 126 | // } 127 | // } 128 | 129 | /* Restore to 1-based indexing */ 130 | for (i = 0; i < *nnz; ++i) ++rowind[i]; 131 | for (i = 0; i <= *n; ++i) ++colptr[i]; 132 | 133 | /* Save the LU factors in the factors handle */ 134 | LUfactors = (factors_t*) SUPERLU_MALLOC(sizeof(factors_t)); 135 | LUfactors->L = L; 136 | LUfactors->U = U; 137 | LUfactors->perm_c = perm_c; 138 | LUfactors->perm_r = perm_r; 139 | *f_factors = (fptr) LUfactors; 140 | /* Free un-wanted storage */ 141 | SUPERLU_FREE(etree); 142 | Destroy_SuperMatrix_Store(&A); 143 | Destroy_CompCol_Permuted(&AC); 144 | StatFree(&stat); 145 | 146 | } else if ( *iopt == 2 ) { /* Triangular solve */ 147 | /* Initialize the statistics variables. */ 148 | StatInit(&stat); 149 | 150 | /* Extract the LU factors in the factors handle */ 151 | LUfactors = (factors_t*) *f_factors; 152 | L = LUfactors->L; 153 | U = LUfactors->U; 154 | perm_c = LUfactors->perm_c; 155 | perm_r = LUfactors->perm_r; 156 | 157 | dCreate_Dense_Matrix(&B, *n, *nrhs, b, *ldb, SLU_DN, SLU_D, SLU_GE); 158 | 159 | /* Solve the system A*X=B, overwriting B with X. */ 160 | dgstrs (trans, L, U, perm_c, perm_r, &B, &stat, info); 161 | 162 | Destroy_SuperMatrix_Store(&B); 163 | StatFree(&stat); 164 | 165 | } else if ( *iopt == 3 ) { /* Free storage */ 166 | /* Free the LU factors in the factors handle */ 167 | LUfactors = (factors_t*) *f_factors; 168 | SUPERLU_FREE (LUfactors->perm_r); 169 | SUPERLU_FREE (LUfactors->perm_c); 170 | Destroy_SuperNode_Matrix(LUfactors->L); 171 | Destroy_CompCol_Matrix(LUfactors->U); 172 | SUPERLU_FREE (LUfactors->L); 173 | SUPERLU_FREE (LUfactors->U); 174 | SUPERLU_FREE (LUfactors); 175 | } else { 176 | fprintf(stderr,"Invalid iopt=%d passed to c_fortran_dgssv()\n",*iopt); 177 | exit(-1); 178 | } 179 | } 180 | 181 | 182 | -------------------------------------------------------------------------------- /LSS_LIBS/x86_64_Linux/SUPERLU/c_fortran_zgssv.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * -- SuperLU routine (version 3.0) -- 4 | * Univ. of California Berkeley, Xerox Palo Alto Research Center, 5 | * and Lawrence Berkeley National Lab. 6 | * October 15, 2003 7 | * 8 | */ 9 | 10 | #include "slu_zdefs.h" 11 | 12 | #define HANDLE_SIZE 8 13 | /* kind of integer to hold a pointer. Use int. 14 | This might need to be changed on 64-bit systems. */ 15 | typedef int fptr; /* 32-bit by default */ 16 | 17 | typedef struct { 18 | SuperMatrix *L; 19 | SuperMatrix *U; 20 | int *perm_c; 21 | int *perm_r; 22 | } factors_t; 23 | 24 | void 25 | c_fortran_zgssv_(int *tr, int *iopt, int *n, int *nnz, int *nrhs, 26 | doublecomplex *values, int *rowind, int *colptr, 27 | doublecomplex *b, int *ldb, 28 | fptr *f_factors, /* a handle containing the address 29 | pointing to the factored matrices */ 30 | int *info) 31 | 32 | { 33 | /* 34 | * This routine can be called from Fortran. 35 | * 36 | * iopt (input) int 37 | * Specifies the operation: 38 | * = 1, performs LU decomposition for the first time 39 | * = 2, performs triangular solve 40 | * = 3, free all the storage in the end 41 | * 42 | * f_factors (input/output) fptr* 43 | * If iopt == 1, it is an output and contains the pointer pointing to 44 | * the structure of the factored matrices. 45 | * Otherwise, it it an input. 46 | * 47 | */ 48 | 49 | SuperMatrix A, AC, B; 50 | SuperMatrix *L, *U; 51 | int *perm_r; /* row permutations from partial pivoting */ 52 | int *perm_c; /* column permutation vector */ 53 | int *etree; /* column elimination tree */ 54 | SCformat *Lstore; 55 | NCformat *Ustore; 56 | int i, panel_size, permc_spec, relax; 57 | trans_t trans; 58 | mem_usage_t mem_usage; 59 | superlu_options_t options; 60 | SuperLUStat_t stat; 61 | factors_t *LUfactors; 62 | 63 | if ( *tr == 1 ) 64 | trans = TRANS; 65 | else if ( *tr == 0 ) 66 | trans = NOTRANS; 67 | else { 68 | fprintf(stderr,"Invalid tr=%d passed to c_fortran_dgssv()\n",*tr); 69 | exit(-1); 70 | } 71 | 72 | 73 | if ( *iopt == 1 ) { /* LU decomposition */ 74 | 75 | /* Set the default input options. */ 76 | set_default_options(&options); 77 | 78 | /* Initialize the statistics variables. */ 79 | StatInit(&stat); 80 | 81 | /* Adjust to 0-based indexing */ 82 | for (i = 0; i < *nnz; ++i) --rowind[i]; 83 | for (i = 0; i <= *n; ++i) --colptr[i]; 84 | 85 | zCreate_CompCol_Matrix(&A, *n, *n, *nnz, values, rowind, colptr, 86 | SLU_NC, SLU_Z, SLU_GE); 87 | L = (SuperMatrix *) SUPERLU_MALLOC( sizeof(SuperMatrix) ); 88 | U = (SuperMatrix *) SUPERLU_MALLOC( sizeof(SuperMatrix) ); 89 | if ( !(perm_r = intMalloc(*n)) ) ABORT("Malloc fails for perm_r[]."); 90 | if ( !(perm_c = intMalloc(*n)) ) ABORT("Malloc fails for perm_c[]."); 91 | if ( !(etree = intMalloc(*n)) ) ABORT("Malloc fails for etree[]."); 92 | 93 | /* 94 | * Get column permutation vector perm_c[], according to permc_spec: 95 | * permc_spec = 0: natural ordering 96 | * permc_spec = 1: minimum degree on structure of A'*A 97 | * permc_spec = 2: minimum degree on structure of A'+A 98 | * permc_spec = 3: approximate minimum degree for unsymmetric matrices 99 | */ 100 | permc_spec = options.ColPerm; 101 | get_perm_c(permc_spec, &A, perm_c); 102 | 103 | sp_preorder(&options, &A, perm_c, etree, &AC); 104 | 105 | panel_size = sp_ienv(1); 106 | relax = sp_ienv(2); 107 | 108 | zgstrf(&options, &AC, relax, panel_size, etree, 109 | NULL, 0, perm_c, perm_r, L, U, &stat, info); 110 | 111 | // if ( *info == 0 ) { 112 | // Lstore = (SCformat *) L->Store; 113 | // Ustore = (NCformat *) U->Store; 114 | // printf("No of nonzeros in factor L = %d\n", Lstore->nnz); 115 | // printf("No of nonzeros in factor U = %d\n", Ustore->nnz); 116 | // printf("No of nonzeros in L+U = %d\n", Lstore->nnz + Ustore->nnz); 117 | // zQuerySpace(L, U, &mem_usage); 118 | // printf("L\\U MB %.3f\ttotal MB needed %.3f\n", 119 | // mem_usage.for_lu/1e6, mem_usage.total_needed/1e6); 120 | // } else { 121 | // printf("zgstrf() error returns INFO= %d\n", *info); 122 | // if ( *info <= *n ) { /* factorization completes */ 123 | // zQuerySpace(L, U, &mem_usage); 124 | // printf("L\\U MB %.3f\ttotal MB needed %.3f\n", 125 | // mem_usage.for_lu/1e6, mem_usage.total_needed/1e6); 126 | // } 127 | // } 128 | 129 | /* Restore to 1-based indexing */ 130 | for (i = 0; i < *nnz; ++i) ++rowind[i]; 131 | for (i = 0; i <= *n; ++i) ++colptr[i]; 132 | 133 | /* Save the LU factors in the factors handle */ 134 | LUfactors = (factors_t*) SUPERLU_MALLOC(sizeof(factors_t)); 135 | LUfactors->L = L; 136 | LUfactors->U = U; 137 | LUfactors->perm_c = perm_c; 138 | LUfactors->perm_r = perm_r; 139 | *f_factors = (fptr) LUfactors; 140 | 141 | /* Free un-wanted storage */ 142 | SUPERLU_FREE(etree); 143 | Destroy_SuperMatrix_Store(&A); 144 | Destroy_CompCol_Permuted(&AC); 145 | StatFree(&stat); 146 | 147 | } else if ( *iopt == 2 ) { /* Triangular solve */ 148 | /* Initialize the statistics variables. */ 149 | StatInit(&stat); 150 | 151 | /* Extract the LU factors in the factors handle */ 152 | LUfactors = (factors_t*) *f_factors; 153 | L = LUfactors->L; 154 | U = LUfactors->U; 155 | perm_c = LUfactors->perm_c; 156 | perm_r = LUfactors->perm_r; 157 | 158 | zCreate_Dense_Matrix(&B, *n, *nrhs, b, *ldb, SLU_DN, SLU_Z, SLU_GE); 159 | 160 | /* Solve the system A*X=B, overwriting B with X. */ 161 | zgstrs (trans, L, U, perm_c, perm_r, &B, &stat, info); 162 | 163 | Destroy_SuperMatrix_Store(&B); 164 | StatFree(&stat); 165 | 166 | } else if ( *iopt == 3 ) { /* Free storage */ 167 | /* Free the LU factors in the factors handle */ 168 | LUfactors = (factors_t*) *f_factors; 169 | SUPERLU_FREE (LUfactors->perm_r); 170 | SUPERLU_FREE (LUfactors->perm_c); 171 | Destroy_SuperNode_Matrix(LUfactors->L); 172 | Destroy_CompCol_Matrix(LUfactors->U); 173 | SUPERLU_FREE (LUfactors->L); 174 | SUPERLU_FREE (LUfactors->U); 175 | SUPERLU_FREE (LUfactors); 176 | } else { 177 | fprintf(stderr,"Invalid iopt=%d passed to c_fortran_zgssv()\n",*iopt); 178 | exit(-1); 179 | } 180 | } 181 | 182 | 183 | --------------------------------------------------------------------------------