Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MostafaMollaali
dynamic
Commits
2d78c55d
Commit
2d78c55d
authored
7 years ago
by
wenqing
Browse files
Options
Downloads
Patches
Plain Diff
[dt] Fixed a bug in time stepper when non-linear solver is rejected
parent
3c9cf53f
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
ProcessLib/UncoupledProcessesTimeLoop.cpp
+21
-22
21 additions, 22 deletions
ProcessLib/UncoupledProcessesTimeLoop.cpp
with
21 additions
and
22 deletions
ProcessLib/UncoupledProcessesTimeLoop.cpp
+
21
−
22
View file @
2d78c55d
...
...
@@ -126,6 +126,7 @@ struct SingleProcessData
//! other members of this struct to their concrety types.
NumLib
::
NonlinearSolverTag
const
nonlinear_solver_tag
;
NumLib
::
NonlinearSolverBase
&
nonlinear_solver
;
bool
nonlinear_solver_converged
;
std
::
unique_ptr
<
NumLib
::
ConvergenceCriterion
>
conv_crit
;
std
::
unique_ptr
<
NumLib
::
TimeDiscretization
>
time_disc
;
...
...
@@ -152,6 +153,7 @@ SingleProcessData::SingleProcessData(
:
timestepper
(
std
::
move
(
timestepper_
)),
nonlinear_solver_tag
(
NLTag
),
nonlinear_solver
(
nonlinear_solver
),
nonlinear_solver_converged
(
true
),
conv_crit
(
std
::
move
(
conv_crit_
)),
time_disc
(
std
::
move
(
time_disc_
)),
process
(
process_
),
...
...
@@ -164,6 +166,7 @@ SingleProcessData::SingleProcessData(SingleProcessData&& spd)
:
timestepper
(
std
::
move
(
spd
.
timestepper
)),
nonlinear_solver_tag
(
spd
.
nonlinear_solver_tag
),
nonlinear_solver
(
spd
.
nonlinear_solver
),
nonlinear_solver_converged
(
spd
.
nonlinear_solver_converged
),
conv_crit
(
std
::
move
(
spd
.
conv_crit
)),
time_disc
(
std
::
move
(
spd
.
time_disc
)),
tdisc_ode_sys
(
std
::
move
(
spd
.
tdisc_ode_sys
)),
...
...
@@ -572,6 +575,7 @@ double UncoupledProcessesTimeLoop::computeTimeStepping(
:
time_disc
->
getRelativeChangeFromPreviousTimestep
(
x
,
norm_type
))
:
0.
;
if
(
!
timestepper
->
next
(
solution_error
)
&&
// In case of FixedTimeStepping, which makes timestepper->next(...)
// return false when the ending time is reached.
...
...
@@ -581,6 +585,12 @@ double UncoupledProcessesTimeLoop::computeTimeStepping(
all_process_steps_accepted
=
false
;
}
if
(
!
ppd
.
nonlinear_solver_converged
)
{
WARN
(
"Time step will be rejected due to nonlinear solver diverged"
);
all_process_steps_accepted
=
false
;
}
if
(
timestepper
->
getTimeStep
().
dt
()
>
std
::
numeric_limits
<
double
>::
min
()
||
std
::
abs
(
t
-
timestepper
->
end
())
<
...
...
@@ -658,15 +668,16 @@ double UncoupledProcessesTimeLoop::computeTimeStepping(
}
else
{
if
(
std
::
abs
(
dt
-
prev_dt
)
<
std
::
numeric_limits
<
double
>::
min
()
&&
_last_step_rejected
)
if
(
std
::
abs
(
dt
-
prev_dt
)
<
std
::
numeric_limits
<
double
>::
min
()
&&
_last_step_rejected
)
{
OGS_FATAL
(
"
\t
This time step is rejected and the new computed"
" step size is the same as
\n
"
"
\t
that was just used.
\n
"
"
\t
Suggest to adjust the parameters of the time"
" stepper or try other time stepper.
\n
"
"
\t
The program stops"
);
OGS_FATAL
(
"
\t
This time step is rejected and the new computed"
" step size is the same as
\n
"
"
\t
that was just used.
\n
"
"
\t
Suggest to adjust the parameters of the time"
" stepper or try other time stepper.
\n
"
"
\t
The program stops"
);
}
if
(
t
<
_end_time
)
...
...
@@ -769,20 +780,6 @@ bool UncoupledProcessesTimeLoop::loop()
INFO
(
"[time] Time step #%u took %g s."
,
timesteps
,
time_timestep
.
elapsed
());
if
(
!
nonlinear_solver_succeeded
)
{
WARN
(
"Time step %d is rejected due to "
"the divergence of the non-linear solver.
\n
"
"
\t
The time stepping steps back to the previous time
\n
"
"
\t
and starts again with the half of the current step size."
,
timesteps
);
t
-=
prev_dt
;
dt
*=
0.5
;
rejected_steps
++
;
continue
;
}
dt
=
computeTimeStepping
(
prev_dt
,
t
,
accepted_steps
,
rejected_steps
);
if
(
t
+
dt
>
_end_time
||
...
...
@@ -855,6 +852,7 @@ bool UncoupledProcessesTimeLoop::solveUncoupledEquationSystems(
const
auto
nonlinear_solver_succeeded
=
solveOneTimeStepOneProcess
(
x
,
timestep_id
,
t
,
dt
,
*
spd
,
void_staggered_coupling_term
,
*
_output
);
spd
->
nonlinear_solver_converged
=
nonlinear_solver_succeeded
;
pcs
.
postTimestep
(
x
);
pcs
.
computeSecondaryVariable
(
t
,
x
,
void_staggered_coupling_term
);
...
...
@@ -933,6 +931,7 @@ bool UncoupledProcessesTimeLoop::solveCoupledEquationSystemsByStaggeredScheme(
const
auto
nonlinear_solver_succeeded
=
solveOneTimeStepOneProcess
(
x
,
timestep_id
,
t
,
dt
,
*
spd
,
coupling_term
,
*
_output
);
spd
->
nonlinear_solver_converged
=
nonlinear_solver_succeeded
;
INFO
(
"[time] Solving process #%u took %g s in time step #%u "
...
...
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