From 1041dda7933e0f825f89b860624d38bdc111ab3d Mon Sep 17 00:00:00 2001 From: allen Date: Sat, 4 Sep 1999 11:04:43 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r2, which included commits to RCS files with non-trunk default branches. git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/IDScalarWave/trunk@3 f5a6acaf-da7d-456b-b0a8-35edbc60b392 --- src/CheckParameters.F77 | 52 +++++++++++++++++++++ src/InitialData.F77 | 122 ++++++++++++++++++++++++++++++++++++++++++++++++ src/make.code.defn | 9 ++++ 3 files changed, 183 insertions(+) create mode 100644 src/CheckParameters.F77 create mode 100644 src/InitialData.F77 create mode 100644 src/make.code.defn (limited to 'src') diff --git a/src/CheckParameters.F77 b/src/CheckParameters.F77 new file mode 100644 index 0000000..96e2d34 --- /dev/null +++ b/src/CheckParameters.F77 @@ -0,0 +1,52 @@ + /*@@ + @file CheckParameters.F77 + @date + @author Gabrielle Allen + @desc + Check parameters for the wave equation initial data + @enddesc + @@*/ + +#include "cctk.h" +#include "cctk_parameters.h" +#include "cctk_arguments.h" + + + /*@@ + @routine IDScalarWave_CheckParameters + @date + @author Gabrielle Allen + @desc + Check parameters for the wave equation initial data + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ + + subroutine IDScalarWave_CheckParameters(CCTK_FARGUMENTS) + + implicit none + + DECLARE_CCTK_FARGUMENTS + DECLARE_CCTK_PARAMETERS + + INTEGER CCTK_Equals + + if (CCTK_Equals(initial_data,"box").eq.1) then + + if (CCTK_Equals(type, "box").eq.0) then + call CCTK_PARAMWARN("Must have a box grid with box initial data") + end if + + if (kx.eq.0 .or. ky.eq.0 .or. kz.eq.0) then + call CCTK_PARAMWARN("Cannot have zero kx,ky,kz for box initial data") + end if + + end if + + return + end diff --git a/src/InitialData.F77 b/src/InitialData.F77 new file mode 100644 index 0000000..d33b56e --- /dev/null +++ b/src/InitialData.F77 @@ -0,0 +1,122 @@ + + /*@@ + @file InitialData.F77 + @date + @author Tom Goodale + @desc + Initial data for the 3D Wave Equation + @enddesc + @@*/ + +#include "cctk.h" +#include "cctk_parameters.h" +#include "cctk_arguments.h" + + + + /*@@ + @routine WaveToyF77_InitialData + @date + @author Tom Goodale + @desc + Set up initial data for the wave equation + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ + + subroutine IDScalarWave_InitialData(CCTK_FARGUMENTS) + + implicit none + + DECLARE_CCTK_FARGUMENTS + DECLARE_CCTK_PARAMETERS + + INTEGER CCTK_Equals + + INTEGER i,j,k + CCTK_REAL dt,omega, pi + CCTK_REAL dx,dy,dz + + pi = 4.0*atan(1.0) + +c Grid spacing shortcuts +c ---------------------- + dx = cctk_delta_space(1) + dy = cctk_delta_space(2) + dz = cctk_delta_space(3) + dt = cctk_delta_time + + omega = sqrt(kx**2+ky**2+kz**2) + + if (CCTK_Equals(initial_data,"plane").eq.1) then + + do k=1,cctk_lsh(3) + do j=1,cctk_lsh(2) + do i=1,cctk_lsh(1) + + phi(i,j,k) = amplitude*cos(kx*x(i,j,k)+ky*y(i,j,k) + & +kz*z(i,j,k)+omega*cctk_time) + phi_old(i,j,k) = amplitude*cos(kx*x(i,j,k)+ky*y(i,j,k) + & +kz*z(i,j,k)+omega*(cctk_time-dt)) + + end do + end do + end do + + else if (CCTK_Equals(initial_data,"gaussian").eq.1) then + + do k=1,cctk_lsh(3) + do j=1,cctk_lsh(2) + do i=1,cctk_lsh(1) + + phi(i,j,k) = amplitude*exp( -(sqrt(x(i,j,k)**2 + & +y(i,j,k)**2+z(i,j,k)**2)-radius)**2/sigma**2) + phi_old(i,j,k) = amplitude*exp( -(sqrt(x(i,j,k)**2 + & +y(i,j,k)**2+z(i,j,k)**2)-radius-dt)**2/sigma**2) + + end do + end do + end do + + else if (CCTK_Equals(initial_data, "box").eq.1) then + +c Use kx,ky,kz as number of modes in each direction. + + do k=1,cctk_lsh(3) + do j=1,cctk_lsh(2) + do i=1,cctk_lsh(1) + + phi(i,j,k) = amplitude*sin(kx*(x(i,j,k)-0.5)*pi)* + $ sin(ky*(y(i,j,k)-0.5)*pi)* + $ sin(kz*(z(i,j,k)-0.5)*pi)* + $ cos(omega*cctk_time*pi) + + phi_old(i,j,k)= amplitude*sin(kx*(x(i,j,k)-0.5)*pi)* + $ sin(ky*(y(i,j,k)-0.5)*pi)* + $ sin(kz*(z(i,j,k)-0.5)*pi)* + $ cos(omega*(cctk_time-dt)*pi) + + + end do + end do + end do + + end if + +c Apply symmetry boundary conditions +c ---------------------------------- + call ApplySymmetry(cctkGH,"wavetoy::scalarevolve") + +c Synchronise +c ----------- + call CCTK_SyncGroup(cctkGH,"wavetoy::scalarevolve") + + return + end + + diff --git a/src/make.code.defn b/src/make.code.defn new file mode 100644 index 0000000..2fabbf2 --- /dev/null +++ b/src/make.code.defn @@ -0,0 +1,9 @@ +# Main make.code.defn file for thorn IDScalarWave +# $Header$ + +# Source files in this directory +SRCS = InitialData.F77 CheckParameters.F77 + +# Subdirectories containing source files +SUBDIRS = + -- cgit v1.2.3