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

[ready for review] create surface mesh from geometry id #262

Conversation

feilin-flexcompute
Copy link
Contributor

@feilin-flexcompute feilin-flexcompute commented May 17, 2024

use geometry id to create surface mesh

@feilin-flexcompute feilin-flexcompute force-pushed the feilin/construction/surf_from_geo_i branch from f0b7b26 to c507a4f Compare May 17, 2024 18:59
@feilin-flexcompute feilin-flexcompute force-pushed the feilin/construction/surf_from_geo_i branch from 9ed4ea1 to 1128340 Compare May 17, 2024 20:00
@feilin-flexcompute feilin-flexcompute changed the title create surface mesh from geometry id [ready for review] create surface mesh from geometry id May 17, 2024
Comment on lines 5 to 8
fl.Env.dev.active()

geometry = Geometry.from_file(
CylinderGeometry.geometry, name="testing-cylinder-geometry", solver_version="release-24.2.2"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think geometry now works on prod. Can we remove dev and exact solver version (24.2.2) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines 5 to 8
fl.Env.dev.active()

geometry = Geometry.from_file(
CylinderGeometry.geometry, name="testing-cylinder-geometry", solver_version="release-24.2.2"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here about dev and solver version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -1,8 +1,12 @@
import flow360 as fl
from flow360.component.geometry import Geometry
from flow360.examples import Octahedron
from flow360.examples import CylinderGeometry
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 204 to 206
for geometry_file in self.file_names:
_, ext = os.path.splitext(geometry_file)
remote_file_name = f"geometry_{index}{ext}"
remote_file_name = f"geometry{ext}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure we want to rename files on upload? This will break assemblies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. The geometry file won't be renamed to support assembly files

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need copy of this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@maciej-flexcompute maciej-flexcompute merged commit ec306bc into UnderConstruction/SimulationInterface May 30, 2024
12 checks passed
benflexcompute added a commit that referenced this pull request Aug 2, 2024
* added strucuture and interface for Simulation object (#239)

* added strucuture and interface for Simulation object

update design with some grouping and renaming, added user_stories to fill in

Added example

FORMAT

Added the diagram

Added stripped Flow360BaseModel

Removed allow_but_remove

WIP on updating the BaseModel to pydantic V2

WIP

Add more docstring for details

* Updated the base model to V2 in simulation

* Fix unit test

* Lint

* fresh install

* Add CI to UnderConstruction/SimulationInterface

* Try again

* Try again

* Try again

---------

Co-authored-by: benflexcompute <ben@flexcompute.com>

* API for geometry (#257)

* added geometry api

* address comments

* Populate (almost) all model fields (#254)

* Added meshing Param

* remove temp file

* Finished field population, will refine tomorrow

* Added more examples

* Changed models according to discussion. Will change examples now

* Applied the suggestions to examples too

* More example fixes

* Fix more examples

* Removed Simulation class

* Fix PorousMedium example error noticed by YiFan

* isort

* add version to surface meshing params (#259)

comments addressed

lint

print version of isort

* Fix windows unit test failure because of accessing temp file before closure (#264)

* Merged volumes and surfaces into models to reflect latest design

* Implement the framework for entities. (#258)

* Entities implementation completed. The rest of relevant work is how and when _expand_entities function is called

Created folder for new tests

Removed ambiguity in implementation

Fix format

Applied Maciej's suggestion, trying to abstract it now

Added EntityList

Added default expansion to all entities

Added input validation and more unit tests

None input validation

* Removed the use of global registry

* Raise error when valid_types is None

* Removed comments and unnecessary comment

* comments addressed

* Address final decorator comment

* Fix unit test

* [ModelRef] Added Field Definitions for **UserDefinedDynamics** (#271)

* [ModelRef] Added Field Definitions for **UserDefinedDynamics**

format

* Update

* Fix the wrong way of checking exceptions (#276)

* Allowing entityList to accept None so the using class can set None default for it when EntityList is not required (#277)

* [ModelRef] Added Field Definitions for **Outputs** (#270)

* [ModelRef] Added Field Definitions for Outputs

Removed test artifacts

Fix format

* Added Entity Implementation

* Comments addressed

* Fix unit test

* Addressed comments

* Fix unit test?

* support for pydantic v2 in unit system (#265)

* basic support for pydantic v2 supported in unit system

* implemented pydantic v2 support for unit system constrained types

* attempt to use json encoders for unyt quantities

* WIP - Splitting unit system implementations, supporting unit system in pydantic 2

* WIP - Fix runtime errors after pydantic v2 migration, fix tests

* Fixed serialization issues

* Fix schema issues and tests

* Test fixes

* Style fixes

* Migrate Axis and Vector types to support pydantic v2, remove pd1-specific types from type definitions

* Remove print statements and leftover code from legacy unit system class

* Fix temperature type validator in pydantic v2 version

---------

Co-authored-by: Andrzej Krupka <andrzej@flexcompute.com>

* Disable Simulation Pylint for now as it is not even finished. (#283)

* [ModelRef] Added Field Definitions for **TimeStepping** (#272)

* [ModelRef] Added Field Definitions for **TimeStepping**

Comments addressed

* Comments addressed

* Update default

* Fix bug where time average outputs are not listed (#284)

* Added output format option (#285)

* [ModelRef] Added Field Definitions for **ReferenceGeometry** (#280)

* [ModelRef] Added Field Definitions for **ReferenceGeometry**

* added some thoughts in docstring

* Fix unit test

* [ready for review] create surface mesh from geometry id (#262)

* create surface mesh from geometry id

* remove _0 in the naming

* rename an example file

* address comments

* address comments

* fix key in Cylinder class

* fix path of resources in examples

* remove dev env settting; keep geometry file name in remote

* added preprod env handling (#282)

Co-authored-by: Feilin <52168719+feilin-flexcompute@users.noreply.github.com>

* use dev in geometry example

* address comments

* fix surface mesh cylinder from 3rd party

* remove iges support

---------

Co-authored-by: Maciej Skarysz <83596707+maciej-flexcompute@users.noreply.github.com>

* Add preprocess for base model (#281)

* [ModelRef] Add Field Definitions for **OperatingCondition** (#275)

* Add operating condition

Rename some fields

Add external flow operating condition

Update design with from* methods

Testing

* Update example

* Remove ExternalFlow and add AerospaceCondition

* Add property for mach and rename ThermalCondition to ThermalState

* [ModelRef] Add Field Definitions for **SurfaceModels** (#274)

* Add surface models

Update freestream

Adds turbulenceQuantities

Address comments

Move velcity type definition to operating_condition

Address comments

Address comments

* Add restrictions

* removed unused inflow model config

---------

Co-authored-by: Maciej Skarysz <maciej@flexcompute.com>

* [ModelRef] Added Field Definitions for **VolumeModels** (#273)

* WIP

* Volume model implementation

Implement solver_numerics

lint

Implement material

Fix unit test

* Address comments

* Address comments

* Add initial condition

* Add material constants as property

* removed radius from BET disk as this is now part of entities

---------

Co-authored-by: Yifan Bai <yifan@flexcompute.com>
Co-authored-by: Maciej Skarysz <maciej@flexcompute.com>

* [ModelRef] Add Field Definitions for **MeshingParameters** (#279)

* [ModelRef] Add Field Definitions for **MeshingParameters**

Format

* Refactored after reviewing the design on the notion page

* Refactored after reviewing the design on the notion page-2

* Merged two edge type into one

* Comments addressed

* Corrected Docstring

* Rename volume models: FluidDynamics->Fluid, HeatTransfer->Solid (#288)

* Rename and separate FluidMaterialTypes and SolidMaterialTypes (#289)

* Add reference_mach to AerospaceCondition.from_mach (#286)

* Deleted unused file (#291)

* remove box from enclosed_objects (#292)

* Remove turbulent quantities from outflow (#293)

* Fix some field definitions (#287)

* Fix some field definitions

* Comment addressed

* Unify TranslationallyPeriodic and RotationallyPeriodic (#290)

* Unify TranslationallyPeriodic and RotationallyPeriodic

* Define periodic boundary with SurfacePair

* Address comments

* Fix unit test

* Correct units for material default (#297)

* Correct units for material default

* Separate unit test runs for simulation and flow360_params

* regex match simulation tests

* revert

* Address comments

* Added seralizer for SimulationParam (#300)

* WIP

WIP2

* Added seralizer for SimulationParam

* WIP fixing unit test

* Fix Unit test

* Comments addressed

* comments addressed

* Add cache model serialization (#301)

Fix unit test

Addess comments

* Added pylint back (#302)

* Created pydantic V2 version of the validation service, created tests. Added AngleType to V2 unit system. (#298)

* Created pydantic V2 version of the validation service, created tests.

* Add PR feedback

* Fix unit system context

* Fix rebase errors, rename heat_capacity to specific_heat_capacity

* Fix Lint

* Fix unit test

---------

Co-authored-by: benflexcompute <ben@flexcompute.com>

* Unit conversion for simulationParam (#305)

* Unit conversion for simulationParam

Fix unit test?

Fixed unit test

Removed flow360_units from frontend

Fix unit test

Fix unit test

* Rebased

* Renames and new meshing part (#306)

* Renames and new meshing part

* Removed Face

* Added _type so translator knows the class (#307)

* Added _type so translator knows the class

* Remove all uncatched private attr

* Translator Utils (#310)

* WIP

* Part that should be cherry-picked

* Part that should be cherry-picked-2

* Delete tests/simulation/params/converted.json

* Added camel case converter

* Fix unit test

* surface mesh translator (#309)

* ready to rebase

* SurfaceMeshing-om6wing translator done

* Fix unit test

* Delete tests/simulation/params/converted.json

* Revert " Added _type so translator knows the class (#307)"

This reverts commit c723463.

* Ben y/volume meshing translator (#311)

* volume meshing translator

* Rename

* Fix unit test

* Add solver translator (#312)

* Adding solver translator

Adding solver translator

Outputs translation

* unit test

* Fix unit test

* Fix unit test

* Address comments

* Fixed all the unit test warnings (#315)

* Enforce 0 warning (#316)

* Changed turbulent_viscosity_ratio to be positive only (#317)

* Add service functions for translations. (#313)

* Added services for the translator services

Added existing JSON entry

Fix Lint

* Fix unit test

* Update cached model to store all constructor function arguments (#318)

* Update cached model to store all constructor function arguments

* Fix pylint

* Fix warnings

* construct from geometry to case (#321)

* construct from geometry to case

split cylinder to 2d and 3d

* remove debug

* Add BET solver JSON translator (#319)

* Reorganized and added unit recursive removal

* Added local test xv15BETDisk as refernece database

* Generalize solver translator test

* Added UDD

* Updated reference JSON wihtout localtest interp

* Implement viscosity model

* Fix preprocess exclude

* Add BETDisk translator

* Add all xv15 cases

* Fix unit tests

* Fix window unit test

* Test type of Windows

* Enforce Float 64 on all dimensioned units

* Remove debug comments

* Added TODO for not scaling Fluids' material

* Address comments

* Added helper function for Sutherland calibration

---------

Co-authored-by: Yifan Bai <yifan@flexcompute.com>

* fix volume params (#326)

* Entity Registry in SimulationParams (#328)

* Still working on completeing test_multiple_param_creation_and_asset_registry

* Unit test passed on refactoring entity

* Ready for self review

* Delete tests/simulation/framework/ref/entity_registry_1.json

* Delete tests/simulation/framework/ref/entity_registry_2.json

* Self review completed

* Fix recursive register

* Fix interface unit test

* Remove _type attribute (#329)

* Fix linting on python 3.9 (#331)

* Fix pylint for ALL simulation files. (#330)

* Fix simulation/framework

* Fixing meshing_param

* Fix outputs

* Fix time stepping

* Fix translators

* Fix user_defined_dynamics

* Fix pylint

---------

Co-authored-by: Yifan Bai <yifan@flexcompute.com>

* Add translator for rotation (#327)

* Add translator for rotation

Update rotation model name

Fix unit test

Address comments

Make cylinders in test fixture

fix unit test

Fix unit tests

Added TODO item

Added type and name for models and refinements

Fix unit test

* Use util function for model expansion

* [ServiceIntegration] Add operating condition unit test for the implementation of custom cache constructor (#324)

* [squash]

generated examples for frontend

Format

Added example and ready for cleanning up

cleaned up

added minimal e2e example for simulation

fixed init data service

fixed init data service

fix insolver translation service

pushed all schema models

removed modelingConstants for time being

Fix unit tests and format

Fix PyLint

Added type and name for models and refinements

reverted mesh units in init request

* Format

* Address comments

---------

Co-authored-by: Feilin <52168719+feilin-flexcompute@users.noreply.github.com>

* Fix merge

* Fix model constants (#334)

* Add from_axes for Box entities (#337)

* Add from_axes for Box entities

* Update poetry lock

* Fix linter

* Fix pylint

* Address comments

* Update poetry lock

* Fix pylint version

* Maciej/workbench service (#335)

* [squash]

generated examples for frontend

* Format

* Added example and ready for cleanning up

* cleaned up

* added minimal e2e example for simulation

* fixed init data service

* fixed init data service

* fix insolver translation service

* pushed all schema models

* removed modelingConstants for time being

* Fix unit tests and format

* Fix PyLint

* Added type and name for models and refinements

* reverted mesh units in init request

* updated service to support user.json

* added example for integration for webUI

* fixed unit_quantity issue

* moved removal of _id to validate call

* translation issue when introduced name

* Pop name from boundaries

* fix

* fixed error serialiser problem

* fixed some tests

* fix

* fixed translation issues

* added defaults to service

* updated schemas

* Fix Lint and format, now fixing tests

* Fix unit tests

* added discriminator to operating condition

* added AD schema

* added units for radius in force per area

* added default outputs

* fixed tests

* Remove print

* Update flow360/component/simulation/simulation_params.py

Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com>

* Update flow360/component/simulation/simulation_params.py

Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com>

---------

Co-authored-by: Feilin <52168719+feilin-flexcompute@users.noreply.github.com>
Co-authored-by: benflexcompute <ben@flexcompute.com>
Co-authored-by: Yifan Bai <yifan@flexcompute.com>
Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com>

* minor fix on volume mesh JSON translator

* translator: fixed farfield type format

* fixed translator tests

* added name to uniform refinement

* updated schemas

* fixed styling

* added default axis and angle for box

* Prepend zone name to the surface name (#345)

* Fixed unit test and prepend ready to test

tested

* Fix Lint and tests

* Local test passed

* output translator (#343)

* TODO: TEST THE REBASE!!!!!!!!!!!!!

Added the get_global_setting_from_per_item_setting util function

Fix CI

Now rebase and lint

Lint and format

* Fix unit tests and rebase errors

* More full name changes

* Comments addressed

* Removed hash from JSON when deserializing (#346)

* Removed hash from JSON when deserializing

* fix

* Add tranlator for porous media (#339)

* Add tranlator for porous media

Implement pressure

Add porous media translator

Add boundary conditions

Add volume zone case

Fix unit test

Move pressure nondimensionalization correction to the translator

Fix python3.9 unit test

Revert a change

Address comments

* Fix pylint

* Fix pylint

* updated JSON examples for UI

* fixed black

* Fixed 500 Reponses (#353)

* Fixed 500 reponses

* Fix linting

* Add AutomatedFarfield (#347)

* now self review

* Added suppport of GhostSurface in the post processings, and also changed some entity design

* Moving things around and add test for updating with volume meshing metadata

* Self reviewed

* Reverted the entities change for RotationCylinder and added the AutomatedFarfield  to shcema generator

* comments addressed

* Rename asset_entity_registy to just registry

* improved check on unit parser (#351)

* improved check on unit parser

* added error message match to test

* added type discriminator to meshing->volume zones (#356)

* Rebased (#352)

Rebase, was working on surface_meshing_translator line 128

Translator for surface meshing should be good. See if any more unit test needed

Need to rebase

Need to rebase again.. see github page

Unit test passed, now self review

Finished self review

Revert to use entitylist for RotationCylinder

Fix lint

Update flow360/component/simulation/meshing_param/volume_params.py

Co-authored-by: Maciej Skarysz <83596707+maciej-flexcompute@users.noreply.github.com>

* added default meshing to init service (#354)

* added default meshing to init service

* addressed comments

* unit test fix

* addressed comment

* Added GhostSurface to full name detection and fixed the type name (#358)

* added units to actuator disk (#357)

* added units to actuator disk

* added test for solver translator

* added solver translator test

* fixed pylint

* fixed docstring

* Work around for inconsistent zone name from meshers (#360)

* fixed comparing to not None in if statements (#362)

* Remove reference geometry default from translator (#359)

* Add actuator disk translator (#361)

* Add actuator disk translator

* Decouple model and solver json for BET

* Removed skipping defaults when getting a setting (#365)

* Removed skipping defaults when getting a setting

* Removed unused func

* Added validation of reusing cylinders in meshing (#363)

* Added validation of reusing cylinders in meshing

* Fix unit test

* Comment addressed

* Fix unit tests

* Add CHT and periodic boundary translator (#348)

* Work around for inconsistent zone name from meshers (#360)

fixed comparing to not None in if statements (#362)

Remove reference geometry default from translator (#359)

Add actuator disk translator (#361)

* Add actuator disk translator

* Decouple model and solver json for BET

Add CHT unit test

Add heat transfer zone translator

Handle solid wall boundaries

Fix pylint and unit tests

Add initial condition in translator

start adding vortexPropagation converter test

vortexPropagation passes. Waiting for periodic boundary implementationn for periodicEulerVortex

Add periodic boundary translator

periodicVortex passes

Address comments

* Improve error message

* Remove unused function

---------

Co-authored-by: Ben <106089368+benflexcompute@users.noreply.github.com>

* Fix front end JSON validation issues. (#368)

* TMP

* Fixed issue with not having discriminator for turbulenceQuantities

* Removed print

* Removed str from EntityList

* added om6WingWallModel case

* isorted

* Minor changes to AD validation (#367)

* Updated Schema (#385)

* Feilin/construction/surface mesh formats (#323)

allow ugrid+mapbc to create surface mesh
add MeshNameParser to unify the interface to parse a given mesh name
adjust examples (remove examples about 3rd party geometry handling temporarily)

* Make Slice and Probe entities (#390)

* fix surface_mesh.py and upload examples for surface meshing (#389)

* fix surface_mesh and upload examples for surface meshing

* lint

* Nasser/move cases (#387)

* Symmetry Plane

* Added XV15HoverMRF + fixed C_D and C_DES for kOmegaSST

* Added NestedCylindersSRF

* Fixed unit test

* Added heatFluxCylinder

* Added plateASI

* Update unit test ref file hash

* Added discriminator for timestepping (#394)

* Add discriminator for some single attribute models (#393)

* Add discriminator for some single attribute models

* Fix unit tests

* Rename Probe to ProbeGroup to avoid confusion (#396)

* Rename Probe to ProbeGroup to avoid confusion

* Corrected alias

* Just Update schema

* Fix missing value error in __init__ signature (#398)

* Fix missing value error in __init__ signature

* Removed debug code

* New geometry class (#397)

* The surface mesh generation works. Now we try to generailize it

* Revert flow360/ changes

* Self review now

* Fix lint

* Add log

* Chenage warning

* Fix lint

* Move old requests to requests_v1

* Put the reqeust_v2 as request

* MV geometry to geometry_V1

* Moved v2 geometry to geometry

* interface --> interface_v1

* geometry_v2 --> geometry

* Renamed resource_base to resource_base_v1

* resource base v2 --> resource_base

* change import

* Add path API for future use

* self review

* MERGE flow360/cloud/requests_v1.py and flow360/cloud/requests.py

* Corrected imports from interfaces_v1

* MERGE resource_base_v1 and resource_base

* Removed deferred_400_error_handling

* List options for valid meshing units

* Address comments

* Added test

* moved solver version into the constructor of draft

* Format

* fix pytest

* Comment addressed

* Added cloud module

* Fix UUID validation check

* Address comments

* Removed unused/unnecessary/outdated examples (#403)

* Remove v2 examples as they are not simulation related

* Mistakenly delete too many examples

* Update linting readme instruction and remove footpint of underconstruction branch

* Comments adddressed

* Fix all sorts of small JIRA tickets (#401)

* Fix https://flow360.atlassian.net/browse/SCFD-2383

* Fix https://flow360.atlassian.net/browse/SCFD-2385

* Fix https://flow360.atlassian.net/browse/SCFD-2386

* Changed degC seralization

* Fixed https://flow360.atlassian.net/browse/SCFD-2398 testing now

* Fix test

* FixBug

* Address comment

* Added StandardAtmosphereModel implementation

* Fix Lint

---------

Co-authored-by: Maciej Skarysz <83596707+maciej-flexcompute@users.noreply.github.com>
Co-authored-by: Feilin <52168719+feilin-flexcompute@users.noreply.github.com>
Co-authored-by: Andrzej Krupka <andrzej@flexcompute.com>
Co-authored-by: yifan-flex <124317394+yifan-flex@users.noreply.github.com>
Co-authored-by: Maciej Skarysz <maciej@flexcompute.com>
Co-authored-by: Yifan Bai <yifan@flexcompute.com>
Co-authored-by: andrzej-krupka <156919532+andrzej-krupka@users.noreply.github.com>
Co-authored-by: John Moore <john@flexcompute.com>
Co-authored-by: Nasser Sabet <95641637+NasserFlexCompute@users.noreply.github.com>
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.

2 participants