Skip to content

Commit

Permalink
Merge pull request #285 from xcompact3d/feature-mhd
Browse files Browse the repository at this point in the history
Add MHD capabilities and update some testing input files
  • Loading branch information
slaizet committed Sep 4, 2024
2 parents 9635a91 + c3050b7 commit 5565268
Show file tree
Hide file tree
Showing 44 changed files with 1,432 additions and 22,387 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ cnu = 0.44 ! Ratio between hypervisvosity at k_m=2/3pi and k_c= pi

! Basic I/O
irestart = 0 ! Read initial flow field ?
icheckpoint = 10000 ! Frequency for writing backup file
ioutput = 100 ! Frequency for visualization
icheckpoint = 100 ! Frequency for writing backup file
ioutput = 50 ! Frequency for visualization
nvisu = 1 ! Size for visualisation collection
ilist = 50 ! Frequency for writing on screen

Expand All @@ -93,7 +93,7 @@ ilist = 50 ! Frequency for writing on screen
wrotation = 0.12 ! rotation speed to trigger turbulence
spinup_time = 0 !10000 ! number of time steps with a rotation to trigger turbulence
nstat = 1 ! Size arrays for statistic collection
initstat = 25000 ! Time steps after which statistics are collected
initstat = 50 ! Time steps after which statistics are collected

/End

Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (${BUILD_TESTING_FULL})
endif()
add_subdirectory(Gravity-current)
add_subdirectory(Mixing-layer)
add_subdirectory(OTV-Ozage-Tang-vortex-2D)
add_subdirectory(MHD)
add_subdirectory(TBL-Turbulent-Boundary-Layer)
add_subdirectory(Wind-Turbine/NREL-5MW_ALM)
endif (${BUILD_TESTING_FULL})
File renamed without changes.
6 changes: 3 additions & 3 deletions examples/Cavity/input_test.i3d
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ cnu = 0.44 ! Ratio between hypervisvosity at k_m=2/3pi and k_c= pi

! Basic I/O
irestart = 0 ! Read initial flow field ?
icheckpoint = 400000 ! Frequency for writing backup file
ioutput = 500 ! Frequency for visualization
icheckpoint = 100 ! Frequency for writing backup file
ioutput = 50 ! Frequency for visualization
ilist = 25 ! Frequency for writing to screen
nvisu = 1 ! Size for visualisation collection
nprobes = 1 ! Number of probes
Expand All @@ -85,7 +85,7 @@ nprobes = 1 ! Number of probes
!=================

nstat = 1 ! Size arrays for statistic collection
initstat = 300000 ! Time steps after which statistics are collected
initstat = 50 ! Time steps after which statistics are collected

/End

Expand Down
6 changes: 3 additions & 3 deletions examples/Channel/input_test_x.i3d
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ cnu = 0.44 ! Ratio between hypervisvosity at k_m=2/3pi and k_c= pi

! Basic I/O
irestart = 0 ! Read initial flow field ?
icheckpoint = 5000 ! Frequency for writing backup file
ioutput = 100 ! Frequency for visualization
icheckpoint = 100 ! Frequency for writing backup file
ioutput = 50 ! Frequency for visualization
ilist = 25 ! Frequency for the output to screen
nvisu = 1 ! Size for visualisation collection

Expand All @@ -93,7 +93,7 @@ nvisu = 1 ! Size for visualisation collection
wrotation = 0.12 ! rotation speed to trigger turbulence
spinup_time = 5000 ! number of time steps with a rotation to trigger turbulence
nstat = 1 ! Size arrays for statistic collection
initstat = 40000 ! Time steps after which statistics are collected
initstat = 50 ! Time steps after which statistics are collected

/End

Expand Down
6 changes: 3 additions & 3 deletions examples/Channel/input_test_z.i3d
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ cnu = 0.44 ! Ratio between hypervisvosity at k_m=2/3pi and k_c= pi

! Basic I/O
irestart = 0 ! Read initial flow field ?
icheckpoint = 5000 ! Frequency for writing backup file
ioutput = 100 ! Frequency for visualization
icheckpoint = 100 ! Frequency for writing backup file
ioutput = 50 ! Frequency for visualization
ilist = 25 ! Frequency for the output to screen
nvisu = 1 ! Size for visualisation collection

Expand All @@ -93,7 +93,7 @@ nvisu = 1 ! Size for visualisation collection
wrotation = 0.12 ! rotation speed to trigger turbulence
spinup_time = 5000 ! number of time steps with a rotation to trigger turbulence
nstat = 1 ! Size arrays for statistic collection
initstat = 40000 ! Time steps after which statistics are collected
initstat = 50 ! Time steps after which statistics are collected

/End

Expand Down
6 changes: 3 additions & 3 deletions examples/Cylinder-wake/input_test.i3d
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ itimescheme = 3 ! Time integration scheme (1->Euler,2->AB2, 3->AB3, 4->AB4

! Basic I/O
irestart = 0 ! Read initial flow field ?
icheckpoint = 10000 ! Frequency for writing backup file
ioutput = 100 ! Frequency for visualization
icheckpoint = 100 ! Frequency for writing backup file
ioutput = 50 ! Frequency for visualization
ilist = 25 ! Frequency for the output to screen
nvisu = 1 ! Size for visualisation collection

Expand All @@ -84,7 +84,7 @@ nvisu = 1 ! Size for visualisation collection
!=================

nstat = 1 ! Size arrays for statistic collection
initstat = 10000 ! Time steps after which statistics are collected
initstat = 50 ! Time steps after which statistics are collected

/End

Expand Down
6 changes: 3 additions & 3 deletions examples/Cylinder-wake/input_test_moving.i3d
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ itimescheme = 2 ! Time integration scheme (1->Euler,2->AB2, 3->AB3, 4->AB4

! Basic I/O
irestart = 0 ! Read initial flow field ?
icheckpoint = 10000 ! Frequency for writing backup file
ioutput = 100 ! Frequency for visualization
icheckpoint = 100 ! Frequency for writing backup file
ioutput = 50 ! Frequency for visualization
ilist = 25 ! Frequency for the output to screen
nvisu = 1 ! Size for visualisation collection

Expand All @@ -84,7 +84,7 @@ nvisu = 1 ! Size for visualisation collection
!=================

nstat = 1 ! Size arrays for statistic collection
initstat = 15000 ! Time steps after which statistics are collected
initstat = 50 ! Time steps after which statistics are collected

/End

Expand Down
8 changes: 8 additions & 0 deletions examples/Gravity-current/adios2_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,12 @@
<parameter key="ProfileUnits" value="Milliseconds"/>
</transport>
</io>
<io name="BC-lock-exchange-io">
<engine type="BP4">
</engine>
<transport type="File">
<parameter key="Library" value="fstream"/>
<parameter key="ProfileUnits" value="Milliseconds"/>
</transport>
</io>
</adios-config>
4 changes: 2 additions & 2 deletions examples/Gravity-current/input_test.i3d
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ cnu = 0.44 ! Ratio between hypervisvosity at k_m=2/3pi and k_c= pi

! Basic I/O
irestart = 0 ! Read initial flow field ?
icheckpoint = 5000 ! Frequency for writing backup file
ioutput = 500 ! Frequency for visualization
icheckpoint = 500 ! Frequency for writing backup file
ioutput = 250 ! Frequency for visualization
ilist = 25 ! Frequency for writing on screen
nvisu = 1 ! Size for visualisation collection
iprocessing = 20
Expand Down
33 changes: 33 additions & 0 deletions examples/MHD/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# OTV-2D
set(case "OTV2D")
set(case_dir "${test_dir}/${case}")
file(MAKE_DIRECTORY ${case_dir})
set(input_file "input_otv_test.i3d")
install(DIRECTORY DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/${case})
install(FILES ${input_file} DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/${case})
if(ADIOS2_FOUND)
install(FILES adios2_config.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/${case})
endif()
# If testing active add test for OTV case
file(COPY ${input_file} DESTINATION ${case_dir})
if(ADIOS2_FOUND)
file(COPY adios2_config.xml DESTINATION ${case_dir})
endif()
add_test(NAME ${case} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} $<TARGET_FILE:xcompact3d> ${input_file} WORKING_DIRECTORY ${case_dir})

# MHDCHANNEL-2D
set(case "MHD-Channel-2D")
set(case_dir "${test_dir}/${case}")
file(MAKE_DIRECTORY ${case_dir})
set(input_file "input_mhdchan_test.i3d")
install(DIRECTORY DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/${case})
install(FILES ${input_file} DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/${case})
if(ADIOS2_FOUND)
install(FILES adios2_config.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/${case})
endif()
# If testing active add test for OTV case
file(COPY ${input_file} DESTINATION ${case_dir})
if(ADIOS2_FOUND)
file(COPY adios2_config.xml DESTINATION ${case_dir})
endif()
add_test(NAME ${case} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} $<TARGET_FILE:xcompact3d> ${input_file} WORKING_DIRECTORY ${case_dir})
51 changes: 51 additions & 0 deletions examples/MHD/adios2_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0"?>
<adios-config>
<io name="solution-io">
<engine type="BP4">
</engine>
<transport type="File">
<parameter key="Library" value="fstream"/>
<parameter key="ProfileUnits" value="Milliseconds"/>
</transport>
</io>
<io name="in-outflow-io">
<engine type="BP4">
</engine>
<transport type="File">
<parameter key="Library" value="fstream"/>
<parameter key="ProfileUnits" value="Milliseconds"/>
</transport>
</io>
<io name="turb-io">
<engine type="BP4">
</engine>
<transport type="File">
<parameter key="Library" value="fstream"/>
<parameter key="ProfileUnits" value="Milliseconds"/>
</transport>
</io>
<io name="restart-io">
<engine type="BP4">
</engine>
<transport type="File">
<parameter key="Library" value="fstream"/>
<parameter key="ProfileUnits" value="Milliseconds"/>
</transport>
</io>
<io name="statistics-io">
<engine type="BP4">
</engine>
<transport type="File">
<parameter key="Library" value="fstream"/>
<parameter key="ProfileUnits" value="Milliseconds"/>
</transport>
</io>
<io name="restart-forces-io">
<engine type="BP4">
</engine>
<transport type="File">
<parameter key="Library" value="fstream"/>
<parameter key="ProfileUnits" value="Milliseconds"/>
</transport>
</io>
</adios-config>
151 changes: 151 additions & 0 deletions examples/MHD/input_mhdchan.i3d
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
! -*- mode: f90 -*-

!===================
&BasicParam
!===================

! Flow type (1=Lock-exchange, 2=TGV, 3=Channel, 4=Periodic hill, 5=Cylinder, 6=dbg-schemes)
itype = 3

! Domain decomposition
p_row=0 ! Row partition
p_col=0 ! Column partition

! Mesh
nx=128 ! X-direction nodes
ny=129 ! Y-direction nodes
nz=128 ! Z-direction nodes
istret = 2 ! y mesh refinement (0:no, 1:center, 2:both sides, 3:bottom)
beta = 0.259065151 ! Refinement parameter (beta)

! Domain
xlx = 12.56637 ! Lx (Size of the box in x-direction)
yly = 2.0 ! Ly (Size of the box in y-direction)
zlz = 6.2831853 ! Lz (Size of the box in z-direction)

! Flow parameters
re = 3457.5 ! nu=1/re (Kinematic Viscosity)
cpg = F ! if cpg=T, then re is friction Reynolds number

! Time stepping
dt = 0.005 ! Time step
ifirst = 1 ! First iteration
ilast = 20 ! Last iteration

! Enable modelling tools
ilesmod=0 ! if 0 then DNS
numscalar = 0 ! How many scalars? (Set to zero to disable scalars)
iibm=0 ! Flag for immersed boundary method

! Boundary and initial conditions
iin = 4 ! Inflow conditions (1: classic, 2: turbinit, 4: SEM)
u1 = 1. ! u1 (max velocity) (for inflow condition)
u2 = 1. ! u2 (min velocity) (for inflow condition)
init_noise = 0.03 ! Turbulence intensity (1=100%) !! Initial condition
inflow_noise = 0.0 ! Turbulence intensity (1=100%) !! Inflow condition
idir_stream = 1 ! Index of the streamwise direction (1=X, 3=Z, 2 not available)

nclx1 = 0
nclxn = 0
ncly1 = 2
nclyn = 2
nclz1 = 0
nclzn = 0

mhd_active = .true.
/End

!====================
&NumOptions
!====================

! Spatial derivatives
ifirstder = 4 ! (1->2nd central, 2->4th central, 3->4th compact, 4-> 6th compact)
isecondder = 5 ! (1->2nd central, 2->4th central, 3->4th compact, 4-> 6th compact, 5->hyperviscous 6th)
ipinter = 3 ! interpolation scheme (1: classic, 2: optimized, 3: optimized agressive)

! Time scheme
iimplicit = 0
itimescheme = 5 ! Time integration scheme (1->Euler,2->AB2, 3->AB3, 4->AB4,5->RK3,6->RK4, 7-->CN2+AB3)

! Dissipation control
nu0nu = 4.0 ! Ratio between hyperviscosity/viscosity at nu
cnu = 0.44 ! Ratio between hypervisvosity at k_m=2/3pi and k_c= pi

/End

!=================
&InOutParam
!=================

! Basic I/O
irestart = 0 ! Read initial flow field
icheckpoint = 10000 ! Frequency for writing backup file
ioutput = 10000 ! Frequency for visualization
ilist = 100 ! Frequency for the output to screen
nvisu = 1 ! Size for visualisation collection

/End

!=================
&Statistics
!=================

wrotation = 0.d0 ! rotation speed to trigger turbulence
spinup_time = 0 ! number of time steps with a rotation to trigger turbulence
nstat = 1 ! Size arrays for statistic collection
initstat = 400000 ! Time steps after which statistics are collected

/End

!########################
! OPTIONAL PARAMETERS
!#######################

!================
&ScalarParam
!================

Sc(1) = 1.0 ! Schmidt number

nclxS1 = 0
nclxSn = 0
nclyS1 = 2
nclySn = 2
nclzS1 = 0
nclzSn = 0

/End

!====================
&MHDParam
!====================

mhd_equation = 'potential' ! MHD type of equation (potential or induction)
hartmann = 6.d0 ! Hartmann number (Ha) ratio of electromagnetic force to the viscous force (BLsqrt(sigma/nu))

/End

!================
&LESModel
!================

iles = 0 ! LES Model (1: Phys Smag, 2: Phys WALE, 3: Phys dyn. Smag, 4: iSVV, 5: dyn SEV)
smagcst = 0.14 ! Smagorinsky constant
walecst = 0.5 ! WALES Model Coefficient
iwall = 0 ! Enable wall modeling

/End

!================
&WallModel
!================

SmagWallDamp = 0 ! Smagorinsky damping function for ABL if 1

/End

&CASE
/End


Loading

0 comments on commit 5565268

Please sign in to comment.