Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
e0039635
Commit
e0039635
authored
15 years ago
by
Emilie Marchandise
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
0d361fd0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Solver/TESTCASES/DamBreak.lua
+67
-0
67 additions, 0 deletions
Solver/TESTCASES/DamBreak.lua
with
67 additions
and
0 deletions
Solver/TESTCASES/DamBreak.lua
0 → 100644
+
67
−
0
View file @
e0039635
--[[
Function for initial conditions
--]]
function
initial_condition
(
xyz
,
f
)
for
i
=
0
,
xyz
:
size1
()
-
1
do
x
=
xyz
:
get
(
i
,
0
)
y
=
xyz
:
get
(
i
,
1
)
z
=
xyz
:
get
(
i
,
2
)
if
(
x
<
0
.
0
)
then
f
:
set
(
i
,
0
,
40
)
f
:
set
(
i
,
1
,
0
)
else
f
:
set
(
i
,
0
,
5
)
f
:
set
(
i
,
1
,
0
)
end
end
end
--[[
Example of a lua program driving the DG code
--]]
model
=
GModel
()
model
:
load
(
'edge.msh'
)
order
=
1
dimension
=
1
-- boundary condition
law
=
dgConservationLawShallowWater1d
()
law
:
addBoundaryCondition
(
'Left'
,
law
:
newBoundaryWall
())
law
:
addBoundaryCondition
(
'Right'
,
law
:
newBoundaryWall
())
groups
=
dgGroupCollection
(
model
,
dimension
,
order
)
groups
:
buildGroupsOfInterfaces
()
claw
=
dgConservationLawShallowWater1d
()
claw
:
addBoundaryCondition
(
'Wall'
,
law
:
newBoundaryWall
())
rk
=
dgRungeKutta
()
limiter
=
dgSlopeLimiter
(
law
)
rk
:
setLimiter
(
limiter
)
-- build solution vector
FS
=
functionLua
(
1
,
'initial_condition'
,
{
'XYZ'
}):
getName
()
solution
=
dgDofContainer
(
groups
,
law
:
getNbFields
())
solution
:
L2Projection
(
FS
)
print
'*** print initial sol ***'
solution
:
exportMsh
(
'output/init'
)
limiter
:
apply
(
solution
)
solution
:
exportMsh
(
'output/init_limit'
)
print
'*** solve ***'
--dt = 0.00001;
CFL
=
1
;
for
i
=
1
,
1000
do
dt
=
CFL
*
rk
:
computeInvSpectralRadius
(
law
,
solution
);
-- norm = rk:iterate44(law,dt,solution)
norm
=
rk
:
iterateEuler
(
law
,
dt
,
solution
)
if
(
i
%
20
==
0
)
then
print
(
'|ITER|'
,
i
,
'|NORM|'
,
norm
,
'|DT|'
,
dt
,
'|CPU|'
,
os.clock
()
-
x
)
end
if
(
i
%
20
==
0
)
then
solution
:
exportMsh
(
string.format
(
'output/solution-%06d'
,
i
))
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment