Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update inclusion benchmark #788

Merged
merged 2 commits into from May 20, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions benchmark/inclusion/adaptive.prm
Expand Up @@ -8,7 +8,7 @@ set Dimension = 2
set Start time = 0
set End time = 0

set Output directory = output
set Output directory = output/adaptive

set Pressure normalization = volume
set Nonlinear solver scheme = Stokes only
Expand Down Expand Up @@ -42,6 +42,8 @@ subsection Material model
subsection Inclusion
set Viscosity jump = 1e3
end

set Material averaging = none
end


Expand Down Expand Up @@ -73,7 +75,7 @@ end

subsection Mesh refinement
set Initial adaptive refinement = 13
set Initial global refinement = 3
set Initial global refinement = 4

set Strategy = velocity#viscosity
set Run postprocessors on initial refinement = true
Expand Down
4 changes: 3 additions & 1 deletion benchmark/inclusion/global.prm.base
Expand Up @@ -8,7 +8,7 @@ set Dimension = 2
set Start time = 0
set End time = 0

set Output directory = output
set Output directory = output/global

set Pressure normalization = volume
set Nonlinear solver scheme = Stokes only
Expand Down Expand Up @@ -42,6 +42,8 @@ subsection Material model
subsection Inclusion
set Viscosity jump = 1e3
end

set Material averaging = none
end


Expand Down
7 changes: 5 additions & 2 deletions benchmark/inclusion/inclusion.cc
Expand Up @@ -513,13 +513,16 @@ namespace aspect
VectorTools::L2_norm,
&comp_p);

unsigned int n = this->get_solution().block(0).size() +
this->get_solution().block(1).size();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to use introspection.block_indices.pressure (and the same for the velocity) instead of just 0 and 1 here. Also, if the direct solver is used, pressure and velocity are in the same block, and then the numbers 0 and 1 are suddenly not correct any more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

std::ostringstream os;
os << std::scientific << cellwise_errors_u.l1_norm()
os << n << "; "
<< std::scientific << cellwise_errors_u.l1_norm()
<< ", " << cellwise_errors_p.l1_norm()
<< ", " << cellwise_errors_ul2.l2_norm()
<< ", " << cellwise_errors_pl2.l2_norm();

return std::make_pair("Errors u_L1, p_L1, u_L2, p_L2:", os.str());
return std::make_pair("DoFs; Errors u_L1, p_L1, u_L2, p_L2:", os.str());
}

}
Expand Down
11 changes: 7 additions & 4 deletions benchmark/inclusion/run.sh
@@ -1,17 +1,20 @@
#!/bin/bash

# global refinement:
for r in "3" "4" "5" "6" "7" "8"
echo "--Global Refinement--"
for r in "4" "5" "6" "7" "8" "9"
do
echo "ref $r:"
cp global.prm.base temp.prm
echo "subsection Mesh refinement" >>temp.prm
echo "set Output directory = output/global/ref$r" >> temp.prm
echo "subsection Mesh refinement" >> temp.prm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really want to run your model for different averaging algorithms (as your description of the pull request implies), this is the place where it should go.
You can do another loop (over whatever averaging operations you want to include here)

for avg in "none" "arithmetic average" "geometric average" "harmonic average" "pick largest" "project to Q1"
do
... (the stuff you already have)
echo "subsection Material model" >>temp.prm
echo "set Material averaging = $avg" >> temp.prm
echo "end" >> temp.prm

And then this will be changed automatically in the input file. And then you don't even need the line 'set Material averaging = none' in the input file you added above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, @bjs2 can you add that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can do that.

echo "set Initial global refinement = $r" >> temp.prm
echo "end" >> temp.prm
./aspect temp.prm | grep Error
./aspect temp.prm | grep DoFs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the output is just the number of DoFs instead of the error, but I think you want both, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. We print dofs and error on the same line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sure, I didn't think about that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tjhei Do you think it would be better to print the DoFs and errors on separate lines? It could make the readability better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having everything in one line is very convenient (copy&paste into a spreadsheet etc).

rm -f temp.prm
done


# adaptive refinement:
./aspect adaptive.prm | egrep "freedom|Error"
echo "--Adaptive Refinement--"
./aspect adaptive.prm | grep DoFs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.