{"action":"created","issue":{"url":"https://api.github.com/repos/nutofem/nuto/issues/43","repository_url":"https://api.github.com/repos/nutofem/nuto","labels_url":"https://api.github.com/repos/nutofem/nuto/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/nutofem/nuto/issues/43/comments","events_url":"https://api.github.com/repos/nutofem/nuto/issues/43/events","html_url":"https://github.com/nutofem/nuto/issues/43","id":234800110,"number":43,"title":"Evaluate in the PDE concept - data transfer from structure level to integrand and vice versa","user":{"login":"joergfunger","id":20501029,"avatar_url":"https://avatars3.githubusercontent.com/u/20501029?v=4","gravatar_id":"","url":"https://api.github.com/users/joergfunger","html_url":"https://github.com/joergfunger","followers_url":"https://api.github.com/users/joergfunger/followers","following_url":"https://api.github.com/users/joergfunger/following{/other_user}","gists_url":"https://api.github.com/users/joergfunger/gists{/gist_id}","starred_url":"https://api.github.com/users/joergfunger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joergfunger/subscriptions","organizations_url":"https://api.github.com/users/joergfunger/orgs","repos_url":"https://api.github.com/users/joergfunger/repos","events_url":"https://api.github.com/users/joergfunger/events{/privacy}","received_events_url":"https://api.github.com/users/joergfunger/received_events","type":"User","site_admin":false},"labels":[{"id":407493045,"url":"https://api.github.com/repos/nutofem/nuto/labels/design","name":"design","color":"128A0C","default":false}],"state":"open","locked":false,"assignee":{"login":"TTitscher","id":12712945,"avatar_url":"https://avatars0.githubusercontent.com/u/12712945?v=4","gravatar_id":"","url":"https://api.github.com/users/TTitscher","html_url":"https://github.com/TTitscher","followers_url":"https://api.github.com/users/TTitscher/followers","following_url":"https://api.github.com/users/TTitscher/following{/other_user}","gists_url":"https://api.github.com/users/TTitscher/gists{/gist_id}","starred_url":"https://api.github.com/users/TTitscher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TTitscher/subscriptions","organizations_url":"https://api.github.com/users/TTitscher/orgs","repos_url":"https://api.github.com/users/TTitscher/repos","events_url":"https://api.github.com/users/TTitscher/events{/privacy}","received_events_url":"https://api.github.com/users/TTitscher/received_events","type":"User","site_admin":false},"assignees":[{"login":"TTitscher","id":12712945,"avatar_url":"https://avatars0.githubusercontent.com/u/12712945?v=4","gravatar_id":"","url":"https://api.github.com/users/TTitscher","html_url":"https://github.com/TTitscher","followers_url":"https://api.github.com/users/TTitscher/followers","following_url":"https://api.github.com/users/TTitscher/following{/other_user}","gists_url":"https://api.github.com/users/TTitscher/gists{/gist_id}","starred_url":"https://api.github.com/users/TTitscher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TTitscher/subscriptions","organizations_url":"https://api.github.com/users/TTitscher/orgs","repos_url":"https://api.github.com/users/TTitscher/repos","events_url":"https://api.github.com/users/TTitscher/events{/privacy}","received_events_url":"https://api.github.com/users/TTitscher/received_events","type":"User","site_admin":false},{"login":"joergfunger","id":20501029,"avatar_url":"https://avatars3.githubusercontent.com/u/20501029?v=4","gravatar_id":"","url":"https://api.github.com/users/joergfunger","html_url":"https://github.com/joergfunger","followers_url":"https://api.github.com/users/joergfunger/followers","following_url":"https://api.github.com/users/joergfunger/following{/other_user}","gists_url":"https://api.github.com/users/joergfunger/gists{/gist_id}","starred_url":"https://api.github.com/users/joergfunger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joergfunger/subscriptions","organizations_url":"https://api.github.com/users/joergfunger/orgs","repos_url":"https://api.github.com/users/joergfunger/repos","events_url":"https://api.github.com/users/joergfunger/events{/privacy}","received_events_url":"https://api.github.com/users/joergfunger/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/nutofem/nuto/milestones/1","html_url":"https://github.com/nutofem/nuto/milestone/1","labels_url":"https://api.github.com/repos/nutofem/nuto/milestones/1/labels","id":2607085,"number":1,"title":"PDE","description":"","creator":{"login":"TTitscher","id":12712945,"avatar_url":"https://avatars0.githubusercontent.com/u/12712945?v=4","gravatar_id":"","url":"https://api.github.com/users/TTitscher","html_url":"https://github.com/TTitscher","followers_url":"https://api.github.com/users/TTitscher/followers","following_url":"https://api.github.com/users/TTitscher/following{/other_user}","gists_url":"https://api.github.com/users/TTitscher/gists{/gist_id}","starred_url":"https://api.github.com/users/TTitscher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TTitscher/subscriptions","organizations_url":"https://api.github.com/users/TTitscher/orgs","repos_url":"https://api.github.com/users/TTitscher/repos","events_url":"https://api.github.com/users/TTitscher/events{/privacy}","received_events_url":"https://api.github.com/users/TTitscher/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":4,"state":"open","created_at":"2017-06-27T12:42:42Z","updated_at":"2017-09-26T11:35:57Z","due_on":null,"closed_at":null},"comments":40,"created_at":"2017-06-09T11:33:44Z","updated_at":"2017-09-26T12:20:05Z","closed_at":null,"author_association":"COLLABORATOR","body":"In the PDE concept, the general layout is as follows. The structure has a list of (quadrature) cells. The only function of these cells is the integration, thus attached to each cell is an integration type. Furthermore, in each cell, an interpolation for a specific dof_type is defined, including the coordinate interpolation. For each integration point, a separate integrand function is defined that specifies what is to be integrated (e.g. for a standard mechanics problem this is B^T \\sigma  or K = B^T C B). This could however also include the time integration, so instead of assembling only K, directly assemble K+a/tC+b/(t^2)M with a and b coefficients from the time integration scheme such as Newmark).\r\nThis requires to evaluate a variety of different objects (mass matrix, damping matrix, stiffness, residual, full hessian) with a variety of options and global inputs (residual w/o update of history data, implicit/explicit integration of history variables (IMPLEX, cycle jump with number of cycles), time step t. In order to avoid writing a separate global function (on the structure level) for each specific output (requiring different inputs)\r\n\r\n`Structure.EvaluateHessian0(), Structure.EvaluateHessian0(double t), ..`\r\n\r\nthe following options are possible:\r\n\r\n### Solution 1: Option class\r\n I would propose to write a single evaluate function that has an optionBase class as an argument. Note that this is very different from the current input/output, since it only includes global options (so no reallocation on structural, element and constitutive level is required, it's just passed by reference). This class also defines what should be stored in the corresponding single output objects.\r\n\r\n```\r\nHessian0 = Structure.EvaluateSparseMatrix(myOptionsHessian0);\r\nGradient = Structure.EvaluateFullMatrix(myOptionsGradient);\r\nHessian = Structure.EvaluateSparseMatrix(myOptionsFullHessianIncludingTimeIntegration);\r\n```\r\nHere, we should decide, if we want to pass the outputObjects by reference (which has the advantage of being able to predefine the sparsity pattern of a sparse matrix), or by defining the result directly as an output. Both approaches would be possible. I would only write two global functions, one for full matrices (including vectors) and another one for sparse matrices. This could also be templated.\r\n\r\nOutput type would be an empty base class. For specific integrands, we would define certain options. Note that this option class can be redefined by any user in its main file and is then directly passed to the integrand. So the \"user\" can do very weird thinks without having to change any of the interfaces in NuTo, just change the optionClass and the integrand in his main file.\r\n\r\n```\r\nclass OptionsTimeIntegration : OptionsBase \r\n{\r\nprivate: \r\n  ResultEnum mResult; //e.g. Hessian0, Hessian1, Residual, ...\r\n  double mDeltaT;\r\n  bool mUpdateHistoryVariables;\r\n}\r\n\r\nclass OptionsNewmark : OptionsTimeIntegration \r\n{\r\nprivate: \r\n  double  beta, gamma;\r\n}\r\n\r\nclass OptionsRungeKutta : OptionsTimeIntegration \r\n{\r\nprivate: \r\n}\r\n```\r\nThe disadvantage of this approach is a cast in the integrand from OptionBase to the SpecificType such as OptionsNewmark.\r\n\r\n###  Solution 2: Shared object in the integrand\r\nAnother approach proposed by @TTitscher and @Psirus is to use a shared ptr in the integrand\r\n```\r\n/* main */\r\nNewmark newmark(...)\r\nReference<TimeStep> timeStepObject = newmark.GetTimeStep();\r\n\r\nIntegrandCreep integrand(creepLaw, ..., timeStepObject);\r\n// other integrands may not require this object.\r\n```\r\nThis has the advantage that no cast in the integrand is required, since the type of the options object is known. Furthermore, no option object has to be passed. However, there are also some disadvantages.\r\n\r\n- How should we define, what output is to be calculated for our time dependent problems (mass, stiffness, combined hessian for time integration)? \r\nThis information could either be given by using separate routines (EvaluateHessian0, ...), but that seems to me many copy/paste routines and is not flexible for other special problems. Or we use this shared object ptr for all our standard evaluations, so even the linearElastic integrand requires this shared_ptr. However, defining what the output of a specific method is based on some global variable (the shared object) does not seem to be optimal.\r\n- From a design point of view, this might also complicate some clone/serialize routines as well as parallel applications with different threads. Even though this is certainly possible (the shared_ptr could be const in the integrand and thus sharing/copying is not a problem), this might cause some headache. \r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/nutofem/nuto/issues/comments/332180423","html_url":"https://github.com/nutofem/nuto/issues/43#issuecomment-332180423","issue_url":"https://api.github.com/repos/nutofem/nuto/issues/43","id":332180423,"user":{"login":"joergfunger","id":20501029,"avatar_url":"https://avatars3.githubusercontent.com/u/20501029?v=4","gravatar_id":"","url":"https://api.github.com/users/joergfunger","html_url":"https://github.com/joergfunger","followers_url":"https://api.github.com/users/joergfunger/followers","following_url":"https://api.github.com/users/joergfunger/following{/other_user}","gists_url":"https://api.github.com/users/joergfunger/gists{/gist_id}","starred_url":"https://api.github.com/users/joergfunger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joergfunger/subscriptions","organizations_url":"https://api.github.com/users/joergfunger/orgs","repos_url":"https://api.github.com/users/joergfunger/repos","events_url":"https://api.github.com/users/joergfunger/events{/privacy}","received_events_url":"https://api.github.com/users/joergfunger/received_events","type":"User","site_admin":false},"created_at":"2017-09-26T12:20:05Z","updated_at":"2017-09-26T12:20:05Z","author_association":"COLLABORATOR","body":"But if someone (and this is the probable standard case when NuTo as a lib is used) just wants to write is own time dependent integrand, then there is IMO no need to rewrite the oprators (nor change something in the timeIntegrationScheme) with a special gradient Operator, only derive your integrand from IntegrandTimeDependentInterface. In the above suggestion, I would have to redefine a gradient operator."}}
{"actor":{"display_login":"joergfunger"}}