Skip to content

Commit 839471d

Browse files
committed
getting there
1 parent a4831d3 commit 839471d

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/tensor_computes/NEML2TensorCompute.C

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#pragma once
1010

11+
#include "Conversion.h"
1112
#include "NEML2TensorCompute.h"
1213
#include "NEML2Utils.h"
1314

@@ -70,6 +71,7 @@ NEML2TensorCompute::NEML2TensorCompute(const InputParameters & params)
7071
const auto inputs = getParam<TensorInputBufferName, std::string>("swift_inputs", "neml2_inputs");
7172
std::map<neml2::LabeledAxisAccessor, TensorInputBufferName> lookup_swift_name;
7273
const auto model_inputs = _model.consumed_items();
74+
mooseInfo("Inputs: ", Moose::stringify(model_inputs));
7375

7476
// current inputs
7577
for (const auto & [swift_input_name, neml2_input_name] : inputs)
@@ -98,7 +100,7 @@ NEML2TensorCompute::NEML2TensorCompute(const InputParameters & params)
98100

99101
// old state inputs
100102
for (const auto & neml2_input : model_inputs)
101-
if (neml2_input.is_old_state())
103+
if (neml2_input.is_old_state() || neml2_input.is_old_force())
102104
{
103105
// check if we couple the current state
104106
auto it = lookup_swift_name.find(neml2_input.current());

src/tensor_computes/TimeTensorCompute.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ TimeTensorCompute::TimeTensorCompute(const InputParameters & parameters)
2727
void
2828
TimeTensorCompute::computeBuffer()
2929
{
30-
_u = torch::tensor({_time}, MooseTensor::floatTensorOptions());
30+
_u = torch::tensor({_time}, MooseTensor::floatTensorOptions()).expand(_domain.getShape());
3131
}

test/tests/neml2/old_state.i

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,29 @@
1818
buffer = A
1919
real = 2
2020
[]
21+
[]
22+
[Solve]
23+
[time]
24+
type = TimeTensorCompute
25+
buffer = time
26+
[]
2127
[dAdt]
2228
type = NEML2TensorCompute
2329
neml2_input_file = neml2_input.i
2430
neml2_model = rate
25-
swift_inputs = 'A B'
26-
neml2_inputs = 'forces/A forces/B'
31+
swift_inputs = 'A time'
32+
neml2_inputs = 'forces/A forces/t'
2733
neml2_outputs = 'state/dAdt'
2834
swift_outputs = 'dAdt'
2935
[]
3036
[]
31-
[Solve]
32-
33-
[]
3437
[]
3538

3639
[Postprocessors]
3740
[dAdt]
3841
type = TensorAveragePostprocessor
3942
buffer = dAdt
43+
execute_on = 'TIMESTEP_END'
4044
[]
4145
[]
4246

0 commit comments

Comments
 (0)