Boundary Conditions
Fixed Boundary Mean
Including Edge Values
A fixed boundary condition sets the edge values before an aggregate is calculated.
Program
Play the program to choose the boundary value and recompute the field mean.
fixed_boundary_mean.f90
program fixed_boundary_mean_demo
implicit none
real :: field(5)
real :: boundary_value
real :: total
real :: mean_value
integer :: i
field = [0.0, 2.0, 4.0, 6.0, 0.0]
boundary_value =
field(1) = boundary_value
field(5) = boundary_value
total = 0.0
do i = 1, 5
total = total + field(i)
end do
mean_value = total / 5.0
print '(F0.1, 1X, F0.1)', boundary_value, mean_value
end program fixed_boundary_mean_demo
program fixed_boundary_mean_demo
implicit none
real :: field(5)
real :: boundary_value
real :: total
real :: mean_value
integer :: i
field = [0.0, 2.0, 4.0, 6.0, 0.0]
boundary_value =
field(1) = boundary_value
field(5) = boundary_value
total = 0.0
do i = 1, 5
total = total + field(i)
end do
mean_value = total / 5.0
print '(F0.1, 1X, F0.1)', boundary_value, mean_value
end program fixed_boundary_mean_demo
program fixed_boundary_mean_demo
implicit none
real :: field(5)
real :: boundary_value
real :: total
real :: mean_value
integer :: i
field = [0.0, 2.0, 4.0, 6.0, 0.0]
boundary_value =
field(1) = boundary_value
field(5) = boundary_value
total = 0.0
do i = 1, 5
total = total + field(i)
end do
mean_value = total / 5.0
print '(F0.1, 1X, F0.1)', boundary_value, mean_value
end program fixed_boundary_mean_demo
fixed boundary
The first and last field entries are assigned before the aggregate.
interior data
Interior values stay unchanged while boundary values vary.
aggregate effect
The mean includes both fixed boundary values and interior values.