From 6512ea518931d1eb17d83b4c43e877925c6afd02 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Wed, 13 Jan 2010 09:20:28 +0000
Subject: [PATCH] test validation

---
 Solver/TESTCASES/validation/WavePulse.lua | 65 +++++++++++++++++++++++
 Solver/TESTCASES/validation/square.geo    | 15 ++++++
 2 files changed, 80 insertions(+)
 create mode 100644 Solver/TESTCASES/validation/WavePulse.lua
 create mode 100644 Solver/TESTCASES/validation/square.geo

diff --git a/Solver/TESTCASES/validation/WavePulse.lua b/Solver/TESTCASES/validation/WavePulse.lua
new file mode 100644
index 0000000000..b22218354a
--- /dev/null
+++ b/Solver/TESTCASES/validation/WavePulse.lua
@@ -0,0 +1,65 @@
+--[[ 
+     Function for initial conditions
+--]]
+function initial_condition( xyz , f )
+  for i=0,xyz:size1()-1 do
+    X = xyz:get(i,0) - .5
+    Y = xyz:get(i,1) - .5
+    Z = xyz:get(i,2)
+--    X2 = xyz:get(i,0) - 1.5
+--    Y2 = xyz:get(i,1) - .5
+--    Z2 = xyz:get(i,2)
+    VALUE = math.exp(-40*(X*X+Y*Y+Z*Z))
+-- + math.exp(-40*(X2*X2+Y2*Y2+Z2*Z2)); 
+    f:set(i,0,VALUE) 
+    f:set(i,1,0.0) 
+    f:set(i,2,0.0) 
+  end
+end
+
+print'*** Loading the mesh and the model ***'
+myModel   = GModel  ()
+--myModel:load('box.geo')
+--myModel:load('box.msh')
+--myModel:load('square_quads.msh')
+myModel:load('square.geo')
+myModel:load('test.msh')
+
+
+
+print'*** Create a dg solver ***'
+DG = dgSystemOfEquations (myModel)
+DG:setOrder(3)
+law=dgConservationLawWaveEquation(2)
+DG:setConservationLaw(law)
+law:addBoundaryCondition('Border',law:newBoundaryWall())
+DG:setup()
+
+initialCondition = functionLua(3,'initial_condition',{'XYZ'}):getName()
+
+print'*** setting the initial solution ***'
+
+DG:L2Projection(initialCondition)
+
+print'*** export ***'
+
+DG:exportSolution('output/solution_000')
+
+print'*** solve ***'
+
+N  = 100;
+CFL = 2.1;
+dt = CFL * DG:computeInvSpectralRadius();
+print('DT = ',dt)
+for i=1,N do
+--    norm = DG:multirateRK43(dt)
+    norm = DG:RK44(dt)
+    if (i % 100 == 0) then 
+      print('*** ITER ***',i,norm)
+      DG:exportSolution(string.format("output/solution-%04d", i)) 
+    end
+end
+
+print'*** done ***'
+
+
diff --git a/Solver/TESTCASES/validation/square.geo b/Solver/TESTCASES/validation/square.geo
new file mode 100644
index 0000000000..d2bd216e0f
--- /dev/null
+++ b/Solver/TESTCASES/validation/square.geo
@@ -0,0 +1,15 @@
+Point(1) = {0.0, 0.0, 0, .03};
+Point(2) = {1, 0.0, 0, .03};
+Point(3) = {1, 1, 0, .03};
+Point(4) = {0, 1, 0, .03};
+Line(1) = {4, 3};
+Line(2) = {3, 2};
+Line(3) = {2, 1};
+Line(4) = {1, 4};
+Line Loop(5) = {2, 3, 4, 1};
+Plane Surface(6) = {5};
+Physical Line("Border") = {1, 2, 3, 4};
+Physical Surface("Inside") = {6};
+Mesh.CharacteristicLengthExtendFromBoundary=1;
+//Transfinite Line {1, 2, 4, 3} = 2 Using Progression 1;
+//Transfinite Surface {6};
-- 
GitLab