Recap¶
Consider the linear-quadratic optimal control problem
subject to the state equation
with suitable boundary conditions.
The three unknowns are:
: the state;
: the adjoint;
: the control.
The code assembles and solves the all-at-once KKT system for . In block form, the discrete system is
Here:
is the discretization of diffusion-reaction-transport;
is the state mass matrix;
is the control mass matrix;
is the regularization parameter.
The goal of the laboratory is to understand, by computation, how the solution changes when we modify:
the regularization parameter ;
the PDE coefficients ;
the regularity of the desired state .
Compile and Run¶
Assume deal.II is already installed and visible to CMake.
From the directory
cd codes/dealiiconfigure and compile with
cmake -S . -B build
cmake --build build --target kkt_2d.gThis creates the executable
./build/kkt_2d.gYou can also build the non-debug target with
cmake --build build --target kkt_2dParameter File¶
The executable reads a parameter file of the form
./build/kkt_2d.g kkt.prmIf kkt.prm does not exist, the executable stops and writes a default one for you.
So the standard workflow is:
./build/kkt_2d.g
./build/kkt_2d.g kkt.prmThen modify kkt.prm and run again.
The most important entries are:
RegularizationState degreeControl degreeContinuous controlGrid generator argumentsDiffusion coefficient / Function expressionReaction coefficient / Function expressionTransport field / Function expressionDesired state / Function expression
After each run, the code writes a .vtu file that can be visualized with ParaView.
What To Look At¶
For every experiment, inspect:
stateadjointcontroldesired_state
and answer the same three questions:
How well does the state track the desired state?
How large or oscillatory is the control?
Which feature of the PDE explains what you see?
Exercise 1: Baseline Run¶
Run the default case.
Tasks:
Plot
state,control, anddesired_state.Describe where the state fails to match the desired state.
Explain why the control is not identically zero.
Question:
Why does a discontinuous target already suggest that exact tracking is difficult?
Exercise 2: Role of Regularization¶
Keep all PDE coefficients fixed and vary only the regularization parameter:
Tasks:
Compare the size of the control for the three runs.
Compare the quality of the tracking.
Decide which solution is the smoothest and which is the most aggressive.
Question:
What is the trade-off introduced by the term
Expected conclusion:
large penalizes the control more;
small improves tracking but produces a larger and less regular control.
Exercise 3: Diffusion¶
Keep and , and vary only the diffusion coefficient:
Tasks:
Compare the sharpness of the state profile.
Compare how difficult it is to reproduce the jump in
desired_state.Compare the amplitude of the control.
Question:
Why does increasing diffusion make the state smoother?
Expected conclusion:
Stronger diffusion damps sharp transitions, so the state cannot easily reproduce a target with jumps.
Exercise 4: Reaction¶
Fix diffusion and transport, and vary the reaction coefficient:
Tasks:
Compare the magnitude of the state.
Compare how much control is needed.
Compare the shape of the adjoint.
Question:
How does the reaction term change the local balance in the PDE?
Exercise 5: Transport¶
Fix diffusion and reaction, and vary the transport field.
Suggested choices:
Tasks:
Identify the preferred direction induced by the transport field.
Compare the displacement of the state relative to the target.
Describe how the control adapts to the flow.
Question:
What is the qualitative difference between diffusion-dominated behavior and transport-dominated behavior?
Exercise 6: Continuous vs Discontinuous Control¶
Repeat one of the previous experiments with:
Continuous control = false,Control degree = 0Continuous control = true,Control degree = 1
Tasks:
Compare the visual regularity of the control.
Compare the tracking quality.
Compare the number of control degrees of freedom.
Question:
What do you gain and what do you lose when you force the control to be continuous?
Exercise 7: Smooth Target vs Discontinuous Target¶
Compare two desired states:
a smooth target, for example
the discontinuous default target
Tasks:
Compare the quality of the tracking.
Compare the regularity of the control.
Compare where the largest mismatch occurs.
Question:
Which target is more compatible with the regularity naturally imposed by the PDE?
Exercise 8: Desired State Not in ¶
Focus on the discontinuous target.
Tasks:
Explain why the target has a jump.
Explain why such a function is not in .
Compare this fact with the regularity expected for the state variable.
Identify where the state smooths the jump.
Question:
Why should we expect the optimizer to approximate the target rather than reproduce it exactly?
Expected conclusion:
The state is constrained by an elliptic or transport-diffusion PDE and belongs to a smoother space than the discontinuous target. The optimal solution is therefore a compromise between:
fitting the target;
satisfying the PDE;
controlling the cost of the control.
What To Submit¶
For each exercise, include:
the parameter values used;
one plot of
state,control, anddesired_state;a short comment answering the question of the exercise.
In the final summary, explain in a few lines:
the role of regularization;
the effect of diffusion, reaction, and transport;
what changes when the desired state is not in .