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
New function for boundary composition #1703
New function for boundary composition #1703
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, please address the comments and add or modify a test to use this functionality
public: | ||
/** | ||
* Constructor. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this comment there is no constructor.
//Function<dim>::Function () | ||
// : | ||
// boundary_composition_function (1) | ||
//{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the commented lines
/** | ||
* A function object representing the composition. | ||
*/ | ||
Functions::ParsedFunction<dim> boundary_composition_function; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this variable is not used in the .cc file, you only use function. Please remove the variable and the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is needed for boundary_composition_function in the .cc file... (other comment below)
if (this->convert_output_to_years()) | ||
boundary_composition_function.set_time (this->get_time() / year_in_seconds); | ||
else | ||
boundary_composition_function.set_time (this->get_time()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to call this for the function object that you use in the boundary_composition
function, not this one one (which is not needed).
// yet. so get it from the parameter file directly. | ||
prm.enter_subsection ("Compositional fields"); | ||
const unsigned int n_compositional_fields = prm.get_integer ("Number of fields"); | ||
prm.leave_subsection (); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace this the same way you did in your other pull request. Also remove the outdated comment above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one may not be quite so outdated. It fails if not in place.
Also add an entry to doc/modules/changes/ |
80f9c14
to
a016bc3
Compare
Updated |
a016bc3
to
eb38b04
Compare
Updated to not break tests |
double | ||
Function<dim>:: | ||
boundary_composition (const types::boundary_id /*boundary_indicator*/, | ||
const Point<dim> &position, const unsigned int n_comp) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please break arguments onto separate lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rename the last argument (also in the declaration, if applicable). The original declataion in the base class looks like this:
virtual
double
boundary_composition (const types::boundary_id boundary_indicator,
const Point<dim> &position,
const unsigned int compositional_field) const;
"parameter is non-zero, which is interpreted to " | ||
"be the depth of the point."); | ||
|
||
Functions::ParsedFunction<dim>::declare_parameters (prm, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is wrong -- it will only work for a single compositional field. but you want this to work also for multiple fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the function.cc in the initial_composition has the same line, not sure why it works. When I use this ->... in Functions::ParsedFunction::declare_parameters (prm, 1); I receive 'this is unavailable for static member functions'
|
||
try | ||
{ | ||
function.reset (new Functions::ParsedFunction<dim>(this->n_compositional_fields())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...because here you are creating a function of multiple arguments.
"post-processing, this boundary composition model " | ||
"must therefore be told what the minimal and " | ||
"maximal values on the boundary are. This is done " | ||
"using parameters set in section ``Boundary composition model/Initial composition''." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break long line
@@ -26,9 +26,6 @@ namespace aspect | |||
{ | |||
namespace InitialComposition | |||
{ | |||
// template <int dim> | |||
// Function<dim>::Function () | |||
// {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch -- this could have been a separate pull request, by the way. the change is conceptually independent, and it is easier to review independent things independently
subsection Function | ||
set Variable names = x, y | ||
set Coordinate system = cartesian | ||
set Function expression = if(y<0.2, 1, 0) ; if(y>0.5, 1, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work? I thought you declared parameters for a scalar function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea why it works, but it seems to do so.
|
||
subsection Mesh refinement | ||
set Initial adaptive refinement = 0 | ||
set Initial global refinement = 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a lot of refinement, and consequently a lot of data that goes with the test. can you reduce this number? To verify the correctness of your class, you don't actually need a very fine mesh :-)
eb38b04
to
457ec7c
Compare
Some changes made. Some not... |
457ec7c
to
b6c063e
Compare
Fixed with astyle |
Did you talk to @bangerth about the function arguments? |
Also please run astyle |
One tester timed out. Let us postpone this till we're all home again. If something works but we don't understand why or how, then that would suggest that we need to work a bit harder to convince ourselves that this is correct. |
@mbweller please update master once and rebase this PR. We should have fixed the tester issues, and will then see which test causes the errors. |
/run-tests |
Hi Matt, |
Function added to boundary composition to allow for variable compositions to placed with user defined coordinate systems. Boundary composition is now consistent with Boundary: Temperature, Velocity, and traction.