Skip to content

Commit 4bc90e5

Browse files
authored
Merge pull request #125 from sandialabs/eparish1/85-opinf-opinf
added rom-rom support to norma
2 parents e576dcf + f0a16f1 commit 4bc90e5

File tree

12 files changed

+195
-21
lines changed

12 files changed

+195
-21
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import normaopinf
2+
import normaopinf.opinf
3+
import nnopinf
4+
import nnopinf.training
5+
import os
6+
import numpy as np
7+
8+
if __name__ == '__main__':
9+
settings = {}
10+
settings['fom-yaml-file'] = "cuboid-1.yaml"
11+
settings['training-data-directories'] = [os.getcwd()]
12+
settings['model-type'] = 'linear'
13+
settings['stop-training-time'] = 'end'
14+
settings['training-skip-steps'] = 1
15+
settings['forcing'] = False
16+
settings['truncation-type'] = 'energy'
17+
settings['boundary-truncation-type'] = 'energy'
18+
settings['regularization-parameter'] = 5.e-3
19+
settings['trial-space-splitting-type'] = 'split'
20+
settings['acceleration-computation-type'] = 'finite-difference'
21+
snapshots_dict = normaopinf.opinf.get_processed_snapshots(settings)
22+
settings['truncation-value'] = 1. - 1.e-5
23+
settings['boundary-truncation-value'] = 1. - 1.e-5
24+
settings['model-name'] = 'opinf-operator-1'
25+
normaopinf.opinf.make_opinf_model_from_snapshots_dict(snapshots_dict,settings)
26+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import normaopinf
2+
import normaopinf.opinf
3+
import nnopinf
4+
import nnopinf.training
5+
import os
6+
import numpy as np
7+
8+
if __name__ == '__main__':
9+
settings = {}
10+
settings['fom-yaml-file'] = "cuboid-2.yaml"
11+
settings['training-data-directories'] = [os.getcwd()]
12+
settings['model-type'] = 'linear'
13+
settings['stop-training-time'] = 'end'
14+
settings['training-skip-steps'] = 1
15+
settings['forcing'] = False
16+
settings['truncation-type'] = 'energy'
17+
settings['boundary-truncation-type'] = 'energy'
18+
settings['regularization-parameter'] = 5.e-3
19+
settings['trial-space-splitting-type'] = 'split'
20+
settings['acceleration-computation-type'] = 'finite-difference'
21+
snapshots_dict = normaopinf.opinf.get_processed_snapshots(settings)
22+
settings['truncation-value'] = 1. - 1.e-5
23+
settings['boundary-truncation-value'] = 1. - 1.e-5
24+
settings['model-name'] = 'opinf-operator-2'
25+
normaopinf.opinf.make_opinf_model_from_snapshots_dict(snapshots_dict,settings)
26+
Binary file not shown.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
type: single
2+
input mesh file: cuboid-1.g
3+
output mesh file: cuboid-1.e
4+
model:
5+
type: linear opinf rom
6+
model-file: opinf-operator-1.npz
7+
material:
8+
blocks:
9+
fine: hyperelastic
10+
hyperelastic:
11+
model: neohookean
12+
elastic modulus: 1.0e+09
13+
Poisson's ratio: 0.25
14+
density: 1000.0
15+
time integrator:
16+
type: Newmark
17+
β: 0.25
18+
γ: 0.5
19+
boundary conditions:
20+
Dirichlet:
21+
- node set: nsx-
22+
component: x
23+
function: "0.0"
24+
- node set: nsy-
25+
component: y
26+
function: "0.0"
27+
- node set: nsz-
28+
component: z
29+
function: "0.0"
30+
Schwarz overlap:
31+
- side set: ssz+
32+
source: cuboid-2
33+
source block: coarse
34+
source side set: ssz-
35+
solver:
36+
type: Hessian minimizer
37+
step: full Newton
38+
minimum iterations: 1
39+
maximum iterations: 16
40+
relative tolerance: 1.0e-10
41+
absolute tolerance: 1.0e-06
Binary file not shown.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
type: single
2+
input mesh file: cuboid-2.g
3+
output mesh file: cuboid-2.e
4+
model:
5+
type: linear opinf rom
6+
model-file: opinf-operator-2.npz
7+
material:
8+
blocks:
9+
coarse: hyperelastic
10+
hyperelastic:
11+
model: neohookean
12+
elastic modulus: 1.0e+09
13+
Poisson's ratio: 0.25
14+
density: 1000.0
15+
time integrator:
16+
type: Newmark
17+
β: 0.25
18+
γ: 0.5
19+
boundary conditions:
20+
Dirichlet:
21+
- node set: nsz+
22+
component: z
23+
function: "1.0 * t"
24+
Schwarz overlap:
25+
- side set: ssz-
26+
source: cuboid-1
27+
source block: fine
28+
source side set: ssz+
29+
solver:
30+
type: Hessian minimizer
31+
step: full Newton
32+
minimum iterations: 1
33+
maximum iterations: 16
34+
relative tolerance: 1.0e-10
35+
absolute tolerance: 1.0e-06
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
type: multi
2+
domains: ["cuboid-1.yaml", "cuboid-2.yaml"]
3+
Exodus output interval: 1
4+
CSV output interval: 1
5+
initial time: 0.0
6+
final time: 0.1
7+
time step: 0.01
8+
minimum iterations: 1
9+
maximum iterations: 16
10+
relative tolerance: 1.0e-12
11+
absolute tolerance: 1.0e-08
Binary file not shown.
Binary file not shown.

src/ics_bcs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ function apply_bc_detail(model::SolidMechanics, bc::SolidMechanicsNonOverlapSchw
425425
end
426426

427427
function apply_bc_detail(model::OpInfModel, bc::SolidMechanicsCouplingSchwarzBoundaryCondition)
428-
if bc.coupled_subsim.model isa SolidMechanics
428+
if bc.coupled_subsim.model isa SolidMechanics || bc.coupled_subsim.model isa OpInfModel
429429
## Apply BC to the FOM vector
430430
apply_bc_detail(model.fom_model, bc)
431431

0 commit comments

Comments
 (0)