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

New function for boundary composition #1703

Closed

Conversation

mbweller
Copy link
Contributor

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.

Copy link
Member

@gassmoeller gassmoeller left a 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.
*/
Copy link
Member

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)
//{}
Copy link
Member

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;
Copy link
Member

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.

Copy link
Contributor Author

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());
Copy link
Member

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 ();
Copy link
Member

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.

Copy link
Contributor Author

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.

@gassmoeller
Copy link
Member

Also add an entry to doc/modules/changes/

@mbweller mbweller force-pushed the boundary_composition_function branch from 80f9c14 to a016bc3 Compare May 16, 2017 19:11
@mbweller
Copy link
Contributor Author

Updated

@mbweller mbweller force-pushed the boundary_composition_function branch from a016bc3 to eb38b04 Compare May 17, 2017 00:25
@mbweller
Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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()));
Copy link
Contributor

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''."
Copy link
Contributor

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 ()
// {}
Copy link
Contributor

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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 :-)

@mbweller mbweller force-pushed the boundary_composition_function branch from eb38b04 to 457ec7c Compare May 17, 2017 03:13
@mbweller
Copy link
Contributor Author

Some changes made. Some not...

@mbweller mbweller force-pushed the boundary_composition_function branch from 457ec7c to b6c063e Compare May 17, 2017 03:23
@mbweller
Copy link
Contributor Author

Fixed with astyle

@gassmoeller
Copy link
Member

Did you talk to @bangerth about the function arguments?

@gassmoeller
Copy link
Member

Also please run astyle

@bangerth
Copy link
Contributor

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.

@gassmoeller
Copy link
Member

@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.

@gassmoeller
Copy link
Member

/run-tests

@gassmoeller
Copy link
Member

Hi Matt,
will you have time to address the comments within the next weeks? I am currently going through our issues and pull requests to see what can be finished, and this seems like a low-hanging fruit. If you do not have time that is not a problem, I can take over and finish the remaining bits (you keep the credit for everything that is already there).

@gassmoeller
Copy link
Member

Superseded and merged by #1943. Thanks @mbweller for the idea and initial implementation.

@gassmoeller gassmoeller closed this Oct 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants