Commit 3bafc50c authored by Paul Stryck's avatar Paul Stryck
Browse files

ex 1

parent e7f4b1bd
<?xml version="1.0"?>
<controls>
<general>
<name>Curved Channel Flow</name>
<description>FDS-Team</description>
<caseid>CFD2 Tutorial</caseid>
</general>
<grids>
<grid name="grid">
<fromFile>
<gridFilePath>../grids</gridFilePath>
<gridFileName>project1</gridFileName>
<restartFileName/>
<restartFilePath>.</restartFilePath>
</fromFile>
</grid>
</grids>
<timeLoop>
<unsteady>false</unsteady>
</timeLoop>
<outerLoop>
<maxIteration>10000</maxIteration>
<convergenceTolerance>1e-8</convergenceTolerance>
</outerLoop>
<equations>
<equation name="mome">
<EQMomentum>
<solve_z>false</solve_z>
<convectiveFluxDiscretisation>
<UD1_CD_BLEND>
<blendingFactor>0.5</blendingFactor>
</UD1_CD_BLEND>
</convectiveFluxDiscretisation>
<relaxationFactor>0.5</relaxationFactor>
</EQMomentum>
</equation>
<equation name="pres">
<EQPressure>
<!-- <pressureReferencePosition>-3.5 0.5 0.5</pressureReferencePosition> -->
<pressureReferencePosition>-5.5 5.0 0.5</pressureReferencePosition>
<pressureReference>1.e5</pressureReference>
<maxIteration>2000</maxIteration>
</EQPressure>
</equation>
<equation name="turb">
<EQTurbulence>
<turbulenceModel>KOMEGA_STANDARD</turbulenceModel>
</EQTurbulence>
</equation>
</equations>
<initial>
<velocity userCode="true"></velocity>
</initial>
<materials>
<backgroundMaterial>Air</backgroundMaterial>
<material>
<materialEntry name="Air">
<fluid>
<viscosityMolecular>1.8e-5</viscosityMolecular>
<density>1.2</density>
</fluid>
</materialEntry>
</material>
</materials>
<boundaries>
<family name="INLET">
<BCVelocity>
<velocity userCode="true"></velocity>
</BCVelocity>
</family>
<family name="OUTLET">
<BCOutflow/>
</family>
<family name="YMIN">
<BCWall>
<useWallFunction>LOW_RN</useWallFunction>
</BCWall>
</family>
<family name="YMAX">
<BCWall>
<useWallFunction>LOW_RN</useWallFunction>
</BCWall>
</family>
<family name="ZMIN">
<BCSymmetryPlane/>
</family>
<family name="ZMAX">
<BCSymmetryPlane/>
</family>
</boundaries>
<output>
<event name="default">
<saveTimeStep>1</saveTimeStep>
<forceGridWrite>true</forceGridWrite>
</event>
<event name="initial">
<filePrefix>initial</filePrefix>
<eventType>BEGIN_COMPUTATION</eventType>
<forceGridWrite>true</forceGridWrite>
</event>
</output>
</controls>
!***********************************************************************
!
! Hamburg Ship Model Basin (HSVA)
! TU Hamburg-Harburg (TUHH)
! Maritime Research Institute of Netherlands (MARIN)
!
! FreSCo
!
! $Id: post.F90 21 2005-06-08 12:50:20Z dieke $
!
! (c) 2004-2006 HSVA,TUHH,MARIN
! Proprietary data. Unauthorized use, distribution,
! or duplication is prohibited. All rights reserved.
!
!***********************************************************************
!
!! module post
! this module can be used to set up special post-processing routines. Use
! -post_outit to modyfy values in each outer iteration
! -post_timestep to modyfy values in each timesteo
! -post_final to set values after the solution
! algorithm is finished or stopped
!
!***********************************************************************
MODULE post
USE common_user_code
USE controls
USE equations
USE fielddata
USE fielddata_tools
USE fielddata_pointers
USE forces
USE geometry
USE logging
USE math
USE movegrid
USE parameters
USE topology
USE tracing
USE grids
USE parallel
USE counters
USE files
IMPLICIT NONE
PRIVATE
INTEGER :: unit_pressure
PUBLIC post_init_set_initial_fields_6,&
post_init_setup_lists_3,&
post_init_register_fields_4,&
post_init_after_grid_resize_5,&
post_timestep,&
post_outit,&
post_adoutit,&
post_final,&
post_exit_default_1
CONTAINS
!======================================================================
SUBROUTINE post_init_set_initial_fields_6
!=====================================================================
! use this to set initital values. To resolve dependencies between
! several *_inital modules this is called several times. Thus
! do not put ALLOCATE statements here.
!----------------------------------------------------------------------
CALL tracing_trace_begin(trace_post_init_set_initial_fields_6)
CALL tracing_trace_end(trace_post_init_set_initial_fields_6)
END SUBROUTINE post_init_set_initial_fields_6
!======================================================================
SUBROUTINE post_init_setup_lists_3
!======================================================================
! use this routine to set up linked lists, to get sizes or to allocate fields
!----------------------------------------------------------------------
CALL tracing_trace_begin(trace_post_init_setup_lists_3)
CALL files_register_file( fileBaseName = 'pressure',&
fileExtension = 'dat',&
timeStepFiles = .FALSE.,&
subDomainFiles = .FALSE.,&
appendOnRestart = .FALSE.,&
fileunit = unit_pressure)
CALL files_open_file(fileBaseName = 'pressure')
CALL tracing_trace_end(trace_post_init_setup_lists_3)
END SUBROUTINE post_init_setup_lists_3
!======================================================================
SUBROUTINE post_init_register_fields_4
!=====================================================================
! use *_init_register_fields_4 module for fielddata_init_register_fields_4,
! equation_system_register_equation_system ... statements
!----------------------------------------------------------------------
CALL tracing_trace_begin(trace_post_init_register_fields_4)
CALL tracing_trace_end(trace_post_init_register_fields_4)
END SUBROUTINE post_init_register_fields_4
!======================================================================
SUBROUTINE post_init_after_grid_resize_5
!=====================================================================
! use *_init_after_grid_resize_5 module for all *_get_pointer statements
!----------------------------------------------------------------------
CALL tracing_trace_begin(trace_post_init_after_grid_resize_5)
CALL tracing_trace_end(trace_post_init_after_grid_resize_5)
END SUBROUTINE post_init_after_grid_resize_5
!======================================================================
SUBROUTINE post_timestep(timestep,simultime)
!======================================================================
! this routine is executed after each timestep
!----------------------------------------------------------------------
IMPLICIT NONE
INTEGER :: timestep
REAL(dp) :: simultime
CALL tracing_trace_begin(trace_post_timestep)
timestep=timestep
simultime = simultime
CALL tracing_trace_end(trace_post_timestep)
END SUBROUTINE post_timestep
!======================================================================
SUBROUTINE post_outit(out_iter)
!======================================================================
! this routine is executed after each outer iteration
!----------------------------------------------------------------------
IMPLICIT NONE
INTEGER :: out_iter
INTEGER :: icell1, icell2, iface
REAL(dp) :: pressure1
REAL(dp) :: area1
REAL(dp) :: pressure2
REAL(dp) :: area2
REAL(dp) :: x1
REAL(dp) :: eps1
REAL(dp) :: y2
REAL(DP) :: eps2
CALL tracing_trace_begin(trace_post_outit)
out_iter = out_iter
x1 = 0
eps1 = 0.01
y2 = 0
eps2 = 0.01
pressure1 = 0
area1 = 0
pressure2 = 0
area2 = 0
! Interpolate pressure to the faces
p_f = fielddata_interpolate_f(p_c)
! Loop all boundary faces
DO iface = 1, nIntFaces
! Select Faces at the start of the curve
IF ( ABS(cent_f_3(iface,1) - x1) .LE. eps1 ) THEN
pressure1 = pressure1 + p_f(iface) * surf_f(iface)
area1 = area1 + surf_f(iface)
! Select Faces at the end of the curve
ELSE IF ( ABS(cent_f_3(iface,2) - y2) .LE. eps2 ) THEN
pressure2 = pressure2 + p_f(iface) * surf_f(iface)
area2 = area2 + surf_f(iface)
END IF
END DO
! Write pressures to file
WRITE(unit_pressure,*) out_iter, pressure1 / area1, pressure2 / area2
CALL tracing_trace_end(trace_post_outit)
END SUBROUTINE post_outit
!======================================================================
SUBROUTINE post_adoutit(adout_iter)
!======================================================================
! this routine is executed after each adjoint outer iteration
!----------------------------------------------------------------------
IMPLICIT NONE
INTEGER :: adout_iter
CALL tracing_trace_begin(trace_post_adoutit)
adout_iter = adout_iter
CALL tracing_trace_end(trace_post_adoutit)
END SUBROUTINE post_adoutit
!======================================================================
SUBROUTINE post_final
!======================================================================
! this routine is executed only once after the computation has stopped
! due to max no of iteration, truncation error or stopfile. It is not
! executed when killfile is used
!----------------------------------------------------------------------
CALL tracing_trace_begin(trace_post_final)
CALL tracing_trace_end(trace_post_final)
END SUBROUTINE post_final
!======================================================================
SUBROUTINE post_exit_default_1
!=====================================================================
! use *_exit_default_1 module for DEALLOCATE statements etc.
!----------------------------------------------------------------------
CALL tracing_trace_begin(trace_post_exit_default_1)
close(unit=400)
CALL tracing_trace_end(trace_post_exit_default_1)
END SUBROUTINE post_exit_default_1
END MODULE post
!***********************************************************************
!
! Hamburg Ship Model Basin (HSVA)
! TU Hamburg-Harburg (TUHH)
! Maritime Research Institute of Netherlands (MARIN)
!
! FreSCo
!
! $Id: set_phi.F90 21 2005-06-08 12:50:20Z dieke $
!
! (c) 2004-2006 HSVA,TUHH,MARIN
! Proprietary data. Unauthorized use, distribution,
! or duplication is prohibited. All rights reserved.
!
!***********************************************************************
!
!! module set_phi
! this module can be used to set user defined values. Use
! -set_phi_initial to set values before the solution
! algorithm starts
! -set_phi_outit to modify values in each outer iteration
! -set_phi_timestep to modify values in each timestep
!
!***********************************************************************
MODULE set_phi
USE controls
USE equations
USE fielddata
USE fielddata_pointers
USE fielddata_tools
USE forces
USE geometry
USE logging
USE math
USE movegrid
USE parameters
USE topology
USE tracing
USE common_user_code
USE grids
USE parallel
IMPLICIT NONE
PRIVATE
PUBLIC set_phi_init_set_initial_fields_6_900,&
set_phi_init_setup_lists_3,&
set_phi_init_register_fields_4,&
set_phi_init_after_grid_resize_5,&
set_phi_timestep,&
set_phi_outit,&
set_phi_adoutit,&
set_phi_final,&
set_phi_exit_default_1
CONTAINS
!======================================================================
SUBROUTINE set_phi_init_set_initial_fields_6_900
!=====================================================================
! use this to set initital values. To resolve dependencies between
! several *_inital modules this is called several times. Thus
! do not put ALLOCATE statements here.
!----------------------------------------------------------------------
INTEGER :: icell, iface ! Declare a Variable for all cells
REAL(dp) :: angle ! Angle of the channel behind the bend
REAL(dp) :: x_start_curve ! min x Coordinate of the curve
REAL(dp) :: y_end_curve ! min y Coordinate of the curve
REAL(dp) :: v_init ! initial Velocity
CALL tracing_trace_begin(trace_set_phi_init_set_initial_fields_6_900)
x_start_curve = 0.
v_init = 4.
angle = 30./180. * PI ! COS(...) SIN(...)
IF ( controls_initial%Velocity_userCode .AND. family_f(iface) ==
topology_get_ifamily(trim ("INLET")) )THEN
DO iface = nIntFaces+1 , nIntFaces + nBndFaces ! Loop all cell
icell = cell2_f(iface)
! Before the Bend
v_c_3(icell,1) = 1.2
v_c_3(icell,2) = 0.0
v_c_3(icell,3) = 0.0
! ELSE
! Behind the Bend
! v_c_3(icell,1) = ...
! v_c_3(icell,2) = ...
END DO
END IF
CALL tracing_trace_end(trace_set_phi_init_set_initial_fields_6_900)
END SUBROUTINE set_phi_init_set_initial_fields_6_900
!======================================================================
SUBROUTINE set_phi_init_setup_lists_3
!======================================================================
! use this routine to set up linked lists, to get sizes or to allocate fields
!----------------------------------------------------------------------
CALL tracing_trace_begin(trace_set_phi_init_setup_lists_3)
CALL tracing_trace_end(trace_set_phi_init_setup_lists_3)
END SUBROUTINE set_phi_init_setup_lists_3
!======================================================================
SUBROUTINE set_phi_init_register_fields_4
!=====================================================================
! use *_init_register_fields_4 module for fielddata_init_register_fields_4,
! equation_system_register_equation_system ... statements
!----------------------------------------------------------------------
CALL tracing_trace_begin(trace_set_phi_init_register_fields_4)
CALL tracing_trace_end(trace_set_phi_init_register_fields_4)