From 35f52540a9ab137de653760959685c6fb2e1e447 Mon Sep 17 00:00:00 2001 From: XiaoyuMao-cyber Date: Mon, 1 Sep 2025 21:23:39 +0800 Subject: [PATCH 1/2] Add files via upload --- CMakeLists.txt | 8 + Makefile | 655 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 614 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea5b780..8e26652 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,14 @@ else(CHEMISTRY) message("chemistry is not activated") endif (CHEMISTRY) +# set two temperature model +option(TTP "Build ASTR with two temperature model" OFF) +if (TTP) + add_definitions(-DTTP) +else(TTP) + message("two temperature model is not activated") +endif (TTP) + set(ASTR_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) message(STATUS "ASTR directory: ${ASTR_ROOT}") set(CMAKE_INSTALL_PREFIX ${ASTR_ROOT}) diff --git a/Makefile b/Makefile index 9455638..c987945 100644 --- a/Makefile +++ b/Makefile @@ -1,49 +1,606 @@ -# This makefile is used to compile ASTR code. -# The compiler: gfortran compiler -# -#FCFLAGS= -Wuse-without-only -g -#FC=mpif90 -FC=h5pfc - -SRCDIR = ./astr/src ./astr/user_define_module -OBJDIR = obj -BINDIR = bin -CTRDIR = cma - -FCFLAGS= -O3 -fbounds-check -fallow-argument-mismatch - -# OPTIONS1 = -fcheck=all -OPTIONS2 = -J $(OBJDIR) -OPTIONS3 = -DHDF5 -# OPTIONS4 = -DCOMB -I$(CTRDIR)/include/cantera -# OMP = -fopenacc - - -EXE=astr - -LIBS= -lz -lm # -L$(CTRDIR)/lib -lcantera_fortran -lcantera -lstdc++ -pthread -#LIBS= -lz -lm - -TARGET = $(BINDIR)/$(EXE) - -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 filter.F90 derivative.F90 flux.F90 bc.F90 readwrite.F90 \ - geom.F90 ibmethod.F90 gridgeneration.F90 riemann.F90 comsolver.F90 solver.F90 \ - udf_pp.F90 pp.F90 initialisation.F90 mainloop.F90 test.F90 astr.F90 - -OBJS=$(srs:.F90=.o) - -%.o:%.F90 - @mkdir -p $(OBJDIR) - $(FC) $(FCFLAGS) $(INCL) $(OPTIONS1) $(OPTIONS2) $(OPTIONS3) $(OPTIONS4) $(OMP) -c -o $(OBJDIR)/$@ $< - -default: $(OBJS) - @mkdir -p $(BINDIR) - $(FC) $(FCFLAGS) -o $(TARGET) $(OBJDIR)/*.o $(LIBS) $(INCL) $(OMP) - -clean: - rm -fv $(OBJDIR)/*.o $(OBJDIR)/*.mod $(TARGET) $(OBJDIR)/*.mod +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /mnt/d/astr-merge/astr-merge + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /mnt/d/astr-merge/astr-merge + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target test +test: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running tests..." + /usr/bin/ctest --force-new-ctest-process $(ARGS) +.PHONY : test + +# Special rule for the target test +test/fast: test +.PHONY : test/fast + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /mnt/d/astr-merge/astr-merge/CMakeFiles /mnt/d/astr-merge/astr-merge//CMakeFiles/progress.marks + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /mnt/d/astr-merge/astr-merge/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +#============================================================================= +# Target rules for targets named Experimental + +# Build rule for target. +Experimental: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 Experimental +.PHONY : Experimental + +# fast build rule for target. +Experimental/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Experimental.dir/build.make CMakeFiles/Experimental.dir/build +.PHONY : Experimental/fast + +#============================================================================= +# Target rules for targets named Nightly + +# Build rule for target. +Nightly: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 Nightly +.PHONY : Nightly + +# fast build rule for target. +Nightly/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Nightly.dir/build.make CMakeFiles/Nightly.dir/build +.PHONY : Nightly/fast + +#============================================================================= +# Target rules for targets named Continuous + +# Build rule for target. +Continuous: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 Continuous +.PHONY : Continuous + +# fast build rule for target. +Continuous/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Continuous.dir/build.make CMakeFiles/Continuous.dir/build +.PHONY : Continuous/fast + +#============================================================================= +# Target rules for targets named NightlyMemoryCheck + +# Build rule for target. +NightlyMemoryCheck: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyMemoryCheck +.PHONY : NightlyMemoryCheck + +# fast build rule for target. +NightlyMemoryCheck/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyMemoryCheck.dir/build.make CMakeFiles/NightlyMemoryCheck.dir/build +.PHONY : NightlyMemoryCheck/fast + +#============================================================================= +# Target rules for targets named NightlyStart + +# Build rule for target. +NightlyStart: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyStart +.PHONY : NightlyStart + +# fast build rule for target. +NightlyStart/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyStart.dir/build.make CMakeFiles/NightlyStart.dir/build +.PHONY : NightlyStart/fast + +#============================================================================= +# Target rules for targets named NightlyUpdate + +# Build rule for target. +NightlyUpdate: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyUpdate +.PHONY : NightlyUpdate + +# fast build rule for target. +NightlyUpdate/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyUpdate.dir/build.make CMakeFiles/NightlyUpdate.dir/build +.PHONY : NightlyUpdate/fast + +#============================================================================= +# Target rules for targets named NightlyConfigure + +# Build rule for target. +NightlyConfigure: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyConfigure +.PHONY : NightlyConfigure + +# fast build rule for target. +NightlyConfigure/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyConfigure.dir/build.make CMakeFiles/NightlyConfigure.dir/build +.PHONY : NightlyConfigure/fast + +#============================================================================= +# Target rules for targets named NightlyBuild + +# Build rule for target. +NightlyBuild: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyBuild +.PHONY : NightlyBuild + +# fast build rule for target. +NightlyBuild/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyBuild.dir/build.make CMakeFiles/NightlyBuild.dir/build +.PHONY : NightlyBuild/fast + +#============================================================================= +# Target rules for targets named NightlyTest + +# Build rule for target. +NightlyTest: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyTest +.PHONY : NightlyTest + +# fast build rule for target. +NightlyTest/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyTest.dir/build.make CMakeFiles/NightlyTest.dir/build +.PHONY : NightlyTest/fast + +#============================================================================= +# Target rules for targets named NightlyCoverage + +# Build rule for target. +NightlyCoverage: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyCoverage +.PHONY : NightlyCoverage + +# fast build rule for target. +NightlyCoverage/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyCoverage.dir/build.make CMakeFiles/NightlyCoverage.dir/build +.PHONY : NightlyCoverage/fast + +#============================================================================= +# Target rules for targets named NightlyMemCheck + +# Build rule for target. +NightlyMemCheck: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlyMemCheck +.PHONY : NightlyMemCheck + +# fast build rule for target. +NightlyMemCheck/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlyMemCheck.dir/build.make CMakeFiles/NightlyMemCheck.dir/build +.PHONY : NightlyMemCheck/fast + +#============================================================================= +# Target rules for targets named NightlySubmit + +# Build rule for target. +NightlySubmit: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 NightlySubmit +.PHONY : NightlySubmit + +# fast build rule for target. +NightlySubmit/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/NightlySubmit.dir/build.make CMakeFiles/NightlySubmit.dir/build +.PHONY : NightlySubmit/fast + +#============================================================================= +# Target rules for targets named ExperimentalStart + +# Build rule for target. +ExperimentalStart: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalStart +.PHONY : ExperimentalStart + +# fast build rule for target. +ExperimentalStart/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalStart.dir/build.make CMakeFiles/ExperimentalStart.dir/build +.PHONY : ExperimentalStart/fast + +#============================================================================= +# Target rules for targets named ExperimentalUpdate + +# Build rule for target. +ExperimentalUpdate: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalUpdate +.PHONY : ExperimentalUpdate + +# fast build rule for target. +ExperimentalUpdate/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalUpdate.dir/build.make CMakeFiles/ExperimentalUpdate.dir/build +.PHONY : ExperimentalUpdate/fast + +#============================================================================= +# Target rules for targets named ExperimentalConfigure + +# Build rule for target. +ExperimentalConfigure: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalConfigure +.PHONY : ExperimentalConfigure + +# fast build rule for target. +ExperimentalConfigure/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalConfigure.dir/build.make CMakeFiles/ExperimentalConfigure.dir/build +.PHONY : ExperimentalConfigure/fast + +#============================================================================= +# Target rules for targets named ExperimentalBuild + +# Build rule for target. +ExperimentalBuild: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalBuild +.PHONY : ExperimentalBuild + +# fast build rule for target. +ExperimentalBuild/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalBuild.dir/build.make CMakeFiles/ExperimentalBuild.dir/build +.PHONY : ExperimentalBuild/fast + +#============================================================================= +# Target rules for targets named ExperimentalTest + +# Build rule for target. +ExperimentalTest: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalTest +.PHONY : ExperimentalTest + +# fast build rule for target. +ExperimentalTest/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalTest.dir/build.make CMakeFiles/ExperimentalTest.dir/build +.PHONY : ExperimentalTest/fast + +#============================================================================= +# Target rules for targets named ExperimentalCoverage + +# Build rule for target. +ExperimentalCoverage: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalCoverage +.PHONY : ExperimentalCoverage + +# fast build rule for target. +ExperimentalCoverage/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalCoverage.dir/build.make CMakeFiles/ExperimentalCoverage.dir/build +.PHONY : ExperimentalCoverage/fast + +#============================================================================= +# Target rules for targets named ExperimentalMemCheck + +# Build rule for target. +ExperimentalMemCheck: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalMemCheck +.PHONY : ExperimentalMemCheck + +# fast build rule for target. +ExperimentalMemCheck/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalMemCheck.dir/build.make CMakeFiles/ExperimentalMemCheck.dir/build +.PHONY : ExperimentalMemCheck/fast + +#============================================================================= +# Target rules for targets named ExperimentalSubmit + +# Build rule for target. +ExperimentalSubmit: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ExperimentalSubmit +.PHONY : ExperimentalSubmit + +# fast build rule for target. +ExperimentalSubmit/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ExperimentalSubmit.dir/build.make CMakeFiles/ExperimentalSubmit.dir/build +.PHONY : ExperimentalSubmit/fast + +#============================================================================= +# Target rules for targets named ContinuousStart + +# Build rule for target. +ContinuousStart: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousStart +.PHONY : ContinuousStart + +# fast build rule for target. +ContinuousStart/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousStart.dir/build.make CMakeFiles/ContinuousStart.dir/build +.PHONY : ContinuousStart/fast + +#============================================================================= +# Target rules for targets named ContinuousUpdate + +# Build rule for target. +ContinuousUpdate: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousUpdate +.PHONY : ContinuousUpdate + +# fast build rule for target. +ContinuousUpdate/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousUpdate.dir/build.make CMakeFiles/ContinuousUpdate.dir/build +.PHONY : ContinuousUpdate/fast + +#============================================================================= +# Target rules for targets named ContinuousConfigure + +# Build rule for target. +ContinuousConfigure: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousConfigure +.PHONY : ContinuousConfigure + +# fast build rule for target. +ContinuousConfigure/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousConfigure.dir/build.make CMakeFiles/ContinuousConfigure.dir/build +.PHONY : ContinuousConfigure/fast + +#============================================================================= +# Target rules for targets named ContinuousBuild + +# Build rule for target. +ContinuousBuild: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousBuild +.PHONY : ContinuousBuild + +# fast build rule for target. +ContinuousBuild/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousBuild.dir/build.make CMakeFiles/ContinuousBuild.dir/build +.PHONY : ContinuousBuild/fast + +#============================================================================= +# Target rules for targets named ContinuousTest + +# Build rule for target. +ContinuousTest: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousTest +.PHONY : ContinuousTest + +# fast build rule for target. +ContinuousTest/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousTest.dir/build.make CMakeFiles/ContinuousTest.dir/build +.PHONY : ContinuousTest/fast + +#============================================================================= +# Target rules for targets named ContinuousCoverage + +# Build rule for target. +ContinuousCoverage: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousCoverage +.PHONY : ContinuousCoverage + +# fast build rule for target. +ContinuousCoverage/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousCoverage.dir/build.make CMakeFiles/ContinuousCoverage.dir/build +.PHONY : ContinuousCoverage/fast + +#============================================================================= +# Target rules for targets named ContinuousMemCheck + +# Build rule for target. +ContinuousMemCheck: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousMemCheck +.PHONY : ContinuousMemCheck + +# fast build rule for target. +ContinuousMemCheck/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousMemCheck.dir/build.make CMakeFiles/ContinuousMemCheck.dir/build +.PHONY : ContinuousMemCheck/fast + +#============================================================================= +# Target rules for targets named ContinuousSubmit + +# Build rule for target. +ContinuousSubmit: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ContinuousSubmit +.PHONY : ContinuousSubmit + +# fast build rule for target. +ContinuousSubmit/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/ContinuousSubmit.dir/build.make CMakeFiles/ContinuousSubmit.dir/build +.PHONY : ContinuousSubmit/fast + +#============================================================================= +# Target rules for targets named astr + +# Build rule for target. +astr: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 astr +.PHONY : astr + +# fast build rule for target. +astr/fast: + $(MAKE) $(MAKESILENT) -f src/CMakeFiles/astr.dir/build.make src/CMakeFiles/astr.dir/build +.PHONY : astr/fast + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... test" + @echo "... Continuous" + @echo "... ContinuousBuild" + @echo "... ContinuousConfigure" + @echo "... ContinuousCoverage" + @echo "... ContinuousMemCheck" + @echo "... ContinuousStart" + @echo "... ContinuousSubmit" + @echo "... ContinuousTest" + @echo "... ContinuousUpdate" + @echo "... Experimental" + @echo "... ExperimentalBuild" + @echo "... ExperimentalConfigure" + @echo "... ExperimentalCoverage" + @echo "... ExperimentalMemCheck" + @echo "... ExperimentalStart" + @echo "... ExperimentalSubmit" + @echo "... ExperimentalTest" + @echo "... ExperimentalUpdate" + @echo "... Nightly" + @echo "... NightlyBuild" + @echo "... NightlyConfigure" + @echo "... NightlyCoverage" + @echo "... NightlyMemCheck" + @echo "... NightlyMemoryCheck" + @echo "... NightlyStart" + @echo "... NightlySubmit" + @echo "... NightlyTest" + @echo "... NightlyUpdate" + @echo "... astr" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + From a5133d659459b62821afe54d11be0138ca5a54a1 Mon Sep 17 00:00:00 2001 From: XiaoyuMao-cyber Date: Mon, 1 Sep 2025 21:24:33 +0800 Subject: [PATCH 2/2] Add files via upload --- src/commarray.F90 | 24 ++++- src/commvar.F90 | 13 ++- src/fludyna.F90 | 216 ++++++++++++++++++++++++++++++++++++----- src/gridgeneration.F90 | 4 + src/initialisation.F90 | 136 ++++++++++++++++++++++++++ src/mainloop.F90 | 85 +++++++++++++++- src/models.F90 | 28 +++++- src/readwrite.F90 | 48 +++++++-- src/solver.F90 | 68 ++++++++++++- 9 files changed, 585 insertions(+), 37 deletions(-) diff --git a/src/commarray.F90 b/src/commarray.F90 index 6a37651..3dbdf87 100644 --- a/src/commarray.F90 +++ b/src/commarray.F90 @@ -30,6 +30,13 @@ module commarray real(8),allocatable,dimension(:,:,:) :: tke,omg,miut,res12,ssf real(8),allocatable,dimension(:,:,:,:) :: dtke,domg ! +#ifdef TTP + real(8),allocatable,dimension(:,:,:) :: tve,Ev,Evrhs + real(8),allocatable,dimension(:,:,:,:) :: dtve + !+---------------------+---------------------------------------------+ + !| tve | vibrational-electronic temperature. | + !+---------------------+---------------------------------------------+ +#endif !+---------------------+---------------------------------------------+ !| x | coordinates. | !| jacob | geometrical Jacobian. | @@ -39,6 +46,7 @@ module commarray !| rho | density. | !| prs | pressure. | !| tmp | temperature. | + !| tve | electronic-vibrational temperature. | !| vel | velocity. | !| spc | species. | !| lenspg_* | length of sponge layer | @@ -110,6 +118,20 @@ subroutine allocommarray allocate(crinod(0:im,0:jm,0:km),stat=lallo) if(lallo.ne.0) stop ' !! error at allocating crinod' ! +#ifdef TTP + allocate( tve(-hm:im+hm,-hm:jm+hm,-hm:km+hm),stat=lallo) + if(lallo.ne.0) stop ' !! error at allocating tve' + ! + allocate( dtve(0:im,0:jm,0:km,1:3),stat=lallo) + if(lallo.ne.0) stop ' !! error at allocating dtve' + ! + allocate( Ev(-hm:im+hm,-hm:jm+hm,-hm:km+hm),stat=lallo) + if(lallo.ne.0) stop ' !! error at allocating Ev' + ! + allocate( Evrhs(0:im,0:jm,0:km),stat=lallo) + if(lallo.ne.0) stop ' !! error at allocating Evrhs' +#endif + end subroutine allocommarray !+-------------------------------------------------------------------+ !| The end of the subroutine allocommarray. | @@ -118,4 +140,4 @@ end subroutine allocommarray end module commarray !+---------------------------------------------------------------------+ !| The end of the module commarray. | -!+---------------------------------------------------------------------+ \ No newline at end of file +!+---------------------------------------------------------------------+ diff --git a/src/commvar.F90 b/src/commvar.F90 index c4b1408..81944b7 100644 --- a/src/commvar.F90 +++ b/src/commvar.F90 @@ -19,7 +19,7 @@ module commvar integer :: hm integer :: numq,num_species,ndims,ninit,num_modequ character(len=1) :: iomode - character(len=10) :: turbmode,ibmode + character(len=10) :: turbmode,ibmode,realgas character(len=4) :: conschm,difschm character(len=64) :: gridfile,solidfile !+---------------------+---------------------------------------------+ @@ -189,7 +189,16 @@ module commvar ! parameter(hm=5) ! +#ifdef TTP + real(8), parameter :: CVT_N2=3393d0 + real(8), parameter :: UNIVERSAL_R=8.314d0 + real(8), parameter :: M_N2=28.0134d-3 + real(8), parameter :: R_N2 = UNIVERSAL_R / M_N2 + real(8), parameter :: PRSATM = 101325d0 + real(8), parameter :: N2N2a=221d0, N2N2b=2.9d-2 + real(8), parameter :: Na=6.02d23 +#endif end module commvar !+---------------------------------------------------------------------+ !| The end of the module commvar. | -!+---------------------------------------------------------------------+ \ No newline at end of file +!+---------------------------------------------------------------------+ diff --git a/src/fludyna.F90 b/src/fludyna.F90 index 9d681d9..2c3bb54 100644 --- a/src/fludyna.F90 +++ b/src/fludyna.F90 @@ -24,12 +24,18 @@ module fludyna module procedure fvar2q_sca module procedure fvar2q_1da module procedure fvar2q_3da +#ifdef TTP + module procedure fvar2q_Ev +#endif end interface ! interface q2fvar module procedure q2fvar_sca module procedure q2fvar_1da module procedure q2fvar_3da +#ifdef TTP + module procedure q2fvar_Ev +#endif end interface ! contains @@ -44,8 +50,11 @@ module fludyna !+-------------------------------------------------------------------+ function thermal_scar(density,pressure,temperature,species) result(vout) ! - use commvar,only : const2,rgas + use commvar,only : const2,rgas,flowtype ! +#ifdef TTP + use commvar, only: M_N2,UNIVERSAL_R +#endif ! arguments real(8) :: vout real(8),intent(in) ,optional :: density,pressure,temperature,species(:) @@ -72,6 +81,10 @@ function thermal_scar(density,pressure,temperature,species) result(vout) #else rloc=rgas #endif + + if (trim(flowtype)=='heatbath') then + rloc=UNIVERSAL_R/M_N2 + endif ! if(present(density).and.present(temperature)) then vout = density*temperature*rloc @@ -89,8 +102,11 @@ end function thermal_scar ! function thermal_1d(density,pressure,temperature,species,dim) result(vout) ! - use commvar,only : const2,rgas + use commvar,only : const2,rgas,flowtype ! +#ifdef TTP + use commvar, only: M_N2,UNIVERSAL_R +#endif ! arguments integer,intent(in) :: dim real(8) :: vout(dim) @@ -119,6 +135,10 @@ function thermal_1d(density,pressure,temperature,species,dim) result(vout) rloc=rgas #endif + if (trim(flowtype)=='heatbath') then + rloc=UNIVERSAL_R/M_N2 + endif + if(present(density).and.present(temperature)) then vout = density*temperature*rloc elseif(present(density).and.present(pressure)) then @@ -135,8 +155,11 @@ end function thermal_1d ! function thermal_3d(density,pressure,temperature,species,dim) result(vout) ! - use commvar,only : const2,rgas + use commvar,only : const2,rgas,flowtype ! +#ifdef TTP + use commvar, only: M_N2,UNIVERSAL_R +#endif ! arguments integer,intent(in) :: dim(3) real(8) :: vout(dim(1),dim(2),dim(3)) @@ -164,8 +187,12 @@ function thermal_3d(density,pressure,temperature,species,dim) result(vout) #else rloc=rgas #endif + + if (trim(flowtype)=='heatbath') then + rloc=UNIVERSAL_R/M_N2 + endif if(present(density).and.present(temperature)) then - vout = density*temperature*rloc + vout = density*temperature*rloc elseif(present(density).and.present(pressure)) then vout = pressure/density/rloc elseif(present(temperature).and.present(pressure)) then @@ -192,6 +219,10 @@ subroutine updatefvar ! use commarray,only : q,rho,vel,prs,tmp,spc,tke,omg use commvar, only : im,jm,km,num_species,num_modequ,turbmode +#ifdef TTP + use commarray,only : tve,Ev + use commvar, only : realgas +#endif ! ! local data integer :: i,j,k @@ -205,7 +236,8 @@ subroutine updatefvar temperature=tmp(0:im,0:jm,0:km), & species=spc(0:im,0:jm,0:km,:), & tke=tke(0:im,0:jm,0:km), & - omega=omg(0:im,0:jm,0:km) ) + omega=omg(0:im,0:jm,0:km), & + Ev=Ev (0:im,0:jm,0:km) ) ! do k=0,km do j=0,jm @@ -227,17 +259,28 @@ subroutine updatefvar ! elseif(trim(turbmode)=='none' .or. trim(turbmode)=='udf1') then ! - call q2fvar(q=q(0:im,0:jm,0:km,:), & - density=rho(0:im,0:jm,0:km), & - velocity=vel(0:im,0:jm,0:km,:), & - pressure=prs(0:im,0:jm,0:km), & - temperature=tmp(0:im,0:jm,0:km), & - species=spc(0:im,0:jm,0:km,:) ) + call q2fvar( q= q(0:im,0:jm,0:km,:), & + density=rho(0:im,0:jm,0:km), & + velocity=vel(0:im,0:jm,0:km,:), & + pressure=prs(0:im,0:jm,0:km), & + temperature=tmp(0:im,0:jm,0:km), & + species=spc(0:im,0:jm,0:km,:) , & + Ev=Ev(0:im,0:jm,0:km) ) ! + else print*,' !! ERROR @ updatefvar' stop endif + +#ifdef TTP + if(trim(realgas)=='twotemp') then + call q2fvar( Ev=Ev(0:im,0:jm,0:km), & + density=rho(0:im,0:jm,0:km), & + tve=tve(0:im,0:jm,0:km) ) + endif + +#endif ! end subroutine updatefvar !+-------------------------------------------------------------------+ @@ -255,6 +298,11 @@ subroutine updateq ! use commarray,only : q,rho,vel,prs,tmp,spc,tke,omg use commvar, only : im,jm,km,num_species,num_modequ,turbmode,numq + +#ifdef TTP + use commarray,only : tve,Ev + use commvar, only : realgas +#endif ! integer :: i,j,k,n ! @@ -266,7 +314,8 @@ subroutine updateq pressure=prs(0:im,0:jm,0:km), & species=spc(0:im,0:jm,0:km,:), & tke=tke(0:im,0:jm,0:km), & - omega=omg(0:im,0:jm,0:km) ) + omega=omg(0:im,0:jm,0:km), & + Ev=Ev(0:im,0:jm,0:km) ) ! elseif(trim(turbmode)=='none' .or. trim(turbmode)=='udf1') then ! @@ -275,8 +324,14 @@ subroutine updateq velocity=vel(0:im,0:jm,0:km,:), & pressure=prs(0:im,0:jm,0:km), & temperature=tmp(0:im,0:jm,0:km), & - species=spc(0:im,0:jm,0:km,:) ) - ! + species=spc(0:im,0:jm,0:km,:) , & + Ev=Ev(0:im,0:jm,0:km) ) +#ifdef TTP + elseif(trim(realgas)=='twotemp') then + call fvar2q( Ev=Ev(0:im,0:jm,0:km), & + density=rho(0:im,0:jm,0:km), & + tve=tve(0:im,0:jm,0:km) ) +#endif do k=0,km do j=0,jm do i=0,im @@ -309,14 +364,21 @@ end subroutine updateq !| ------------- | !| 09-02-2021: Created by J. Fang @ Warrington. | !+-------------------------------------------------------------------+ + !-------------------------------------------------------- + ! scalar and 1d need two temperature implementation + !-------------------------------------------------------- subroutine fvar2q_sca(q,density,velocity,pressure,temperature, & species,tke,omega) ! use commvar, only: numq,ndims,num_species,const1,const6,cv ! +#ifdef TTP + use commarray, only: Ev +#endif real(8),intent(in) :: density,velocity(:) real(8),intent(in),optional :: pressure,temperature,species(:),tke,omega real(8),intent(out) :: q(:) + ! ! local data integer :: jspec,j @@ -379,10 +441,15 @@ subroutine fvar2q_1da(q,density,velocity,pressure,temperature,species) ! use commvar, only: numq,ndims,num_species,const1,const6,cv ! +#ifdef TTP + use commarray, only: Ev +#endif real(8),intent(in) :: density(:),velocity(:,:) real(8),intent(in),optional :: pressure(:),temperature(:), & species(:,:) real(8),intent(out) :: q(:,:) + + ! ! local data integer :: jspec,j @@ -446,16 +513,20 @@ subroutine fvar2q_1da(q,density,velocity,pressure,temperature,species) ! end subroutine fvar2q_1da ! - subroutine fvar2q_3da(q,density,velocity,pressure,temperature,species,tke,omega) + subroutine fvar2q_3da(q,density,velocity,pressure,temperature,species,tke,omega,Ev) ! use commvar, only: numq,ndims,num_species,const1,const6,cv ! +#ifdef TTP + use commvar, only: realgas, R_N2 +#endif + ! real(8),intent(in) :: density(:,:,:),velocity(:,:,:,:) real(8),intent(in),optional :: pressure(:,:,:),temperature(:,:,:), & species(:,:,:,:),tke(:,:,:), & - omega(:,:,:) + omega(:,:,:),Ev(:,:,:) real(8),intent(out) :: q(:,:,:,:) - ! + ! local data integer :: jspec,i,j,k real(8) :: var1,var2,cotem @@ -494,6 +565,8 @@ subroutine fvar2q_3da(q,density,velocity,pressure,temperature,species,tke,omega) if(nondimen) then cotem=const1 + elseif(trim(realgas)=='twotemp') then + cotem= 5.d0/2.d0 * R_N2 else cotem=cv endif @@ -504,6 +577,7 @@ subroutine fvar2q_3da(q,density,velocity,pressure,temperature,species,tke,omega) velocity(:,:,:,2)**2 + & velocity(:,:,:,3)**2) ) elseif(present(pressure)) then + q(:,:,:,5)=pressure(:,:,:)*const6+0.5d0*density(:,:,:)*( & velocity(:,:,:,1)**2 + & velocity(:,:,:,2)**2 + & @@ -530,7 +604,34 @@ subroutine fvar2q_3da(q,density,velocity,pressure,temperature,species,tke,omega) ! endif ! + +#ifdef TTP + if(trim(realgas)=='twotemp') then + q(:,:,:,5)=q(:,:,:,5)+Ev(:,:,:) + + endif +#endif end subroutine fvar2q_3da + + +#ifdef TTP + subroutine fvar2q_Ev(Ev,density,tve) + ! + use commvar, only: CVT_N2, R_N2 + ! + real(8),intent(in) :: density(:,:,:),tve(:,:,:) + real(8),intent(out) :: Ev(:,:,:) + ! + ! local data + integer :: jspec,j + real(8) :: var1,var2,cotem + ! + + Ev(:,:,:)=density(:,:,:)*(R_N2*CVT_N2)/(exp(CVT_N2/tve(:,:,:))-1) + + end subroutine fvar2q_Ev +#endif + ! !+-------------------------------------------------------------------+ !| The end of the subroutine fvar2q. | !+-------------------------------------------------------------------+ @@ -542,20 +643,27 @@ end subroutine fvar2q_3da !| ------------- | !| 09-02-2021: Created by J. Fang @ Warrington. | !+-------------------------------------------------------------------+ - subroutine q2fvar_3da(q,density,velocity,pressure,temperature,species,tke,omega) + !----------------------------------------------------------------------- + ! scalar and 1d need two temperature implementation + ! TTP, COMB and usual calculation for temperature needs to be integrated + !----------------------------------------------------------------------- + subroutine q2fvar_3da(q,density,velocity,pressure,temperature,species,tke,omega,Ev) ! - use commvar, only: numq,ndims,num_species,const1,const6,tinf + use commvar, only: numq,ndims,num_species,const1,const6,tinf,cv,flowtype ! +#ifdef TTP + use commvar, only: R_N2, realgas +#endif real(8),intent(inout) :: q(:,:,:,:) real(8),intent(out) :: density(:,:,:) real(8),intent(out),optional :: temperature(:,:,:),pressure(:,:,:),& species(:,:,:,:),velocity(:,:,:,:),& - tke(:,:,:),omega(:,:,:) + tke(:,:,:),omega(:,:,:),Ev(:,:,:) ! ! local data integer :: jspec,i,j,k integer :: dim(3) - real(8) :: var1 + real(8) :: var1,cotem ! density(:,:,:) =q(:,:,:,1) ! @@ -604,8 +712,39 @@ subroutine q2fvar_3da(q,density,velocity,pressure,temperature,species,tke,omega) endif ! -#else +#elif TTP + if(present(Ev) .and. trim(realgas)=='twotemp') then + + if(nondimen) then + cotem=const1 + else + cotem=cv + endif + + if (trim(flowtype)=='heatbath') then + cotem= 5.d0/2.d0 * R_N2 + endif + + + temperature(:,:,:)=(q(:,:,:,5)-0.5d0*density(:,:,:)*( & + velocity(:,:,:,1)**2+ & + velocity(:,:,:,2)**2+ & + velocity(:,:,:,3)**2) & + - Ev(:,:,:)) & + /(cotem * density(:,:,:) ) + endif + if(present(pressure) .or. present(temperature)) then + dim(1)=size(q,1) + dim(2)=size(q,2) + dim(3)=size(q,3) + + pressure=thermal (temperature=temperature,density=density, & + species=species,dim=dim) + + endif + +#else if(present(pressure) .or. present(temperature)) then pressure(:,:,:) =( q(:,:,:,5)-0.5d0*density(:,:,:)*( & velocity(:,:,:,1)**2+ & @@ -780,6 +919,39 @@ subroutine q2fvar_sca(q,density,velocity,pressure,temperature,species,tke,omega) endif ! end subroutine q2fvar_sca + +#ifdef TTP + subroutine q2fvar_Ev(Ev,density,tve) + ! + use commvar, only: CVT_N2, R_N2 + ! + real(8),intent(in) :: density(:,:,:),Ev(:,:,:) + real(8),intent(out) :: tve(:,:,:) + ! + ! local data + integer :: jspec,j,i,k + real(8) :: var1,var2,cotem,arg + ! + do i=LBOUND(Ev,1),UBOUND(Ev,1) + do j=LBOUND(Ev,2),UBOUND(Ev,2) + do k=LBOUND(Ev,3),UBOUND(Ev,3) + if (Ev(i,j,k) <=0d0) then + print*, i,j,k,Ev(i,j,k) + print*, ' !! error, negative Ev value' + endif + + arg = density(i,j,k) * (R_N2 * CVT_N2) / Ev(i,j,k) + 1 + if (arg > 0) then + tve(i,j,k) = CVT_N2 / log(arg) + else + tve(i,j,k) = 0.0 ! or some default safe value + stop ' !! error, negative vibrational-electronic temperature' + end if + end do + end do + end do + end subroutine q2fvar_Ev +#endif !+-------------------------------------------------------------------+ !| The end of the subroutine q2fvar. | !+-------------------------------------------------------------------+ diff --git a/src/gridgeneration.F90 b/src/gridgeneration.F90 index a59104e..0528f21 100644 --- a/src/gridgeneration.F90 +++ b/src/gridgeneration.F90 @@ -60,6 +60,10 @@ subroutine gridgen call gridcube(0.25d0,1.d0,0.d0) elseif(trim(flowtype)=='ldcavity') then call gridcube(1.d0,1.d0,0.d0) +#ifdef TTP + elseif(trim(flowtype)=='heatbath') then + call gridcube(ref_len*2.d0*pi,ref_len*2.d0*pi,ref_len*2.d0*pi) +#endif else call gridcube(0.03d0,0.03d0,0.03d0) ! call udf_grid diff --git a/src/initialisation.F90 b/src/initialisation.F90 index 3dc1e17..7e1ebb5 100644 --- a/src/initialisation.F90 +++ b/src/initialisation.F90 @@ -117,6 +117,8 @@ subroutine flowinit call rtini case('ldcavity') call ldcavityini + case('heatbath') + call heatbathini ! case('hitflame') ! call hitflameini ! case default @@ -1194,6 +1196,140 @@ end subroutine rtini !| The end of the subroutine rtini. | !+-------------------------------------------------------------------+ ! +#ifdef TTP + !+-------------------------------------------------------------------+ + !| This subroutine is used to generate an initial field for the | + !| simulation of N2 heat bath problem. | + !+-------------------------------------------------------------------+ + !| CHANGE RECORD | + !| ------------- | + !| 2-Jul-2025: Created by Xiaoyu Mao @ IMCAS | + !+-------------------------------------------------------------------+ + subroutine heatbathini + ! + use commarray,only: rho,prs,tmp,tve,vel,Ev,q,spc + use commvar, only : im,jm,km + use fludyna, only: thermal,fvar2q + ! + ! local data + integer :: i,j,k + ! + + + do k=0,km + do j=0,jm + do i=0,im + tmp(i,j,k)=3000 + tve(i,j,k)=10000 + prs(i,j,k)=101325 + rho(i,j,k)=thermal(temperature=tmp(i,j,k),pressure=prs(i,j,k)) + + ! +! rho(i,j,k)= 1.d0 +! prs(i,j,k)=1.d0 +! tmp(i,j,k)=thermal(density=rho(i,j,k),pressure=prs(i,j,k)) + + vel(i,j,k,1)= 0.d0 + vel(i,j,k,2)= 0.d0 + vel(i,j,k,3)= 0.d0 + ! + + enddo + enddo + enddo + ! + + call fvar2q(Ev=Ev(0:im,0:jm,0:km), & + density=rho(0:im,0:jm,0:km),& + tve=tve(0:im,0:jm,0:km)) + + call fvar2q( q= q(0:im,0:jm,0:km,:), & + density=rho(0:im,0:jm,0:km), & + velocity=vel(0:im,0:jm,0:km,:), & + pressure=prs(0:im,0:jm,0:km), & + temperature=tmp(0:im,0:jm,0:km), & + species=spc(0:im,0:jm,0:km,:) , & + Ev=Ev(0:im,0:jm,0:km) ) + + + ! + if(lio) write(*,'(A,I1,A)')' ** ',ndims,'-D two temperature initialised.' + ! + end subroutine heatbathini + !+-------------------------------------------------------------------+ + !| The end of the subroutine heatbathini. | + !+-------------------------------------------------------------------+ + ! + !+-------------------------------------------------------------------+ + !| This subroutine is used to generate an initial field for the | + !| simulation of 5-component air reaction problem. | + !| species: 1:N2 2:O2 3:N 4:O 5:NO + !+-------------------------------------------------------------------+ + !| CHANGE RECORD | + !| ------------- | + !| 2-Jul-2025: Created by Xiaoyu Mao @ IMCAS | + !+-------------------------------------------------------------------+ + subroutine rctairini + ! + use commarray,only: rho,prs,tmp,tve,vel,Ev,q,spc + use commvar, only : im,jm,km,PRSATM + use fludyna, only: thermal,fvar2q + ! + ! local data + integer :: i,j,k + ! + + + do k=0,km + do j=0,jm + do i=0,im + tmp(i,j,k)=30000 + tve(i,j,k)=1000 + prs(i,j,k)=0.068*PRSATM + rho(i,j,k)=thermal(temperature=tmp(i,j,k),pressure=prs(i,j,k)) + spc(i,j,k,1)=0.79 + spc(i,j,k,2)=0.21 + spc(i,j,k,3)=0 + spc(i,j,k,4)=0 + spc(i,j,k,5)=0 + + ! +! rho(i,j,k)= 1.d0 +! prs(i,j,k)=1.d0 +! tmp(i,j,k)=thermal(density=rho(i,j,k),pressure=prs(i,j,k)) + + vel(i,j,k,1)= 0.d0 + vel(i,j,k,2)= 0.d0 + vel(i,j,k,3)= 0.d0 + ! + + enddo + enddo + enddo + ! + + call fvar2q(Ev=Ev(0:im,0:jm,0:km), & + density=rho(0:im,0:jm,0:km),& + tve=tve(0:im,0:jm,0:km)) + + call fvar2q( q= q(0:im,0:jm,0:km,:), & + density=rho(0:im,0:jm,0:km), & + velocity=vel(0:im,0:jm,0:km,:), & + pressure=prs(0:im,0:jm,0:km), & + temperature=tmp(0:im,0:jm,0:km), & + species=spc(0:im,0:jm,0:km,:) , & + Ev=Ev(0:im,0:jm,0:km) ) + + + ! + if(lio) write(*,'(A,I1,A)')' ** ',ndims,'-D 5 species reating air initialised.' + ! + end subroutine rctairini + !+-------------------------------------------------------------------+ + !| The end of the subroutine heatbathini. | + !+-------------------------------------------------------------------+ + ! +#endif !+-------------------------------------------------------------------+ !| This subroutine is used to generate an initial field for the | !| simulation of channel flow. | diff --git a/src/mainloop.F90 b/src/mainloop.F90 index b06b5a6..8e19967 100644 --- a/src/mainloop.F90 +++ b/src/mainloop.F90 @@ -281,12 +281,20 @@ subroutine time_integration_rk(timerept) use commvar, only : im,jm,km,numq,deltat,lfilter,feqchkpt,hm, & lavg,feqavg,nstep,limmbou,turbmode,feqslice, & feqwsequ,lwslic,lreport,flowtype, & - ndims,num_species,maxstep,rkscheme + ndims,num_species,maxstep,rkscheme,realgas use commarray,only : x,q,qrhs,rho,vel,prs,tmp,spc,jacob use fludyna, only : updatefvar use comsolver,only : filterq,spongefilter,filter2e use solver, only : rhscal use bc, only : boucon,immbody + +#ifdef TTP + use parallel, only : dataswap, datasync + use commarray,only : Ev, Evrhs + real(8),allocatable,save :: Evsave(:,:,:), Evrhsav(:,:,:) +#endif + + #ifdef COMB use thermchem,only : imp_euler_ode,heatrate use fdnn @@ -363,13 +371,22 @@ subroutine time_integration_rk(timerept) endif ! allocate(qsave(0:im,0:jm,0:km,1:numq)) - - firstcall=.false. +#ifdef TTP + if(trim(realgas)=='twotemp') then + allocate(Evsave(0:im,0:jm,0:km)) + endif +#endif + firstcall=.false. ! endif ! if(rkscheme=='rk4') allocate(rhsav(0:im,0:jm,0:km,1:numq)) ! +#ifdef TTP + if(trim(realgas)=='twotemp') then + if(rkscheme=='rk4') allocate(Evrhsav(0:im,0:jm,0:km)) + endif +#endif do rkstep=1,n_rk_steps if(lfilter) then @@ -383,16 +400,34 @@ subroutine time_integration_rk(timerept) endif qrhs=0.d0 + +#ifdef TTP + if(trim(realgas)=='twotemp') then + Evrhs=0.d0 + endif +#endif ! if(limmbou) then call immbody(timerept=ltimrpt) if(flowtype(1:2)/='0d') call qswap(timerept=ltimrpt) +#ifdef TTP + if(trim(realgas)=='twotemp') then + if(flowtype(1:2)/='0d') call dataswap(Ev) + if(flowtype(1:2)/='0d') call datasync(Ev(0:im,0:jm,0:km)) + endif +#endif endif ! if(flowtype(1:2)/='0d') call boucon ! if(flowtype(1:2)/='0d') call qswap(timerept=ltimrpt) +#ifdef TTP + if(trim(realgas)=='twotemp') then + if(flowtype(1:2)/='0d') call dataswap(Ev) + if(flowtype(1:2)/='0d') call datasync(Ev(0:im,0:jm,0:km)) + endif +#endif ! call rhscal(timerept=ltimrpt) ! @@ -404,8 +439,17 @@ subroutine time_integration_rk(timerept) ! do m=1,numq qsave(0:im,0:jm,0:km,m)=q(0:im,0:jm,0:km,m)*jacob(0:im,0:jm,0:km) - +#ifdef TTP + if(trim(realgas)=='twotemp') then + Evsave(0:im,0:jm,0:km)=Ev(0:im,0:jm,0:km)*jacob(0:im,0:jm,0:km) + endif +#endif if(rkscheme=='rk4') rhsav(0:im,0:jm,0:km,m)=0.d0 +#ifdef TTP + if(trim(realgas)=='twotemp') then + if(rkscheme=='rk4') Evrhsav(0:im,0:jm,0:km)=0.d0 + endif +#endif enddo ! call rkfirst @@ -423,6 +467,16 @@ subroutine time_integration_rk(timerept) q(0:im,0:jm,0:km,m)=q(0:im,0:jm,0:km,m)/jacob(0:im,0:jm,0:km) ! enddo +#ifdef TTP + if(trim(realgas)=='twotemp') then + Ev(0:im,0:jm,0:km)=rkcoe(1,rkstep)*Evsave(0:im,0:jm,0:km)+ & + rkcoe(2,rkstep)*Ev(0:im,0:jm,0:km)* & + jacob(0:im,0:jm,0:km)+ & + rkcoe(3,rkstep)*Evrhs(0:im,0:jm,0:km)*deltat + ! + Ev(0:im,0:jm,0:km)=Ev(0:im,0:jm,0:km)/jacob(0:im,0:jm,0:km) + endif +#endif elseif(rkscheme=='rk4') then if(rkstep<=3) then do m=1,numq @@ -434,6 +488,17 @@ subroutine time_integration_rk(timerept) rhsav(0:im,0:jm,0:km,m)=rhsav(0:im,0:jm,0:km,m)+ & rkcoe(2,rkstep)*qrhs(0:im,0:jm,0:km,m) enddo +#ifdef TTP + if(trim(realgas)=='twotemp') then + Ev(0:im,0:jm,0:km)=Evsave(0:im,0:jm,0:km)+ & + rkcoe(1,rkstep)*deltat*Evrhs(0:im,0:jm,0:km) + ! + Ev(0:im,0:jm,0:km)=Ev(0:im,0:jm,0:km)/jacob(0:im,0:jm,0:km) + ! + Evrhsav(0:im,0:jm,0:km)=Evrhsav(0:im,0:jm,0:km)+ & + rkcoe(2,rkstep)*Evrhs(0:im,0:jm,0:km) + endif +#endif else do m=1,numq q(0:im,0:jm,0:km,m)=qsave(0:im,0:jm,0:km,m)+ & @@ -444,6 +509,18 @@ subroutine time_integration_rk(timerept) q(0:im,0:jm,0:km,m)=q(0:im,0:jm,0:km,m)/jacob(0:im,0:jm,0:km) ! enddo +#ifdef TTP + if(trim(realgas)=='twotemp') then + Ev(0:im,0:jm,0:km)=Evsave(0:im,0:jm,0:km)+ & + rkcoe(1,rkstep)*deltat*( & + Evrhs(0:im,0:jm,0:km)+ & + Evrhsav(0:im,0:jm,0:km) ) + ! + Ev(0:im,0:jm,0:km)=Ev(0:im,0:jm,0:km)/jacob(0:im,0:jm,0:km) + ! + endif +#endif + endif else stop ' !! error2 @ time_integration_rk' diff --git a/src/models.F90 b/src/models.F90 index db81221..f5f8311 100644 --- a/src/models.F90 +++ b/src/models.F90 @@ -82,6 +82,32 @@ end subroutine init_komegasst !| The end of the subroutine init_komegasst. | !+-------------------------------------------------------------------+ ! +#ifdef TTP + !+-------------------------------------------------------------------+ + !| This subroutine is to allocate array for two temperature model. | + !+-------------------------------------------------------------------+ + !+-------------------------------------------------------------------+ + !| CHANGE RECORD | + !| ------------- | + !| 01-Jul-2025: Created by Xiaoyu Mao @ IMCAS | + !+-------------------------------------------------------------------+ + subroutine init_twotemp + ! + use commvar,only : im,jm,km,hm + use commarray,only : tve, dtve, Ev, Evrhs + ! + integer :: lallo + ! + ! suppose to have memory allocation here, but segmentation fault. + ! temporarily moved to commarray.F90 + ! + + end subroutine init_twotemp + !+-------------------------------------------------------------------+ + !| The end of the subroutine init_twotemp. | + !+-------------------------------------------------------------------+ +#endif + ! !+-------------------------------------------------------------------+ !| This subroutine is to obtain eddy viscousity of k-omega sst model | !+-------------------------------------------------------------------+ @@ -230,4 +256,4 @@ end subroutine src_komega end module models !+---------------------------------------------------------------------+ !| The end of the module models. | -!+---------------------------------------------------------------------+ \ No newline at end of file +!+---------------------------------------------------------------------+ diff --git a/src/readwrite.F90 b/src/readwrite.F90 index 29545ef..972fe51 100644 --- a/src/readwrite.F90 +++ b/src/readwrite.F90 @@ -183,6 +183,8 @@ subroutine infodisp typedefine=' Taylor-Green Vortex flame' case('rti') typedefine=' Rayleigh–Taylor instability' + case('heatbath') + typedefine=' N2 heat bath' ! case('hitflame') ! typedefine=' homogeneous isotropic turbulence flame' case default @@ -520,7 +522,7 @@ subroutine readinput spg_k0,spg_km,spg_def,lchardecomp, & recon_schem,lrestart,limmbou,solidfile, & bfacmpld,shkcrt,turbmode,schmidt,ibmode, & - ltimrpt,testmode + ltimrpt,testmode,realgas use parallel,only : bcast use cmdefne, only : readkeyboad use bc, only : bctype,twall,xslip,turbinf,xrhjump,angshk @@ -603,6 +605,13 @@ subroutine readinput read(fh,*)num_species,(schmidt(i),i=1,num_species) endif #endif + + +#ifdef TTP + read(fh,'(/)') + read(fh,*)realgas +#endif + read(fh,'(/)') read(fh,*)turbmode,iomode read(fh,'(/)') @@ -763,6 +772,10 @@ subroutine readinput endif ! #endif + +#ifdef TTP + call bcast(realgas) +#endif ! end subroutine readinput !+-------------------------------------------------------------------+ @@ -1023,7 +1036,7 @@ end subroutine readmonc subroutine writemon ! use commvar, only: nmonitor,imon,nstep,time,pinf,deltat - use commarray, only : x,rho,vel,prs,tmp,dvel + use commarray, only : x,rho,vel,prs,tmp,dvel,tve ! ! local data integer :: n,i,j,k,ios,ns @@ -1055,7 +1068,7 @@ subroutine writemon fh(n)=get_unit() ! inquire(file=trim(filename), exist=lexist) - open(fh(n),file=trim(filename),access='direct',recl=8*4) + open(fh(n),file=trim(filename)) ! if(nstep==0 .or. (.not.lexist)) then ! create new monitor files @@ -1111,7 +1124,9 @@ subroutine writemon ! vel(i,j,k,1:3),rho(i,j,k),prs(i,j,k)/pinf,tmp(i,j,k), & ! dvel(i,j,k,1,:),dvel(i,j,k,2,:),dvel(i,j,k,3,:) record(n)=record(n)+1 - write(fh(n),rec=record(n))nstep,time,prs(i,j,k),dvel(i,j,k,1,2) +! write(fh(n),rec=record(n))nstep,time,prs(i,j,k),dvel(i,j,k,1,2) + write(fh(n),'(I7, 1X, E13.6, 3(1X, E15.7))')& + nstep,time,tmp(i,j,k),tve(i,j,k) ! write(fh(n),rec=record(n))nstep,time,vel(i,j,k,:),rho(i,j,k),prs(i,j,k), & ! tmp(i,j,k),dvel(i,j,k,:,:) ! write(*,*)nstep,time,vel(i,j,k,:),rho(i,j,k),prs(i,j,k), & @@ -1769,8 +1784,11 @@ end subroutine bakupfile subroutine writeflfed(timerept) ! use commvar, only: time,nstep,filenumb,fnumslic,num_species,im,jm, & - km,lwsequ,turbmode,feqwsequ,force,ymin,ymax + km,lwsequ,turbmode,feqwsequ,force,ymin,ymax,realgas use commarray,only : x,rho,vel,prs,tmp,spc,q,ssf,lshock,crinod +#ifdef TTP + use commarray,only : tve +#endif use models, only : tke,omg,miut use statistic,only : nsamples,liosta,massflux,massflux_target use bc, only : ninflowslice @@ -1822,6 +1840,11 @@ subroutine writeflfed(timerept) call h5write(varname='u3',var=vel(0:im,0:jm,0:km,3),mode=iomode) call h5write(varname='p', var=prs(0:im,0:jm,0:km), mode=iomode) call h5write(varname='t', var=tmp(0:im,0:jm,0:km), mode=iomode) +#ifdef TTP + if(trim(realgas)=='twotemp') then + call h5write(varname='tve', var=tve(0:im,0:jm,0:km), mode=iomode) + endif +#endif if(num_species>0) then do jsp=1,num_species write(spname,'(i3.3)')jsp @@ -2486,8 +2509,11 @@ subroutine writeslice(subtime) ! use parallel, only: irk_islice,jrk_jslice,krk_kslice,mpi_islice, & mpi_jslice,mpi_kslice - use commvar, only: fnumslic,nstep,time,islice,jslice,kslice,im,jm,km + use commvar, only: fnumslic,nstep,time,islice,jslice,kslice,im,jm,km,realgas use commarray,only: rho,vel,prs,tmp,dvel,dtmp +#ifdef TTP + use commarray,only : tve +#endif use hdf5io ! ! arguments @@ -2522,6 +2548,11 @@ subroutine writeslice(subtime) call h5write(varname='u3',var=vel(i,0:jm,0:km,3),dir='i') call h5write(varname='p', var=prs(i,0:jm,0:km) ,dir='i') call h5write(varname='t', var=tmp(i,0:jm,0:km) ,dir='i') +#ifdef TTP + if(trim(realgas)=='twotemp') then + call h5write(varname='tve', var=tve(0:im,0:jm,0:km), mode=iomode) + endif +#endif ! call h5write(varname='dudx',var=dvel(i,0:jm,0:km,1,1),dir='i') call h5write(varname='dudy',var=dvel(i,0:jm,0:km,1,2),dir='i') @@ -2605,6 +2636,11 @@ subroutine writeslice(subtime) call h5write(varname='u3',var=vel(0:im,0:jm,k,3),dir='k') call h5write(varname='p', var=prs(0:im,0:jm,k) ,dir='k') call h5write(varname='t', var=tmp(0:im,0:jm,k) ,dir='k') +#ifdef TTP + if(trim(realgas)=='twotemp') then + call h5write(varname='tve', var=tve(0:im,0:jm,0:km), mode=iomode) + endif +#endif ! call h5write(varname='dudx',var=dvel(0:im,0:jm,k,1,1),dir='k') call h5write(varname='dudy',var=dvel(0:im,0:jm,k,1,2),dir='k') diff --git a/src/solver.F90 b/src/solver.F90 index 56e61c7..d5da99b 100644 --- a/src/solver.F90 +++ b/src/solver.F90 @@ -185,7 +185,7 @@ subroutine rhscal(timerept) ! use commarray, only : qrhs,x,q use commvar, only : flowtype,conschm,diffterm,im,jm, & - recon_schem,limmbou,lchardecomp,lihomo + recon_schem,limmbou,lchardecomp,lihomo,realgas use commcal, only : ShockSolid,ducrossensor use comsolver, only : gradcal use userdefine,only : udf_src @@ -256,6 +256,11 @@ subroutine rhscal(timerept) ! #ifdef COMB call srccomb(timerept=ltimrpt) +#endif +#ifdef TTP + if(trim(realgas)=='twotemp') then + call srcttp(timerept=ltimrpt) + endif #endif ! if(present(timerept) .and. timerept) then @@ -536,6 +541,67 @@ subroutine srccomb(timerept) endif ! end subroutine srccomb +#endif + !+-------------------------------------------------------------------+ + !| This subroutine add a source term to the rhs of the equation to | + !| calculate source for two-temperature model. | + !+-------------------------------------------------------------------+ + !| CHANGE RECORD | + !| ------------- | + !| 13-02-2021: Created by J. Fang @ STFC Daresbury Laboratory | + !+-------------------------------------------------------------------+ +#ifdef TTP + subroutine srcttp(timerept) + ! + use commvar, only : im,jm,km,PRSATM,N2N2a,N2N2b,R_N2,M_N2,Na + use commarray,only : rho,tmp,jacob,Ev,tve,prs,Evrhs,q + use parallel, only : ptime + use fludyna, only : fvar2q + ! + ! arguments + logical,intent(in),optional :: timerept + ! + ! local data + integer :: i,j,k + real(8) :: time_beg + real(8),save :: subtime=0.d0 + ! + real(8) :: Eb(0:im,0:jm,0:km),tmw(0:im,0:jm,0:km),tc(0:im,0:jm,0:km),t(0:im,0:jm,0:km) + ! + if(present(timerept) .and. timerept) time_beg=ptime() + ! + + call fvar2q(Ev(0:im,0:jm,0:km), & + rho(0:im,0:jm,0:km), & + tve(0:im,0:jm,0:km) ) + + call fvar2q(Eb(0:im,0:jm,0:km), & + rho(0:im,0:jm,0:km), & + tmp(0:im,0:jm,0:km) ) + + + + tmw(0:im,0:jm,0:km)=prs(0:im,0:jm,0:km)/PRSATM*exp(N2N2a*(tmp(0:im,0:jm,0:km)**(-1d0/3d0)-N2N2b)-18.42d0) + + tc(0:im,0:jm,0:km)=tmp(0:im,0:jm,0:km)**(2d0)/(sqrt(8.d0*R_N2*tmp(0:im,0:jm,0:km)/pi)* & + rho(0:im,0:jm,0:km)/M_N2*Na* & + 3.d-21*(50000.d0)**2d0) + + t(0:im,0:jm,0:km)=tmw(0:im,0:jm,0:km)+tc(0:im,0:jm,0:km) + + Evrhs(0:im,0:jm,0:km)=(Eb(0:im,0:jm,0:km)-Ev(0:im,0:jm,0:km))/t(0:im,0:jm,0:km)*jacob(0:im,0:jm,0:km) + + + if(present(timerept) .and. timerept) then + ! + subtime=subtime+ptime()-time_beg + ! + if(lio .and. lreport .and. ltimrpt) call timereporter(routine='srcttp', & + timecost=subtime, & + message='SRC term for two-temperature model') + endif + ! + end subroutine srcttp #endif !+-------------------------------------------------------------------+ !| this subroutine is to solve the convectional term with upwind |