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 --- README | 18 +++++++ interface.ccl | 6 +++ param.ccl | 46 ++++++++++++++++++ schedule.ccl | 9 ++++ src/CheckParameters.F77 | 52 +++++++++++++++++++++ src/InitialData.F77 | 122 ++++++++++++++++++++++++++++++++++++++++++++++++ src/make.code.defn | 9 ++++ 7 files changed, 262 insertions(+) create mode 100644 README create mode 100644 interface.ccl create mode 100644 param.ccl create mode 100644 schedule.ccl create mode 100644 src/CheckParameters.F77 create mode 100644 src/InitialData.F77 create mode 100644 src/make.code.defn diff --git a/README b/README new file mode 100644 index 0000000..f8b0a91 --- /dev/null +++ b/README @@ -0,0 +1,18 @@ +Cactus Code Thorn IDScalarWave +Authors : ... +CVS info : $Header$ +-------------------------------------------------------------------------- + +1. Purpose of the thorn + +This thorn does ... + +2. Dependencies of the thorn + +This thorn additionally requires implementations and thorns ... + +3. Thorn distribution + +This thorn is available to ... + +4. Additional information diff --git a/interface.ccl b/interface.ccl new file mode 100644 index 0000000..642766a --- /dev/null +++ b/interface.ccl @@ -0,0 +1,6 @@ +# Interface definition for thorn IDScalarWave +# $Header$ + +implements: idscalarwave +inherits: wavetoy grid +friend: wavetoy diff --git a/param.ccl b/param.ccl new file mode 100644 index 0000000..4dce0db --- /dev/null +++ b/param.ccl @@ -0,0 +1,46 @@ +# Parameter definitions for thorn IDScalarWave +# $Header$ + +shares: grid + +USES KEYWORD type "" +{ +} + +private: + +REAL radius "The radius of the gaussian wave" +{ + 0:* :: +} 0.0 + +REAL sigma "The sigma for the gaussian wave" +{ + 0:* :: +} 0.1 + +REAL kx "The wave number in the x-direction" +{ + *:* :: "No restriction" +} 4.0 +REAL ky "The wave number in the y-direction" +{ + *:* :: "No restriction" +} 0.0 +REAL kz "The wave number in the z-direction" +{ + *:* :: "No restriction" +} 0.0 + +REAL amplitude "The amplitude of the waves" +{ + *:* :: "No restriction" +} 1.0 + +KEYWORD initial_data "Type of initial data" +{ + "plane" :: "Plane wave" + "gaussian" :: "Gaussian wave" + "box" :: "Box wave" +} "gaussian" + diff --git a/schedule.ccl b/schedule.ccl new file mode 100644 index 0000000..584aa4e --- /dev/null +++ b/schedule.ccl @@ -0,0 +1,9 @@ +# Schedule definitions for thorn IDScalarWave +# $Header$ + +schedule IDScalarWave_InitialData at CCTK_INITIAL after WaveToyF77_Initial +{ + STORAGE: wavetoy::scalarevolve,wavetoy::scalarold + COMMUNICATION: wavetoy::scalarevolve + LANG: Fortran +} "Initial data for 3D wave equation" 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