From 7c48496c6692ad3325a133df8b1a53948604ba7a Mon Sep 17 00:00:00 2001 From: fangjian Date: Thu, 7 Dec 2023 08:52:27 +0000 Subject: [PATCH] modify cmake and add an shell script for case creation --- CMakeLists.txt | 1 - Makefile | 6 +++--- README.md | 3 ++- script/astr.case.creater | 11 +++++++++++ src/CMakeLists.txt | 11 +++++++++-- .../{ => examples}/userdefine_channel.F90 | 0 .../{ => examples}/userdefine_forcedhit.F90 | 0 .../{ => examples}/userdefine_hitflame.F90 | 14 ++++++++++++++ .../{ => examples}/userdefine_mixinglayer.F90 | 0 .../{ => examples}/userdefine_onedflame.F90 | 14 ++++++++++++++ user_define_module/userdefine.F90 | 13 +++++++++++++ 11 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 script/astr.case.creater rename user_define_module/{ => examples}/userdefine_channel.F90 (100%) rename user_define_module/{ => examples}/userdefine_forcedhit.F90 (100%) rename user_define_module/{ => examples}/userdefine_hitflame.F90 (96%) rename user_define_module/{ => examples}/userdefine_mixinglayer.F90 (100%) rename user_define_module/{ => examples}/userdefine_onedflame.F90 (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95ea3d1..678fba5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,6 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/opt" CACHE PATH "..." FORCE) endif() - # Add support for CMAKE_DEPENDENT_OPTION INCLUDE(CMakeDependentOption) INCLUDE(CMakeParseArguments) diff --git a/Makefile b/Makefile index c26a837..5701417 100644 --- a/Makefile +++ b/Makefile @@ -8,13 +8,13 @@ FC=h5pfc SRCDIR = /mnt/d/ASTR/astr/src ./user_define_module OBJDIR = obj BINDIR = bin -CTRDIR = /home/fangjian/opt/cantera-2.5.1 +CTRDIR = cma FCFLAGS= -O3 -fbounds-check -fallow-argument-mismatch # OPTIONS1 = -fcheck=all OPTIONS2 = -J $(OBJDIR) -OPTIONS3 = -DHDF5 +OPTIONS3 = -DHDF5s # OPTIONS4 = -DCOMB -I$(CTRDIR)/include/cantera # OMP = -fopenacc @@ -31,7 +31,7 @@ VPATH = $(SRCDIR):$(OBJDIR) srs= strings.F90 fdnn.F90 singleton.F90 commtype.F90 stlaio.F90 constdef.F90 tecio.F90 \ vtkio.F90 interp.F90 commvar.F90 utility.F90 thermchem.F90 commarray.F90 fludyna.F90 \ parallel.F90 hdf5io.F90 cmdefne.F90 commfunc.F90 commcal.F90 models.F90 statistic.F90 \ - userdefine.F90 bc.F90 readwrite.F90 geom.F90 ibmethod.F90 gridgeneration.F90 \ + userdefine.F90 bc.F90 readwrite.F90 geom.F90 ibmethod.F90 gridgeneration.F90 \ riemann.F90 comsolver.F90 solver.F90 pp.F90 initialisation.F90 mainloop.F90 test.F90 \ astr.F90 diff --git a/README.md b/README.md index efa6553..2245cf8 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,8 @@ By default ASTR solves equations under non-dimensional form, unless the chemstry create a case folder, e.g. mkdir test_case -cd test_case +sh path_to_the_source/script/astr.case.creater #create a new case + cmake path_to_the_source cmake --build ./ or make cmake --install ./ or make install diff --git a/script/astr.case.creater b/script/astr.case.creater new file mode 100644 index 0000000..783eacd --- /dev/null +++ b/script/astr.case.creater @@ -0,0 +1,11 @@ +#!/bin/bash + +echo ' this is to create a new ASTR case' + +mkdir -p ./user_define_module + +echo ' ASTR PATH:'$apath + +cp -v $apath/user_define_module/userdefine.F90 ./user_define_module/ + +cp -rv $apath/examples/Taylor_Green_Vortex_2D/datin ./ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bf2c9ff..598e8dd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,13 @@ - message(STATUS "CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}") message(STATUS "PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}") +# message(STATUS "the local path: ${PROJECT_BINARY_DIR}") + +set(UDF_SRC ${PROJECT_BINARY_DIR}/user_define_module) +file(GLOB UDF_SOURCE_FILES ${UDF_SRC}/*.F90) + +message(STATUS "UDF path: ${UDF_SRC}") + add_executable(astr astr.F90 bc.F90 @@ -36,9 +42,10 @@ add_executable(astr tecio.F90 test.F90 thermchem.F90 - userdefine.F90 + ${UDF_SOURCE_FILES} utility.F90 vtkio.F90) + target_link_libraries(astr) if (MPI_FOUND) target_link_libraries(astr PRIVATE MPI::MPI_Fortran) diff --git a/user_define_module/userdefine_channel.F90 b/user_define_module/examples/userdefine_channel.F90 similarity index 100% rename from user_define_module/userdefine_channel.F90 rename to user_define_module/examples/userdefine_channel.F90 diff --git a/user_define_module/userdefine_forcedhit.F90 b/user_define_module/examples/userdefine_forcedhit.F90 similarity index 100% rename from user_define_module/userdefine_forcedhit.F90 rename to user_define_module/examples/userdefine_forcedhit.F90 diff --git a/user_define_module/userdefine_hitflame.F90 b/user_define_module/examples/userdefine_hitflame.F90 similarity index 96% rename from user_define_module/userdefine_hitflame.F90 rename to user_define_module/examples/userdefine_hitflame.F90 index bde74b2..b05a2bd 100644 --- a/user_define_module/userdefine_hitflame.F90 +++ b/user_define_module/examples/userdefine_hitflame.F90 @@ -175,6 +175,20 @@ end subroutine udf_flowinit !+-------------------------------------------------------------------+ ! !+-------------------------------------------------------------------+ + !| This subroutine is to collect statistics. | + !+-------------------------------------------------------------------+ + !| CHANGE RECORD | + !| ------------- | + !| 09-Nov-2023: created by Jian Fang @ Appleton | + !+-------------------------------------------------------------------+ + subroutine udf_meanflow + ! + end subroutine udf_meanflow + !+-------------------------------------------------------------------+ + !| The end of the subroutine udf_meanflow. | + !+-------------------------------------------------------------------+ + !! + !+-------------------------------------------------------------------+ !| This subroutine is to generate grid. | !+-------------------------------------------------------------------+ !| CHANGE RECORD | diff --git a/user_define_module/userdefine_mixinglayer.F90 b/user_define_module/examples/userdefine_mixinglayer.F90 similarity index 100% rename from user_define_module/userdefine_mixinglayer.F90 rename to user_define_module/examples/userdefine_mixinglayer.F90 diff --git a/user_define_module/userdefine_onedflame.F90 b/user_define_module/examples/userdefine_onedflame.F90 similarity index 97% rename from user_define_module/userdefine_onedflame.F90 rename to user_define_module/examples/userdefine_onedflame.F90 index 2480c61..52f40a0 100644 --- a/user_define_module/userdefine_onedflame.F90 +++ b/user_define_module/examples/userdefine_onedflame.F90 @@ -234,6 +234,20 @@ end subroutine udf_flowinit !+-------------------------------------------------------------------+ ! !+-------------------------------------------------------------------+ + !| This subroutine is to collect statistics. | + !+-------------------------------------------------------------------+ + !| CHANGE RECORD | + !| ------------- | + !| 09-Nov-2023: created by Jian Fang @ Appleton | + !+-------------------------------------------------------------------+ + subroutine udf_meanflow + ! + end subroutine udf_meanflow + !+-------------------------------------------------------------------+ + !| The end of the subroutine udf_meanflow. | + !+-------------------------------------------------------------------+ + !! + !+-------------------------------------------------------------------+ !| This subroutine is to generate grid. | !+-------------------------------------------------------------------+ !| CHANGE RECORD | diff --git a/user_define_module/userdefine.F90 b/user_define_module/userdefine.F90 index 203cab7..94ed2b4 100644 --- a/user_define_module/userdefine.F90 +++ b/user_define_module/userdefine.F90 @@ -403,6 +403,19 @@ end subroutine udf_write !| The end of the subroutine udf_write. | !+-------------------------------------------------------------------+ ! + !+-------------------------------------------------------------------+ + !| This subroutine is to collect statistics. | + !+-------------------------------------------------------------------+ + !| CHANGE RECORD | + !| ------------- | + !| 09-Nov-2023: created by Jian Fang @ Appleton | + !+-------------------------------------------------------------------+ + subroutine udf_meanflow + ! + end subroutine udf_meanflow + !+-------------------------------------------------------------------+ + !| The end of the subroutine udf_meanflow. | + !+-------------------------------------------------------------------+ end module userdefine !+---------------------------------------------------------------------+ !| The end of the module userdefine. |